guard-jasmine-headless-webkit 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -6,3 +6,4 @@ gem 'guard'
6
6
  gem 'rspec'
7
7
  gem 'mocha'
8
8
  gem 'rake', '0.8.7'
9
+ gem 'growl'
data/README.md CHANGED
@@ -14,7 +14,10 @@ home folder's `.jasmine-headless-webkit` file.
14
14
 
15
15
  ## `guard` options
16
16
 
17
- * `:all_on_start => false` to not run everything when starting, just like `guard-rspec`
17
+ * `:all_on_start => false` to not run everything when starting, just like `guard-rspec`.
18
+ * `:run_before => "<command to run>` to run a command before running specs. If the command fails, the test run stops. Useful for running Jammit before running your specs to compile templates:
19
+
20
+ `guard 'jasmine-headliness-webkit', :run_before => 'jammit -f 2>/dev/null' do`
18
21
 
19
22
  ## What's the deal with `newest_js_file`?
20
23
 
@@ -7,21 +7,35 @@ module Guard
7
7
  def initialize(watchers = [], options = {})
8
8
  super
9
9
  @options = {
10
- :all_on_start => true
10
+ :all_on_start => true,
11
+ :run_before => false
11
12
  }.merge(options)
12
13
  end
13
-
14
+
14
15
  def start
15
16
  UI.info "Guard::JasmineHeadlessWebkit is running."
16
17
  run_all if @options[:all_on_start]
17
18
  end
18
19
 
19
20
  def run_all
20
- JasmineHeadlessWebkitRunner.run
21
+ JasmineHeadlessWebkitRunner.run if run_before
21
22
  end
22
23
 
23
24
  def run_on_change(paths)
24
- run_all if JasmineHeadlessWebkitRunner.run(paths) == 0
25
+ if run_before
26
+ run_all if JasmineHeadlessWebkitRunner.run(paths) == 0
27
+ end
28
+ end
29
+
30
+ private
31
+ def run_before
32
+ if @options[:run_before]
33
+ UI.info "Guard::JasmineHeadlessWebkit running #{@options[:run_before]} first..."
34
+ system @options[:run_before]
35
+ $?.exitstatus == 0
36
+ else
37
+ true
38
+ end
25
39
  end
26
40
  end
27
41
 
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module JasmineHeadlessWebkitVersion
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -45,4 +45,30 @@ describe Guard::JasmineHeadlessWebkit do
45
45
  end
46
46
  end
47
47
  end
48
+
49
+ context 'with run_before' do
50
+ context 'with failing command' do
51
+ before do
52
+ Guard::JasmineHeadlessWebkitRunner.expects(:run).never
53
+ end
54
+
55
+ let(:options) { { :run_before => 'false' } }
56
+
57
+ it "should run the command first" do
58
+ guard.run_all
59
+ end
60
+ end
61
+
62
+ context 'with succeeding command' do
63
+ before do
64
+ Guard::JasmineHeadlessWebkitRunner.expects(:run).once
65
+ end
66
+
67
+ let(:options) { { :run_before => 'true' } }
68
+
69
+ it "should run the command first" do
70
+ guard.run_all
71
+ end
72
+ end
73
+ end
48
74
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: guard-jasmine-headless-webkit
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - John Bintz
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-26 00:00:00 -04:00
13
+ date: 2011-05-29 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -71,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- hash: -3276204944062890380
74
+ hash: -4553353874945438509
75
75
  segments:
76
76
  - 0
77
77
  version: "0"
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
- hash: -3276204944062890380
83
+ hash: -4553353874945438509
84
84
  segments:
85
85
  - 0
86
86
  version: "0"