clintegracon 0.5.2 → 0.5.3
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/.gitignore +0 -1
- data/Gemfile.lock +50 -0
- data/README.md +4 -0
- data/clintegracon.gemspec +1 -0
- data/lib/CLIntegracon/diff.rb +14 -2
- data/lib/CLIntegracon/subject.rb +2 -2
- data/lib/CLIntegracon/version.rb +1 -1
- data/spec/bacon/execution_output.txt +22 -10
- data/spec/bacon/spec_helper.rb +2 -3
- data/spec/integration/coffeemaker_help/after/execution_output.txt +0 -7
- data/spec/integration/coffeemaker_no_milk/after/CaPheSuaDa.brewed-coffee +1 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66075c5c5f568f363aeb4427edfe784b28658d73
|
4
|
+
data.tar.gz: 2eebf0522c50cedf00cc06612c8fc3fef1200ffe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21d257b2d152d77a7c3c63cdf24b10c250b358543e6ff1f0b5b0ae72426a2167f4e405dfa0086c0451f60bb231908d9a62ac7ffb005b48ae0970ac3e5959ac4a
|
7
|
+
data.tar.gz: bb71dbb097317af4f98322de319adaeb4769c51dd47ea14b23c195ce43333d002e51bf9c28591851db0444bfbba001a35745b583d99198a272674acf0b33c682
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
clintegracon (0.5.3)
|
5
|
+
colored (~> 1.2)
|
6
|
+
diffy
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
bacon (1.2.0)
|
12
|
+
claide (0.7.0)
|
13
|
+
coderay (1.1.0)
|
14
|
+
colored (1.2)
|
15
|
+
diffy (3.0.6)
|
16
|
+
inch (0.5.0)
|
17
|
+
pry
|
18
|
+
sparkr (>= 0.2.0)
|
19
|
+
term-ansicolor
|
20
|
+
yard (~> 0.8.7)
|
21
|
+
metaclass (0.0.4)
|
22
|
+
method_source (0.8.2)
|
23
|
+
mocha (1.0.0)
|
24
|
+
metaclass (~> 0.0.1)
|
25
|
+
mocha-on-bacon (0.2.2)
|
26
|
+
mocha (>= 0.13.0)
|
27
|
+
pry (0.10.1)
|
28
|
+
coderay (~> 1.1.0)
|
29
|
+
method_source (~> 0.8.1)
|
30
|
+
slop (~> 3.4)
|
31
|
+
rake (10.1.1)
|
32
|
+
slop (3.6.0)
|
33
|
+
sparkr (0.4.1)
|
34
|
+
term-ansicolor (1.3.0)
|
35
|
+
tins (~> 1.0)
|
36
|
+
tins (1.3.3)
|
37
|
+
yard (0.8.7.4)
|
38
|
+
|
39
|
+
PLATFORMS
|
40
|
+
ruby
|
41
|
+
|
42
|
+
DEPENDENCIES
|
43
|
+
bacon
|
44
|
+
bundler (~> 1.3)
|
45
|
+
claide
|
46
|
+
clintegracon!
|
47
|
+
inch
|
48
|
+
mocha (~> 1.0.0)
|
49
|
+
mocha-on-bacon
|
50
|
+
rake (~> 10.1.0)
|
data/README.md
CHANGED
@@ -3,12 +3,16 @@
|
|
3
3
|
[](http://rubygems.org/gems/clintegracon)
|
4
4
|
[](https://travis-ci.org/mrackwitz/CLIntegracon)
|
5
5
|
[](https://codeclimate.com/github/mrackwitz/CLIntegracon)
|
6
|
+
[](http://inch-ci.org/github/mrackwitz/CLIntegracon)
|
7
|
+
[](https://gemnasium.com/mrackwitz/CLIntegracon)
|
6
8
|
|
7
9
|
CLIntegracon allows you to build *Integration* specs for your *CLI*,
|
8
10
|
independent if they are based on Ruby or another technology.
|
9
11
|
It is especially useful if your command modifies the file system.
|
10
12
|
Furthermore it provides an integration for *Bacon*.
|
11
13
|
|
14
|
+
Take a look in the [documentation](http://www.rubydoc.info/github/mrackwitz/CLIntegracon/master/frames).
|
15
|
+
|
12
16
|
|
13
17
|
## Installation
|
14
18
|
|
data/clintegracon.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency "mocha", "~> 1.0.0" # Ruby 1.8.7
|
29
29
|
spec.add_development_dependency "mocha-on-bacon"
|
30
30
|
spec.add_development_dependency "claide" # Example CLI
|
31
|
+
spec.add_development_dependency "inch"
|
31
32
|
|
32
33
|
spec.add_runtime_dependency 'colored', '~> 1.2'
|
33
34
|
spec.add_runtime_dependency 'diffy'
|
data/lib/CLIntegracon/diff.rb
CHANGED
@@ -52,13 +52,22 @@ module CLIntegracon
|
|
52
52
|
@prepared_produced ||= preparator.call(produced)
|
53
53
|
end
|
54
54
|
|
55
|
+
# Check if the prepared inputs are files or need to be dumped first to
|
56
|
+
# temporary files to be compared.
|
57
|
+
#
|
58
|
+
# @return [Bool]
|
59
|
+
#
|
60
|
+
def compares_files?
|
61
|
+
prepared_expected.is_a? Pathname
|
62
|
+
end
|
63
|
+
|
55
64
|
# Check if the produced output equals the expected
|
56
65
|
#
|
57
66
|
# @return [Bool]
|
58
67
|
# whether the expected is equal to the produced
|
59
68
|
#
|
60
69
|
def is_equal?
|
61
|
-
@is_equal ||= if
|
70
|
+
@is_equal ||= if compares_files?
|
62
71
|
FileUtils.compare_file(prepared_expected, prepared_produced)
|
63
72
|
else
|
64
73
|
prepared_expected == prepared_produced
|
@@ -73,7 +82,10 @@ module CLIntegracon
|
|
73
82
|
# @return [Diffy::Diff]
|
74
83
|
#
|
75
84
|
def each(options = {}, &block)
|
76
|
-
options = {
|
85
|
+
options = {
|
86
|
+
:source => compares_files? ? 'files' : 'strings',
|
87
|
+
:context => 3
|
88
|
+
}.merge options
|
77
89
|
Diffy::Diff.new(prepared_expected.to_s, prepared_produced.to_s, options).each &block
|
78
90
|
end
|
79
91
|
|
data/lib/CLIntegracon/subject.rb
CHANGED
@@ -93,7 +93,7 @@ module CLIntegracon
|
|
93
93
|
|
94
94
|
# @!group Interaction
|
95
95
|
|
96
|
-
# Runs the executable with the given arguments
|
96
|
+
# Runs the executable with the given arguments.
|
97
97
|
#
|
98
98
|
# @note: You can check by `$?.success?` if the execution succeeded.
|
99
99
|
#
|
@@ -104,7 +104,7 @@ module CLIntegracon
|
|
104
104
|
# The arguments to pass to the executable after the default arguments.
|
105
105
|
#
|
106
106
|
# @return [String]
|
107
|
-
# The output, which is emitted while execution
|
107
|
+
# The output, which is emitted while execution.
|
108
108
|
#
|
109
109
|
def launch(head_arguments='', tail_arguments='')
|
110
110
|
vars = environment_vars.map { |key,value| "#{key}=#{value}" }.join ' '
|
data/lib/CLIntegracon/version.rb
CHANGED
@@ -4,7 +4,7 @@ CLIntegracon::Adapter::Bacon
|
|
4
4
|
without milk
|
5
5
|
- $ coffee-maker --no-milk
|
6
6
|
- BlackEye.brewed-coffee
|
7
|
-
- CaPheSuaDa.brewed-coffee
|
7
|
+
- CaPheSuaDa.brewed-coffee [FAILED]
|
8
8
|
- Coffeemakerfile.yml
|
9
9
|
- RedTux.brewed-coffee
|
10
10
|
- execution_output.txt
|
@@ -22,11 +22,23 @@ CLIntegracon::Adapter::Bacon
|
|
22
22
|
- execution_output.txt
|
23
23
|
- should not produce unexpected files
|
24
24
|
|
25
|
+
Bacon::Error: File comparison error `CaPheSuaDa.brewed-coffee` for coffeemaker_no_milk:
|
26
|
+
--- DIFF -----------------------------------------------------------------------
|
27
|
+
class CaPheSuaDa < BrewedCoffee
|
28
|
+
[31m- @origin = "Việt Nam"[0m
|
29
|
+
--- END ------------------------------------------------------------------------
|
30
|
+
|
31
|
+
spec/bacon/spec_helper.rb:44
|
32
|
+
spec/bacon/spec_helper.rb:43
|
33
|
+
spec/bacon/spec_helper.rb:41
|
34
|
+
spec/bacon/spec_helper.rb:17
|
35
|
+
spec/bacon/spec_helper.rb:15
|
36
|
+
|
25
37
|
Bacon::Error: Unexpected files for coffeemaker_no_milk:
|
26
38
|
* [32mAffogato.brewed-coffee[0m
|
27
|
-
spec/bacon/spec_helper.rb:45
|
28
39
|
spec/bacon/spec_helper.rb:44
|
29
|
-
spec/bacon/spec_helper.rb:
|
40
|
+
spec/bacon/spec_helper.rb:43
|
41
|
+
spec/bacon/spec_helper.rb:41
|
30
42
|
spec/bacon/spec_helper.rb:17
|
31
43
|
spec/bacon/spec_helper.rb:15
|
32
44
|
|
@@ -37,17 +49,17 @@ Bacon::Error: File comparison error `Affogato.brewed-coffee` for coffeemaker_swe
|
|
37
49
|
@sweetner = honey
|
38
50
|
--- END ------------------------------------------------------------------------
|
39
51
|
|
40
|
-
spec/bacon/spec_helper.rb:49
|
41
52
|
spec/bacon/spec_helper.rb:48
|
42
|
-
spec/bacon/spec_helper.rb:
|
53
|
+
spec/bacon/spec_helper.rb:47
|
54
|
+
spec/bacon/spec_helper.rb:41
|
43
55
|
spec/bacon/spec_helper.rb:17
|
44
56
|
spec/bacon/spec_helper.rb:15
|
45
57
|
|
46
58
|
Bacon::Error: Missing file for coffeemaker_sweetner_honey:
|
47
59
|
* [31mBlackEye.brewed-coffee[0m
|
48
|
-
spec/bacon/spec_helper.rb:49
|
49
60
|
spec/bacon/spec_helper.rb:48
|
50
|
-
spec/bacon/spec_helper.rb:
|
61
|
+
spec/bacon/spec_helper.rb:47
|
62
|
+
spec/bacon/spec_helper.rb:41
|
51
63
|
spec/bacon/spec_helper.rb:17
|
52
64
|
spec/bacon/spec_helper.rb:15
|
53
65
|
|
@@ -59,10 +71,10 @@ Bacon::Error: File comparison error `RedTux.brewed-coffee` for coffeemaker_sweet
|
|
59
71
|
[32m+ @sweetner = honey[0m
|
60
72
|
--- END ------------------------------------------------------------------------
|
61
73
|
|
62
|
-
spec/bacon/spec_helper.rb:49
|
63
74
|
spec/bacon/spec_helper.rb:48
|
64
|
-
spec/bacon/spec_helper.rb:
|
75
|
+
spec/bacon/spec_helper.rb:47
|
76
|
+
spec/bacon/spec_helper.rb:41
|
65
77
|
spec/bacon/spec_helper.rb:17
|
66
78
|
spec/bacon/spec_helper.rb:15
|
67
79
|
|
68
|
-
17 specifications (27 requirements),
|
80
|
+
17 specifications (27 requirements), 5 failures, 0 errors
|
data/spec/bacon/spec_helper.rb
CHANGED
@@ -27,15 +27,14 @@ describe CLIntegracon::Adapter::Bacon do
|
|
27
27
|
'--no-ansi'
|
28
28
|
]
|
29
29
|
s.replace_path ROOT.to_s, 'ROOT'
|
30
|
-
s.replace_path `bundle show claide`.rstrip, 'CLAIDE_SRC'
|
31
30
|
end
|
32
31
|
|
33
32
|
file_tree_spec_context do |c|
|
34
33
|
c.ignores '.DS_Store'
|
35
34
|
c.ignores '.gitkeep'
|
36
35
|
|
37
|
-
c.has_special_handling_for '
|
38
|
-
File.read(path)
|
36
|
+
c.has_special_handling_for 'CaPheSuaDa.brewed-coffee' do |path|
|
37
|
+
File.read(path)
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
@@ -14,10 +14,3 @@ Options:
|
|
14
14
|
--verbose Show more debugging information
|
15
15
|
--no-ansi Show output without ANSI codes
|
16
16
|
--help Show help banner of specified command
|
17
|
-
|
18
|
-
CLAIDE_SRC/lib/claide/command.rb:348:in `help!'
|
19
|
-
CLAIDE_SRC/lib/claide/command.rb:466:in `help!'
|
20
|
-
CLAIDE_SRC/lib/claide/command.rb:434:in `validate!'
|
21
|
-
ROOT/spec/fixtures/bin/coffeemaker.rb:27:in `validate!'
|
22
|
-
CLAIDE_SRC/lib/claide/command.rb:280:in `run'
|
23
|
-
ROOT/spec/fixtures/bin/coffeemaker.rb:58:in `<main>'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clintegracon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marius Rackwitz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: inch
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: colored
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +148,7 @@ files:
|
|
134
148
|
- ".gitignore"
|
135
149
|
- ".travis.yml"
|
136
150
|
- Gemfile
|
151
|
+
- Gemfile.lock
|
137
152
|
- LICENSE.txt
|
138
153
|
- README.md
|
139
154
|
- Rakefile
|
@@ -214,3 +229,4 @@ test_files:
|
|
214
229
|
- spec/unit/configuration_spec.rb
|
215
230
|
- spec/unit/formatter_spec.rb
|
216
231
|
- spec/unit/spec_helper.rb
|
232
|
+
has_rdoc:
|