prospectus 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.prospectus +21 -7
- data/bin/prospectus +1 -16
- data/lib/prospectus.rb +7 -4
- data/lib/prospectus/item.rb +1 -1
- data/lib/prospectus/loader.rb +31 -0
- data/lib/prospectus/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6a7c68d906bd417f0f089b15566e1a577b9272a
|
4
|
+
data.tar.gz: 465c39908596caefa93c39b2a3f395eb3cdbb967
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e1c5e5f7a5efbfeb296f2edda70750c599ff7a8af8c1d98b45c768f22ecab52e0411f2eae2805e1352d0d7927640dc3a6c5c8728f5f2f8e8a2ff07dc50d5aea
|
7
|
+
data.tar.gz: 57e611969ca62a66ba376116bdc1e3c40047e1e52d7f413afb425950424b146b358c26927c7c4461722b649e3c398b852891f236eea4979b2d62ddbae0d31709
|
data/.prospectus
CHANGED
@@ -1,11 +1,25 @@
|
|
1
|
+
Prospectus.extra_dep('file', 'prospectus_circleci')
|
2
|
+
|
3
|
+
my_slug = 'akerl/prospectus'
|
4
|
+
|
1
5
|
item do
|
2
|
-
|
3
|
-
static
|
4
|
-
set 'green'
|
5
|
-
end
|
6
|
+
noop
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
deps do
|
9
|
+
item do
|
10
|
+
name 'gems'
|
11
|
+
|
12
|
+
expected do
|
13
|
+
static
|
14
|
+
set 'green'
|
15
|
+
end
|
16
|
+
|
17
|
+
actual do
|
18
|
+
gemnasium
|
19
|
+
slug my_slug
|
20
|
+
end
|
21
|
+
end
|
10
22
|
end
|
23
|
+
|
24
|
+
extend ProspectusCircleci::Build.new(my_slug)
|
11
25
|
end
|
data/bin/prospectus
CHANGED
@@ -3,21 +3,6 @@
|
|
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
|
-
|
13
|
-
def load_list(params)
|
14
|
-
return run_file(params) if File.exist? '.prospectus'
|
15
|
-
raise('No .prospectus/.prospectus.d found') unless Dir.exist? '.prospectus.d'
|
16
|
-
files = Dir.glob('.prospectus.d/*')
|
17
|
-
raise('No files in .prospectus.d') if files.empty?
|
18
|
-
files.map { |x| run_file(params, x) }.flatten
|
19
|
-
end
|
20
|
-
|
21
6
|
Mercenary.program(:prospectus) do |p|
|
22
7
|
p.version Prospectus::VERSION
|
23
8
|
p.description 'Tool and DSL for checking expected vs actual state'
|
@@ -34,7 +19,7 @@ Mercenary.program(:prospectus) do |p|
|
|
34
19
|
p.action do |_, options|
|
35
20
|
options[:directory] ||= '.'
|
36
21
|
Dir.chdir(options[:directory]) do
|
37
|
-
results =
|
22
|
+
results = Prospectus.load(options)
|
38
23
|
unless options[:quiet]
|
39
24
|
if options[:json]
|
40
25
|
puts results.to_json
|
data/lib/prospectus.rb
CHANGED
@@ -5,8 +5,6 @@ require 'logcabin'
|
|
5
5
|
##
|
6
6
|
# Tool and DSL for checking expected vs actual state
|
7
7
|
module Prospectus
|
8
|
-
DEFAULT_FILE = './.prospectus'.freeze
|
9
|
-
|
10
8
|
class << self
|
11
9
|
##
|
12
10
|
# Insert a helper .new() method for creating a new Cache object
|
@@ -14,13 +12,17 @@ module Prospectus
|
|
14
12
|
self::List.new(*args)
|
15
13
|
end
|
16
14
|
|
15
|
+
def load(*args)
|
16
|
+
self::Loader.new(*args).load
|
17
|
+
end
|
18
|
+
|
17
19
|
##
|
18
20
|
# Method for loading list from DSL
|
19
21
|
def load_from_file(params = {})
|
20
|
-
file = params[:file] ||
|
22
|
+
file = params[:file] || raise('File path required for load_from_file')
|
21
23
|
list = List.new(params)
|
22
24
|
dsl = ListDSL.new(list, params)
|
23
|
-
dsl.instance_eval(File.read(file), file)
|
25
|
+
dsl.instance_eval(File.read(file), File.realpath(file, Dir.pwd))
|
24
26
|
list
|
25
27
|
end
|
26
28
|
|
@@ -51,6 +53,7 @@ module Prospectus
|
|
51
53
|
end
|
52
54
|
|
53
55
|
require 'prospectus/version'
|
56
|
+
require 'prospectus/loader'
|
54
57
|
require 'prospectus/list'
|
55
58
|
require 'prospectus/item'
|
56
59
|
require 'prospectus/state'
|
data/lib/prospectus/item.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
module Prospectus
|
2
|
+
DEFAULT_FILE = './.prospectus'.freeze
|
3
|
+
|
4
|
+
##
|
5
|
+
# Helper for loading prospectus from the current directory
|
6
|
+
class Loader
|
7
|
+
def initialize(params = {})
|
8
|
+
@options = params
|
9
|
+
@file = params[:file] || DEFAULT_FILE
|
10
|
+
@dir = @file + '.d'
|
11
|
+
end
|
12
|
+
|
13
|
+
def load
|
14
|
+
return run_file(@options, @file) if File.exist? @file
|
15
|
+
raise("No #{@file}/#{@dir} found") unless Dir.exist? @dir
|
16
|
+
files = Dir.glob(@dir + '/*')
|
17
|
+
raise('No files in ' + @dir) if files.empty?
|
18
|
+
files.map { |x| run_file(@options, x, true) }.flatten
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def run_file(params, file, suffix_file = false)
|
24
|
+
options = { file: file, suffix_file: suffix_file }.merge(params)
|
25
|
+
Prospectus.load_from_file(options).check
|
26
|
+
rescue RuntimeError
|
27
|
+
puts "Failed parsing #{Dir.pwd}/#{file}"
|
28
|
+
raise
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/prospectus/version.rb
CHANGED
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Les Aker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mercenary
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- lib/prospectus/helpers/regex.rb
|
135
135
|
- lib/prospectus/item.rb
|
136
136
|
- lib/prospectus/list.rb
|
137
|
+
- lib/prospectus/loader.rb
|
137
138
|
- lib/prospectus/modules/gemnasium.rb
|
138
139
|
- lib/prospectus/modules/git_hash.rb
|
139
140
|
- lib/prospectus/modules/git_tag.rb
|