Commit Graph
21 Commits
Author SHA1 Message Date
George Rodrigues 89d831d67e fix: typos on test and docs (#12167) 2022-10-04 14:53:09 +02:00
sabiwara 29bf449f3f Evaluate formating charlists as ~c sigils (#12064) 2022-08-10 06:47:00 +02:00
Eksperimental 9ed60b73e9 Allow Application.compile_env* to accept attributes (#11383) 2021-11-11 22:04:20 +01:00
José Valim 3c0e26c857 Update CHANGELOG 2021-08-22 17:27:41 +02:00
José Valim 51b0c43df5 Update fetch_env application feedback, closes #10225 2020-07-27 09:50:59 +02:00
Wojtek Mach 62530d89fd Deprecate non-atom keys on put_env, get_env, fetch_env*, delete_env (#9915)
Typespecs already required an atom key but it was never enforced by
code. We're doing this because we eventually would like to support
passing a _path_ like:

    Application.get_env(:myapp, [:key, :foo, :bar])

and this way we will be consistent with recently added
`Application.compile_env/3`.
2020-03-28 13:02:23 +01:00
José Valim b2d58e5f35 Add Application.compile_env/3 (#9628)
Mix stores the compile_env in each applications' .app file.

Releases and Mix tasks were also changed to validate against
the runtime configuration against any stored `compile_env`.
In case of mismatches, an error is raised during boot.
2019-12-06 17:23:01 +01:00
José Valim 8152436235 Improve fetch_env error message 2017-10-24 16:44:06 +02:00
Fumihiro Xue 4ea2ca6784 Run the code formatter on ApplicationTest (#6716) 2017-10-09 15:53:56 +02:00
Aleksei Magusev b86b8ca335 Emit warning when variable is being expanded to function call (#3517) 2016-06-11 22:31:03 +02:00
Aleksei Magusev 96a0a20cb9 Remove unnecessary newlines 2016-06-03 11:58:49 +02:00
robi-wan 08cb324cc2 ApplicationTest fails under Windows (#4761)
2) test application directory (ApplicationTest)
     test/elixir/application_test.exs:53
     Assertion with == failed
     code: String.downcase(Application.app_dir(:elixir)) == String.downcase(Path.join(root, "bin/../lib/elixir"))
     lhs:  "d:/home/docs/dev/git_repos/robi-wan-elixir/lib/elixir"
     rhs:  "d:/home/docs/dev/git_repos/robi-wan-elixir/bin/../lib/elixir"
     stacktrace:
       test/elixir/application_test.exs:55: (test)

`Application.app_dir(:elixir)` delivers under Windows (7 Pro 64bit) an absolute path:

iex(1)> Application.app_dir(:elixir)
"d:/home/docs/dev/git_repos/robi-wan-elixir/lib/elixir"

Under Linux (Ubuntu 16.04 64bit) it delivers a relative path:

iex(1)> Application.app_dir(:elixir)
"/home/robi-wan/development/work/robi-wan-elixir/bin/../lib/elixir"

`Application.app_dir/1` uses `:code.lib_dir` to retrieve the code path.
So maybe the different types of paths (relative vs absolute) are caused by Erlang.

Suggestion to fix the tests under Windows: Use Path.expand/1 to convert
the path (on the right hand side of the assertion) to an absolute path.
2016-06-03 01:53:26 +02:00
Thijs Klaver 82073669a6 Make app_dir accept a list as path argument. 2016-03-17 13:24:44 +01:00
José Valim 606fad1ade Ensure Application.spec/2 returns nil for unknown applications 2016-01-21 18:23:12 +01:00
José Valim d342df1100 Rename get_key to spec 2015-11-25 14:19:55 +01:00
Roman Smirnov ad0a820031 Implementation of get_key and get_all_key from :application in Elixir
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2015-11-25 14:06:43 +01:00
Dan Rees-Jones a672b5754d (#3603) add more application functions 2015-08-21 15:24:51 +01:00
Aleksei Magusev 247143bc38 Add Application.fetch_env!/2 2015-04-15 17:42:39 +02:00
jw2013 60817a3bf8 downcase path comparison in application directory test 2014-10-07 00:34:48 -07:00
José Valim de26484bda Normalize IEx and ExUnit configurations 2014-05-08 19:07:25 +02:00
José Valim 8797280b9e Define an Application module 2014-05-04 12:43:49 +02:00