guard-cane 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +1 -0
- data/guard-cane.gemspec +5 -3
- data/lib/guard/cane.rb +8 -9
- data/spec/guard/cane_spec.rb +33 -29
- data/spec/spec_helper.rb +20 -5
- metadata +40 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8120b44f590d45ae902ef9628d7bc79a5646cc55
|
4
|
+
data.tar.gz: 8ae3a1ca7f0a4e042346abe68f1ea9d3f11163e7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c6c16d316d8d4a279198e576220f78aedaa1a51ffc7304192919b744ed7bb28a77e36cfccd666200a8f7e279092e3bd0e148e6a2b83867463b67750f46e5159b
|
7
|
+
data.tar.gz: 0b9d2aed1e58c981392663f17985f657218e27e17c9c4f31100b2aaa0e847488b8224dfe1633364d6bfe376bf9272ddf0638dcb89b5d41a5d803cd7287659dbe
|
data/.rspec
CHANGED
data/guard-cane.gemspec
CHANGED
@@ -4,20 +4,22 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'guard-cane'
|
7
|
-
gem.version = '0.2.
|
7
|
+
gem.version = '0.2.1'
|
8
8
|
gem.authors = ["Justin Campbell"]
|
9
9
|
gem.email = ["justin@justincampbell.me"]
|
10
10
|
gem.summary = "Guard plugin for Cane"
|
11
11
|
gem.description = "Guard::Cane automatically runs Cane when files change"
|
12
12
|
gem.homepage = "https://github.com/guard/guard-cane"
|
13
|
+
gem.license = 'MIT'
|
13
14
|
|
14
15
|
gem.files = `git ls-files`.split($/)
|
15
16
|
gem.require_paths = ["lib"]
|
16
17
|
|
17
18
|
gem.add_dependency 'cane'
|
18
|
-
gem.add_dependency 'guard'
|
19
|
+
gem.add_dependency 'guard', '>= 2.10.0'
|
20
|
+
gem.add_dependency 'guard-compat', '~> 1.1'
|
19
21
|
|
20
22
|
gem.add_development_dependency 'guard-rspec'
|
21
23
|
gem.add_development_dependency 'rake'
|
22
|
-
gem.add_development_dependency 'rspec'
|
24
|
+
gem.add_development_dependency 'rspec', '~> 3.1'
|
23
25
|
end
|
data/lib/guard/cane.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
require 'guard'
|
2
|
-
require 'guard/guard'
|
1
|
+
require 'guard/compat/plugin'
|
3
2
|
|
4
3
|
module Guard
|
5
4
|
# Defines the guard, which is automatically seen by Guard
|
6
|
-
class Cane <
|
5
|
+
class Cane < Plugin
|
7
6
|
DEFAULTS = {
|
8
7
|
run_all_on_start: true
|
9
8
|
}
|
@@ -13,14 +12,14 @@ module Guard
|
|
13
12
|
|
14
13
|
attr_reader :last_result, :options
|
15
14
|
|
16
|
-
def initialize(
|
17
|
-
super
|
15
|
+
def initialize(options = {})
|
16
|
+
super options
|
18
17
|
|
19
18
|
@options = DEFAULTS.merge(options)
|
20
19
|
end
|
21
20
|
|
22
21
|
def start
|
23
|
-
UI.info "Guard::Cane is running"
|
22
|
+
Compat::UI.info "Guard::Cane is running"
|
24
23
|
|
25
24
|
run_all if options[:run_all_on_start]
|
26
25
|
end
|
@@ -37,14 +36,14 @@ module Guard
|
|
37
36
|
def cane(paths = [])
|
38
37
|
command = build_command(paths)
|
39
38
|
|
40
|
-
UI.info "Running Cane: #{command}"
|
39
|
+
Compat::UI.info "Running Cane: #{command}"
|
41
40
|
|
42
41
|
result = system command
|
43
42
|
|
44
43
|
if result
|
45
|
-
|
44
|
+
Compat::UI.notify(*SUCCESS) if last_result == false
|
46
45
|
else
|
47
|
-
|
46
|
+
Compat::UI.notify(*FAILED)
|
48
47
|
end
|
49
48
|
|
50
49
|
@last_result = result
|
data/spec/guard/cane_spec.rb
CHANGED
@@ -1,25 +1,26 @@
|
|
1
|
-
require
|
1
|
+
require "guard/compat/test/helper"
|
2
2
|
|
3
|
-
|
4
|
-
subject { guard }
|
5
|
-
let(:guard) { described_class.new(watchers, options) }
|
3
|
+
require "guard/cane"
|
6
4
|
|
5
|
+
RSpec.describe Guard::Cane do
|
7
6
|
let(:options) { {} }
|
8
7
|
let(:paths) { [] }
|
9
|
-
let(:watchers) { [] }
|
10
8
|
|
11
|
-
|
12
|
-
Guard::Notifier.stub :notify
|
9
|
+
let(:guard) { described_class.new(options) }
|
13
10
|
|
14
|
-
|
15
|
-
|
11
|
+
subject { guard }
|
12
|
+
|
13
|
+
before do
|
14
|
+
allow(Guard::Compat::UI).to receive :notify
|
15
|
+
allow(Guard::Compat::UI).to receive :info
|
16
|
+
allow(Guard::Compat::UI).to receive :error
|
16
17
|
end
|
17
18
|
|
18
19
|
describe "#start" do
|
19
20
|
subject(:start) { guard.start }
|
20
21
|
|
21
22
|
it "runs all" do
|
22
|
-
guard.
|
23
|
+
expect(guard).to receive :run_all
|
23
24
|
|
24
25
|
start
|
25
26
|
end
|
@@ -28,7 +29,7 @@ describe Guard::Cane do
|
|
28
29
|
let(:options) { { run_all_on_start: false } }
|
29
30
|
|
30
31
|
it "does not run all" do
|
31
|
-
guard.
|
32
|
+
expect(guard).to_not receive :run_all
|
32
33
|
|
33
34
|
start
|
34
35
|
end
|
@@ -39,7 +40,7 @@ describe Guard::Cane do
|
|
39
40
|
subject(:run_all) { guard.run_all }
|
40
41
|
|
41
42
|
it "runs cane with no arguments" do
|
42
|
-
guard.
|
43
|
+
expect(guard).to receive(:cane).with(no_args)
|
43
44
|
|
44
45
|
run_all
|
45
46
|
end
|
@@ -51,7 +52,7 @@ describe Guard::Cane do
|
|
51
52
|
let(:paths) { %w[a b c] }
|
52
53
|
|
53
54
|
it "runs cane with the paths" do
|
54
|
-
guard.
|
55
|
+
expect(guard).to receive(:cane).with(paths)
|
55
56
|
|
56
57
|
run_on_modifications
|
57
58
|
end
|
@@ -60,17 +61,17 @@ describe Guard::Cane do
|
|
60
61
|
let(:options) { { all_after_pass: true } }
|
61
62
|
|
62
63
|
it "does run all after pass" do
|
63
|
-
guard.
|
64
|
-
guard.
|
65
|
-
guard.
|
64
|
+
allow(guard).to receive(:cane).and_return(true)
|
65
|
+
expect(guard).to receive(:cane).with(paths)
|
66
|
+
expect(guard).to receive :run_all
|
66
67
|
|
67
68
|
run_on_modifications
|
68
69
|
end
|
69
70
|
|
70
71
|
it "does not run all if tests did not pass" do
|
71
|
-
guard.
|
72
|
-
guard.
|
73
|
-
guard.
|
72
|
+
allow(guard).to receive(:cane).and_return(false)
|
73
|
+
expect(guard).to receive(:cane).with(paths)
|
74
|
+
expect(guard).to_not receive :run_all
|
74
75
|
|
75
76
|
run_on_modifications
|
76
77
|
end
|
@@ -83,24 +84,25 @@ describe Guard::Cane do
|
|
83
84
|
let(:result) { true }
|
84
85
|
|
85
86
|
before do
|
86
|
-
guard.
|
87
|
+
allow(guard).to receive(:system).and_return result
|
87
88
|
end
|
88
89
|
|
89
|
-
it { should
|
90
|
+
it { should be true }
|
90
91
|
|
91
92
|
it "does not notify of success" do
|
92
|
-
Guard::
|
93
|
+
expect(Guard::Compat::UI).to_not receive(:notify)
|
93
94
|
|
94
|
-
cane.
|
95
|
+
expect(cane).to be true
|
95
96
|
end
|
96
97
|
|
97
98
|
context "when failed" do
|
98
99
|
let(:result) { false }
|
99
100
|
|
100
|
-
it { should
|
101
|
+
it { should be false }
|
101
102
|
|
102
103
|
it "notifies of a failure" do
|
103
|
-
Guard::
|
104
|
+
expect(Guard::Compat::UI).to receive(:notify)
|
105
|
+
.with(*described_class::FAILED)
|
104
106
|
|
105
107
|
cane
|
106
108
|
end
|
@@ -108,13 +110,15 @@ describe Guard::Cane do
|
|
108
110
|
|
109
111
|
context "when failing and then succeeding" do
|
110
112
|
it "notifies of a success" do
|
111
|
-
guard.
|
112
|
-
Guard::
|
113
|
+
allow(guard).to receive(:system).and_return false
|
114
|
+
expect(Guard::Compat::UI).to receive(:notify)
|
115
|
+
.with(*described_class::FAILED)
|
113
116
|
|
114
117
|
guard.cane(paths)
|
115
118
|
|
116
|
-
guard.
|
117
|
-
Guard::
|
119
|
+
allow(guard).to receive(:system).and_return true
|
120
|
+
expect(Guard::Compat::UI).to receive(:notify)
|
121
|
+
.with(*described_class::SUCCESS)
|
118
122
|
|
119
123
|
guard.cane(paths)
|
120
124
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,26 @@
|
|
1
1
|
ENV['RUBY_ENV'] ||= 'test'
|
2
2
|
|
3
|
-
require 'guard/cane'
|
4
|
-
|
5
3
|
RSpec.configure do |config|
|
6
|
-
config.
|
4
|
+
config.expect_with :rspec do |expectations|
|
5
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
6
|
+
end
|
7
|
+
|
8
|
+
config.mock_with :rspec do |mocks|
|
9
|
+
mocks.verify_partial_doubles = true
|
10
|
+
end
|
11
|
+
|
12
|
+
config.filter_run focus: ENV['CI'] != 'true'
|
7
13
|
config.run_all_when_everything_filtered = true
|
8
|
-
|
14
|
+
|
15
|
+
config.disable_monkey_patching!
|
16
|
+
|
17
|
+
config.warnings = true
|
18
|
+
|
19
|
+
config.default_formatter = 'doc' if config.files_to_run.one?
|
20
|
+
|
21
|
+
#config.profile_examples = 10
|
22
|
+
|
9
23
|
config.order = :random
|
10
|
-
end
|
11
24
|
|
25
|
+
Kernel.srand config.seed
|
26
|
+
end
|
metadata
CHANGED
@@ -1,96 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-cane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Justin Campbell
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-12-20 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: cane
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: guard
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
33
|
+
version: 2.10.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
40
|
+
version: 2.10.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard-compat
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.1'
|
46
55
|
- !ruby/object:Gem::Dependency
|
47
56
|
name: guard-rspec
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
58
|
requirements:
|
51
|
-
- -
|
59
|
+
- - ">="
|
52
60
|
- !ruby/object:Gem::Version
|
53
61
|
version: '0'
|
54
62
|
type: :development
|
55
63
|
prerelease: false
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
65
|
requirements:
|
59
|
-
- -
|
66
|
+
- - ">="
|
60
67
|
- !ruby/object:Gem::Version
|
61
68
|
version: '0'
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: rake
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
72
|
requirements:
|
67
|
-
- -
|
73
|
+
- - ">="
|
68
74
|
- !ruby/object:Gem::Version
|
69
75
|
version: '0'
|
70
76
|
type: :development
|
71
77
|
prerelease: false
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
79
|
requirements:
|
75
|
-
- -
|
80
|
+
- - ">="
|
76
81
|
- !ruby/object:Gem::Version
|
77
82
|
version: '0'
|
78
83
|
- !ruby/object:Gem::Dependency
|
79
84
|
name: rspec
|
80
85
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
86
|
requirements:
|
83
|
-
- -
|
87
|
+
- - "~>"
|
84
88
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
89
|
+
version: '3.1'
|
86
90
|
type: :development
|
87
91
|
prerelease: false
|
88
92
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
93
|
requirements:
|
91
|
-
- -
|
94
|
+
- - "~>"
|
92
95
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
96
|
+
version: '3.1'
|
94
97
|
description: Guard::Cane automatically runs Cane when files change
|
95
98
|
email:
|
96
99
|
- justin@justincampbell.me
|
@@ -98,9 +101,9 @@ executables: []
|
|
98
101
|
extensions: []
|
99
102
|
extra_rdoc_files: []
|
100
103
|
files:
|
101
|
-
- .gitignore
|
102
|
-
- .rspec
|
103
|
-
- .travis.yml
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
104
107
|
- Gemfile
|
105
108
|
- Guardfile
|
106
109
|
- LICENSE.txt
|
@@ -112,27 +115,27 @@ files:
|
|
112
115
|
- spec/guard/cane_spec.rb
|
113
116
|
- spec/spec_helper.rb
|
114
117
|
homepage: https://github.com/guard/guard-cane
|
115
|
-
licenses:
|
118
|
+
licenses:
|
119
|
+
- MIT
|
120
|
+
metadata: {}
|
116
121
|
post_install_message:
|
117
122
|
rdoc_options: []
|
118
123
|
require_paths:
|
119
124
|
- lib
|
120
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
126
|
requirements:
|
123
|
-
- -
|
127
|
+
- - ">="
|
124
128
|
- !ruby/object:Gem::Version
|
125
129
|
version: '0'
|
126
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
-
none: false
|
128
131
|
requirements:
|
129
|
-
- -
|
132
|
+
- - ">="
|
130
133
|
- !ruby/object:Gem::Version
|
131
134
|
version: '0'
|
132
135
|
requirements: []
|
133
136
|
rubyforge_project:
|
134
|
-
rubygems_version:
|
137
|
+
rubygems_version: 2.2.2
|
135
138
|
signing_key:
|
136
|
-
specification_version:
|
139
|
+
specification_version: 4
|
137
140
|
summary: Guard plugin for Cane
|
138
141
|
test_files: []
|