From ea416253d2e744df89165ac408445326967ddc6f Mon Sep 17 00:00:00 2001 From: Kelvin Stinghen Date: Mon, 4 Sep 2017 18:10:35 -0300 Subject: [PATCH] Resolving elixir 1.3 and greater warnings --- .travis.yml | 13 ++----------- lib/progress_bar/animation_server.ex | 2 +- lib/progress_bar/bytes.ex | 2 +- lib/progress_bar/determinate.ex | 2 +- mix.exs | 6 +++--- test/bytes_test.exs | 4 ++-- test/indeterminate_test.exs | 2 +- test/spinner_test.exs | 4 ++-- 8 files changed, 13 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index ad57819..0dc009b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,4 @@ language: elixir -elixir: - - 1.3.0 - - 1.2.0 --otp_release: 18.0 - -matrix: - include: - - elixir: 1.1.0 - otp_release: 17.3 - - elixir: 1.0.5 - otp_release: 17.3 +elixir: 1.3.0 +otp_release: 18.0 diff --git a/lib/progress_bar/animation_server.ex b/lib/progress_bar/animation_server.ex index 4be37fa..6a73b3f 100644 --- a/lib/progress_bar/animation_server.ex +++ b/lib/progress_bar/animation_server.ex @@ -39,7 +39,7 @@ defmodule ProgressBar.AnimationServer do # This timer is automatically cancelled when the server goes away. interval = config[:interval] - Process.send_after(self, :tick, interval) + Process.send_after(self(), :tick, interval) {config, count + 1} end diff --git a/lib/progress_bar/bytes.ex b/lib/progress_bar/bytes.ex index 7d6a666..3f827d4 100644 --- a/lib/progress_bar/bytes.ex +++ b/lib/progress_bar/bytes.ex @@ -17,7 +17,7 @@ defmodule ProgressBar.Bytes do defp format_without_unit(bytes, bytes_to_determine_unit) do {divisor, _} = divisor_and_unit(bytes_to_determine_unit) - bytes / divisor |> to_s + to_s(bytes / divisor) end defp divisor_and_unit(bytes) when bytes < @mb, do: {@kb, "KB"} diff --git a/lib/progress_bar/determinate.ex b/lib/progress_bar/determinate.ex index 67c9da2..6194410 100644 --- a/lib/progress_bar/determinate.ex +++ b/lib/progress_bar/determinate.ex @@ -36,7 +36,7 @@ defmodule ProgressBar.Determinate do defp formatted_percent(false, _), do: "" defp formatted_percent(true, number) do - " " <> String.rjust(Integer.to_string(number), 3) <> "%" + " " <> String.pad_leading(Integer.to_string(number), 3) <> "%" end defp bytes(false, _, _), do: "" diff --git a/mix.exs b/mix.exs index 906bb48..4037a89 100644 --- a/mix.exs +++ b/mix.exs @@ -5,12 +5,12 @@ defmodule ProgressBar.Mixfile do [ app: :progress_bar, version: "1.6.1", - elixir: "~> 1.0", + elixir: "~> 1.3", description: "Command-line progress bars and spinners.", - package: package, + package: package(), build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, - deps: deps, + deps: deps(), ] end diff --git a/test/bytes_test.exs b/test/bytes_test.exs index 17ed055..23fc8b8 100644 --- a/test/bytes_test.exs +++ b/test/bytes_test.exs @@ -38,10 +38,10 @@ defmodule BytesTest do end defp mb_to_bytes(mb) do - mb * @mb |> trunc + trunc(mb * @mb) end defp kb_to_bytes(kb) do - kb * @kb |> trunc + trunc(kb * @kb) end end diff --git a/test/indeterminate_test.exs b/test/indeterminate_test.exs index fab732f..9137f26 100644 --- a/test/indeterminate_test.exs +++ b/test/indeterminate_test.exs @@ -87,7 +87,7 @@ defmodule IndeterminateTest do test "passes through the function's return value" do capture_io fn -> value = ProgressBar.render_indeterminate(fn -> :fun_return end) - send self, value + send self(), value end assert_received :fun_return diff --git a/test/spinner_test.exs b/test/spinner_test.exs index 047a2d2..649d16a 100644 --- a/test/spinner_test.exs +++ b/test/spinner_test.exs @@ -68,7 +68,7 @@ defmodule SpinnerTest do test "passes through the function's return value" do capture_io fn -> value = ProgressBar.render_spinner(fn -> :fun_return end) - send self, value + send self(), value end assert_received :fun_return @@ -88,7 +88,7 @@ defmodule SpinnerTest do defp split_frames(string) do string - |> String.strip + |> String.trim() |> String.split(Utils.ansi_prefix) |> Enum.reject(&(&1 == "")) end