Skip to content
Browse files

Add option --no-fetch to build and install commands

  • Loading branch information...
1 parent 6e26029 commit bf18c792ced537c43e462115316b2589cb0c22d3 @yrashk yrashk committed
Showing with 15 additions and 5 deletions.
  1. +5 −2 README.md
  2. +6 −1 src/agner_fetch.erl
  3. +4 −2 src/agner_main.erl
View
7 README.md
@@ -166,11 +166,11 @@ defaults to `.`)
For convenience, the following shortcuts are defined:
- agner build PACKAGE [DESTDIR] [-v/--version VERSION] [-s/--spec-file SPECFILE] [-a/--add-path] [-i/--install]
+ agner build PACKAGE [DESTDIR] [-v/--version VERSION] [-s/--spec-file SPECFILE] [-a/--add-path] [-i/--install] [--no-fetch]
Alias for `agner fetch --build PACKAGE`.
- agner install PACKAGE [-v/--version VERSION] [-s/--spec-file SPECFILE]
+ agner install PACKAGE [-v/--version VERSION] [-s/--spec-file SPECFILE] [--no-fetch]
Alias for `agner fetch --build --install PACKAGE
/tmp/<uniq_filename>`. A typical example would be `agner install
@@ -178,6 +178,9 @@ rebar` or `agner install rebar -v @agner` to get `rebar` binary in
your `PATH`. It is assumed that `install_command` property will make use
of `AGNER_INSTALL_PREFIX` OS environment variable.
+`--no-fetch` option could be useful when you don't want to update already
+fetched repository, but just build or install it.
+
### Uninstalling
agner uninstall PACKAGE [-v/--version VERSION] [-s/--spec-file SPECFILE]
View
7 src/agner_fetch.erl
@@ -150,7 +150,12 @@ handle_state(fetchable, #state{ opts = #opts_rec{ spec = Spec, package_path = Pa
%% Everything is ready to go, fetch
handle_state(fetchable, #state{ opts = #opts_rec{spec = {spec, Spec}, version = Version, directory = Directory }
} = State) when is_list(Directory) andalso is_list(Version) ->
- agner:fetch(Spec, Version, Directory),
+ case proplists:get_value(nofetch, Spec, false) of
+ true ->
+ ignore;
+ false ->
+ agner:fetch(Spec, Version, Directory)
+ end,
gen_fsm2:send_event(self(), next),
{ok, State};
View
6 src/agner_main.erl
@@ -78,7 +78,8 @@ arg_proplist() ->
{version, $v, "version", {string, "@master"}, "Version"},
{app, undefined, "app", string, "Fetch dependencies from .app"},
{spec, $s, "spec-file", string, "Use local specification file"},
- {quiet, $q, "quiet", {boolean, false}, "Don't render build/install scripts output"}
+ {quiet, $q, "quiet", {boolean, false}, "Don't render build/install scripts output"},
+ {nofetch, undefined, "no-fetch", {boolean, false}, "Don't (re)-fetch the source code"}
]}},
{"uninstall",
{uninstall,
@@ -107,7 +108,8 @@ arg_proplist() ->
{addpath, $a, "add-path", {boolean, false}, "Add path to compiled package to .erlang"},
{install, $i, "install", {boolean, false}, "Install package (if install_command is available)"},
{directory, undefined, undefined, string, "Directory to check package out to"},
- {quiet, $q, "quiet", {boolean, false}, "Don't render build/install scripts output"}
+ {quiet, $q, "quiet", {boolean, false}, "Don't render build/install scripts output"},
+ {nofetch, undefined, "no-fetch", {boolean, false}, "Don't (re)-fetch the source code"}
]}},
{"create",
{create,

0 comments on commit bf18c79

Please sign in to comment.
Something went wrong with that request. Please try again.