Skip to content

Commit

Permalink
--no-fetch was completely broken, fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yrashk committed May 12, 2011
1 parent 8c37f46 commit b42e9ea
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/agner_fetch.erl
Expand Up @@ -24,7 +24,8 @@
install,
spec,
package_path,
quiet
quiet,
nofetch
}).

-record(state, {
Expand Down Expand Up @@ -148,14 +149,14 @@ handle_state(fetchable, #state{ opts = #opts_rec{ spec = Spec, package_path = Pa
handle_state(fetchable, State#state{ opts = Opts#opts_rec{ spec = {spec, agner_spec:normalize(Spec0)} }, repo_dir = PackagePath } );

%% Everything is ready to go, fetch
handle_state(fetchable, #state{ opts = #opts_rec{version = Version, directory = Directory, nofetch = true }
} = State) when is_list(Directory) andalso is_list(Version) ->
gen_fsm2:send_event(self(), next),
{ok, State};

handle_state(fetchable, #state{ opts = #opts_rec{spec = {spec, Spec}, version = Version, directory = Directory }
} = State) when is_list(Directory) andalso is_list(Version) ->
case proplists:get_value(nofetch, Spec, false) of
true ->
ignore;
false ->
agner:fetch(Spec, Version, Directory)
end,
agner:fetch(Spec, Version, Directory),
gen_fsm2:send_event(self(), next),
{ok, State};

Expand Down

0 comments on commit b42e9ea

Please sign in to comment.