rebar3: Fix typos and support name-version-tag

The fixup_app_name/1 change notably supports packages like proper-1.1.1-beta.

authored by Eric Bailey and committed by Tuomas Tynkkynen ab9688a6 fe727a19

+5 -4
+5 -4
pkgs/development/tools/build-managers/rebar3/rebar3-nix-bootstrap
··· 41 {ok, RequiredData} = gather_required_data_from_the_environment(ArgData), 42 do_the_bootstrap(RequiredData). 43 44 - %% @doc There are two modes 'registery_only' where the register is 45 %% created from hex and everything else. 46 -spec do_the_bootstrap(#data{}) -> ok. 47 do_the_bootstrap(RequiredData = #data{registry_only = true}) -> ··· 55 %% @doc 56 %% Argument parsing is super simple only because we want to keep the 57 %% dependencies minimal. For now there can be two entries on the 58 - %% command line, "registery-only" and "debug-info" 59 -spec parse_args([string()]) -> #data{}. 60 parse_args(Args0) -> 61 PossibleArgs = sets:from_list(["registry-only", "debug-info"]), ··· 146 147 %% @doc 148 %% This takes an app name in the standard OTP <name>-<version> format 149 - %% and returns just the app name. Why? because rebar is doesn't 150 %% respect OTP conventions in some cases. 151 -spec fixup_app_name(string()) -> string(). 152 fixup_app_name(FileName) -> 153 case string:tokens(FileName, "-") of 154 [Name] -> Name; 155 - [Name, _Version] -> Name 156 end. 157 158 -spec bootstrap_registry(#data{}) -> ok.
··· 41 {ok, RequiredData} = gather_required_data_from_the_environment(ArgData), 42 do_the_bootstrap(RequiredData). 43 44 + %% @doc There are two modes 'registry_only' where the register is 45 %% created from hex and everything else. 46 -spec do_the_bootstrap(#data{}) -> ok. 47 do_the_bootstrap(RequiredData = #data{registry_only = true}) -> ··· 55 %% @doc 56 %% Argument parsing is super simple only because we want to keep the 57 %% dependencies minimal. For now there can be two entries on the 58 + %% command line, "registry-only" and "debug-info" 59 -spec parse_args([string()]) -> #data{}. 60 parse_args(Args0) -> 61 PossibleArgs = sets:from_list(["registry-only", "debug-info"]), ··· 146 147 %% @doc 148 %% This takes an app name in the standard OTP <name>-<version> format 149 + %% and returns just the app name. Why? because rebar doesn't 150 %% respect OTP conventions in some cases. 151 -spec fixup_app_name(string()) -> string(). 152 fixup_app_name(FileName) -> 153 case string:tokens(FileName, "-") of 154 [Name] -> Name; 155 + [Name, _Version] -> Name; 156 + [Name, _Version, _Tag] -> Name 157 end. 158 159 -spec bootstrap_registry(#data{}) -> ok.