Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving new elixir version warnings #17

Merged
merged 1 commit into from
Sep 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion lib/progress_bar/utils.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule ProgressBar.Utils do
def ansi_prefix do
[
ansi_clear_line, # So a shorter line can replace a previous, longer line.
ansi_clear_line(), # So a shorter line can replace a previous, longer line.
"\r", # Back to beginning of line.
] |> Enum.join
end
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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that if phoenix and ecto both depend on elixir 1.3 to work on current versions, we could be a little restrictive for a 1.7.0 release. 😉

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, yeah, this seems reasonable. I'm not scared of bumping major, so we could even make it 2.0. Maybe along with a breaking suffix: change.

Sorry about the nondeterministic specs of #18 fame. I re-ran the build and now it passes…

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem at all! :)

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