Skip to content

Commit

Permalink
Clean up elixir 1.4 compile warnings (#65)
Browse files Browse the repository at this point in the history
* Clean up elixir 1.4 compile warnings

* Fix a couple more deprecation warnings
  • Loading branch information
joshuawscott authored and scrogson committed Mar 7, 2017
1 parent a385e12 commit 4031779
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
10 changes: 4 additions & 6 deletions lib/hedwig/adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ defmodule Hedwig.Adapter do
`Hedwig.Message` struct and call `Hedwig.Robot.handle_message(robot, msg)`.
"""

use Behaviour

@doc false
defmacro __using__(_opts) do
quote do
Expand Down Expand Up @@ -57,15 +55,15 @@ defmodule Hedwig.Adapter do

@doc false
def start_link(module, opts) do
GenServer.start_link(module, {self, opts})
GenServer.start_link(module, {self(), opts})
end

@type robot :: pid
@type state :: term
@type opts :: any
@type msg :: Hedwig.Message.t

defcallback send(pid, msg) :: term
defcallback reply(pid, msg) :: term
defcallback emote(pid, msg) :: term
@callback send(pid, msg) :: term
@callback reply(pid, msg) :: term
@callback emote(pid, msg) :: term
end
2 changes: 1 addition & 1 deletion lib/hedwig/adapters/test.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Hedwig.Adapters.Test do
use Hedwig.Adapter

def init({robot, opts}) do
GenServer.cast(self, :after_init)
GenServer.cast(self(), :after_init)
{:ok, %{conn: nil, opts: opts, robot: robot}}
end

Expand Down
8 changes: 4 additions & 4 deletions lib/mix/tasks/hedwig.gen.robot.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ defmodule Mix.Tasks.Hedwig.Gen.Robot do
"""]

aka = opts[:aka] || "/"
name = opts[:name] || prompt_for_name
name = opts[:name] || prompt_for_name()
robot = opts[:robot] || default_robot(app)
adapter = get_adapter_module(deps)

underscored = Mix.Utils.underscore(robot)
underscored = Macro.underscore(robot)
file = Path.join("lib", underscored) <> ".ex"

robot = Module.concat([robot])
Expand Down Expand Up @@ -79,15 +79,15 @@ defmodule Mix.Tasks.Hedwig.Gen.Robot do

defp default_robot(app) do
case Application.get_env(app, :app_namespace, app) do
^app -> app |> to_string |> Mix.Utils.camelize
^app -> app |> to_string |> Macro.camelize
mod -> mod |> inspect
end |> Module.concat(Robot)
end

defp available_adapters(deps) do
deps
|> all_modules
|> Kernel.++(hedwig_modules)
|> Kernel.++(hedwig_modules())
|> Enum.uniq
|> Enum.filter(&implements_adapter?/1)
|> Enum.with_index
Expand Down

0 comments on commit 4031779

Please sign in to comment.