Skip to content

Commit

Permalink
Resolving elixir 1.3 and greater warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinst committed Sep 4, 2017
1 parent d6cdb84 commit ea41625
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 22 deletions.
13 changes: 2 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion lib/progress_bar/animation_server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/progress_bar/bytes.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion lib/progress_bar/determinate.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down
6 changes: 3 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions test/bytes_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion test/indeterminate_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/spinner_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ea41625

Please sign in to comment.