Skip to content

Commit

Permalink
Update Elixir API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
yrashk committed Jan 23, 2013
1 parent cd4d1e3 commit 94093d8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions lib/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ defmodule Expm.Config do
[handlers: [
{:lager_console_backend, :info},
{:lager_file_backend, [
{to_char_list(File.join(config.log_dir, "debug.log")), :debug, 10485760, '$D0', 5},
{to_char_list(File.join(config.log_dir, "error.log")), :error, 10485760, '$D0', 5},
{to_char_list(File.join(config.log_dir, "console.log")), :info, 10485760, '$D0', 5},
{to_char_list(Path.join(config.log_dir, "debug.log")), :debug, 10485760, '$D0', 5},
{to_char_list(Path.join(config.log_dir, "error.log")), :error, 10485760, '$D0', 5},
{to_char_list(Path.join(config.log_dir, "console.log")), :info, 10485760, '$D0', 5},
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions lib/repositories/dets.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ defrecord Expm.Repository.DETS, table: nil,
options: [auto_save: 1000] do
defoverridable [new: 1]
def new(opts) do
super(opts) /> init
super(opts) |> init
end

defp init(repo) do
ref = make_ref
:dets.open_file(ref, repo.options /> Keyword.put(:file, binary_to_list(repo.filename)))
:dets.open_file(ref, repo.options |> Keyword.put(:file, binary_to_list(repo.filename)))
repo.table(ref)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Expm.Server do
Application.start(:bcrypt) # because we don't want to start it in the CLI
env = Application.environment(:expm)
repo = env[:repository] || quote do: Expm.Repository.DETS.new(filename: "expm.dat")
static_dir = File.join [File.dirname(:code.which(__MODULE__)), "..", "priv", "static"]
static_dir = Path.join [Path.dirname(:code.which(__MODULE__)), "..", "priv", "static"]
{repository, _} = Code.eval_quoted repo, [env: env]
dispatch = [
{:_, [{[], Expm.Server.Http.List, [repository: repository]},
Expand Down Expand Up @@ -78,7 +78,7 @@ defmodule Expm.Server.Http do
{host, req} = Req.host(req)
{port, req} = Req.port(req)
{path, _req} = Req.path(req)
motd_file = File.join [File.dirname(__FILE__), "..", "priv", "motd"]
motd_file = Path.join [Path.dirname(__FILE__), "..", "priv", "motd"]
if File.exists?(motd_file) and path == "/" do
{:ok, motd} = File.read(motd_file)
else
Expand Down
8 changes: 4 additions & 4 deletions lib/server/templates.ex
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,18 @@ end
defmodule Expm.Server.Templates do
require EEx

templates_dir = File.join([File.dirname(__FILE__),"templates"])
templates_dir = Path.join([Path.dirname(__FILE__),"templates"])

EEx.function_from_file :def, :list,
File.join(templates_dir,"list.html.eex"),
Path.join(templates_dir,"list.html.eex"),
[:pkgs, :title]

EEx.function_from_file :def, :package,
File.join(templates_dir,"package.html.eex"),
Path.join(templates_dir,"package.html.eex"),
[:package, :repo]

EEx.function_from_file :def, :page,
File.join(templates_dir,"page.html.eex"),
Path.join(templates_dir,"page.html.eex"),
[:content, :assigns]

end
2 changes: 1 addition & 1 deletion lib/user_config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ defmodule Expm.UserConfig do
end

def filename do
File.join(System.get_env("HOME"), ".expm.config")
Path.join(System.get_env("HOME"), ".expm.config")
end
end
8 changes: 4 additions & 4 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"cowboy": {:git,"https://github.com/extend/cowboy.git","0b82eebed654bd894802acb52697a4d4187cb228",[]},
"edown": {:git,"https://github.com/esl/edown.git","35f8296a25d14c5c1e3209399a2c1856700d9d5b",[]},
"erlpass": {:git,"https://github.com/ferd/erlpass.git","9df3643db39b5acad44643ddbcabb090437c8519",[]},
"exconfig": {:git,"https://github.com/yrashk/exconfig.git","c6401a041bac19f53d0afd1f839e19347eded209",[]},
"exconfig": {:git,"https://github.com/yrashk/exconfig.git","9f02d06c3fba132839cff1f9a639fd63aa2155a3",[]},
"exreloader": {:git,"https://github.com/yrashk/exreloader.git","82e1bd157b75ed4a362f128d9d24646f36a586ba",[]},
"genx": {:git,"https://github.com/yrashk/genx.git","d041f140962c19678bfc672a528144409785810e",[]},
"genx": {:git,"https://github.com/yrashk/genx.git","85fc66c93e5e5711635e5d031a4031538b295ce0",[]},
"hackney": {:git,"https://github.com/benoitc/hackney.git","896fc24e8efb4a5a6966cae13e749ab7cf1f73e2",[]},
"lager": {:git,"https://github.com/basho/lager","9981ca0b4d7a57a421f7a6bba71e2087c0d614ed",[]},
"lagerex": {:git,"https://github.com/yrashk/lagerex.git","4152858bfb058b9e2fc91cd7df9270ecb621a019",[]},
"mimetypes": {:git,"https://github.com/spawngrid/mimetypes.git","e9dfab5aec98963589ecf13bdfcf0490667a730d",[]},
"mimetypes": {:git,"https://github.com/spawngrid/mimetypes.git","0800544bbb684616651a2a1b30aa260132d17d37",[]},
"proper": {:git,"https://github.com/manopapad/proper.git","8f09ee5252f595f32f9a8fd45b8e530b1a3fdfeb",[]},
"ranch": {:git,"https://github.com/extend/ranch.git","cd099983b1b807b87fa050d1e4ff0a13aba25b49",[]},
"relex": {:git,"https://github.com/yrashk/relex.git","9fc231270ddbb72fcf0feff95bc46d404fe46932",[]},
"relex": {:git,"https://github.com/yrashk/relex.git","99952223798fb75435196e3dc8991833aba15592",[]},
"validatex": {:git,"https://github.com/yrashk/validatex.git","f6e1d934647388f297132edcf80bcf7036b5eb09",[]} ]

0 comments on commit 94093d8

Please sign in to comment.