guard-rebar 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,6 +6,20 @@ TODO: Write a gem description
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
+ gem "guard-rebar"
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install guard-rebar
18
+
19
+ ## Configuration
20
+
21
+ Add this line to your application's Guardfile:
22
+
9
23
  notification :emacs
10
24
 
11
25
  guard 'rebar-eunit', all_on_start: true, skip_deps: true do
@@ -13,17 +27,18 @@ Add this line to your application's Gemfile:
13
27
  watch(%r{test/.*?.erl})
14
28
  end
15
29
 
16
- Or initialize repo:
30
+ # or/and ...
17
31
 
18
- bundle guard init rebar
19
-
20
- And then execute:
21
-
22
- $ bundle
32
+ guard 'rebar-compile', all_on_start: true do
33
+ watch(%r{src/.*?.erl})
34
+ watch(%r{test/.*?.erl})
35
+ end
23
36
 
24
- Or install it yourself as:
37
+ # or/and ...
25
38
 
26
- $ gem install guard-rebar
39
+ guard 'rebar-deps', all_on_start: true do
40
+ watch(%r{rebar?.config})
41
+ end
27
42
 
28
43
  ## Usage
29
44
 
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module Rebar
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -0,0 +1,53 @@
1
+ require 'guard/guard'
2
+
3
+ module Guard
4
+ class RebarCompile < Guard
5
+
6
+ def initialize(watchers = [], options = {})
7
+ super
8
+ options[:skip_deps] = true if options[:skip_deps].nil?
9
+ end
10
+
11
+ def start
12
+ run_all if options[:all_on_start]
13
+ end
14
+
15
+ def run_all
16
+ cmd = "rebar compile #{handle_skip_deps}"
17
+ UI.info "#{cmd}"
18
+ handle_output(`#{cmd}`)
19
+ end
20
+
21
+ def run_on_change(paths = [])
22
+ paths.each do |path|
23
+ UI.info "changed: #{path}"
24
+ end
25
+ cmd = "rebar compile #{handle_skip_deps}"
26
+ UI.info "#{cmd}"
27
+ handle_output(`#{cmd}`)
28
+ end
29
+
30
+ def handle_output(output, suite = nil)
31
+ suite = directory_name unless suite
32
+ if $? == 0
33
+ Notifier.notify(suite, title: title, image: :success)
34
+ UI.info output
35
+ else
36
+ Notifier.notify(suite, title: title, image: :failed)
37
+ UI.error output
38
+ end
39
+ end
40
+
41
+ def handle_skip_deps
42
+ options[:skip_deps] ? "skip_deps=true" : ""
43
+ end
44
+
45
+ def title
46
+ "Rebar Compile: #{directory_name}"
47
+ end
48
+
49
+ def directory_name
50
+ "#{File.basename(Dir.pwd)}"
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,49 @@
1
+ require 'guard/guard'
2
+
3
+ module Guard
4
+ class RebarDeps < Guard
5
+
6
+ def initialize(watchers = [], options = {})
7
+ super
8
+ options[:skip_deps] = true if options[:skip_deps].nil?
9
+ end
10
+
11
+ def start
12
+ run_all if options[:all_on_start]
13
+ end
14
+
15
+ def run_all
16
+ cmd = "rebar get-deps"
17
+ UI.info "#{cmd}"
18
+ handle_output(`#{cmd}`)
19
+ end
20
+
21
+ def run_on_change(paths = [])
22
+ paths.each do |path|
23
+ UI.info "changed: #{path}"
24
+ end
25
+ cmd = "rebar update-deps"
26
+ UI.info "#{cmd}"
27
+ handle_output(`#{cmd}`)
28
+ end
29
+
30
+ def handle_output(output, suite = nil)
31
+ suite = directory_name unless suite
32
+ if $? == 0
33
+ Notifier.notify(suite, title: title, image: :success)
34
+ UI.info output
35
+ else
36
+ Notifier.notify(suite, title: title, image: :failed)
37
+ UI.error output
38
+ end
39
+ end
40
+
41
+ def title
42
+ "Rebar Deps: #{directory_name}"
43
+ end
44
+
45
+ def directory_name
46
+ "#{File.basename(Dir.pwd)}"
47
+ end
48
+ end
49
+ end
@@ -49,7 +49,7 @@ module Guard
49
49
  end
50
50
 
51
51
  def title
52
- "Rebar: #{directory_name}"
52
+ "Rebar EUnit: #{directory_name}"
53
53
  end
54
54
 
55
55
  def directory_name
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-rebar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-14 00:00:00.000000000 Z
12
+ date: 2012-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 1.5.4
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 1.5.4
30
30
  description:
31
31
  email:
32
32
  - andrzej.sliwa@gmail.com
@@ -36,6 +36,8 @@ extra_rdoc_files: []
36
36
  files:
37
37
  - lib/guard/rebar/templates/Guardfile
38
38
  - lib/guard/rebar/version.rb
39
+ - lib/guard/rebar-compile.rb
40
+ - lib/guard/rebar-deps.rb
39
41
  - lib/guard/rebar-eunit.rb
40
42
  - LICENSE
41
43
  - README.md