guard-konacha 0.1.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.
Files changed (4) hide show
  1. data/LICENSE +20 -0
  2. data/Readme.md +33 -0
  3. data/lib/guard/konacha.rb +41 -0
  4. metadata +83 -0
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Alex Gibbons
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ # Guard::Bundler
2
+
3
+ Automatically run your [Konacha](https://github.com/jfirebaugh/konacha) tests through [Guard](https://github.com/guard/guard/).
4
+
5
+ ## Install
6
+
7
+ Install the gem:
8
+
9
+ $ gem install guard-konacha
10
+
11
+ Or add to your Gemfile:
12
+
13
+ gem 'guard-konacha'
14
+
15
+ ## Usage
16
+
17
+ Add guard definitions to your `Guardfile`
18
+
19
+ guard :konacha do
20
+ watch(%r{^spec/javascripts/.+_spec(\.js|\.js\.coffee)})
21
+ end
22
+
23
+ ## Configure
24
+
25
+ If your specs live outside of `spec/javascripts` then tell Konacha where to find them.
26
+
27
+ guard :konacha, :spec_dir => 'spec/front-end' do
28
+ # ...
29
+ end
30
+
31
+ ## Development
32
+
33
+ This is a work in progress and could use some help.
@@ -0,0 +1,41 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+
4
+ module Guard
5
+ class Konacha < Guard
6
+
7
+ def initialize(watchers=[], options={})
8
+ super
9
+ @spec_dir = options[:spec_dir] || 'spec/javascripts'
10
+ end
11
+
12
+ def start
13
+ run_all
14
+ end
15
+
16
+ def run_all
17
+ run_konacha
18
+ end
19
+
20
+ def run_on_changes(paths)
21
+ run_konacha(paths)
22
+ end
23
+
24
+ def run_konacha(paths=[])
25
+ files = paths.map { |p| p.to_s.sub(%r{^#{@spec_dir}/}, '').sub(/(.js\.coffee|\.js|\.coffee)/, '') }
26
+ option = files.empty? ? '' : "SPEC=#{files.join(',')}"
27
+ cmd = "bundle exec rake konacha:run #{option}"
28
+
29
+ ::Guard::UI.info "Konacha: #{cmd}"
30
+ result = `bundle exec rake konacha:run #{option}`
31
+
32
+ last_line = result.split("\n").last
33
+ examples, failures = last_line.scan(/\d/).map { |s| s.to_i }
34
+ image = failures > 0 ? :failed : :success
35
+
36
+ ::Guard::UI.info result
37
+ ::Guard::Notifier.notify(last_line, :title => 'Konacha Specs', :image => image )
38
+ end
39
+
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-konacha
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Alex Gibbons
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-15 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: '1.1'
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: '1.1'
30
+ - !ruby/object:Gem::Dependency
31
+ name: konacha
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.4'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.4'
46
+ description: Automatically run konacha tests
47
+ email:
48
+ - alex.gibbons@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - lib/guard/konacha.rb
54
+ - LICENSE
55
+ - Readme.md
56
+ homepage: https://github.com/alexgb/guard-konacha
57
+ licenses: []
58
+ post_install_message:
59
+ rdoc_options:
60
+ - --charset=UTF-8
61
+ - --main=README.md
62
+ - --exclude='lib|Gemfile'
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 1.8.24
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Guard gem for Konacha
83
+ test_files: []