applb 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +255 -0
- data/Rakefile +6 -0
- data/applb.gemspec +33 -0
- data/aws_config.yml.enc +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/applb +5 -0
- data/lib/applb.rb +14 -0
- data/lib/applb/cli.rb +80 -0
- data/lib/applb/client.rb +386 -0
- data/lib/applb/client_wrapper.rb +85 -0
- data/lib/applb/converter.rb +22 -0
- data/lib/applb/dsl.rb +56 -0
- data/lib/applb/dsl/attributes.rb +49 -0
- data/lib/applb/dsl/checker.rb +27 -0
- data/lib/applb/dsl/ec2.rb +35 -0
- data/lib/applb/dsl/listener.rb +140 -0
- data/lib/applb/dsl/listeners.rb +29 -0
- data/lib/applb/dsl/load_balancer.rb +209 -0
- data/lib/applb/dsl/rule.rb +157 -0
- data/lib/applb/dsl/rules.rb +32 -0
- data/lib/applb/dsl/target_group.rb +156 -0
- data/lib/applb/dsl/target_groups.rb +28 -0
- data/lib/applb/error.rb +4 -0
- data/lib/applb/exporter.rb +7 -0
- data/lib/applb/filterable.rb +13 -0
- data/lib/applb/output_alb.erb +122 -0
- data/lib/applb/template_helper.rb +20 -0
- data/lib/applb/utils.rb +48 -0
- data/lib/applb/version.rb +3 -0
- metadata +192 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
module Applb
|
2
|
+
module TemplateHelper
|
3
|
+
def include_template(template_name, context = {})
|
4
|
+
template = @context.templates[template_name.to_s]
|
5
|
+
|
6
|
+
unless template
|
7
|
+
raise "Template `#{template_name}' is not defined"
|
8
|
+
end
|
9
|
+
|
10
|
+
context_org = @context
|
11
|
+
@context = @context.merge(context)
|
12
|
+
instance_eval(&template)
|
13
|
+
@context = context_org
|
14
|
+
end
|
15
|
+
|
16
|
+
def context
|
17
|
+
@context
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/applb/utils.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'diffy'
|
2
|
+
|
3
|
+
module Applb
|
4
|
+
class Utils
|
5
|
+
class << self
|
6
|
+
def normalize_hash(hash)
|
7
|
+
hash.dup.each do |k, v|
|
8
|
+
if v.kind_of?(Array)
|
9
|
+
if v.first.kind_of?(Hash)
|
10
|
+
hash[k] = v.map { |o| normalize_hash(o) }
|
11
|
+
elsif v.first.respond_to?(:to_h)
|
12
|
+
hash[k] = v.map { |o| normalize_hash(o.to_h) }
|
13
|
+
end
|
14
|
+
elsif v.respond_to?(:to_h)
|
15
|
+
hash[k] = normalize_hash(v.to_h)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
sort_keys(hash)
|
19
|
+
end
|
20
|
+
|
21
|
+
def sort_keys(hash)
|
22
|
+
hash = Hash[hash.sort]
|
23
|
+
hash.each do |k, v|
|
24
|
+
if v.kind_of?(Array)
|
25
|
+
if v.first.kind_of?(Hash)
|
26
|
+
hash[k] = v.map { |h| sort_keys(h) }
|
27
|
+
end
|
28
|
+
elsif v.kind_of?(Hash)
|
29
|
+
hash[k] = sort_keys(v)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
hash
|
33
|
+
end
|
34
|
+
|
35
|
+
def diff(obj1, obj2, options = {})
|
36
|
+
diffy = Diffy::Diff.new(
|
37
|
+
obj1.pretty_inspect,
|
38
|
+
obj2.pretty_inspect,
|
39
|
+
:diff => '-u'
|
40
|
+
)
|
41
|
+
|
42
|
+
out = diffy.to_s(options[:color] ? :color : :text).gsub(/\s+\z/m, '')
|
43
|
+
out.gsub!(/^/, options[:indent]) if options[:indent]
|
44
|
+
out
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: applb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- wata
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aws-sdk
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: hashie
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: diffy
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: term-ansicolor
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
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'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry-byebug
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: Manage ALB by DSL
|
126
|
+
email:
|
127
|
+
- wata.gm@gmail.com
|
128
|
+
executables:
|
129
|
+
- applb
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- ".gitignore"
|
134
|
+
- ".rspec"
|
135
|
+
- ".travis.yml"
|
136
|
+
- Gemfile
|
137
|
+
- LICENSE.txt
|
138
|
+
- README.md
|
139
|
+
- Rakefile
|
140
|
+
- applb.gemspec
|
141
|
+
- aws_config.yml.enc
|
142
|
+
- bin/console
|
143
|
+
- bin/setup
|
144
|
+
- exe/applb
|
145
|
+
- lib/applb.rb
|
146
|
+
- lib/applb/cli.rb
|
147
|
+
- lib/applb/client.rb
|
148
|
+
- lib/applb/client_wrapper.rb
|
149
|
+
- lib/applb/converter.rb
|
150
|
+
- lib/applb/dsl.rb
|
151
|
+
- lib/applb/dsl/attributes.rb
|
152
|
+
- lib/applb/dsl/checker.rb
|
153
|
+
- lib/applb/dsl/ec2.rb
|
154
|
+
- lib/applb/dsl/listener.rb
|
155
|
+
- lib/applb/dsl/listeners.rb
|
156
|
+
- lib/applb/dsl/load_balancer.rb
|
157
|
+
- lib/applb/dsl/rule.rb
|
158
|
+
- lib/applb/dsl/rules.rb
|
159
|
+
- lib/applb/dsl/target_group.rb
|
160
|
+
- lib/applb/dsl/target_groups.rb
|
161
|
+
- lib/applb/error.rb
|
162
|
+
- lib/applb/exporter.rb
|
163
|
+
- lib/applb/filterable.rb
|
164
|
+
- lib/applb/output_alb.erb
|
165
|
+
- lib/applb/template_helper.rb
|
166
|
+
- lib/applb/utils.rb
|
167
|
+
- lib/applb/version.rb
|
168
|
+
homepage: http://github.com/wata-gh/applb
|
169
|
+
licenses:
|
170
|
+
- MIT
|
171
|
+
metadata: {}
|
172
|
+
post_install_message:
|
173
|
+
rdoc_options: []
|
174
|
+
require_paths:
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
requirements: []
|
187
|
+
rubyforge_project:
|
188
|
+
rubygems_version: 2.5.2
|
189
|
+
signing_key:
|
190
|
+
specification_version: 4
|
191
|
+
summary: Codenize ELB v2 (ALB)
|
192
|
+
test_files: []
|