guard-rebar 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2012 Andrzej Śliwa
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # Guard::Rebar
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ notification :emacs
10
+
11
+ guard 'rebar-eunit', all_on_start: true, skip_deps: true do
12
+ watch(%r{src/.*?.erl})
13
+ watch(%r{test/.*?.erl})
14
+ end
15
+
16
+ Or initialize repo:
17
+
18
+ bundle guard init rebar
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install guard-rebar
27
+
28
+ ## Usage
29
+
30
+ TODO: Write usage instructions here
31
+
32
+ ## Contributing
33
+
34
+ 1. Fork it
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create new Pull Request
@@ -0,0 +1,6 @@
1
+ notification :emacs
2
+
3
+ guard 'rebar-eunit', all_on_start: true, skip_deps: true do
4
+ watch(%r{src/.*?.erl})
5
+ watch(%r{test/.*?.erl})
6
+ end
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ module Rebar
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,59 @@
1
+ require 'guard/guard'
2
+
3
+ module Guard
4
+ class RebarEunit < 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 eunit #{handle_skip_deps}"
17
+ UI.info "#{cmd}"
18
+ handle_output(`#{cmd}`)
19
+ end
20
+
21
+ def run_on_change(paths = [])
22
+ suites = []
23
+ paths.each do |path|
24
+ UI.info "changed: #{path}"
25
+ if suite = path.match(%r{.*?/([^.].*?)_tests?.erl$})
26
+ suites << suite[1]
27
+ elsif suite = path.match(%r{.*?/([^.].*?)?.erl$})
28
+ suites << suite[1]
29
+ end
30
+ end
31
+ cmd = "rebar eunit #{handle_skip_deps}suites=#{suites.join(",")}"
32
+ UI.info "#{cmd}"
33
+ handle_output(`#{cmd}`, suites.join(" "))
34
+ end
35
+
36
+ def handle_output(output, suite = nil)
37
+ suite = directory_name unless suite
38
+ if $? == 0
39
+ Notifier.notify(suite, title: title, image: :success)
40
+ UI.info output
41
+ else
42
+ Notifier.notify(suite, title: title, image: :failed)
43
+ UI.error output
44
+ end
45
+ end
46
+
47
+ def handle_skip_deps
48
+ options[:skip_deps] ? "skip_deps=true" : ""
49
+ end
50
+
51
+ def title
52
+ "Rebar: #{directory_name}"
53
+ end
54
+
55
+ def directory_name
56
+ "#{File.basename(Dir.pwd)}"
57
+ end
58
+ end
59
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-rebar
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Andrzej Sliwa
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: guard
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description:
31
+ email:
32
+ - andrzej.sliwa@gmail.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - lib/guard/rebar/templates/Guardfile
38
+ - lib/guard/rebar/version.rb
39
+ - lib/guard/rebar-eunit.rb
40
+ - LICENSE
41
+ - README.md
42
+ homepage: http://github.com/andrzejsliwa/guard-rebar
43
+ licenses: []
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 1.8.24
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: Guard Rebar plugin
66
+ test_files: []