prospectus 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/bin/prospectus +14 -7
- data/lib/prospectus.rb +2 -1
- data/lib/prospectus/helpers/chdir.rb +2 -2
- data/lib/prospectus/item.rb +6 -0
- data/lib/prospectus/version.rb +2 -1
- data/prospectus.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a83caa1e8c5df11f5a75a0504dd2ee30bff50b1
|
4
|
+
data.tar.gz: a8f7968847301c55278e5166c83ba2ccce6d41cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4335beb6154e75c29497c1926c32f21e12828f88710513e60d3be891c24707ef5b4199b4f1d3d3b02687cdc2fd55de0783e618c608f9d32d69b7b09efee2cfbf
|
7
|
+
data.tar.gz: 0143bab868fe7240835782fbfb8358107cde332afcd20c639584f866bbbd586dccaf439f0af75e6a2d35619011f3e32ffd57f8a31615466616ffa00839d0d5c3
|
data/README.md
CHANGED
@@ -39,6 +39,10 @@ The expected/actual blocks first define the module to be used, and then define a
|
|
39
39
|
|
40
40
|
To run the check, just run `prospectus` in the directory with the .prospectus file, or use `prospectus -d /path/to/directory`.
|
41
41
|
|
42
|
+
### Parsing output
|
43
|
+
|
44
|
+
If you're looking to parse the output with something else, consider using -j to get JSON output.
|
45
|
+
|
42
46
|
## Included Modules
|
43
47
|
|
44
48
|
The following modules are included with Prospectus.
|
data/bin/prospectus
CHANGED
@@ -3,15 +3,19 @@
|
|
3
3
|
require 'prospectus'
|
4
4
|
require 'mercenary'
|
5
5
|
|
6
|
+
def run_file(params, file = nil)
|
7
|
+
Prospectus.load_from_file({ file: file }.merge(params)).check
|
8
|
+
rescue RuntimeError
|
9
|
+
puts "Failed parsing #{Dir.pwd}/#{file}"
|
10
|
+
raise
|
11
|
+
end
|
12
|
+
|
6
13
|
def load_list(params)
|
7
|
-
return
|
14
|
+
return run_file(params) if File.exist? '.prospectus'
|
8
15
|
fail('No .prospectus/.prospectus.d found') unless Dir.exist? '.prospectus.d'
|
9
16
|
files = Dir.glob('.prospectus.d/*')
|
10
17
|
fail('No files in .prospectus.d') if files.empty?
|
11
|
-
|
12
|
-
Prospectus.load_from_file({ file: x }.merge(params)).check
|
13
|
-
end
|
14
|
-
results.flatten
|
18
|
+
files.map { |x| run_file(params, x) }.flatten
|
15
19
|
end
|
16
20
|
|
17
21
|
Mercenary.program(:prospectus) do |p|
|
@@ -23,14 +27,17 @@ Mercenary.program(:prospectus) do |p|
|
|
23
27
|
p.option :directory, '-d DIR', '--directory DIR', 'Change to directory before loading'
|
24
28
|
p.option :good_only, '-g', '--good', 'Show only items with good state'
|
25
29
|
p.option :all, '-a', '--all', 'Show all items'
|
30
|
+
p.option :json, '-j', '--json', 'Output results as json'
|
26
31
|
# rubocop:enable Metrics/LineLength
|
27
32
|
|
28
33
|
p.action do |_, options|
|
29
34
|
options[:directory] ||= '.'
|
30
35
|
Dir.chdir(options[:directory]) do
|
31
36
|
results = load_list(options)
|
32
|
-
|
33
|
-
puts
|
37
|
+
if options[:json]
|
38
|
+
puts results.to_json
|
39
|
+
else
|
40
|
+
results.each { |x| puts "#{x.name}: #{x.actual} / #{x.expected}" }
|
34
41
|
end
|
35
42
|
end
|
36
43
|
end
|
data/lib/prospectus.rb
CHANGED
data/lib/prospectus/item.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module Prospectus
|
2
4
|
##
|
3
5
|
# Define item objects that defined expected vs actual state
|
@@ -23,6 +25,10 @@ module Prospectus
|
|
23
25
|
def actual
|
24
26
|
@actual || fail("No actual state was loaded for #{name}")
|
25
27
|
end
|
28
|
+
|
29
|
+
def to_json(_ = {})
|
30
|
+
{ name: name, expected: expected, actual: actual }.to_json
|
31
|
+
end
|
26
32
|
end
|
27
33
|
|
28
34
|
##
|
data/lib/prospectus/version.rb
CHANGED
data/prospectus.gemspec
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency 'mercenary', '~> 0.3.4'
|
21
21
|
s.add_dependency 'logcabin', '~> 0.0.1'
|
22
22
|
|
23
|
-
s.add_development_dependency 'rubocop', '~> 0.
|
24
|
-
s.add_development_dependency 'rake', '~> 10.
|
23
|
+
s.add_development_dependency 'rubocop', '~> 0.36.0'
|
24
|
+
s.add_development_dependency 'rake', '~> 10.5.0'
|
25
25
|
s.add_development_dependency 'codecov', '~> 0.1.1'
|
26
26
|
s.add_development_dependency 'rspec', '~> 3.4.0'
|
27
27
|
s.add_development_dependency 'fuubar', '~> 2.0.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prospectus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Les Aker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mercenary
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.36.0
|
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
|
-
version: 0.
|
54
|
+
version: 0.36.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 10.
|
61
|
+
version: 10.5.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
|
-
version: 10.
|
68
|
+
version: 10.5.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: codecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|