Skip to content

Commit eeb7624

Browse files
author
Devin Torres
committed
Upgrade to Elixir 1.4
1 parent e54dcd7 commit eeb7624

8 files changed

Lines changed: 27 additions & 14 deletions

File tree

.travis.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
11
language: elixir
22
elixir:
3+
- 1.4.0
4+
- 1.3.4
5+
- 1.3.3
6+
- 1.3.2
7+
- 1.3.1
8+
- 1.3.0
9+
- 1.2.6
10+
- 1.2.5
11+
- 1.2.4
12+
- 1.2.3
13+
- 1.2.2
14+
- 1.2.1
315
- 1.2.0
416
- 1.1.1
517
- 1.1.0
618
- 1.0.5
719
- 1.0.4
820
otp_release:
21+
- 19.2
22+
- 19.1
23+
- 19.0
24+
- 18.3
925
- 18.2
1026
- 18.1
1127
- 18.0
12-
- 17.5
13-
- 17.4
14-
- 17.3
1528
before_install:
1629
- sudo apt-get update -qq
1730
- sudo apt-get install -qq rhino

lib/execjs.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ defmodule Execjs do
5252
{ ^port, { :data, data } } ->
5353
loop(port, acc <> data)
5454
{ ^port, :eof } ->
55-
send port, { self, :close }
55+
send port, { self(), :close }
5656
receive do: ({ ^port, :closed } -> :ok)
5757
acc
5858
end
5959
end
6060

6161
defp compile_to_tempfile(program) do
62-
hash = :erlang.phash2(:crypto.rand_bytes(8))
62+
hash = :erlang.phash2(:crypto.strong_rand_bytes(8))
6363
filename = "execjs-#{hash}.js"
6464
path = Path.join(System.tmp_dir!, filename)
6565
File.write! path, program

lib/execjs/escape.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ defmodule Execjs.Escape do
1010
{ ?\n, "\\n" },
1111
{ ?\r, "\\r" },
1212
# http://bclary.com/2004/11/07/#a-7.3
13-
{ "\x{2028}", "\\u2028" },
14-
{ "\x{2029}", "\\u2029" }
13+
{ "\u2028", "\\u2028" },
14+
{ "\u2029", "\\u2029" }
1515
]
1616

1717
for { char, escaped } <- escape_map do

lib/execjs/runtime.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defmodule Execjs.Runtime do
1212

1313
def command, do: unquote(options[:command])
1414

15-
def available?, do: !!System.find_executable(command)
15+
def available?, do: !!System.find_executable(command())
1616

1717
runner_path = Execjs.Runtime.runner_path(unquote(options[:runner]))
1818
EEx.function_from_file :def, :template, runner_path, [:source]

lib/execjs/runtimes.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ defmodule Execjs.Runtimes do
3232
:undefined ->
3333
runtime = case System.get_env("EXECJS_RUNTIME") do
3434
nil ->
35-
Enum.find(runtimes, &(&1.available?)) || raise RuntimeUnavailable
35+
Enum.find(runtimes(), &(&1.available?)) || raise RuntimeUnavailable
3636
name ->
3737
runtime = Module.concat(__MODULE__, name)
3838
Code.ensure_loaded?(runtime)

mix.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ defmodule Execjs.Mixfile do
88
version: @version,
99
elixir: "~> 1.0",
1010
description: "Run JavaScript code from Elixir",
11-
deps: deps,
12-
package: package]
11+
deps: deps(),
12+
package: package()]
1313
end
1414

1515
# Configuration for the OTP application
@@ -29,7 +29,7 @@ defmodule Execjs.Mixfile do
2929
#
3030
# Type `mix help deps` for more examples and options
3131
defp deps do
32-
[{:poison, "~> 1.5"}]
32+
[{:poison, "~> 3.1"}]
3333
end
3434

3535
defp package do

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
%{"poison": {:hex, :poison, "1.5.1"}}
1+
%{"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], []}}

test/execjs_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ defmodule ExecjsTest do
77

88
test "eval" do
99
assert eval(~s(var a = "a"; a + "b")) == "ab"
10-
assert eval(~s(\x{2028}\nvar str = "foo";\x{2029}\n))
10+
assert eval(~s(\u2028\nvar str = "foo";\u2029\n))
1111

1212
assert_raise RuntimeError, fn ->
1313
eval("xxx")

0 commit comments

Comments
 (0)