hedwig-im / hedwig_slack

Slack Adapter for Hedwig
MIT License
46 stars 30 forks source link

Hedwig Slack dependencies incompatible with Phoenix #5

Closed mattraykowski closed 8 years ago

mattraykowski commented 8 years ago

I attempted to include Hedwig with Slack in an umbrella which also included a Phoenix project and there are dependency conflicts:

➜  omgbot mix deps.update --all
Running dependency resolution

Failed to use "cowlib" (versions 1.0.0 to 1.0.2) because
  cowboy (versions 1.0.0 to 1.0.4) requires ~> 1.0.0
  gun (version 1.0.0-pre.1) requires 1.3.0

Failed to use "poison" (versions 1.3.0 to 1.5.2) because
  ecto (version 1.1.9) requires ~> 1.0 or ~> 2.0
  hedwig_slack (version 0.1.0) requires ~> 2.0
  phoenix (versions 1.1.1 and 1.1.2) requires ~> 1.3
  phoenix_ecto (version 2.0.2) requires ~> 1.3 or ~> 2.0

Failed to use "ranch" (versions 1.2.0 and 1.2.1) because
  cowboy (versions 1.0.0 to 1.0.4) requires ~> 1.0
  gun (version 1.0.0-pre.1) requires 1.1.0

** (Mix) Hex dependency resolution failed, relax the version requirements of your dependencies or unlock them (by using mix deps.update or mix deps.unlock)

It appears that cowboy requires an older version of ranch and cowlib than gun, which is required by hedwig_slack. It also appears that the newer version of cowlib is not backwards compatible and I was unable to get it to work with cowboy. There is no more recent version of cowboy.

Not sure how I can get around this problem.

scrogson commented 8 years ago

@mattraykowski,

So sorry about the late response. I wasn't watching this repo so I never saw the notifications 😢

So here's what you can do for now to get around this problem:

In mix.exs:

defp deps do
  [# existing deps...,
   {:cowboy, github: "ninenines/cowboy", tag: "1.0.4", override: true},
   {:cowlib, "~> 1.3.0", override: true},
   {:gun, github: "ninenines/gun", override: true},
   {:ranch, "~> 1.1.0", override: true}]
end

I am tempted to swap out gun for https://github.com/meh/elixir-socket to avoid this problem. However I'm not sure how the license will effect adoption within companies.

Please let me know if this solves you issue. Sorry again for the late response.

lixmon commented 8 years ago

@mattraykowski I am having the same issue. Followed instructions in your new post but this is the error I am getting now when I changed my dependencies.

mix run --no-halt ==> cowboy (compile) src/cowboy_protocol.erl:272: undefined macro 'INLINE_LOWERCASE/9' src/cowboy_protocol.erl:397: undefined macro 'INLINE_LOWERCASE/4' src/cowboy_protocol.erl:257: function parse_hd_name/8 undefined src/cowboy_protocol.erl:369: function parse_host/3 undefined src/cowboy_protocol.erl:275: Warning: function parse_hd_name_ws/8 is unused src/cowboy_protocol.erl:282: Warning: function wait_hd_before_value/8 is unused src/cowboy_protocol.erl:295: Warning: function parse_hd_before_value/8 is unused src/cowboy_protocol.erl:314: Warning: function wait_hd_value/9 is unused src/cowboy_protocol.erl:329: Warning: function wait_hd_value_nl/9 is unused src/cowboy_protocol.erl:343: Warning: function parse_hd_value/9 is unused Compiling src/cowboy_protocol.erl failed: ERROR: compile failed while processing /home/me/Documents/hedwig/myapp/deps/cowboy: rebar_abort \ (Mix) Could not compile dependency :cowboy, "/home/me/.mix/rebar compile skip_deps=true deps_dir="/home/me/Documents/hedwig_slack3/myapp/_build/dev/lib"" command failed. You can recompile this dependency with "mix deps.compile cowboy", update it with "mix deps.update cowboy" or clean it with "mix deps.clean cowboy"

scrogson commented 8 years ago

I have started work on this but have not yet had time to finish it. I will attempt to finish it up this week.

I will be using a combination of hackney and websocket_client. I really wish gun was ready for prime time 😢

Thanks for your patience.

mattraykowski commented 8 years ago

@scrogson thank you for working on it. I'll just be patient, it's not critical to me. When you're ready for some testing though just let me know and I'll update my umbrella.

scrogson commented 8 years ago

Hey folks, please pull in master and give it a shot. You can review the code changes in #8