{"action":"created","comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/54136186","id":54136186,"diff_hunk":"@@ -3,14 +3,43 @@ defmodule Mix.Local do\n \n   @public_keys_html \"https://s3.amazonaws.com/s3.hex.pm/installs/public_keys.html\"\n \n+  @type item :: :archive | :escript\n+\n   @doc \"\"\"\n-  The path for local archives.\n+  Returns the name for an archive or an escript, based on on the project config.\n+\n+  ## Examples\n+\n+      iex> Mix.Local.name_for(:archive, [app: \"foo\", version: \"0.1.0\"])\n+      \"foo-0.1.0.ez\"\n+\n+      iex> Mix.Local.name_for(:escript, [escript: [name: \"foo\"]])\n+      \"foo\"\n+\n+  \"\"\"\n+  @spec name_for(item, Keyword.t) :: String.t\n+  def name_for(:archive, project) do\n+    version = if version = project[:version], do: \"-#{version}\"\n+    \"#{project[:app]}#{version}.ez\"\n+  end\n+\n+  def name_for(:escript, project) do\n+    case get_in(project, [:escript, :name]) do\n+      nil -> project[:app]\n+      name -> name\n+    end |> to_string()\n+  end\n \n-  Check `mix archive` for info.\n+  @doc \"\"\"\n+  The path for local archives or escripts.\n   \"\"\"\n-  def archives_path do\n-    System.get_env(\"MIX_ARCHIVES\") ||\n-      Path.join(Mix.Utils.mix_home, \"archives\")\n+  @spec path_for(item) :: String.t\n+  def path_for(:archive) do\n+    System.get_env(\"MIX_ARCHIVES\") || Path.join(Mix.Utils.mix_home, \"archives\")\n+  end\n+\n+  def path_for(:escript) do\n+    Path.join(Mix.Utils.mix_home, \"escripts\")","path":"lib/mix/lib/mix/local.ex","position":45,"original_position":45,"commit_id":"2b417ae75875336108ba1a16da1b2018d20d4f2d","original_commit_id":"2b417ae75875336108ba1a16da1b2018d20d4f2d","user":{"login":"alco","id":207748,"avatar_url":"https://avatars.githubusercontent.com/u/207748?v=3","gravatar_id":"","url":"https://api.github.com/users/alco","html_url":"https://github.com/alco","followers_url":"https://api.github.com/users/alco/followers","following_url":"https://api.github.com/users/alco/following{/other_user}","gists_url":"https://api.github.com/users/alco/gists{/gist_id}","starred_url":"https://api.github.com/users/alco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alco/subscriptions","organizations_url":"https://api.github.com/users/alco/orgs","repos_url":"https://api.github.com/users/alco/repos","events_url":"https://api.github.com/users/alco/events{/privacy}","received_events_url":"https://api.github.com/users/alco/received_events","type":"User","site_admin":false},"body":"This has already been asked and answered [here](https://github.com/elixir-lang/elixir/pull/2974#issuecomment-68431565) (see the second quote).","created_at":"2016-02-25T17:59:53Z","updated_at":"2016-02-25T17:59:53Z","html_url":"https://github.com/elixir-lang/elixir/pull/2974#discussion_r54136186","pull_request_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/2974","_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/54136186"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/2974#discussion_r54136186"},"pull_request":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/2974"}}},"pull_request":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/2974","id":26701914,"html_url":"https://github.com/elixir-lang/elixir/pull/2974","diff_url":"https://github.com/elixir-lang/elixir/pull/2974.diff","patch_url":"https://github.com/elixir-lang/elixir/pull/2974.patch","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/2974","number":2974,"state":"closed","locked":false,"title":"escript-related mix tasks","user":{"login":"alco","id":207748,"avatar_url":"https://avatars.githubusercontent.com/u/207748?v=3","gravatar_id":"","url":"https://api.github.com/users/alco","html_url":"https://github.com/alco","followers_url":"https://api.github.com/users/alco/followers","following_url":"https://api.github.com/users/alco/following{/other_user}","gists_url":"https://api.github.com/users/alco/gists{/gist_id}","starred_url":"https://api.github.com/users/alco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alco/subscriptions","organizations_url":"https://api.github.com/users/alco/orgs","repos_url":"https://api.github.com/users/alco/repos","events_url":"https://api.github.com/users/alco/events{/privacy}","received_events_url":"https://api.github.com/users/alco/received_events","type":"User","site_admin":false},"body":"This PR implements a few additional escript-related mix tasks, outlined in [this proposal](https://groups.google.com/d/msg/elixir-lang-core/LEr5Vjd1gys/A8WTbC1vmhwJ).\r\n\r\n## Technical details\r\n\r\n  * `mix escript.install` has been added that works similarly to `mix archive.install`: it takes a path or a URL to an arbitrary file and puts it under `~/.mix/escripts`.\r\n\r\n  * `mix escript` lists all executable files under `~/.mix/escripts`.\r\n\r\n  * `mix escript.uninstall` removes the file with the given name from `~/.mix/escripts`.\r\n\r\n## Additional concerns\r\n\r\n  * the ability to escript.install a prebuilt escript has been added because archive.install could already do that for .ez files, and it makes even more sense to have this work with escripts as they are not dependent on the installed Elixir version.\r\n\r\n  * there is no environment variable MIX_ESCRIPTS because, as I mentioned, escript are generally independent of the installed Elixir version.\r\n\r\n## TODO\r\n\r\n  * [x] tests\r\n\r\n  * [ ] to keep `archive.install` and `escript.install` symmetric, both should be able to fetch repositories and hex packages. The package will be fetched into a temporary directory, in the case of an escript it will also fetch dependencies. Then everything is compiled and subsequently `archive.install` or `escript.install` is called with the resulting archive or escript file. This makes it possible to host mix tasks on hex.pm too.\r\n\r\n  * [ ] the command-line invocation syntax is just an idea. I have considered lots of alternatives, but would like to hear what the team thinks about it first. We can't really say that it is similar to the dep syntax in mix.exs because that would mean having something like this:\r\n\r\n        mix escript.install phoenix\r\n        mix escript.install phoenix 1.0.2\r\n        mix escript.install phoenix github phoenixframework/phoenix\r\n\r\n  I would much rather have the Mix task infer the source type from the URL given to it. The biggest problem is then to distinguish a local path from the package name.\r\n\r\n  * if we allow both archives and escripts to be fetched from hex.pm, it may be confusing in which way a given package is supposed to be used: as a dependency, as an archive, or as an escript. Perhaps, hex.pm could indicate that visually in some way, or via the project's name.","created_at":"2014-12-30T20:24:12Z","updated_at":"2016-02-25T17:59:53Z","closed_at":"2016-02-25T16:33:06Z","merged_at":"2016-02-25T16:33:06Z","merge_commit_sha":"5fadbacdba604df6741725abb3e1a8b416d1e00d","assignee":null,"milestone":{"url":"https://api.github.com/repos/elixir-lang/elixir/milestones/17","html_url":"https://github.com/elixir-lang/elixir/milestones/v1.3.0","labels_url":"https://api.github.com/repos/elixir-lang/elixir/milestones/17/labels","id":1442016,"number":17,"title":"v1.3.0","description":"","creator":{"login":"josevalim","id":9582,"avatar_url":"https://avatars.githubusercontent.com/u/9582?v=3","gravatar_id":"","url":"https://api.github.com/users/josevalim","html_url":"https://github.com/josevalim","followers_url":"https://api.github.com/users/josevalim/followers","following_url":"https://api.github.com/users/josevalim/following{/other_user}","gists_url":"https://api.github.com/users/josevalim/gists{/gist_id}","starred_url":"https://api.github.com/users/josevalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josevalim/subscriptions","organizations_url":"https://api.github.com/users/josevalim/orgs","repos_url":"https://api.github.com/users/josevalim/repos","events_url":"https://api.github.com/users/josevalim/events{/privacy}","received_events_url":"https://api.github.com/users/josevalim/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":5,"state":"open","created_at":"2015-12-03T12:25:01Z","updated_at":"2016-02-25T16:37:33Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/2974/commits","review_comments_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/2974/comments","review_comment_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/2974/comments","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/2b417ae75875336108ba1a16da1b2018d20d4f2d","head":{"label":"alco:alco/escript.install","ref":"alco/escript.install","sha":"2b417ae75875336108ba1a16da1b2018d20d4f2d","user":{"login":"alco","id":207748,"avatar_url":"https://avatars.githubusercontent.com/u/207748?v=3","gravatar_id":"","url":"https://api.github.com/users/alco","html_url":"https://github.com/alco","followers_url":"https://api.github.com/users/alco/followers","following_url":"https://api.github.com/users/alco/following{/other_user}","gists_url":"https://api.github.com/users/alco/gists{/gist_id}","starred_url":"https://api.github.com/users/alco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alco/subscriptions","organizations_url":"https://api.github.com/users/alco/orgs","repos_url":"https://api.github.com/users/alco/repos","events_url":"https://api.github.com/users/alco/events{/privacy}","received_events_url":"https://api.github.com/users/alco/received_events","type":"User","site_admin":false},"repo":{"id":3815790,"name":"elixir","full_name":"alco/elixir","owner":{"login":"alco","id":207748,"avatar_url":"https://avatars.githubusercontent.com/u/207748?v=3","gravatar_id":"","url":"https://api.github.com/users/alco","html_url":"https://github.com/alco","followers_url":"https://api.github.com/users/alco/followers","following_url":"https://api.github.com/users/alco/following{/other_user}","gists_url":"https://api.github.com/users/alco/gists{/gist_id}","starred_url":"https://api.github.com/users/alco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alco/subscriptions","organizations_url":"https://api.github.com/users/alco/orgs","repos_url":"https://api.github.com/users/alco/repos","events_url":"https://api.github.com/users/alco/events{/privacy}","received_events_url":"https://api.github.com/users/alco/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alco/elixir","description":"A modern approach to programming for the Erlang VM","fork":true,"url":"https://api.github.com/repos/alco/elixir","forks_url":"https://api.github.com/repos/alco/elixir/forks","keys_url":"https://api.github.com/repos/alco/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alco/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alco/elixir/teams","hooks_url":"https://api.github.com/repos/alco/elixir/hooks","issue_events_url":"https://api.github.com/repos/alco/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/alco/elixir/events","assignees_url":"https://api.github.com/repos/alco/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/alco/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/alco/elixir/tags","blobs_url":"https://api.github.com/repos/alco/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alco/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alco/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/alco/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alco/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/alco/elixir/languages","stargazers_url":"https://api.github.com/repos/alco/elixir/stargazers","contributors_url":"https://api.github.com/repos/alco/elixir/contributors","subscribers_url":"https://api.github.com/repos/alco/elixir/subscribers","subscription_url":"https://api.github.com/repos/alco/elixir/subscription","commits_url":"https://api.github.com/repos/alco/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/alco/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/alco/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/alco/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/alco/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/alco/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alco/elixir/merges","archive_url":"https://api.github.com/repos/alco/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alco/elixir/downloads","issues_url":"https://api.github.com/repos/alco/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/alco/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/alco/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/alco/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alco/elixir/labels{/name}","releases_url":"https://api.github.com/repos/alco/elixir/releases{/id}","deployments_url":"https://api.github.com/repos/alco/elixir/deployments","created_at":"2012-03-24T07:48:47Z","updated_at":"2015-12-22T02:46:37Z","pushed_at":"2016-02-24T13:50:21Z","git_url":"git://github.com/alco/elixir.git","ssh_url":"git@github.com:alco/elixir.git","clone_url":"https://github.com/alco/elixir.git","svn_url":"https://github.com/alco/elixir","homepage":"http://elixir-lang.org/","size":33628,"stargazers_count":17,"watchers_count":17,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":17,"default_branch":"master"}},"base":{"label":"elixir-lang:master","ref":"master","sha":"4407170349aa12c58664cab2122374167e827f5e","user":{"login":"elixir-lang","id":1481354,"avatar_url":"https://avatars.githubusercontent.com/u/1481354?v=3","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":1234714,"name":"elixir","full_name":"elixir-lang/elixir","owner":{"login":"elixir-lang","id":1481354,"avatar_url":"https://avatars.githubusercontent.com/u/1481354?v=3","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elixir-lang/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":false,"url":"https://api.github.com/repos/elixir-lang/elixir","forks_url":"https://api.github.com/repos/elixir-lang/elixir/forks","keys_url":"https://api.github.com/repos/elixir-lang/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elixir-lang/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elixir-lang/elixir/teams","hooks_url":"https://api.github.com/repos/elixir-lang/elixir/hooks","issue_events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/elixir-lang/elixir/events","assignees_url":"https://api.github.com/repos/elixir-lang/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/elixir-lang/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/elixir-lang/elixir/tags","blobs_url":"https://api.github.com/repos/elixir-lang/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elixir-lang/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elixir-lang/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/elixir-lang/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/elixir-lang/elixir/languages","stargazers_url":"https://api.github.com/repos/elixir-lang/elixir/stargazers","contributors_url":"https://api.github.com/repos/elixir-lang/elixir/contributors","subscribers_url":"https://api.github.com/repos/elixir-lang/elixir/subscribers","subscription_url":"https://api.github.com/repos/elixir-lang/elixir/subscription","commits_url":"https://api.github.com/repos/elixir-lang/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/elixir-lang/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/elixir-lang/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/elixir-lang/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elixir-lang/elixir/merges","archive_url":"https://api.github.com/repos/elixir-lang/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elixir-lang/elixir/downloads","issues_url":"https://api.github.com/repos/elixir-lang/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/elixir-lang/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/elixir-lang/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/elixir-lang/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elixir-lang/elixir/labels{/name}","releases_url":"https://api.github.com/repos/elixir-lang/elixir/releases{/id}","deployments_url":"https://api.github.com/repos/elixir-lang/elixir/deployments","created_at":"2011-01-09T08:43:57Z","updated_at":"2016-02-25T15:51:25Z","pushed_at":"2016-02-25T17:37:42Z","git_url":"git://github.com/elixir-lang/elixir.git","ssh_url":"git@github.com:elixir-lang/elixir.git","clone_url":"https://github.com/elixir-lang/elixir.git","svn_url":"https://github.com/elixir-lang/elixir","homepage":"http://elixir-lang.org/","size":41876,"stargazers_count":6367,"watchers_count":6367,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":868,"mirror_url":null,"open_issues_count":38,"forks":868,"open_issues":38,"watchers":6367,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/2974"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/2974"},"issue":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/2974"},"comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/2974/comments"},"review_comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/2974/comments"},"review_comment":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/2974/commits"},"statuses":{"href":"https://api.github.com/repos/elixir-lang/elixir/statuses/2b417ae75875336108ba1a16da1b2018d20d4f2d"}}}}