From 6978ab9a5949172b8b3222e00ec9c8121355bfb9 Mon Sep 17 00:00:00 2001 From: Eduardo Gurgel Date: Sun, 27 Apr 2014 13:57:26 +1200 Subject: [PATCH] Update to Elixir 0.13.1 --- .travis.yml | 15 +++++++++------ lib/httparrot.ex | 2 +- lib/httparrot/set_cookies_handler.ex | 2 +- mix.exs | 6 +++--- mix.lock | 10 +++++----- test/set_cookies_handler_test.exs | 2 +- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4cd3ff..03dade2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,18 @@ -language: erlang notifications: recipients: - eduardo@gurgel.me -otp_release: - - R16B - - R16B01 - - R16B02 script: mix test --no-start install: mix deps.get before_install: + - wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb + - sudo dpkg -i erlang-solutions_1.0_all.deb + - sudo apt-get update + - sudo apt-get install erlang - mkdir -p vendor/elixir - - wget -q https://github.com/elixir-lang/elixir/releases/download/v0.12.4/Precompiled.zip && unzip -qq Precompiled.zip -d vendor/elixir + - wget -q https://github.com/elixir-lang/elixir/releases/download/v0.13.1/Precompiled.zip && unzip -qq Precompiled.zip -d vendor/elixir + - wget -q https://github.com/rebar/rebar/wiki/rebar + - cp rebar vendor/elixir/bin + - chmod +x vendor/elixir/bin/rebar - export PATH="$PATH:$PWD/vendor/elixir/bin" + - rebar --version - export MIX_ENV=test diff --git a/lib/httparrot.ex b/lib/httparrot.ex index f33187a..bc2b637 100644 --- a/lib/httparrot.ex +++ b/lib/httparrot.ex @@ -53,7 +53,7 @@ defmodule HTTParrot do def prettify_json(status, headers, body, req) do if JSEX.is_json? body do body = JSEX.prettify!(body) - headers = ListDict.put(headers, "content-length", integer_to_list(String.length(body))) + headers = List.keystore(headers, "content-length", 0, {"content-length", integer_to_list(String.length(body))}) {:ok, req} = :cowboy_req.reply(status, headers, body, req) end req diff --git a/lib/httparrot/set_cookies_handler.ex b/lib/httparrot/set_cookies_handler.ex index 60754d5..d367ac6 100644 --- a/lib/httparrot/set_cookies_handler.ex +++ b/lib/httparrot/set_cookies_handler.ex @@ -16,7 +16,7 @@ defmodule HTTParrot.SetCookiesHandler do {name, req} = :cowboy_req.binding(:name, req, nil) if name do {value, req} = :cowboy_req.binding(:value, req, nil) - {false, req, Dict.merge([{name, value}], qs_vals)} + {false, req, List.keystore(qs_vals, name, 0, {name, value})} else if Enum.empty?(qs_vals), do: {true, req, state}, else: {false, req, qs_vals} end diff --git a/mix.exs b/mix.exs index fc0d4db..0731cab 100644 --- a/mix.exs +++ b/mix.exs @@ -5,7 +5,7 @@ defmodule Httparrot.Mixfile do [ app: :httparrot, version: "0.1.0", name: "HTTParrot", - elixir: "~> 0.12.4", + elixir: "~> 0.13.1", deps: deps(Mix.env) ] end @@ -20,12 +20,12 @@ defmodule Httparrot.Mixfile do defp deps(:dev) do [ {:cowboy, github: "extend/cowboy", tag: "0.9.0" }, - {:jsex, github: "talentdeficit/jsex" } ] + {:jsex, github: "talentdeficit/jsex", tag: "v1.0.2" } ] end defp deps(:test) do deps(:dev) ++ - [ {:meck, github: "eproxus/meck", tag: "0.8.1" } ] + [ {:meck, github: "eproxus/meck", ref: "69f02255a8219185bf55da303981d86886b3c24b" } ] end defp deps(_), do: deps(:dev) diff --git a/mix.lock b/mix.lock index 5480ffd..e47c6c9 100644 --- a/mix.lock +++ b/mix.lock @@ -1,6 +1,6 @@ -[ "cowboy": {:git, "git://github.com/extend/cowboy.git", "db52494371ea249f38d51108c7d79cf487ff6374", [tag: "0.9.0"]}, +%{"cowboy": {:git, "git://github.com/extend/cowboy.git", "db52494371ea249f38d51108c7d79cf487ff6374", [tag: "0.9.0"]}, "cowlib": {:git, "git://github.com/extend/cowlib.git", "63298e8e160031a70efff86a1acde7e7db1fcda6", [ref: "0.4.0"]}, - "jsex": {:git, "git://github.com/talentdeficit/jsex.git", "65aa6ae7c1543a0c4e83032c04626af7be7a7f3e", []}, - "jsx": {:git, "git://github.com/talentdeficit/jsx.git", "e50af6e109cb03bd26acf715cbc77de746507d1d", [tag: "v1.4.3"]}, - "meck": {:git, "git://github.com/eproxus/meck.git", "1286aba1cb6bbd6c9fc3f817740758b224843ee7", [tag: "0.8.1"]}, - "ranch": {:git, "git://github.com/extend/ranch.git", "5df1f222f94e08abdcab7084f5e13027143cc222", [ref: "0.9.0"]} ] + "jsex": {:git, "git://github.com/talentdeficit/jsex.git", "8a92e26180cb11c858130f9693a195a0fad1ecf9", [tag: "v1.0.2"]}, + "jsx": {:git, "git://github.com/talentdeficit/jsx.git", "507fa4c41db33c81e925ab53f4d789d234aaff2f", [tag: "v2.0.1"]}, + "meck": {:git, "git://github.com/eproxus/meck.git", "69f02255a8219185bf55da303981d86886b3c24b", [ref: "69f02255a8219185bf55da303981d86886b3c24b"]}, + "ranch": {:git, "git://github.com/extend/ranch.git", "5df1f222f94e08abdcab7084f5e13027143cc222", [ref: "0.9.0"]}} diff --git a/test/set_cookies_handler_test.exs b/test/set_cookies_handler_test.exs index daa1aec..bcd376f 100644 --- a/test/set_cookies_handler_test.exs +++ b/test/set_cookies_handler_test.exs @@ -26,7 +26,7 @@ defmodule HTTParrot.SetCookiesHandlerTest do expect(:cowboy_req, :binding, [{[:name, :req2, nil], {"name", :req3}}, {[:value, :req3, nil], {"value", :req4}}]) - assert malformed_request(:req1, :state) == {false, :req4, [{"name", "value2"}]} + assert malformed_request(:req1, :state) == {false, :req4, [{"name", "value"}]} assert validate :cowboy_req end