Skip to content
This repository has been archived by the owner on Apr 7, 2018. It is now read-only.

Commit

Permalink
Merge pull request #386 from whatyouhide/elixir-1.4-warnings
Browse files Browse the repository at this point in the history
Fix a bunch of Elixir 1.4 warnings
  • Loading branch information
bitwalker committed Sep 12, 2016
2 parents 0bb8815 + 1b694e1 commit 61446d2
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 35 deletions.
20 changes: 10 additions & 10 deletions lib/exrm/utils/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@ defmodule ReleaseManager.Utils do
terms
{:error, {line, type, msg}} ->
Logger.error "Unable to parse #{path}: Line #{line}, #{type}, - #{msg}"
abort!
abort!()
{:error, reason} ->
Logger.error "Unable to access #{path}: #{reason}"
abort!
abort!()
end
result
end
Expand Down Expand Up @@ -338,13 +338,13 @@ defmodule ReleaseManager.Utils do
@doc "Get the priv path of the exrm dependency"
def priv_path, do: "#{:code.priv_dir('exrm')}"
@doc "Get the priv/rel path of the exrm dependency"
def rel_source_path, do: Path.join(priv_path, "rel")
def rel_source_path, do: Path.join(priv_path(), "rel")
@doc "Get the path to a file located in priv/rel of the exrm dependency"
def rel_source_path(file), do: Path.join(rel_source_path, file)
def rel_source_path(file), do: Path.join(rel_source_path(), file)
@doc "Get the priv/rel/files path of the exrm dependency"
def rel_file_source_path, do: Path.join([priv_path, "rel", "files"])
def rel_file_source_path, do: Path.join([priv_path(), "rel", "files"])
@doc "Get the path to a file located in priv/rel/files of the exrm dependency"
def rel_file_source_path(file), do: Path.join(rel_file_source_path, file)
def rel_file_source_path(file), do: Path.join(rel_file_source_path(), file)
@doc """
Get the path to a file located in the rel directory of the current project.
You can pass either a file name, or a list of directories to a file, like:
Expand All @@ -356,8 +356,8 @@ defmodule ReleaseManager.Utils do
"path/to/project/rel/<project>/lib/<project>.appup"
"""
def rel_dest_path(files) when is_list(files), do: Path.join([rel_dest_path] ++ files)
def rel_dest_path(file), do: Path.join(rel_dest_path, file)
def rel_dest_path(files) when is_list(files), do: Path.join([rel_dest_path()] ++ files)
def rel_dest_path(file), do: Path.join(rel_dest_path(), file)
@doc "Get the rel path of the current project."
def rel_dest_path, do: Path.join(File.cwd!, "rel")
@doc """
Expand All @@ -371,8 +371,8 @@ defmodule ReleaseManager.Utils do
"path/to/project/rel/.files/some/path/file.txt"
"""
def rel_file_dest_path(files) when is_list(files), do: Path.join([rel_file_dest_path] ++ files)
def rel_file_dest_path(file), do: Path.join(rel_file_dest_path, file)
def rel_file_dest_path(files) when is_list(files), do: Path.join([rel_file_dest_path()] ++ files)
def rel_file_dest_path(file), do: Path.join(rel_file_dest_path(), file)
@doc "Get the rel/.files path of the current project."
def rel_file_dest_path, do: Path.join([File.cwd!, "rel", ".files"])

Expand Down
4 changes: 2 additions & 2 deletions lib/mix/tasks/release.clean.ex
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ defmodule Mix.Tasks.Release.Clean do
end
# Clean up the template files for release generation
def do_cleanup(:relfiles) do
rel_files = rel_file_dest_path
rel_files = rel_file_dest_path()
if File.exists?(rel_files), do: File.rm_rf!(rel_files)
end
# Clean up everything
Expand All @@ -83,7 +83,7 @@ defmodule Mix.Tasks.Release.Clean do
do_cleanup :build

# Remove release folder
rel = rel_dest_path
rel = rel_dest_path()
if File.exists?(rel), do: File.rm_rf!(rel)
end

Expand Down
18 changes: 9 additions & 9 deletions lib/mix/tasks/release.ex
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ defmodule Mix.Tasks.Release do
IO.puts IO.ANSI.reset
case answer =~ ~r/^(Y(es)?)?$/i do
true -> config
false -> abort!
false -> abort!()
end
end
end
Expand All @@ -126,7 +126,7 @@ defmodule Mix.Tasks.Release do
"" -> config
_ -> %{config | :upgrade? => true}
end
elixir_paths = get_elixir_lib_paths |> Enum.map(&String.to_char_list/1)
elixir_paths = get_elixir_lib_paths() |> Enum.map(&String.to_char_list/1)
lib_dirs = [ '#{Path.join(Mix.Project.build_path, "lib")}', '#{Mix.Project.deps_path}' | elixir_paths ]
# Build release configuration
relx_config = relx_config
Expand Down Expand Up @@ -242,7 +242,7 @@ defmodule Mix.Tasks.Release do
defp execute_before_hooks(%Config{} = config) do
# Just in case there are plugins which expect relx.config to already
# be persisted, we'll persist it before any are run, and again after each plugin runs
Utils.write_terms(relx_config_path, config.relx_config)
Utils.write_terms(relx_config_path(), config.relx_config)
plugins = ReleaseManager.Plugin.load_all
Enum.reduce plugins, config, fn plugin, conf ->
try do
Expand All @@ -251,7 +251,7 @@ defmodule Mix.Tasks.Release do
%Config{} = result -> result
_ -> conf
end
Utils.write_terms(relx_config_path, config.relx_config)
Utils.write_terms(relx_config_path(), config.relx_config)
config
rescue
exception ->
Expand Down Expand Up @@ -301,7 +301,7 @@ defmodule Mix.Tasks.Release do
defp do_release(%Config{name: name, version: version, verbosity: verbosity, upgrade?: upgrade?, dev: dev_mode?, env: env} = config) do
Logger.debug "Generating release..."
# Persist relx.config one last time in case it was updated by a plugin
Utils.write_terms(relx_config_path, config.relx_config)
Utils.write_terms(relx_config_path(), config.relx_config)
# If this is an upgrade release, generate an appup
if upgrade? do
# Change mix env for appup generation
Expand All @@ -321,7 +321,7 @@ defmodule Mix.Tasks.Release do
Logger.info "Using custom .appup located in rel/#{name}.appup"
{:error, reason} ->
Logger.error "Unable to copy custom .appup file: #{reason}"
abort!
abort!()
end
_ ->
# No custom .appup found, proceed with autogeneration
Expand All @@ -330,7 +330,7 @@ defmodule Mix.Tasks.Release do
Logger.info "Generated .appup for #{name} #{v1} -> #{version}"
{:error, reason} ->
Logger.error "Appup generation failed with #{reason}"
abort!
abort!()
end
end
end
Expand All @@ -353,13 +353,13 @@ defmodule Mix.Tasks.Release do
{:error, message} ->
IO.puts(logs)
Logger.error "ERROR: #{inspect message}"
abort!
abort!()
end
catch
err ->
Logger.error "#{IO.inspect err}"
Logger.error "Failed to build release package! Try running with `--verbosity=verbose` to see debugging info!"
abort!
abort!()
end
end

Expand Down
6 changes: 3 additions & 3 deletions lib/mix/tasks/release.plugins.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defmodule Mix.Tasks.Release.Plugins do
end

defp do_run([action: :list]) do
case get_plugins do
case get_plugins() do
[] -> IO.puts "No plugins found!"
plugins ->
for plugin <- plugins do
Expand Down Expand Up @@ -52,7 +52,7 @@ defmodule Mix.Tasks.Release.Plugins do
case result do
nil ->
Logger.notice "No plugin by that name could be found!"
abort!
abort!()
_ ->
result
end
Expand Down Expand Up @@ -91,7 +91,7 @@ defmodule Mix.Tasks.Release.Plugins do
{_, [plugin], _} -> [action: :details, plugin: plugin]
{_, _, _} ->
Logger.error "Invalid arguments for `mix release.plugins`!"
abort!
abort!()
end
end

Expand Down
8 changes: 4 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ defmodule ReleaseManager.Mixfile do
[ app: :exrm,
version: "1.0.8",
elixir: "~> 1.0",
description: description,
package: package,
deps: deps,
docs: docs,
description: description(),
package: package(),
deps: deps(),
docs: docs(),
test_coverage: [tool: Coverex.Task, coveralls: true]]
end

Expand Down
6 changes: 3 additions & 3 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
%{"bbmustache": {:hex, :bbmustache, "1.0.4", "7ba94f971c5afd7b6617918a4bb74705e36cab36eb84b19b6a1b7ee06427aa38", [:rebar], []},
"certifi": {:hex, :certifi, "0.4.0", "a7966efb868b179023618d29a407548f70c52466bf1849b9e8ebd0e34b7ea11f", [:rebar3], []},
"cf": {:hex, :cf, "0.2.1", "69d0b1349fd4d7d4dc55b7f407d29d7a840bf9a1ef5af529f1ebe0ce153fc2ab", [:rebar3], []},
"coverex": {:hex, :coverex, "1.4.10", "f6b68f95b3d51d04571a09dd2071c980e8398a38cf663db22b903ecad1083d51", [:mix], [{:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: false]}, {:httpoison, "~> 0.9", [hex: :httpoison, optional: false]}]},
"coverex": {:hex, :coverex, "1.4.10", "f6b68f95b3d51d04571a09dd2071c980e8398a38cf663db22b903ecad1083d51", [:mix], [{:httpoison, "~> 0.9", [hex: :httpoison, optional: false]}, {:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: false]}]},
"earmark": {:hex, :earmark, "1.0.1", "2c2cd903bfdc3de3f189bd9a8d4569a075b88a8981ded9a0d95672f6e2b63141", [:mix], []},
"erlware_commons": {:hex, :erlware_commons, "0.21.0", "a04433071ad7d112edefc75ac77719dd3e6753e697ac09428fc83d7564b80b15", [:rebar3], [{:cf, "0.2.1", [hex: :cf, optional: false]}]},
"ex_doc": {:hex, :ex_doc, "0.13.0", "aa2f8fe4c6136a2f7cfc0a7e06805f82530e91df00e2bff4b4362002b43ada65", [:mix], [{:earmark, "~> 1.0", [hex: :earmark, optional: false]}]},
"getopt": {:hex, :getopt, "0.8.2", "b17556db683000ba50370b16c0619df1337e7af7ecbf7d64fbf8d1d6bce3109b", [:rebar], []},
"hackney": {:hex, :hackney, "1.6.1", "ddd22d42db2b50e6a155439c8811b8f6df61a4395de10509714ad2751c6da817", [:rebar3], [{:ssl_verify_fun, "1.1.0", [hex: :ssl_verify_fun, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:idna, "1.2.0", [hex: :idna, optional: false]}, {:certifi, "0.4.0", [hex: :certifi, optional: false]}]},
"hackney": {:hex, :hackney, "1.6.1", "ddd22d42db2b50e6a155439c8811b8f6df61a4395de10509714ad2751c6da817", [:rebar3], [{:certifi, "0.4.0", [hex: :certifi, optional: false]}, {:idna, "1.2.0", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.0", [hex: :ssl_verify_fun, optional: false]}]},
"httpoison": {:hex, :httpoison, "0.9.0", "68187a2daddfabbe7ca8f7d75ef227f89f0e1507f7eecb67e4536b3c516faddb", [:mix], [{:hackney, "~> 1.6.0", [hex: :hackney, optional: false]}]},
"idna": {:hex, :idna, "1.2.0", "ac62ee99da068f43c50dc69acf700e03a62a348360126260e87f2b54eced86b2", [:rebar3], []},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []},
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []},
"neotoma": {:hex, :neotoma, "1.7.3"},
"poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], []},
"providers": {:hex, :providers, "1.6.0", "db0e2f9043ae60c0155205fcd238d68516331d0e5146155e33d1e79dc452964a", [:rebar3], [{:getopt, "0.8.2", [hex: :getopt, optional: false]}]},
"relx": {:hex, :relx, "3.20.0", "b515b8317d25b3a1508699294c3d1fa6dc0527851dffc87446661bce21a36710", [:rebar3], [{:providers, "1.6.0", [hex: :providers, optional: false]}, {:getopt, "0.8.2", [hex: :getopt, optional: false]}, {:erlware_commons, "0.21.0", [hex: :erlware_commons, optional: false]}, {:cf, "0.2.1", [hex: :cf, optional: false]}, {:bbmustache, "1.0.4", [hex: :bbmustache, optional: false]}]},
"relx": {:hex, :relx, "3.20.0", "b515b8317d25b3a1508699294c3d1fa6dc0527851dffc87446661bce21a36710", [:rebar3], [{:bbmustache, "1.0.4", [hex: :bbmustache, optional: false]}, {:cf, "0.2.1", [hex: :cf, optional: false]}, {:erlware_commons, "0.21.0", [hex: :erlware_commons, optional: false]}, {:getopt, "0.8.2", [hex: :getopt, optional: false]}, {:providers, "1.6.0", [hex: :providers, optional: false]}]},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.0", "edee20847c42e379bf91261db474ffbe373f8acb56e9079acb6038d4e0bf414f", [:rebar, :make], []},
"ssl_verify_hostname": {:hex, :ssl_verify_hostname, "1.0.5"}}
6 changes: 3 additions & 3 deletions test/appups_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ defmodule AppupsTest do
@v2_app_path Path.join(@v2_path, "ebin/test.app")

setup do
@v1_app_path |> write_term(v1_app)
@v2_app_path |> write_term(v2_app)
@v1_app_path |> write_term(v1_app())
@v2_app_path |> write_term(v2_app())

on_exit fn ->
if @v1_app_path |> File.exists? do
Expand All @@ -27,7 +27,7 @@ defmodule AppupsTest do

test "generates valid .appup file" do
{:ok, appup} = ReleaseManager.Appups.make(:test, "0.0.1", "0.0.2", @v1_path, @v2_path)
assert appup == expected_appup
assert appup == expected_appup()
end

defp v1_app do
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ defmodule PathHelpers do
end

def fixture_path(extra) do
Path.join(fixture_path, extra)
Path.join(fixture_path(), extra)
end
end

0 comments on commit 61446d2

Please sign in to comment.