Skip to content
Browse files

testing

  • Loading branch information...
1 parent aef2525 commit d1c9d3a2c2befc73c51318e9352f2df152352a75 @gregorej committed Feb 14, 2012
Showing with 11 additions and 16 deletions.
  1. +1 −1 README.md
  2. +3 −3 rebar.config
  3. +7 −12 src/rebar_scm_plugin.erl
View
2 README.md
@@ -22,7 +22,7 @@ where ```Protocol``` is one of following:
You also have to add following dependency:
```erlang
-{rebar_scm_plugin, {git, "git://github.com/gregorej/rebar_scm_plugin"}}
+{rebar_scm_plugin, "1", {git, "git://github.com/gregorej/rebar_scm_plugin"}}
```
View
6 rebar.config
@@ -20,6 +20,6 @@
{scm, {svn, "http://www.some/svn/trunk"}}.
-{deps, [
- {rebar, "2", {git, "git://github.com/basho/rebar"}}
-]}.
+%{deps, [
+% {rebar, "2", {git, "git://github.com/basho/rebar"}}
+%]}.
View
19 src/rebar_scm_plugin.erl
@@ -1,17 +1,15 @@
-module(rebar_scm_plugin).
-export([
- pre_scm/2,
scm/2
]).
--include_lib("rebar/include/rebar.hrl").
+-include_lib("rebar.hrl").
%%
% url() ::= {protocol, [Path]}
-
as_url(UrlString) ->
Sep = "://",
L = length(Sep),
@@ -28,16 +26,11 @@ as_string({Protocol, PathParts}) ->
atom_to_list(Protocol) ++ "://" ++ string:join(PathParts, "/").
-pre_scm(Config, AppFile) ->
- rebar_config:set_global(skip_deps, true),
- ok.
-
% copied from http://hyperthunk.github.com/rebar-plugin-tutorial/part-2-plugin-anatomy/index.html
is_base_dir() ->
rebar_utils:get_cwd() == rebar_config:get_global(base_dir, undefined).
-scm(Config, AppFile) ->
- ?DEBUG("Works!~nConfig: ~p~nAppFile: ~p~n", [Config, AppFile]),
+scm(Config, _AppFile) ->
case is_base_dir() of
true ->
Tag = rebar_config:get_global(tag, undefined),
@@ -65,15 +58,17 @@ scm(Config, AppFile) ->
tag({svn, UrlStr}, Tag) when is_list(UrlStr) ->
{ok, {Protocol, Path}} = as_url(UrlStr),
TargetPath = case lists:last(Path) of
+ % get rid of /trunk and append /tags/[Tag]
"trunk" -> lists:append(lists:sublist(Path, length(Path) - 1), ["tags",Tag]);
_ -> lists:append(Path, ["tags", Tag])
end,
rebar_utils:sh("svn copy " ++ UrlStr ++ " " ++ as_string({Protocol, TargetPath}), []);
tag({git, _Url}, Tag) ->
- ?Tag("Tagging with Git ~s", [Url]),
- rebar_utils:sh("git tag " ++ Tag).
+ ?INFO("Tagging with Git ~s", [Tag]),
+ rebar_utils:sh("git tag " ++ Tag);
-tag({Scm, _},Tag) ->
+tag({Scm, _}, _Tag) ->
?ERROR("Unknown scm: ~p", [Scm]).
+

0 comments on commit d1c9d3a

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