Преглед изворни кода

chore: Upgrade phoenix to 1.4 and elixir 1.8 (#4557)

Johanna Larsson пре 6 година
родитељ
комит
87fc55eea9

+ 4 - 0
.gitignore

@@ -102,3 +102,7 @@ build/
 
 # haskell
 .stack-work
+
+# Elixir
+_build/
+deps/

+ 5 - 0
frameworks/Elixir/phoenix/.formatter.exs

@@ -0,0 +1,5 @@
+[
+  import_deps: [:ecto, :phoenix],
+  inputs: ["*.{ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{ex,exs}"],
+  subdirectories: ["priv/*/migrations"]
+]

+ 1 - 0
frameworks/Elixir/phoenix/.gitignore

@@ -0,0 +1 @@
+.elixir_ls/

+ 6 - 1
frameworks/Elixir/phoenix/config/config.exs

@@ -5,6 +5,11 @@
 # is restricted to this project.
 use Mix.Config
 
+config :phoenix, :json_library, Jason
+
+config :hello,
+  ecto_repos: [Hello.Repo]
+
 # Configures the endpoint
 config :hello, Hello.Endpoint,
   url: [host: "localhost"],
@@ -21,4 +26,4 @@ config :logger, :console,
 
 # Import environment specific config. This must remain at the bottom
 # of this file so it overrides the configuration defined above.
-import_config "#{Mix.env}.exs"
+import_config "#{Mix.env()}.exs"

+ 0 - 1
frameworks/Elixir/phoenix/config/dev.exs

@@ -23,7 +23,6 @@ config :hello, Hello.Endpoint,
   ]
 
 config :hello, Hello.Repo,
-  adapter: Ecto.Adapters.Postgres,
   username: "benchmarkdbuser",
   password: "benchmarkdbpass",
   database: "hello_world",

+ 7 - 7
frameworks/Elixir/phoenix/config/prod.exs

@@ -10,18 +10,18 @@ config :hello, Hello.Endpoint,
   server: true
 
 config :hello, Hello.Repo,
-  adapter: Ecto.Adapters.Postgres,
   username: "benchmarkdbuser",
   password: "benchmarkdbpass",
   database: "hello_world",
   hostname: "tfb-database",
-  pool_size: 256,
-  loggers: []
+  pool_size: 256
 
-  config :logger,
-    compile_time_purge_level: :error,
-    level: :error,
-    backends: []
+config :logger,
+  compile_time_purge_matching: [
+    [level_lower_than: :error]
+  ],
+  level: :error,
+  backends: []
 
 # ## SSL Support
 #

+ 1 - 0
frameworks/Elixir/phoenix/config/test.exs

@@ -0,0 +1 @@
+use Mix.Config

+ 1 - 1
frameworks/Elixir/phoenix/lib/hello/repo.ex

@@ -1,3 +1,3 @@
 defmodule Hello.Repo do
-  use Ecto.Repo, otp_app: :hello
+  use Ecto.Repo, otp_app: :hello, adapter: Ecto.Adapters.Postgres
 end

+ 19 - 16
frameworks/Elixir/phoenix/mix.exs

@@ -2,14 +2,15 @@ defmodule Hello.Mixfile do
   use Mix.Project
 
   def project do
-   [app: :hello,
-    version: "0.1.0",
-    elixir: "~> 1.6.5",
-    elixirc_paths: elixirc_paths(Mix.env),
-    compilers: [:phoenix] ++ Mix.compilers,
-    build_embedded: Mix.env == :prod,
-    start_permanent: Mix.env == :prod,
-    deps: deps()]
+    [
+      app: :hello,
+      version: "0.1.0",
+      elixir: "~> 1.8",
+      elixirc_paths: elixirc_paths(Mix.env()),
+      compilers: [:phoenix] ++ Mix.compilers(),
+      start_permanent: Mix.env() == :prod,
+      deps: deps()
+    ]
   end
 
   # Configuration for the OTP application
@@ -25,13 +26,15 @@ defmodule Hello.Mixfile do
   #
   # Type `mix help deps` for examples and options
   defp deps do
-    [{:phoenix, "1.3.2"},
-     {:phoenix_ecto, "3.3.0"},
-     {:postgrex, "0.13.3"},
-     {:cowboy, "1.0.0"},
-     {:plug_cowboy, "1.0.0"},
-     {:jason, "1.0.0"},
-     {:phoenix_html, "2.11.0"},
-     {:phoenix_live_reload, "1.1.0", only: :dev}]
+    [
+      {:phoenix, "~> 1.4.0"},
+      {:phoenix_ecto, "~> 4.0"},
+      {:ecto_sql, "~> 3.0"},
+      {:postgrex, "~> 0.14"},
+      {:plug_cowboy, "~> 2.0"},
+      {:jason, "~> 1.0"},
+      {:phoenix_html, "~> 2.11"},
+      {:phoenix_live_reload, "~> 1.2", only: :dev}
+    ]
   end
 end

+ 2 - 2
frameworks/Elixir/phoenix/phoenix.dockerfile

@@ -1,4 +1,4 @@
-FROM elixir:1.6.5
+FROM elixir:1.8.1
 
 ADD ./ /phoenix
 WORKDIR /phoenix
@@ -10,4 +10,4 @@ RUN mix local.rebar --force
 RUN mix deps.get --force --only prod
 RUN mix compile --force
 
-CMD ["elixir", "--erl", "+K true +sbwt very_long +swt very_low", "-S", "mix", "phoenix.server"]
+CMD ["elixir", "--erl", "+K true +sbwt very_long +swt very_low", "-S", "mix", "phx.server"]