guard-depend 0.0.1 → 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.
- checksums.yaml +4 -4
- data/guard-depend.gemspec +1 -1
- data/lib/guard/depend.rb +13 -39
- data/lib/guard/depend/detect.rb +52 -0
- data/lib/guard/depend/runner.rb +2 -0
- data/lib/guard/depend/version.rb +2 -2
- data/spec/guard/depend/detect_spec.rb +188 -0
- data/spec/guard/depend/runner_spec.rb +87 -0
- data/spec/guard/depend_spec.rb +99 -0
- metadata +27 -21
- data/lib/guard/depend/options.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00df09e4254c38c259d76557dbd1f65970974f79
|
4
|
+
data.tar.gz: 8e7ba194f05a6fc527f0e533ff7a2e1c2033b76d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 904eeeb984854f8773af7e76b2b99b2d90ee498e88eed335769de5d13465dd8bc525f54f4c45a26557385e758502a7d562e0b7fc6a666ca3cf9f37b5ab6e70fe
|
7
|
+
data.tar.gz: 3f8f1782b9540837b47a7bfe6d8a60e088dbd620b83aede903cb94561ac5ba2b7d3ee2c56f7b5f38a61b4aba6b0f583ab66ec891fd239d59d7477014350bd3ad
|
data/guard-depend.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'guard/depend/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'guard-depend'
|
8
|
-
s.version = Guard::
|
8
|
+
s.version = Guard::DependVersion::VERSION
|
9
9
|
s.platform = Gem::Platform::RUBY
|
10
10
|
s.authors = ['Alexander Groß']
|
11
11
|
s.email = ['agross@therightstuff.de']
|
data/lib/guard/depend.rb
CHANGED
@@ -3,17 +3,26 @@ require 'guard/plugin'
|
|
3
3
|
|
4
4
|
module Guard
|
5
5
|
class Depend < Plugin
|
6
|
-
require 'guard/depend/
|
6
|
+
require 'guard/depend/detect'
|
7
7
|
require 'guard/depend/runner'
|
8
8
|
|
9
|
+
DEFAULTS = {
|
10
|
+
run_on_start: false,
|
11
|
+
output_paths: [],
|
12
|
+
cmd: nil
|
13
|
+
}
|
14
|
+
|
15
|
+
attr_reader :options, :runner, :detect
|
16
|
+
|
9
17
|
def initialize(options = {})
|
10
18
|
super
|
11
|
-
@options =
|
19
|
+
@options = DEFAULTS.merge(options)
|
12
20
|
@runner = Runner.new
|
21
|
+
@detect = Detect.new(@options[:output_paths])
|
13
22
|
end
|
14
23
|
|
15
24
|
def start
|
16
|
-
UI.info
|
25
|
+
UI.info "#{self.class} is running"
|
17
26
|
run_all if @options[:run_on_start]
|
18
27
|
end
|
19
28
|
|
@@ -33,42 +42,7 @@ module Guard
|
|
33
42
|
|
34
43
|
private
|
35
44
|
def run_if_outdated(paths = [])
|
36
|
-
|
37
|
-
|
38
|
-
outdated = out_of_date?(paths, @options[:output_paths])
|
39
|
-
unless outdated
|
40
|
-
UI.debug("Output is not outdated with regard to #{paths}")
|
41
|
-
return
|
42
|
-
end
|
43
|
-
|
44
|
-
@runner.run(@options[:cmd])
|
45
|
-
end
|
46
|
-
|
47
|
-
def out_of_date?(input, output)
|
48
|
-
output = output.call if output.respond_to?(:call)
|
49
|
-
|
50
|
-
return true if input.nil? || input.empty? || output.nil? || output.empty?
|
51
|
-
|
52
|
-
input = input.max_by {|f| input_mtime(f) }
|
53
|
-
output = output.min_by {|f| output_mtime(f) }
|
54
|
-
|
55
|
-
input_time = input_mtime(input)
|
56
|
-
output_time = output_mtime(output)
|
57
|
-
|
58
|
-
UI.debug("Newest input file: #{input_time} #{input}")
|
59
|
-
UI.debug("Oldest output file: #{output_time} #{output}")
|
60
|
-
|
61
|
-
return input_time > output_time
|
62
|
-
end
|
63
|
-
|
64
|
-
def input_mtime(file)
|
65
|
-
return Time.new(9999, 12, 31) unless File.readable?(file)
|
66
|
-
File.mtime(file)
|
67
|
-
end
|
68
|
-
|
69
|
-
def output_mtime(file)
|
70
|
-
return Time.new(0, 1, 1) unless File.readable?(file)
|
71
|
-
File.mtime(file)
|
45
|
+
@runner.run(@options[:cmd]) if detect.out_of_date?(paths)
|
72
46
|
end
|
73
47
|
end
|
74
48
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Guard
|
2
|
+
class Depend
|
3
|
+
class Detect
|
4
|
+
attr_reader :output_paths
|
5
|
+
|
6
|
+
def initialize(output_paths = nil)
|
7
|
+
@output_paths = output_paths
|
8
|
+
end
|
9
|
+
|
10
|
+
def out_of_date?(paths = [])
|
11
|
+
paths = paths || []
|
12
|
+
return false if paths.empty?
|
13
|
+
|
14
|
+
outdated = check(paths, output)
|
15
|
+
UI.debug("#{output.join(', ')} is not outdated with regard to #{paths.join(', ')}") unless outdated
|
16
|
+
|
17
|
+
outdated
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def output
|
22
|
+
paths = output_paths
|
23
|
+
paths = output_paths.call if output_paths.respond_to?(:call)
|
24
|
+
|
25
|
+
[paths].flatten.reject(&:nil?)
|
26
|
+
end
|
27
|
+
|
28
|
+
def check(input, output)
|
29
|
+
input = input.max_by { |f| input_mtime(f) }
|
30
|
+
output = output.min_by { |f| output_mtime(f) }
|
31
|
+
|
32
|
+
input_mtime = input_mtime(input)
|
33
|
+
output_mtime = output_mtime(output)
|
34
|
+
|
35
|
+
UI.debug("Newest input file: #{input_mtime} #{input}")
|
36
|
+
UI.debug("Oldest output file: #{output_mtime} #{output}")
|
37
|
+
|
38
|
+
return input_mtime > output_mtime
|
39
|
+
end
|
40
|
+
|
41
|
+
def input_mtime(file)
|
42
|
+
return Time.new(9999, 12, 31) unless File.readable?(file)
|
43
|
+
File.mtime(file)
|
44
|
+
end
|
45
|
+
|
46
|
+
def output_mtime(file)
|
47
|
+
return Time.new(0, 1, 1) unless File.readable?(file)
|
48
|
+
File.mtime(file)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/guard/depend/runner.rb
CHANGED
data/lib/guard/depend/version.rb
CHANGED
@@ -0,0 +1,188 @@
|
|
1
|
+
require 'guard'
|
2
|
+
require 'guard/depend'
|
3
|
+
|
4
|
+
describe Guard::Depend::Detect do
|
5
|
+
before {
|
6
|
+
Guard::UI.stub(:info)
|
7
|
+
Guard::UI.stub(:debug)
|
8
|
+
}
|
9
|
+
|
10
|
+
describe 'defaults' do
|
11
|
+
its(:output_paths) { should be_nil }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'overriding defaults' do
|
15
|
+
subject { described_class.new(1) }
|
16
|
+
|
17
|
+
its(:output_paths) { should == 1 }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'nil changed paths' do
|
21
|
+
it 'should not be out of date' do
|
22
|
+
subject.out_of_date?(nil).should == false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'omitted changed paths' do
|
27
|
+
it 'should not be out of date' do
|
28
|
+
subject.out_of_date?.should == false
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'no changed paths' do
|
33
|
+
it 'should not be out of date' do
|
34
|
+
subject.out_of_date?([]).should == false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
shared_examples :reports_files do
|
39
|
+
it 'should report newest input' do
|
40
|
+
expect(Guard::UI).to have_received(:debug).with(/^Newest input file/)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should report oldest output' do
|
44
|
+
expect(Guard::UI).to have_received(:debug).with(/^Oldest output file/)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
shared_examples :outdated do
|
49
|
+
it 'should be out of date' do
|
50
|
+
@outdated.should == true
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should not report non-outdatedness' do
|
54
|
+
expect(Guard::UI).to_not have_received(:debug).with(/is not outdated with regard to/)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
shared_examples :not_outdated do
|
59
|
+
it 'should not be out of date' do
|
60
|
+
@outdated.should == false
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should report non-outdatedness' do
|
64
|
+
expect(Guard::UI).to have_received(:debug).with('output is not outdated with regard to input')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context '#out_of_date?' do
|
69
|
+
describe 'single input and output' do
|
70
|
+
let(:input_mtime) {}
|
71
|
+
let(:output_mtime) {}
|
72
|
+
|
73
|
+
before {
|
74
|
+
File.stub(:readable?).and_return(false)
|
75
|
+
|
76
|
+
if input_mtime
|
77
|
+
File.stub(:readable?).with('input').and_return(true)
|
78
|
+
File.stub(:mtime).with('input').and_return(input_mtime)
|
79
|
+
end
|
80
|
+
|
81
|
+
if output_mtime
|
82
|
+
File.stub(:readable?).with('output').and_return(true)
|
83
|
+
File.stub(:mtime).with('output').and_return(output_mtime)
|
84
|
+
end
|
85
|
+
}
|
86
|
+
|
87
|
+
subject { described_class.new('output') }
|
88
|
+
|
89
|
+
before { @outdated = subject.out_of_date?(%w(input)) }
|
90
|
+
|
91
|
+
context 'output was deleted' do
|
92
|
+
let(:input_mtime) { Time.now }
|
93
|
+
|
94
|
+
it_behaves_like :reports_files
|
95
|
+
it_behaves_like :outdated
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'input was deleted' do
|
99
|
+
let(:output_mtime) { Time.now }
|
100
|
+
|
101
|
+
it_behaves_like :reports_files
|
102
|
+
it_behaves_like :outdated
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'input is newer than output' do
|
106
|
+
let(:input_mtime) { Time.at(1) }
|
107
|
+
let(:output_mtime) { Time.at(0) }
|
108
|
+
|
109
|
+
it_behaves_like :reports_files
|
110
|
+
it_behaves_like :outdated
|
111
|
+
end
|
112
|
+
|
113
|
+
context 'input is older than output' do
|
114
|
+
let(:input_mtime) { Time.at(0) }
|
115
|
+
let(:output_mtime) { Time.at(1) }
|
116
|
+
|
117
|
+
it_behaves_like :reports_files
|
118
|
+
it_behaves_like :not_outdated
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'input has the same mtime as output' do
|
122
|
+
let(:input_mtime) { Time.at(0) }
|
123
|
+
let(:output_mtime) { Time.at(0) }
|
124
|
+
|
125
|
+
it_behaves_like :reports_files
|
126
|
+
it_behaves_like :not_outdated
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'output is callable' do
|
130
|
+
let(:output_mtime) { Time.at(0) }
|
131
|
+
|
132
|
+
subject { described_class.new(Proc.new { 'output' }) }
|
133
|
+
|
134
|
+
it 'should call' do
|
135
|
+
expect(File).to have_received(:mtime).with('output').at_least(:once)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context 'output is nil' do
|
140
|
+
subject { described_class.new(nil) }
|
141
|
+
|
142
|
+
it_behaves_like :outdated
|
143
|
+
end
|
144
|
+
|
145
|
+
context 'output is empty' do
|
146
|
+
subject { described_class.new([]) }
|
147
|
+
|
148
|
+
it_behaves_like :outdated
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe 'multiple inputs' do
|
153
|
+
before {
|
154
|
+
File.stub(:readable?).and_return(true)
|
155
|
+
|
156
|
+
File.stub(:mtime).with('input old').and_return(Time.at(0))
|
157
|
+
File.stub(:mtime).with('input new').and_return(Time.at(1))
|
158
|
+
File.stub(:mtime).with('output').and_return(Time.at(0))
|
159
|
+
}
|
160
|
+
|
161
|
+
subject { described_class.new(['output']) }
|
162
|
+
|
163
|
+
before { @outdated = subject.out_of_date?(['input old', 'input new']) }
|
164
|
+
|
165
|
+
it 'should use newest input' do
|
166
|
+
expect(Guard::UI).to have_received(:debug).with(/^Newest input.+input new$/)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
describe 'multiple outputs' do
|
171
|
+
before {
|
172
|
+
File.stub(:readable?).and_return(true)
|
173
|
+
|
174
|
+
File.stub(:mtime).with('input').and_return(Time.at(0))
|
175
|
+
File.stub(:mtime).with('output old').and_return(Time.at(0))
|
176
|
+
File.stub(:mtime).with('output new').and_return(Time.at(1))
|
177
|
+
}
|
178
|
+
|
179
|
+
subject { described_class.new(['output new', 'output old']) }
|
180
|
+
|
181
|
+
before { @outdated = subject.out_of_date?(%w(input)) }
|
182
|
+
|
183
|
+
it 'should use oldest output' do
|
184
|
+
expect(Guard::UI).to have_received(:debug).with(/^Oldest output.+output old$/)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'guard'
|
2
|
+
require 'guard/depend'
|
3
|
+
|
4
|
+
describe Guard::Depend::Runner do
|
5
|
+
before {
|
6
|
+
Guard::UI.stub(:info)
|
7
|
+
Guard::UI.stub(:error)
|
8
|
+
Guard::UI.stub(:debug)
|
9
|
+
|
10
|
+
Guard::Notifier.stub(:notify)
|
11
|
+
}
|
12
|
+
|
13
|
+
let(:error) { nil }
|
14
|
+
|
15
|
+
before {
|
16
|
+
next subject.stub(:sh).and_raise(error) if error
|
17
|
+
subject.stub(:sh)
|
18
|
+
}
|
19
|
+
|
20
|
+
describe 'command execution' do
|
21
|
+
context 'no command' do
|
22
|
+
before { subject.run(nil) }
|
23
|
+
|
24
|
+
it 'should not run' do
|
25
|
+
expect(subject).to_not have_received(:sh)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'command without parameters' do
|
30
|
+
before { subject.run('command') }
|
31
|
+
|
32
|
+
it 'should run using #sh' do
|
33
|
+
expect(subject).to have_received(:sh).with('command')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'command with parameters' do
|
38
|
+
before { subject.run(%w(command arg)) }
|
39
|
+
|
40
|
+
it 'should run using #sh' do
|
41
|
+
expect(subject).to have_received(:sh).with('command', 'arg')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'reporting' do
|
47
|
+
before { subject.run(%w(command arg)) }
|
48
|
+
|
49
|
+
context 'success' do
|
50
|
+
it 'should report command running info' do
|
51
|
+
expect(Guard::UI).to have_received(:info).with("Running 'command arg'")
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should notify running' do
|
55
|
+
expect(Guard::Notifier).to have_received(:notify).with('command arg', title: 'Running', image: :success)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should notify success' do
|
59
|
+
expect(Guard::Notifier).to have_received(:notify).with('command arg succeeded', title: 'Success', image: :success)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'failure' do
|
64
|
+
let(:error) { StandardError.new('something bad happened') }
|
65
|
+
|
66
|
+
it 'should report command running info' do
|
67
|
+
expect(Guard::UI).to have_received(:info).with("Running 'command arg'")
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should report command failure error' do
|
71
|
+
expect(Guard::UI).to have_received(:error).with("Failed to run 'command arg'. Exception was: StandardError: something bad happened")
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should report command failure backtrace' do
|
75
|
+
expect(Guard::UI).to have_received(:debug)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should notify running' do
|
79
|
+
expect(Guard::Notifier).to have_received(:notify).with('command arg', title: 'Running', image: :success)
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'should notify failure' do
|
83
|
+
expect(Guard::Notifier).to have_received(:notify).with('command arg failed with something bad happened', title: 'Failed', image: :failed)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'guard'
|
2
|
+
require 'guard/depend'
|
3
|
+
|
4
|
+
describe Guard::Depend do
|
5
|
+
let(:command) {}
|
6
|
+
let(:output_paths) { [] }
|
7
|
+
let(:run_on_start) { false }
|
8
|
+
|
9
|
+
subject { described_class.new(cmd: command, output_paths: output_paths, run_on_start: run_on_start) }
|
10
|
+
|
11
|
+
before { subject.runner.stub(:run) }
|
12
|
+
|
13
|
+
before { Guard::UI.stub(:info) }
|
14
|
+
|
15
|
+
describe 'defaults' do
|
16
|
+
subject { described_class.new }
|
17
|
+
|
18
|
+
its(:options) { should include(cmd: nil) }
|
19
|
+
its(:options) { should include(output_paths: []) }
|
20
|
+
its(:options) { should include(run_on_start: false) }
|
21
|
+
its(:runner) { should be_an_instance_of(Guard::Depend::Runner) }
|
22
|
+
its(:detect) { should be_an_instance_of(Guard::Depend::Detect) }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'overriding defaults' do
|
26
|
+
let(:command) { 'command' }
|
27
|
+
let(:output_paths) { '1' }
|
28
|
+
let(:run_on_start) { true }
|
29
|
+
|
30
|
+
its(:options) { should include(cmd: 'command') }
|
31
|
+
its(:options) { should include(output_paths: '1') }
|
32
|
+
its(:options) { should include(run_on_start: true) }
|
33
|
+
its(:runner) { should be_an_instance_of(Guard::Depend::Runner) }
|
34
|
+
its(:detect) { should be_an_instance_of(Guard::Depend::Detect) }
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#start' do
|
38
|
+
before { subject.stub(:run_all) }
|
39
|
+
before { subject.start }
|
40
|
+
|
41
|
+
it 'should write info' do
|
42
|
+
expect(Guard::UI).to have_received(:info).with("#{described_class} is running")
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'run_on_start enabled' do
|
46
|
+
let(:run_on_start) { true }
|
47
|
+
|
48
|
+
it 'should run' do
|
49
|
+
expect(subject).to have_received(:run_all)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'run_on_start disabled' do
|
54
|
+
let(:run_on_start) { false }
|
55
|
+
|
56
|
+
it 'should not run' do
|
57
|
+
expect(subject).to_not have_received(:run_all)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#run_all' do
|
63
|
+
let(:command) { 'command' }
|
64
|
+
|
65
|
+
before { subject.runner.stub(:run) }
|
66
|
+
|
67
|
+
before { subject.run_all }
|
68
|
+
|
69
|
+
it 'should run command' do
|
70
|
+
expect(subject.runner).to have_received(:run).with('command')
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe '#run_on_changes' do
|
75
|
+
let(:command) { 'command' }
|
76
|
+
|
77
|
+
context 'outdated' do
|
78
|
+
before {
|
79
|
+
subject.detect.stub(:out_of_date?).and_return(true)
|
80
|
+
subject.run_on_changes
|
81
|
+
}
|
82
|
+
|
83
|
+
it 'should run command' do
|
84
|
+
expect(subject.runner).to have_received(:run).with('command')
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context 'not outdated' do
|
89
|
+
before {
|
90
|
+
subject.detect.stub(:out_of_date?).and_return(false)
|
91
|
+
subject.run_on_changes
|
92
|
+
}
|
93
|
+
|
94
|
+
it 'should not run command' do
|
95
|
+
expect(subject.runner).to_not have_received(:run)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-depend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Groß
|
@@ -14,112 +14,112 @@ dependencies:
|
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: guard
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.5'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.5'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard-bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: guard-rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: ruby_gntp
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: wdm
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
description: Run commands only if build output is not up to date.
|
@@ -129,7 +129,7 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
-
-
|
132
|
+
- .gitignore
|
133
133
|
- Gemfile
|
134
134
|
- Guardfile
|
135
135
|
- LICENSE.txt
|
@@ -137,10 +137,13 @@ files:
|
|
137
137
|
- Rakefile
|
138
138
|
- guard-depend.gemspec
|
139
139
|
- lib/guard/depend.rb
|
140
|
-
- lib/guard/depend/
|
140
|
+
- lib/guard/depend/detect.rb
|
141
141
|
- lib/guard/depend/runner.rb
|
142
142
|
- lib/guard/depend/templates/Guardfile
|
143
143
|
- lib/guard/depend/version.rb
|
144
|
+
- spec/guard/depend/detect_spec.rb
|
145
|
+
- spec/guard/depend/runner_spec.rb
|
146
|
+
- spec/guard/depend_spec.rb
|
144
147
|
- spec/spec_helper.rb
|
145
148
|
homepage: http://grossweber.com
|
146
149
|
licenses:
|
@@ -152,12 +155,12 @@ require_paths:
|
|
152
155
|
- lib
|
153
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
154
157
|
requirements:
|
155
|
-
- -
|
158
|
+
- - '>='
|
156
159
|
- !ruby/object:Gem::Version
|
157
160
|
version: '0'
|
158
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
162
|
requirements:
|
160
|
-
- -
|
163
|
+
- - '>='
|
161
164
|
- !ruby/object:Gem::Version
|
162
165
|
version: '0'
|
163
166
|
requirements: []
|
@@ -169,4 +172,7 @@ summary: guard-depend is useful for projects that produce build output like bina
|
|
169
172
|
guard-depend will only run the command you sify if the build output does not exists
|
170
173
|
or is not up to date with regard to the watched files.
|
171
174
|
test_files:
|
175
|
+
- spec/guard/depend/detect_spec.rb
|
176
|
+
- spec/guard/depend/runner_spec.rb
|
177
|
+
- spec/guard/depend_spec.rb
|
172
178
|
- spec/spec_helper.rb
|
data/lib/guard/depend/options.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
module Guard
|
2
|
-
class Depend
|
3
|
-
module Options
|
4
|
-
DEFAULTS = {
|
5
|
-
run_on_start: false,
|
6
|
-
output_paths: [],
|
7
|
-
cmd: nil
|
8
|
-
}
|
9
|
-
|
10
|
-
class << self
|
11
|
-
def with_defaults(options = {})
|
12
|
-
_deep_merge(DEFAULTS, options)
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
def _deep_merge(hash1, hash2)
|
17
|
-
hash1.merge(hash2) do |key, oldval, newval|
|
18
|
-
if oldval.instance_of?(Hash) && newval.instance_of?(Hash)
|
19
|
-
_deep_merge(oldval, newval)
|
20
|
-
else
|
21
|
-
newval
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|