viaduct-archfile 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/vdt-archfile-check +1 -1
- data/lib/viaduct/archfile.rb +30 -30
- data/lib/viaduct/archfile_remote_backend.rb +5 -5
- 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: 2868a73bceef45509254e09b8ae0fa2837f1b6aa
|
4
|
+
data.tar.gz: 5a6801fe28a8acb3bd9fe7499583565f93feb865
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23ef597b0040900d8a7c8a92d043ee74738884aa3bd83ac6a466ff9ce05c0a58ef68d80b846e7dc30a909388969d163c3700c30cd2c6174a2137ebd522ccd4be
|
7
|
+
data.tar.gz: 8dc38d2eaf92518f1e65847bccf55d7e2d9121b61b459f52c75d8f1da6a3fd218effb9fbf59ce20b8f0477c96589da50c771213abacc5d126473e9cd38a00314
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ what it looks like would be to refer to our examples.
|
|
17
17
|
|
18
18
|
## How can I test the validity of an Archfile?
|
19
19
|
|
20
|
-
To test that your Archfile is appropriate, you can install this library and follow the instructions
|
20
|
+
To test that your Archfile is appropriate, you can install this library and follow the instructions
|
21
21
|
below. Our backend systems also use this library to validate Archfiles so if it passes here, it'll
|
22
22
|
pass when you create your application.
|
23
23
|
|
data/bin/vdt-archfile-check
CHANGED
@@ -10,7 +10,7 @@ begin
|
|
10
10
|
if errors.empty?
|
11
11
|
puts
|
12
12
|
puts " \e[32mCongratulations. That Archfile looks excellent and should work well!\e[0m"
|
13
|
-
puts
|
13
|
+
puts
|
14
14
|
puts " Just head over to \e[35mhttps://my.viaduct.io\e[0m to create your new application."
|
15
15
|
puts " Don't forget to add your Archfile to your repository so we can find it."
|
16
16
|
puts
|
data/lib/viaduct/archfile.rb
CHANGED
@@ -3,9 +3,9 @@ require 'viaduct/archfile_remote_backend'
|
|
3
3
|
|
4
4
|
module Viaduct
|
5
5
|
class Archfile
|
6
|
-
|
6
|
+
|
7
7
|
PATH_REGEX = /\A[a-z0-9\_\-\/\.]+\z/
|
8
|
-
|
8
|
+
|
9
9
|
#
|
10
10
|
# Create a new Archfile object from raw yaml
|
11
11
|
#
|
@@ -18,9 +18,9 @@ module Viaduct
|
|
18
18
|
# Return the spec document
|
19
19
|
#
|
20
20
|
def spec
|
21
|
-
@spec ||= SafeYAML.load(@yaml)
|
21
|
+
@spec ||= @yaml.is_a?(String) ? SafeYAML.load(@yaml) : @yaml
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
#
|
25
25
|
# Is the archfile valid?
|
26
26
|
#
|
@@ -34,7 +34,7 @@ module Viaduct
|
|
34
34
|
def errors
|
35
35
|
@errors ||= []
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
#
|
39
39
|
# Store the current namespace we're working in
|
40
40
|
#
|
@@ -42,47 +42,47 @@ module Viaduct
|
|
42
42
|
@current_hash = hash
|
43
43
|
@current_namespace = ns
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
#
|
47
47
|
# Return the current namespace
|
48
48
|
#
|
49
49
|
def current_namespace
|
50
50
|
@current_namespace ||= []
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
#
|
54
54
|
# Return the current hash
|
55
55
|
#
|
56
56
|
def current_hash
|
57
57
|
@current_hash ||= spec
|
58
58
|
end
|
59
|
-
|
60
|
-
#
|
59
|
+
|
60
|
+
#
|
61
61
|
# Add an error
|
62
62
|
#
|
63
63
|
def add_error(key, message)
|
64
64
|
errors << [key.nil? ? nil : "#{current_namespace.join('.')}.#{key}".gsub(/\A\./, ''), message]
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
#
|
68
68
|
# Return remote properties for this archfile
|
69
69
|
#
|
70
70
|
def remote_properties
|
71
71
|
@remote_properties ||= @remote_backend.properties
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
#
|
75
75
|
# Validate that the object is valid, returning an array of errors
|
76
76
|
# or an empty array if there are no errors.
|
77
77
|
#
|
78
78
|
def validate
|
79
79
|
@errors = []
|
80
|
-
|
80
|
+
|
81
81
|
#
|
82
82
|
# Ensure we have a stack
|
83
83
|
#
|
84
84
|
ensure_inclusion remote_properties['platforms'], 'platform'
|
85
|
-
|
85
|
+
|
86
86
|
#
|
87
87
|
# Check settings
|
88
88
|
#
|
@@ -92,14 +92,14 @@ module Viaduct
|
|
92
92
|
ensure_boolean('serve_static_files') if spec['settings'].keys.include?('serve_static_files')
|
93
93
|
ensure_matches(/\A[a-z0-9\_\-\/]+\z/, 'document_root') if spec['settings'].keys.include?('document_root')
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
#
|
97
97
|
# Check that we have some processes to begin with
|
98
98
|
#
|
99
99
|
unless spec['processes'].is_a?(Array) && spec['processes'].length > 0
|
100
100
|
add_error nil, "You must have at least one process"
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
#
|
104
104
|
# Check processes
|
105
105
|
#
|
@@ -119,7 +119,7 @@ module Viaduct
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
123
|
#
|
124
124
|
# Check shared databases
|
125
125
|
#
|
@@ -130,7 +130,7 @@ module Viaduct
|
|
130
130
|
ensure_string('label')
|
131
131
|
end
|
132
132
|
end
|
133
|
-
|
133
|
+
|
134
134
|
#
|
135
135
|
# Check Environment Variables
|
136
136
|
#
|
@@ -140,7 +140,7 @@ module Viaduct
|
|
140
140
|
ensure_string('key', 'value')
|
141
141
|
end
|
142
142
|
end
|
143
|
-
|
143
|
+
|
144
144
|
#
|
145
145
|
# Check persistent directories
|
146
146
|
#
|
@@ -150,7 +150,7 @@ module Viaduct
|
|
150
150
|
ensure_matches(PATH_REGEX, 'path')
|
151
151
|
end
|
152
152
|
end
|
153
|
-
|
153
|
+
|
154
154
|
#
|
155
155
|
# Check commands
|
156
156
|
#
|
@@ -162,7 +162,7 @@ module Viaduct
|
|
162
162
|
ensure_integer 'success_exit_code'
|
163
163
|
end
|
164
164
|
end
|
165
|
-
|
165
|
+
|
166
166
|
#
|
167
167
|
# Check config files
|
168
168
|
#
|
@@ -173,30 +173,30 @@ module Viaduct
|
|
173
173
|
ensure_string 'content'
|
174
174
|
end
|
175
175
|
end
|
176
|
-
|
176
|
+
|
177
177
|
errors
|
178
178
|
end
|
179
|
-
|
179
|
+
|
180
180
|
private
|
181
|
-
|
181
|
+
|
182
182
|
def value_for(item)
|
183
183
|
current_hash.is_a?(Hash) ? current_hash[item] : nil
|
184
184
|
end
|
185
|
-
|
185
|
+
|
186
186
|
def ensure_boolean(*items)
|
187
187
|
items.each do |item|
|
188
188
|
value = value_for(item)
|
189
189
|
add_error item, "must be a boolean" unless value.is_a?(TrueClass) || value.is_a?(FalseClass)
|
190
190
|
end
|
191
191
|
end
|
192
|
-
|
192
|
+
|
193
193
|
def ensure_string(*items)
|
194
194
|
items.each do |item|
|
195
195
|
value = value_for(item)
|
196
196
|
add_error item, "must be a string" unless value.is_a?(String) && value.length > 0
|
197
197
|
end
|
198
198
|
end
|
199
|
-
|
199
|
+
|
200
200
|
def ensure_matches(regex, *items)
|
201
201
|
items.each do |item|
|
202
202
|
value = value_for(item)
|
@@ -205,19 +205,19 @@ module Viaduct
|
|
205
205
|
end
|
206
206
|
end
|
207
207
|
end
|
208
|
-
|
208
|
+
|
209
209
|
def ensure_integer(*items)
|
210
210
|
items.each do |item|
|
211
211
|
value = value_for(item)
|
212
212
|
add_error item, "must be a number" unless value.is_a?(Fixnum)
|
213
213
|
end
|
214
214
|
end
|
215
|
-
|
215
|
+
|
216
216
|
def ensure_inclusion(options, *items)
|
217
217
|
items.each do |item|
|
218
218
|
add_error item, "must be one of #{options}" unless options.include?(value_for(item))
|
219
219
|
end
|
220
220
|
end
|
221
|
-
|
221
|
+
|
222
222
|
end
|
223
|
-
end
|
223
|
+
end
|
@@ -3,9 +3,9 @@ require 'json'
|
|
3
3
|
|
4
4
|
module Viaduct
|
5
5
|
class ArchfileRemoteBackend
|
6
|
-
|
6
|
+
|
7
7
|
class Error < StandardError; end
|
8
|
-
|
8
|
+
|
9
9
|
def self.properties
|
10
10
|
req = Net::HTTP::Get.new('/archfile/properties')
|
11
11
|
http = Net::HTTP.new(ENV['VDT_HOST'] || 'my.viaduct.io', ENV['VDT_PORT'] || 443)
|
@@ -13,7 +13,7 @@ module Viaduct
|
|
13
13
|
http.use_ssl = true
|
14
14
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
result = http.request(req)
|
18
18
|
if result.is_a?(Net::HTTPSuccess)
|
19
19
|
JSON.parse(result.body)
|
@@ -22,8 +22,8 @@ module Viaduct
|
|
22
22
|
end
|
23
23
|
rescue => e
|
24
24
|
puts e
|
25
|
-
raise Error, "Unable to download data from Viaduct host. Please try again later."
|
25
|
+
raise Error, "Unable to download data from Viaduct host. Please try again later."
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
end
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: viaduct-archfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: safe_yaml
|
@@ -46,10 +46,10 @@ executables:
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
+
- README.md
|
49
50
|
- bin/vdt-archfile-check
|
50
51
|
- lib/viaduct/archfile.rb
|
51
52
|
- lib/viaduct/archfile_remote_backend.rb
|
52
|
-
- README.md
|
53
53
|
homepage: http://viaduct.io
|
54
54
|
licenses: []
|
55
55
|
metadata: {}
|
@@ -59,17 +59,17 @@ require_paths:
|
|
59
59
|
- lib
|
60
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- -
|
62
|
+
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
requirements: []
|
71
71
|
rubyforge_project:
|
72
|
-
rubygems_version: 2.
|
72
|
+
rubygems_version: 2.2.2
|
73
73
|
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: A validation tool for checking the validity of a Viaduct Archfile
|