guard-erlang 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/erlang_fun ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env escript
2
+ -export([main/1]).
3
+
4
+ main([ModuleName]) ->
5
+ Module = erlang:list_to_atom(ModuleName),
6
+ try Module:module_info(exports) of
7
+ Functions ->
8
+ lists:foreach(
9
+ fun({FunctionName, ArgumentsCount}) ->
10
+ io:format("~s/~B~n", [FunctionName, ArgumentsCount])
11
+ end,
12
+ Functions
13
+ )
14
+ catch
15
+ error:undef ->
16
+ bad_module
17
+ end;
18
+
19
+ main(_) ->
20
+ bad_module.
@@ -1,3 +1,7 @@
1
1
  guard 'erlang' do
2
2
  watch(/^.+\.erl$/)
3
3
  end
4
+
5
+ guard 'eunit' do
6
+ watch(/^ebin\/.+\.beam$/)
7
+ end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module Erlang
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
data/lib/guard/erlang.rb CHANGED
@@ -14,4 +14,25 @@ module Guard
14
14
  end
15
15
  end
16
16
  end
17
+
18
+ class Eunit < Guard
19
+ def run_all
20
+ end
21
+
22
+ def run_on_change(paths)
23
+ paths.each do |x|
24
+ functions = `cd ebin && #{erlang_fun} a`.split
25
+ puts `#{eunit "a"}` if functions.include?("test/0")
26
+ end
27
+ end
28
+
29
+ private
30
+ def erlang_fun
31
+ "#{Gem.loaded_specs['guard-erlang'].full_gem_path}/bin/erlang_fun"
32
+ end
33
+
34
+ def eunit(m)
35
+ "erl -pa #{Dir.pwd}/ebin -s init stop -noshell -eval '#{m}:test()'"
36
+ end
37
+ end
17
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-erlang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
- requirement: &70316407747080 !ruby/object:Gem::Requirement
16
+ requirement: &70293787863000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,14 +21,15 @@ dependencies:
21
21
  version: 0.8.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70316407747080
25
- description: Guard::Erlang automatically compile your erlang file
24
+ version_requirements: *70293787863000
25
+ description: Guard::Erlang automatically compile your erlang file & run Module:test()
26
26
  email:
27
27
  - jackchiu.org@gmail.com
28
28
  executables: []
29
29
  extensions: []
30
30
  extra_rdoc_files: []
31
31
  files:
32
+ - bin/erlang_fun
32
33
  - lib/guard/erlang/templates/Guardfile
33
34
  - lib/guard/erlang/version.rb
34
35
  - lib/guard/erlang.rb