rake-funnel 0.9.0.pre → 0.9.1.pre
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/lib/rake/funnel/ambiguous_file_error.rb +16 -8
- data/lib/rake/funnel/execution_error.rb +19 -6
- data/lib/rake/funnel/extensions/shell.rb +2 -2
- data/lib/rake/funnel/version.rb +1 -1
- data/spec/rake/funnel/execution_error_spec.rb +49 -43
- data/spec/rake/funnel/extensions/shell_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 654127b97949b02eee869ea2a09be66f9f2a310d
|
4
|
+
data.tar.gz: 612b33cf3287735aa3a0cf5454188dae4266f299
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4551b61164ed3a434664ae5a81c975397617783407e0bcef7e937fe2822331299e79161fee40744c26833976111f3540a748bdcf7c302fd286c41c0fc164a3eb
|
7
|
+
data.tar.gz: a8ee0e0085f6f8bd9109669340ae4257919f97e906175190b977d507fd0641d141ad276b452e2a91a18b55ba0102f114be97ed03a7190e01791f79d0154d3301
|
@@ -14,18 +14,26 @@ module Rake
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def to_s
|
17
|
-
msg = []
|
18
|
-
|
19
|
-
(msg << "Search pattern used: #{@search_pattern}") if @search_pattern
|
20
|
-
unless (@candidates || []).empty?
|
21
|
-
msg << 'Candidates:'
|
22
|
-
msg << @candidates.map { |c| " - #{c}" }
|
23
|
-
end
|
24
|
-
|
17
|
+
msg = [] << inspect_description << inspect_search_pattern << inspect_candidates
|
18
|
+
msg = msg.flatten.compact
|
25
19
|
msg = [super.to_s] if msg.empty?
|
26
20
|
|
27
21
|
msg.join("\n")
|
28
22
|
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def inspect_description
|
26
|
+
[description] if description
|
27
|
+
end
|
28
|
+
|
29
|
+
def inspect_search_pattern
|
30
|
+
["Search pattern used: #{search_pattern}"] if search_pattern
|
31
|
+
end
|
32
|
+
|
33
|
+
def inspect_candidates
|
34
|
+
return if (candidates || []).empty?
|
35
|
+
['Candidates:', candidates.map { |c| " - #{c}" }]
|
36
|
+
end
|
29
37
|
end
|
30
38
|
end
|
31
39
|
end
|
@@ -13,16 +13,29 @@ module Rake
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def to_s
|
16
|
-
msg = []
|
17
|
-
|
18
|
-
(msg << 'Error executing:' << command << nil) if command
|
19
|
-
(msg << "Exit code: #{exit_code}" << nil) if exit_code
|
20
|
-
(msg << 'Command output (last 10 lines):' << output.split("\n").last(10) << nil) if output
|
21
|
-
|
16
|
+
msg = [] << inspect_description << inspect_command << inspect_exit_code << last_output
|
17
|
+
msg = msg.flatten.compact
|
22
18
|
msg = [super.to_s] if msg.empty?
|
23
19
|
|
24
20
|
msg.join("\n")
|
25
21
|
end
|
22
|
+
|
23
|
+
private
|
24
|
+
def inspect_description
|
25
|
+
[description] if description
|
26
|
+
end
|
27
|
+
|
28
|
+
def inspect_command
|
29
|
+
['Error executing:', command] if command
|
30
|
+
end
|
31
|
+
|
32
|
+
def inspect_exit_code
|
33
|
+
["Exit code: #{exit_code}"] if exit_code
|
34
|
+
end
|
35
|
+
|
36
|
+
def last_output
|
37
|
+
['Command output (last 10 lines):', output.encode('UTF-8').split("\n").last(10)] if output
|
38
|
+
end
|
26
39
|
end
|
27
40
|
end
|
28
41
|
end
|
@@ -69,14 +69,14 @@ module Rake
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def to_stdout(line)
|
72
|
-
$stdout.puts line.
|
72
|
+
$stdout.puts line.rstrip.green
|
73
73
|
:success
|
74
74
|
end
|
75
75
|
|
76
76
|
def to_stderr(line, error_lines)
|
77
77
|
return unless error_lines && line =~ error_lines
|
78
78
|
|
79
|
-
$stderr.puts line.
|
79
|
+
$stderr.puts line.rstrip.bold.red
|
80
80
|
:error
|
81
81
|
end
|
82
82
|
end
|
data/lib/rake/funnel/version.rb
CHANGED
@@ -8,60 +8,66 @@ describe Rake::Funnel::ExecutionError do
|
|
8
8
|
its(:exit_code) { should be_nil }
|
9
9
|
its(:output) { should be_nil }
|
10
10
|
its(:description) { should be_nil }
|
11
|
-
its(:to_s) { should =~ /^Error executing:\
|
12
|
-
end
|
11
|
+
its(:to_s) { should =~ /^Error executing:\ncommand/ }
|
13
12
|
|
14
|
-
|
15
|
-
|
13
|
+
context 'and exit code' do
|
14
|
+
subject { described_class.new('command', 127) }
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
16
|
+
its(:command) { should == 'command' }
|
17
|
+
its(:exit_code) { should == 127 }
|
18
|
+
its(:output) { should be_nil }
|
19
|
+
its(:description) { should be_nil }
|
20
|
+
its(:to_s) { should =~ /^Error executing:\ncommand/ }
|
21
|
+
its(:to_s) { should =~ /^Exit code: 127/ }
|
24
22
|
|
25
|
-
|
26
|
-
|
23
|
+
context 'and output' do
|
24
|
+
subject { described_class.new('command', 127, 'output') }
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
26
|
+
its(:command) { should == 'command' }
|
27
|
+
its(:exit_code) { should == 127 }
|
28
|
+
its(:output) { should == 'output' }
|
29
|
+
its(:description) { should be_nil }
|
30
|
+
its(:to_s) { should =~ /^Error executing:\ncommand/ }
|
31
|
+
its(:to_s) { should =~ /^Exit code: 127/ }
|
32
|
+
its(:to_s) { should =~ /^Command output \(last 10 lines\):\noutput/ }
|
36
33
|
|
37
|
-
|
38
|
-
|
34
|
+
context 'encoded output' do
|
35
|
+
subject { described_class.new('command', 127, 'output äöüß'.encode('CP850')) }
|
39
36
|
|
40
|
-
|
41
|
-
|
42
|
-
its(:output) { should == 'output' }
|
43
|
-
its(:description) { should == 'description' }
|
44
|
-
its(:to_s) { should =~ /^description/ }
|
45
|
-
its(:to_s) { should =~ /^Error executing:\scommand/ }
|
46
|
-
its(:to_s) { should =~ /^Exit code: 127/ }
|
47
|
-
its(:to_s) { should =~ /^Command output \(last 10 lines\):\soutput/ }
|
48
|
-
end
|
37
|
+
its(:to_s) { should =~ /^Command output \(last 10 lines\):\noutput/ }
|
38
|
+
end
|
49
39
|
|
50
|
-
|
51
|
-
|
52
|
-
|
40
|
+
context 'longer than 10 lines' do
|
41
|
+
let(:output) {
|
42
|
+
output = []
|
53
43
|
|
54
|
-
|
55
|
-
|
56
|
-
|
44
|
+
11.times.each do |i|
|
45
|
+
output << "output #{i}"
|
46
|
+
end
|
57
47
|
|
58
|
-
|
59
|
-
|
48
|
+
output.join("\n")
|
49
|
+
}
|
60
50
|
|
61
|
-
|
51
|
+
subject { described_class.new(nil, nil, output) }
|
62
52
|
|
63
|
-
|
64
|
-
|
53
|
+
it 'should display the last 10 lines of output' do
|
54
|
+
expect(subject.to_s).not_to match(/^output 0/)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'and description' do
|
59
|
+
subject { described_class.new('command', 127, 'output', 'description') }
|
60
|
+
|
61
|
+
its(:command) { should == 'command' }
|
62
|
+
its(:exit_code) { should == 127 }
|
63
|
+
its(:output) { should == 'output' }
|
64
|
+
its(:description) { should == 'description' }
|
65
|
+
its(:to_s) { should =~ /^description/ }
|
66
|
+
its(:to_s) { should =~ /^Error executing:\ncommand/ }
|
67
|
+
its(:to_s) { should =~ /^Exit code: 127/ }
|
68
|
+
its(:to_s) { should =~ /^Command output \(last 10 lines\):\noutput/ }
|
69
|
+
end
|
70
|
+
end
|
65
71
|
end
|
66
72
|
end
|
67
73
|
end
|
@@ -159,6 +159,14 @@ describe Rake::Funnel::Extensions::Shell do
|
|
159
159
|
expect($stdout).to have_received(:puts).with(/output 2/)
|
160
160
|
end
|
161
161
|
end
|
162
|
+
|
163
|
+
context 'lines with different encoding' do
|
164
|
+
let(:stdout_and_stderr) { StringIO.new('error äöüß'.encode('CP850')) }
|
165
|
+
|
166
|
+
it 'should log to stdout before error' do
|
167
|
+
expect($stderr).to have_received(:puts).with(/error/)
|
168
|
+
end
|
169
|
+
end
|
162
170
|
end
|
163
171
|
|
164
172
|
describe 'callback block' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-funnel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Groß
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|