Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use local rebar to prevent issues with deps building.

  • Loading branch information...
commit 442f562ddd3f37e4325a5b8a3b474e3a9ea2cf3b 1 parent 7f05974
@cmeiklejohn cmeiklejohn authored
View
6 src/rebar_js_concatenator_plugin.erl
@@ -53,8 +53,8 @@
%% {out_dir, "priv/assets/javascripts"},
%% {doc_root, "priv/assets/javascripts"},
%% {concatenations, [
-%% {"vendor.js", ["ember.js", "jquery.js"]},
-%% {"application.js", ["models.js", "controllers.js"]}
+%% {"vendor.js", ["ember.js", "jquery.js"], []},
+%% {"application.js", ["models.js", "controllers.js"], []}
%% ]}
%% ]}.
%%
@@ -110,7 +110,7 @@ concatenate_files(Sources) ->
%% ===================================================================
options(Config) ->
- rebar_config:get(Config, js_concatenator, []).
+ rebar_config:get_local(Config, js_concatenator, []).
option(Option, Options) ->
proplists:get_value(Option, Options, default(Option)).
View
17 src/rebar_js_handlebars_plugin.erl
@@ -40,6 +40,9 @@
%% templates: list of tuples of format {Destination, [Sources]}
%% empty list by default.
%%
+%% source_ext: file extension to truncate to derive module name
+%% ".hbs" by default
+%%
%% The default settings are the equivalent of:
%%
%% {js_handlebars, [
@@ -47,6 +50,7 @@
%% {out_dir, "priv/www/javascripts"},
%% {target, "Ember.TEMPLATES"},
%% {compiler, "Ember.Handlebars.compile"},
+%% {source_ext,".hbs"},
%% {templates, []}
%% ]}.
%%
@@ -104,7 +108,7 @@ handlebars(Name, Body, Target, Compiler) ->
%% ===================================================================
options(Config) ->
- rebar_config:get(Config, js_handlebars, []).
+ rebar_config:get_local(Config, js_handlebars, []).
option(Option, Options) ->
proplists:get_value(Option, Options, default(Option)).
@@ -113,6 +117,7 @@ default(doc_root) -> "priv/assets/javascripts";
default(out_dir) -> "priv/www/javascripts";
default(target) -> "Ember.TEMPLATES";
default(compiler) -> "Ember.Handlebars.compile";
+default(source_ext)-> ".hbs";
default(templates) -> [].
ensure_list(Object) ->
@@ -129,7 +134,7 @@ read(File) ->
list_to_binary(re:replace(binary_to_list(Binary), "\\n+", "",
[global]));
{error, Reason} ->
- rebar_log:log(error, "Reading asset ~s failed during concatenation:~n ~p~n",
+ rebar_log:log(error, "Reading asset ~s failed during compilation:~n ~p~n",
[File, Reason]),
rebar_utils:abort()
end.
@@ -144,13 +149,13 @@ build_each([]) ->
build_each([{Destination, Sources, Options} | Rest]) ->
Target = option(target, Options),
Compiler = option(compiler, Options),
- Destination1 = Destination ++ ".js",
- Contents = [handlebars(filename:basename(Source), read(Source ++ ".hbs"), Target, Compiler)
+ SourceExt = option(source_ext, Options),
+ Contents = [handlebars(filename:basename(Source, SourceExt), read(Source), Target, Compiler)
|| Source <- Sources],
Concatenated = rebar_js_concatenator_plugin:concatenate(Contents),
- case file:write_file(Destination1, Concatenated, [write]) of
+ case file:write_file(Destination, Concatenated, [write]) of
ok ->
- io:format("Compiled handlebars asset ~s~n", [Destination ++ ".js"]);
+ io:format("Compiled handlebars asset ~s~n", [Destination]);
{error, Reason} ->
rebar_log:log(error, "Handlebars compliation of ~s failed:~n ~p~n",
[Destination, Reason]),
View
2  src/rebar_js_minispade_plugin.erl
@@ -99,7 +99,7 @@ minispade(Module, Contents) ->
%% ===================================================================
options(Config) ->
- rebar_config:get(Config, js_minispade, []).
+ rebar_config:get_local(Config, js_minispade, []).
option(Option, Options) ->
proplists:get_value(Option, Options, default(Option)).
View
2  src/rebar_js_stylus_plugin.erl
@@ -100,7 +100,7 @@ clean(Config, _AppFile) ->
%% ===================================================================
options(Config) ->
- rebar_config:get(Config, js_stylus, []).
+ rebar_config:get_local(Config, js_stylus, []).
option(Option, Options) ->
proplists:get_value(Option, Options, default(Option)).
View
2  src/rebar_js_uglifier_plugin.erl
@@ -130,7 +130,7 @@ compress(Source, Destination, Options) ->
%% ===================================================================
options(Config) ->
- rebar_config:get(Config, js_uglifier, []).
+ rebar_config:get_local(Config, js_uglifier, []).
option(Option, Options) ->
proplists:get_value(Option, Options, default(Option)).

0 comments on commit 442f562

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