diff options
| author | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-04-22 17:30:00 -0500 | 
|---|---|---|
| committer | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-04-22 17:30:00 -0500 | 
| commit | de77225b49ca1af2e4a90f02ef248a15f1e74081 (patch) | |
| tree | cb0c300dce1d2532f68eec6cb4109f1adb4a5430 /src | |
| parent | 31ef4c491689f2e3166e4365455ebf86374ab8a2 (diff) | |
| parent | 18c395ff1557d16268101d5b7ea87d56071b5ff0 (diff) | |
Merge pull request #361 from ferd/symlink-default-fix
Symlink existing default deps when in new profile
Diffstat (limited to 'src')
| -rw-r--r-- | src/rebar_prv_install_deps.erl | 23 | 
1 files changed, 15 insertions, 8 deletions
| diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index 1884a9c..3612303 100644 --- a/src/rebar_prv_install_deps.erl +++ b/src/rebar_prv_install_deps.erl @@ -395,14 +395,8 @@ maybe_fetch(AppInfo, Profile, Upgrade, Seen, State) ->                          false ->                              case fetch_app(AppInfo, AppDir, State) of                                  true -> -                                    case needs_symlinking(State, Profile) of -                                        true -> -                                            SymDir = filename:join([rebar_dir:deps_dir(State), rebar_app_info:name(AppInfo)]), -                                            symlink_dep(AppDir, SymDir), -                                            {true, AppInfo}; -                                        false -> -                                            {true, AppInfo} -                                    end; +                                    maybe_symlink_default(State, Profile, AppDir, AppInfo), +                                    {true, AppInfo};                                  Other ->                                      {Other, AppInfo}                              end; @@ -417,6 +411,7 @@ maybe_fetch(AppInfo, Profile, Upgrade, Seen, State) ->                      %% Preserve the state we created with overrides                      AppState = rebar_app_info:state(AppInfo),                      AppInfo2 = rebar_app_info:state(AppInfo1, AppState), +                    maybe_symlink_default(State, Profile, AppDir, AppInfo2),                      case sets:is_element(rebar_app_info:name(AppInfo), Seen) of                          true ->                              {false, AppInfo2}; @@ -445,6 +440,18 @@ needs_symlinking(State, Profile) ->              false      end. +maybe_symlink_default(State, Profile, AppDir, AppInfo) -> +    case needs_symlinking(State, Profile) of +        true -> +            SymDir = filename:join([rebar_dir:deps_dir(State), +                                    rebar_app_info:name(AppInfo)]), +            symlink_dep(AppDir, SymDir), +            true; +        false -> +            false +    end. + +  symlink_dep(From, To) ->      ?INFO("Linking ~s to ~s", [From, To]),      filelib:ensure_dir(To), | 
