Permalink
Browse files

Move files to proper locations and fix rebar build

  • Loading branch information...
1 parent 17efac2 commit fa812e50beb9593c623e2a96320a596e665fc693 @alavrik committed Jul 10, 2011
View
@@ -1,9 +1,9 @@
ebin
+.eunit
*.beam
*.P
-src/erl_parse.erl
-src/erl_parse_shell.erl
+erl_parse.erl
# vim:
*.swp
View
@@ -0,0 +1,7 @@
+.PHONY: all test
+
+all:
+ ./rebar compile
+
+test:
+ ./rebar eunit
View
@@ -0,0 +1,15 @@
+% this will allow us to load the Erlson rebar plugin during this build (e.g. for
+% running EUnit)
+{lib_dirs, [".."]}.
+
+{rebar_plugins, [erlson_rebar_plugin]}.
+
+% version of the extended Erlang parser that generates Erlson at parse time
+{sub_dirs, ["shell"]}.
+
+{post_hooks, [
+ {compile, "cp shell/ebin/erl_parse.beam ebin/erl_parse_shell.beam"}
+ ]}.
+
+
+% vim:ft=erlang
File renamed without changes.
@@ -0,0 +1,6 @@
+{application, erlson_shell,
+ [{description, "Erlang Simple Object Notation (version for Erlang shell)"},
+ {vsn, git},
+ {modules, []},
+ {applications, [kernel, stdlib]},
+ {env, []}]}.
View
@@ -1,4 +1,4 @@
-ERL_SOURCES = erl_parse.erl erl_parse_shell.erl erlson_pt.erl erlson.erl
+ERL_SOURCES = erl_parse.erl erlson_pt.erl erlson.erl erlson_rebar_plugin.erl
ERL_TESTS = erlson_tests.erl
TEST = erlson_tests
@@ -17,9 +17,11 @@ all: $(ERL_SOURCES) $(ERL_OBJECTS) expand test
erlson_tests.erl: $(ERL_SOURCES)
- #cp ../test/$@ $@
- touch $@
-
+ if [ -s $@ ]; then \
+ touch $@; \
+ else \
+ ln -s ../test/$@ $@; \
+ fi
$(ERL_OBJECTS) $(ERL_TEST_OBJECTS): %.beam: %.erl
$(ERLC) $(ERLC_FLAGS) -o $(EBIN_DIR) $<
@@ -40,5 +42,8 @@ expand: erlson_tests.erl erlson_tests.P
clean:
- rm -f $(ERL_OBJECTS) erl_crash.dump erl_parse.erl erlson_tests.P # erlson_tests.erl
+ rm -f $(ERL_OBJECTS) erl_crash.dump \
+ erl_parse.erl \
+ erl_parse_shell.* \
+ erlson_tests.*
@@ -0,0 +1,37 @@
+-module(erlson_rebar_plugin).
+
+% rebar commands
+-export([
+ pre_compile/2,
+ pre_eunit/2,
+ pre_ct/2,
+ pre_doc/2,
+ pre_xref/2
+]).
+
+
+pre_compile(Config, X) ->
+ common(Config, X).
+
+pre_eunit(Config, X) ->
+ common(Config, X).
+
+pre_ct(Config, X) ->
+ common(Config, X).
+
+pre_doc(Config, X) ->
+ common(Config, X).
+
+pre_xref(Config, X) ->
+ common(Config, X).
+
+
+common(_Config, _X) ->
+ code:purge(erl_parse),
+ code:delete(erl_parse),
+ code:load_file(erl_parse),
+ rebar_log:log(debug,
+ "erlson_rebar_plugin: repointed erl_parse to: ~s~n",
+ [code:which(erl_parse)]),
+ ok.
+
File renamed without changes.

0 comments on commit fa812e5

Please sign in to comment.