summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rebar_compiler_erl.erl2
-rw-r--r--src/rebar_file_utils.erl17
-rw-r--r--src/rebar_git_resource.erl5
3 files changed, 18 insertions, 6 deletions
diff --git a/src/rebar_compiler_erl.erl b/src/rebar_compiler_erl.erl
index 0a560cd..759305c 100644
--- a/src/rebar_compiler_erl.erl
+++ b/src/rebar_compiler_erl.erl
@@ -317,7 +317,7 @@ expand_file_names(Files, Dirs) ->
true ->
[Incl];
false ->
- rebar_utils:find_files_in_dirs(Dirs, Incl, true)
+ rebar_utils:find_files_in_dirs(Dirs, [$^, Incl, $$], true)
end
end, Files).
diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl
index a51a557..0e0dfe3 100644
--- a/src/rebar_file_utils.erl
+++ b/src/rebar_file_utils.erl
@@ -189,16 +189,27 @@ cp_r([], _Dest) ->
ok;
cp_r(Sources, Dest) ->
case os:type() of
- {unix, _} ->
+ {unix, Os} ->
EscSources = [rebar_utils:escape_chars(Src) || Src <- Sources],
SourceStr = rebar_string:join(EscSources, " "),
+ % On darwin the following cp command will cp everything inside
+ % target vs target and everything inside, so we chop the last char
+ % off if it is a '/'
+ Source = case {Os == darwin, lists:last(SourceStr) == $/} of
+ {true, true} ->
+ rebar_string:trim(SourceStr, trailing, "/");
+ {true, false} ->
+ SourceStr;
+ {false, _} ->
+ SourceStr
+ end,
% ensure destination exists before copying files into it
{ok, []} = rebar_utils:sh(?FMT("mkdir -p ~ts",
[rebar_utils:escape_chars(Dest)]),
[{use_stdout, false}, abort_on_error]),
{ok, []} = rebar_utils:sh(?FMT("cp -Rp ~ts \"~ts\"",
- [SourceStr, rebar_utils:escape_double_quotes(Dest)]),
- [{use_stdout, false}, abort_on_error]),
+ [Source, rebar_utils:escape_double_quotes(Dest)]),
+ [{use_stdout, true}, abort_on_error]),
ok;
{win32, _} ->
lists:foreach(fun(Src) -> ok = cp_r_win32(Src,Dest) end, Sources),
diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl
index b2db6ca..c5031df 100644
--- a/src/rebar_git_resource.erl
+++ b/src/rebar_git_resource.erl
@@ -36,10 +36,11 @@ lock_(AppDir, {git, Url}) ->
{ok, VsnString} =
case os:type() of
{win32, _} ->
- rebar_utils:sh("git --git-dir=\"" ++ Dir ++ "/.git\" --work-tree=\"" ++ Dir ++ "\" rev-parse --verify HEAD",
+ rebar_utils:sh("git --git-dir='" ++ Dir ++ "/.git' "
+ "--work-tree='" ++ Dir ++ "' rev-parse --verify HEAD",
[{use_stdout, false}, {debug_abort_on_error, AbortMsg}]);
_ ->
- rebar_utils:sh("git --git-dir=\"" ++ Dir ++ "/.git\" rev-parse --verify HEAD",
+ rebar_utils:sh("git --git-dir='" ++ Dir ++ "/.git' rev-parse --verify HEAD",
[{use_stdout, false}, {debug_abort_on_error, AbortMsg}])
end,
Ref = rebar_string:trim(VsnString, both, "\n"),