codily 0.1.0.beta → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/codily/cli.rb +1 -1
- data/lib/codily/elements/condition.rb +9 -0
- data/lib/codily/engine.rb +11 -0
- data/lib/codily/importer.rb +1 -1
- data/lib/codily/root.rb +10 -2
- data/lib/codily/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5ccea29ad8df53e57d7ea9a3f4f7cf39f2c4ba4
|
4
|
+
data.tar.gz: 6f15de9ea8cf711a27d9025ebbe188b67ee1c8ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2e8231b7369ac78b0977a95e0f77617a8cce6b6dd4f2ab075dc7c0c6d2461abe3813a116ba387a49c771c325f394249a803ec68362c8d05789f8f0e08138c63
|
7
|
+
data.tar.gz: a5195b25eddb9b7cab63133be12bf54edc7d883381b008496bdd9e4161677f12920939188c1db5334b229656c3005141a6a17e22bdc6dadbe1aa6f5e7b47eb0d
|
data/README.md
CHANGED
data/lib/codily/cli.rb
CHANGED
@@ -40,7 +40,7 @@ module Codily
|
|
40
40
|
Dir.chdir(File.dirname(options[:file]))
|
41
41
|
|
42
42
|
present = importer.run.root
|
43
|
-
desired = Root.new(debug: options[:debug]).run_string(File.read(File.basename(options[:file])), options[:file], 1)
|
43
|
+
desired = Root.new(debug: options[:debug], service_filter: options[:target]).run_string(File.read(File.basename(options[:file])), options[:file], 1)
|
44
44
|
|
45
45
|
require_fastly_auth!
|
46
46
|
|
data/lib/codily/engine.rb
CHANGED
@@ -52,6 +52,17 @@ module Codily
|
|
52
52
|
act_any = false
|
53
53
|
act = false
|
54
54
|
|
55
|
+
present.service_versions.each do |id, version|
|
56
|
+
if !version[:dev]
|
57
|
+
puts "CLONE VERSION: #{version[:name]}.#{version[:active]}"
|
58
|
+
if !dry_run
|
59
|
+
version[:dev] = fastly.get_version(id, version[:active]).clone.number
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
puts
|
65
|
+
|
55
66
|
creations.each do |new_element|
|
56
67
|
act_any = act = true
|
57
68
|
puts "CREATE: #{new_element.inspect}"
|
data/lib/codily/importer.rb
CHANGED
@@ -39,7 +39,7 @@ module Codily
|
|
39
39
|
next unless @service_filter.any? { |_| _ === service.name }
|
40
40
|
end
|
41
41
|
service_version = root.service_version_set(service.name, service.id, service.versions)
|
42
|
-
import_version = @import_targets[service.id] || @import_targets[service.name] || service_version[:dev]
|
42
|
+
import_version = @import_targets[service.id] || @import_targets[service.name] || service_version[:dev] || service_version[:active]
|
43
43
|
|
44
44
|
root.add_element Elements::Service.new(root, service)
|
45
45
|
|
data/lib/codily/root.rb
CHANGED
@@ -5,15 +5,18 @@ module Codily
|
|
5
5
|
class Root
|
6
6
|
class AlreadyDefined < StandardError; end
|
7
7
|
|
8
|
-
def initialize(debug: false)
|
8
|
+
def initialize(debug: false, service_filter: nil)
|
9
9
|
@debug = debug
|
10
10
|
@elements = {}
|
11
11
|
|
12
|
+
@service_filter = service_filter
|
12
13
|
@service_versions = {}
|
13
14
|
@service_map_name_to_id = {}
|
14
15
|
end
|
15
16
|
|
16
17
|
attr_reader :elements
|
18
|
+
attr_reader :service_filter
|
19
|
+
attr_reader :service_versions
|
17
20
|
attr_accessor :debug
|
18
21
|
|
19
22
|
def as_hash
|
@@ -27,7 +30,8 @@ module Codily
|
|
27
30
|
# XXX: is it okay having this here?
|
28
31
|
def service_version_set(service_name, service_id, versions)
|
29
32
|
@service_map_name_to_id[service_name] = service_id
|
30
|
-
|
33
|
+
dev_version = versions.reverse_each.find { |_| !_.locked }
|
34
|
+
dev = dev_version && dev_version.number
|
31
35
|
active = (versions.reverse_each.find(&:active) || versions.reverse_each.find(&:locked)).number
|
32
36
|
@service_versions[service_id] = {dev: dev, active: active, name: service_name, id: service_id}
|
33
37
|
end
|
@@ -41,6 +45,10 @@ module Codily
|
|
41
45
|
end
|
42
46
|
|
43
47
|
def service(name, &block)
|
48
|
+
if service_filter
|
49
|
+
return nil unless service_filter.any? { |_| _ === name }
|
50
|
+
end
|
51
|
+
|
44
52
|
raise AlreadyDefined if services.key?(name)
|
45
53
|
add_element(Elements::Service.new(self, {name: name}, &block))
|
46
54
|
end
|
data/lib/codily/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codily
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sorah Fukumori
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastly
|
@@ -126,12 +126,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '0'
|
132
132
|
requirements: []
|
133
133
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.6.
|
134
|
+
rubygems_version: 2.6.6
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Codificate Fastly configuration
|