diff --git a/lib/mix/lib/mix.ex b/lib/mix/lib/mix.ex index be9d6292980..c4d494394ef 100644 --- a/lib/mix/lib/mix.ex +++ b/lib/mix/lib/mix.ex @@ -5,9 +5,9 @@ defmodule Mix do build tool for Clojure and was written by one of its contributors. This module works as a facade for accessing the most common functionality - in Elixir, as the shell and the current project configuration. + in Elixir, such as the shell and the current project configuration. - For getting started with Elixir, checkout out the guide available in + For getting started with Elixir, checkout out the guide available on [Elixir's website](http://elixir-lang.org). """ @@ -37,7 +37,7 @@ defmodule Mix do @doc """ Changes the current mix env. Project configuration loaded - per environment is not going to be reloaded. + per environment will not be reloaded. """ def env(env) when is_atom(env) do Mix.Server.cast({ :env, env }) @@ -52,7 +52,7 @@ defmodule Mix do end @doc """ - Starts mix and loads the project and dependencies into + Starts mix and loads the project and dependencies in one step. Useful when invoking mix from an external tool. """ def loadpaths do @@ -64,8 +64,8 @@ defmodule Mix do The shell is a wrapper for doing IO. It contains conveniences for asking the user information, - printing status and so forth. The fact it is also swappable - allow developers to use a test shell, that simply sends the + printing status and so forth. It is also swappable, + allowing developers to use a test shell that simply sends the messages to the current process. """ def shell do @@ -81,9 +81,9 @@ defmodule Mix do @doc """ Retrieves the current project configuration. If there - isn't a project defined, this function will simply + is not a project defined, this function will return an empty keyword list. This allows many mix - tasks to work without a need for an underlying project. + tasks to work without the need for an underlying project. """ def project do Mix.Project.config diff --git a/lib/mix/lib/mix/archive.ex b/lib/mix/lib/mix/archive.ex index e53b16db94d..8f87de01428 100644 --- a/lib/mix/lib/mix/archive.ex +++ b/lib/mix/lib/mix/archive.ex @@ -5,11 +5,11 @@ defmodule Mix.Archive do An archive is a zip file containing the app and beam files. A valid archive must be named with the name of the application and it should contain the relative paths beginning with the application - name, e.g. root of zip file should be `my_app/ebin/Elixir.My.App.beam`. + name, e.g. the root of the zip file should be `my_app/ebin/Elixir.My.App.beam`. """ @doc """ - Returns the archive name based on the app and version. + Returns the archive name based on `app` and version. """ def name(app, nil), do: "#{app}.ez" def name(app, vsn), do: "#{app}-#{vsn}.ez" diff --git a/lib/mix/lib/mix/deps.ex b/lib/mix/lib/mix/deps.ex index d03983e6b0d..d77ffe987d4 100644 --- a/lib/mix/lib/mix/deps.ex +++ b/lib/mix/lib/mix/deps.ex @@ -2,18 +2,18 @@ defrecord Mix.Dep, [ scm: nil, app: nil, requirement: nil, status: nil, opts: ni deps: [], source: nil, manager: nil, from: nil ] do @moduledoc """ This is a record that keeps information about your project - dependencies. It keeps: - - * scm - a module representing the source code management tool (SCM) operations; - * app - the app name as an atom; - * requirement - a binary or regex with the dep's requirement - * status - the current status of dependency, check `Mix.Deps.format_status/1` for more info; - * opts - the options given by the developer - * deps - dependencies of this dependency - * source - any possible configuration associated with the manager field, - rebar.config for rebar or the Mix.Project for Mix - * manager - the project management, possible values: :rebar | :mix | :make | nil - * from - path to file where dependency was defined + dependencies. It contains: + + * `scm` - a module representing the source code management tool (SCM) operations; + * `app` - the application name as an atom; + * `requirement` - a binary or regex with the dependency's requirement + * `status` - the current status of the dependency, check `Mix.Deps.format_status/1` for more info; + * `opts` - the options given by the developer + * `deps` - dependencies of this dependency + * `source` - any possible configuration associated with the `manager` field, + `rebar.config` for rebar or the `Mix.Project` for Mix + * `manager` - the project management, possible values: `:rebar` | `:mix` | `:make` | `nil` + * `from` - path to the file where the dependency was defined """ end @@ -23,12 +23,12 @@ defmodule Mix.Deps do """ @doc """ - Returns all dependencies recursively as `Mix.Dep` record. + Return all dependencies recursively as a `Mix.Dep` record. ## Exceptions - This function raises an exception in case the developer - provides a dependency in the wrong format. + This function raises an exception if the provided + dependency is in the wrong format. """ def all do { deps, _ } = Mix.Deps.Converger.all(nil, fn(dep, acc) -> { dep, acc } end) @@ -36,7 +36,7 @@ defmodule Mix.Deps do end @doc """ - Returns all dependencies but with a custom callback and + Return all dependencies, but with a custom callback and accumulator. """ def all(acc, callback) do @@ -45,12 +45,12 @@ defmodule Mix.Deps do end @doc """ - Returns all direct child dependencies. + Return all direct child dependencies. """ defdelegate children(), to: Mix.Deps.Retriever @doc """ - Returns all dependencies depending on given dependencies. + Return all dependencies depending on the given dependencies. """ def depending(deps, all_deps // all) @@ -69,7 +69,7 @@ defmodule Mix.Deps do end @doc """ - Receives a list of deps names and returns deps records. + Receives a list of dependency names and returns dependency records. Logs a message if the dependency could not be found. """ def by_name(given, all_deps // all) do @@ -93,9 +93,9 @@ defmodule Mix.Deps do end @doc """ - Runs the given `fun` inside the given dependency project by + Run the given `fun` inside the given dependency project by changing the current working directory and loading the given - project into the project stack. + project onto the project stack. """ def in_dependency(dep, post_config // [], fun) @@ -123,13 +123,13 @@ defmodule Mix.Deps do end @doc """ - Formats the status of a dependency. + Format the status of a dependency. """ def format_status(Mix.Dep[status: { :ok, _vsn }]), do: "ok" def format_status(Mix.Dep[status: { :noappfile, path }]), - do: "could not find app file at #{Mix.Utils.relative_to_cwd(path)}" + do: "could not find an app file at #{Mix.Utils.relative_to_cwd(path)}" def format_status(Mix.Dep[status: { :invalidapp, path }]), do: "the app file at #{Mix.Utils.relative_to_cwd(path)} is invalid" @@ -160,7 +160,7 @@ defmodule Mix.Deps do do: "the dependency is not available, run `mix deps.get`" @doc """ - Checks the lock for the given dependency and update its status accordingly. + Check the lock for the given dependency and update its status accordingly. """ def check_lock(Mix.Dep[scm: scm, app: app, opts: opts] = dep, lock) do if available?(dep) do @@ -179,7 +179,7 @@ defmodule Mix.Deps do end @doc """ - Updates the dependency inside the given project. + Update the dependency inside the given project. """ defdelegate update(dep), to: Mix.Deps.Retriever @@ -205,7 +205,7 @@ defmodule Mix.Deps do end @doc """ - Check if a dependency is out of date or not, considering its + Check if a dependency is out of date, considering its lock status. Therefore, be sure to call `check_lock` before invoking this function. """ @@ -214,7 +214,7 @@ defmodule Mix.Deps do def out_of_date?(dep), do: not available?(dep) @doc """ - Format the dependency for printing. + Format a dependency for printing. """ def format_dep(Mix.Dep[scm: scm, app: app, status: status, opts: opts]) do version = @@ -227,7 +227,7 @@ defmodule Mix.Deps do end @doc """ - Returns all compile paths for the dependency. + Return all compile paths for the dependency. """ def compile_paths(Mix.Dep[app: app, opts: opts, manager: manager]) do if manager == :mix do @@ -240,7 +240,7 @@ defmodule Mix.Deps do end @doc """ - Returns all load paths for the dependency. + Return all load paths for the dependency. """ def load_paths(Mix.Dep[manager: :mix, app: app, opts: opts]) do paths = Mix.Project.in_project app, opts[:dest], fn _ -> @@ -267,21 +267,21 @@ defmodule Mix.Deps do end @doc """ - Returns true if dependency is a mix project. + Return `true` if dependency is a mix project. """ def mix?(Mix.Dep[manager: manager]) do manager == :mix end @doc """ - Returns true if dependency is a rebar project. + Return `true` if dependency is a rebar project. """ def rebar?(Mix.Dep[manager: manager]) do manager == :rebar end @doc """ - Returns true if dependency is a make project. + Return `true` if dependency is a make project. """ def make?(Mix.Dep[manager: manager]) do manager == :make diff --git a/lib/mix/lib/mix/tasks/deps.check.ex b/lib/mix/lib/mix/tasks/deps.check.ex index 26f533d89b0..73ff935ad9c 100644 --- a/lib/mix/lib/mix/tasks/deps.check.ex +++ b/lib/mix/lib/mix/tasks/deps.check.ex @@ -4,15 +4,15 @@ defmodule Mix.Tasks.Deps.Check do import Mix.Deps, only: [all: 0, format_dep: 1, format_status: 1, check_lock: 2, out_of_date?: 1] @hidden true - @shortdoc "Check if all dependencies are ok" + @shortdoc "Check if all dependencies are valid" @recursive :both @moduledoc """ Checks if all dependencies are valid and if not, abort. - Prints the invalid dependencies status before aborting. + Prints the invalid dependencies' status before aborting. This task is not shown in `mix help` but it is part - of mix public API and can be depended on. + of the `mix` public API and can be depended on. """ def run(_) do lock = Mix.Deps.Lock.read diff --git a/lib/mix/lib/mix/tasks/deps.clean.ex b/lib/mix/lib/mix/tasks/deps.clean.ex index 494f5970c6e..d113870dceb 100644 --- a/lib/mix/lib/mix/tasks/deps.clean.ex +++ b/lib/mix/lib/mix/tasks/deps.clean.ex @@ -1,15 +1,15 @@ defmodule Mix.Tasks.Deps.Clean do use Mix.Task - @shortdoc "Remove dependencies files" + @shortdoc "Remove dependencies' files" @recursive :both @moduledoc """ Clean dependencies. - By default, cleans all dependencies. A list of deps can + By default, cleans all dependencies. A list of dependencies can be given to clean specific ones. Clean does not unlock - the repositories, unless --unlock is given. + the repositories, unless `--unlock` is given. """ import Mix.Deps, only: [all: 0, by_name: 1, format_dep: 1] diff --git a/lib/mix/lib/mix/tasks/deps.compile.ex b/lib/mix/lib/mix/tasks/deps.compile.ex index fe619c26450..6d6eeb224d3 100644 --- a/lib/mix/lib/mix/tasks/deps.compile.ex +++ b/lib/mix/lib/mix/tasks/deps.compile.ex @@ -7,10 +7,10 @@ defmodule Mix.Tasks.Deps.Compile do @moduledoc """ Compile dependencies. - By default, compile all dependencies. A list of deps can - be given to force the compilation of specific deps. + By default, compile all dependencies. A list of dependencies can + be given to force the compilation of specific dependencies. - By default, it tries to detect if the project contains one of + By default, attempt to detect if the project contains one of the following files: * `mix.exs` - if so, invokes `mix compile` @@ -97,7 +97,7 @@ defmodule Mix.Tasks.Deps.Compile do catch kind, reason -> Mix.shell.error "could not compile dependency #{app}, mix compile failed. " <> - "In case you want to recompile this dependency, please run: mix deps.compile #{app}" + "If you want to recompile this dependency, please run: mix deps.compile #{app}" :erlang.raise(kind, reason, System.stacktrace) after Mix.env(old_env) @@ -129,7 +129,7 @@ defmodule Mix.Tasks.Deps.Compile do defp do_command(app, command, extra // "") do if Mix.shell.cmd("#{command} #{extra}") != 0 do raise Mix.Error, message: "could not compile dependency #{app}, #{command} command failed. " <> - "In case you want to recompile this dependency, please run: mix deps.compile #{app}" + "If you want to recompile this dependency, please run: mix deps.compile #{app}" end end @@ -141,7 +141,7 @@ defmodule Mix.Tasks.Deps.Compile do Mix.shell.info("#{app}: #{command}") if Mix.shell.cmd(command) != 0 do raise Mix.Error, message: "could not compile dependency #{app}, custom #{command} command failed. " <> - "In case you want to recompile this dependency, please run: mix deps.compile #{app}" + "If you want to recompile this dependency, please run: mix deps.compile #{app}" end end end diff --git a/lib/mix/lib/mix/tasks/deps.ex b/lib/mix/lib/mix/tasks/deps.ex index 8bfced46b7e..4020d8ca4cb 100644 --- a/lib/mix/lib/mix/tasks/deps.ex +++ b/lib/mix/lib/mix/tasks/deps.ex @@ -8,7 +8,7 @@ defmodule Mix.Tasks.Deps do @moduledoc """ List all dependencies and their status. - The output is given as follow: + The output is given as follows: * APP [VERSION] SCM: LOCATION [locked at REF] diff --git a/lib/mix/lib/mix/tasks/deps.loadpaths.ex b/lib/mix/lib/mix/tasks/deps.loadpaths.ex index 32150755df2..4abff9c90e7 100644 --- a/lib/mix/lib/mix/tasks/deps.loadpaths.ex +++ b/lib/mix/lib/mix/tasks/deps.loadpaths.ex @@ -4,12 +4,12 @@ defmodule Mix.Tasks.Deps.Loadpaths do import Mix.Deps, only: [all: 0, load_paths: 1, ok?: 1] @hidden true - @shortdoc "Load all dependencies paths" + @shortdoc "Load all dependencies' paths" @recursive :both @moduledoc """ Loads all dependencies. This is invoked directly - by "loadpaths" when the CLI boots. + by `loadpaths` when the CLI boots. """ def run(args) do { opts, _ } = OptionParser.parse(args) diff --git a/lib/mix/lib/mix/tasks/deps.update.ex b/lib/mix/lib/mix/tasks/deps.update.ex index a07d788fda0..af05649825c 100644 --- a/lib/mix/lib/mix/tasks/deps.update.ex +++ b/lib/mix/lib/mix/tasks/deps.update.ex @@ -7,7 +7,7 @@ defmodule Mix.Tasks.Deps.Update do @moduledoc """ Update dependencies. - By default, updates all dependencies. A list of deps can + By default, updates all dependencies. A list of dependencies can be given to update specific ones. Recompiles the given projects after updating. diff --git a/lib/mix/test/mix/tasks/deps_test.exs b/lib/mix/test/mix/tasks/deps_test.exs index eb79b722c68..43e9c39f7d3 100644 --- a/lib/mix/test/mix/tasks/deps_test.exs +++ b/lib/mix/test/mix/tasks/deps_test.exs @@ -65,7 +65,7 @@ defmodule Mix.Tasks.DepsTest do assert_received { :mix_shell, :info, ["* invalidapp [path: \"deps/invalidapp\"]"] } assert_received { :mix_shell, :info, [" the app file at deps/invalidapp/ebin/invalidapp.app is invalid"] } assert_received { :mix_shell, :info, ["* noappfile [path: \"deps/noappfile\"]"] } - assert_received { :mix_shell, :info, [" could not find app file at deps/noappfile/ebin/noappfile.app"] } + assert_received { :mix_shell, :info, [" could not find an app file at deps/noappfile/ebin/noappfile.app"] } assert_received { :mix_shell, :info, ["* uncloned [git: \"https://github.com/elixir-lang/uncloned.git\"]"] } assert_received { :mix_shell, :info, [" the dependency is not available, run `mix deps.get`"] } end @@ -131,7 +131,7 @@ defmodule Mix.Tasks.DepsTest do assert_received { :mix_shell, :error, ["* invalidapp [path: \"deps/invalidapp\"]"] } assert_received { :mix_shell, :error, [" the app file at deps/invalidapp/ebin/invalidapp.app is invalid"] } assert_received { :mix_shell, :error, ["* noappfile [path: \"deps/noappfile\"]"] } - assert_received { :mix_shell, :error, [" could not find app file at deps/noappfile/ebin/noappfile.app"] } + assert_received { :mix_shell, :error, [" could not find an app file at deps/noappfile/ebin/noappfile.app"] } assert_received { :mix_shell, :error, ["* uncloned [git: \"https://github.com/elixir-lang/uncloned.git\"]"] } assert_received { :mix_shell, :error, [" the dependency is not available, run `mix deps.get`"] } end