docker_rails_proxy 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dcbb5bd8b29380984a31c27724560f09bc2c03f4
4
- data.tar.gz: 8c80d0ef2ed5d757d478bfb0f098af4382a6b3da
3
+ metadata.gz: 561e9f9ae62d749cf755743f6c9bf33bdb022c8c
4
+ data.tar.gz: 03198f32922c146fa1cd4fdb565ffd9d370f1eac
5
5
  SHA512:
6
- metadata.gz: 54429448faff42c06c230455941bd642aaea9a1d326eed91842e544754af57f9620f8c3c5d5ac220f32202339566dc208835500f2219f98723c920d72bd778fe
7
- data.tar.gz: 6310ee15511e957287feb0f17f63ad64c1db152fa8f774483bb6ef60ef6abfd71fc32d2b175a16a7067d2546b690f5a5a971af01b5a5f84e45626e077d1acde9
6
+ metadata.gz: c9d7480fb0be8b4de4d36cee08dc4e9b5c43455adc9de1c05c275e85d71082dcf3e829a41e067ed01dfc2b58ce2a550194bf41a631b86b97d17a82a312a48bf2
7
+ data.tar.gz: cb575cc3c1785dba7d1bebc0ee18d18f936add253cfa2d20c9a3cb05f06c895528822a1e666ce30a7fe97532c00a0cb0e033f2dd1307c5f19c66a947f0cf6f95
@@ -24,7 +24,7 @@ module DockerRailsProxy
24
24
  validates do
25
25
  if YML_EXTENSIONS.include? File.extname(options[:ymlfile])
26
26
  self.data = YAML::load_file(options[:ymlfile])
27
- options[:jsonfile] = options[:ymlfile].sub(/\/(\w+)\..+$/, '/.\1.json')
27
+ options[:jsonfile] = options[:ymlfile].underscore.sub(/\/(\w+)\..+$/, '/.\1.json')
28
28
  File.write(options[:jsonfile], data.to_json)
29
29
  else
30
30
  "#{options[:ymlfile]} is not a yml file"
@@ -111,6 +111,8 @@ module DockerRailsProxy
111
111
 
112
112
  puts '-' * 100
113
113
 
114
+ options_hash = {}
115
+
114
116
  while parameters[key].to_s.blank? do
115
117
  value = nil
116
118
 
@@ -125,27 +127,85 @@ module DockerRailsProxy
125
127
  parameters[key] = get_option(key_pairs)
126
128
 
127
129
  when 'List<AWS::EC2::Subnet::Id>'
128
- subnets_data ||= JSON.load %x(
130
+ json_data ||= JSON.load %x(
129
131
  aws ec2 describe-subnets --profile '#{options[:profile]}'
130
132
  ).strip
131
133
 
132
- subnets = {}
133
-
134
- subnets_data['Subnets'].map{|h|
135
- subnets[h['SubnetId']] = "#{h['SubnetId']} (#{h['CidrBlock']})"
134
+ json_data['Subnets'].map{|h|
135
+ options_hash[h['SubnetId']] = "#{h['SubnetId']} (#{h['CidrBlock']})"
136
136
  }
137
137
 
138
138
  # By VPCs
139
- subnets_data['Subnets']
139
+ json_data['Subnets']
140
140
  .group_by{|h| h['VpcId'] }
141
141
  .map{|vpc_id, subnets_attrs|
142
142
  vpc = [vpc_id, subnets_attrs.first['DefaultForAz'] ? '(Default)' : nil].compact.join(' ')
143
143
  subnet_ids = subnets_attrs.map{|h| h['SubnetId']}.join(',')
144
- subnets[subnet_ids] = "#{vpc}: [#{subnet_ids}]"
144
+ options_hash[subnet_ids] = "#{vpc}: [#{subnet_ids}]"
145
145
  }
146
146
 
147
- print_options(subnets.values, "Choose an option for #{key} and press [ENTER] (Use 0,1,2... to select multiple values)")
148
- parameters[key] = get_option(subnets.keys, array: true)
147
+ print_options(options_hash.values, "Choose an option for #{key} and press [ENTER] (Use 0,1,2... to select multiple values)")
148
+ parameters[key] = get_option(options_hash.keys, array: true)
149
+
150
+ when 'List<AWS::EC2::AvailabilityZone::Name>'
151
+ json_data ||= JSON.load %x(
152
+ aws ec2 describe-availability-zones --profile '#{options[:profile]}'
153
+ ).strip
154
+
155
+ json_data['AvailabilityZones'].map{|h|
156
+ options_hash[h['ZoneName']] = "#{h['ZoneName']} (#{h['State']})"
157
+ }
158
+
159
+ all_azs = options_hash.keys.join(',')
160
+ options_hash[all_azs] = "All: [#{all_azs}]"
161
+
162
+ print_options(options_hash.values, "Choose an option for #{key} and press [ENTER] (Use 0,1,2... to select multiple values)")
163
+ parameters[key] = get_option(options_hash.keys, array: true)
164
+
165
+ when 'AWS::EC2::SecurityGroup::Id'
166
+ json_data ||= JSON.load %x(
167
+ aws ec2 describe-security-groups --profile '#{options[:profile]}'
168
+ ).strip
169
+
170
+ json_data['SecurityGroups'].map{|h|
171
+ options_hash[h['GroupId']] = [
172
+ h['GroupName'],
173
+ "(#{h['GroupId']})",
174
+ h['Description'].present? ? "(#{h['Description']})" : nil
175
+ ].compact.join(' ')
176
+ }
177
+
178
+ print_options(options_hash.values, "Choose an option for #{key} and press [ENTER]")
179
+ parameters[key] = get_option(options_hash.keys)
180
+
181
+ when 'AWS::Route53::HostedZone::Id'
182
+ json_data ||= JSON.load %x(
183
+ aws route53 list-hosted-zones --profile '#{options[:profile]}'
184
+ ).strip
185
+
186
+ json_data['HostedZones'].map{|h|
187
+ id = h['Id'].split('/').last
188
+ type = h['Config']['PrivateZone'] ? 'Private' : 'Public'
189
+ options_hash[id] = "#{h['Name']} (#{id}) (#{type})"
190
+ }
191
+
192
+ print_options(options_hash.values, "Choose an option for #{key} and press [ENTER]")
193
+ parameters[key] = get_option(options_hash.keys)
194
+
195
+ when 'AWS::EC2::VPC::Id'
196
+ json_data ||= JSON.load %x(
197
+ aws ec2 describe-vpcs --profile '#{options[:profile]}'
198
+ ).strip
199
+
200
+ json_data['Vpcs'].map{|h|
201
+ name = (h['Tags'].detect { |t| t['Key'] == 'Name' } || {})['Value']
202
+ options_hash[h['VpcId']] = [
203
+ h['VpcId'], "(#{h['CidrBlock']})", name ? "(#{name})" : nil
204
+ ].compact.join(' ')
205
+ }
206
+
207
+ print_options(options_hash.values, "Choose an option for #{key} and press [ENTER]")
208
+ parameters[key] = get_option(options_hash.keys)
149
209
 
150
210
  else
151
211
  value ||= attrs['Default']
@@ -0,0 +1,8 @@
1
+ module DockerRailsProxy
2
+ class Yarn < DockerMainApp
3
+ def process
4
+ command, *args = arguments
5
+ system "docker exec #{APP_NAME} bin/yarn #{command} #{args.join(' ')}"
6
+ end
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module DockerRailsProxy
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker_rails_proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jairo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-05-19 00:00:00.000000000 Z
12
+ date: 2017-06-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Configures docker-compose and provides rails command helpers
15
15
  email:
@@ -41,6 +41,7 @@ files:
41
41
  - lib/docker_rails_proxy/commands/stack.rb
42
42
  - lib/docker_rails_proxy/commands/stack/create.rb
43
43
  - lib/docker_rails_proxy/commands/stack/destroy.rb
44
+ - lib/docker_rails_proxy/commands/yarn.rb
44
45
  - lib/docker_rails_proxy/concerns/callbacks.rb
45
46
  - lib/docker_rails_proxy/concerns/inheritable_attributes.rb
46
47
  - lib/docker_rails_proxy/concerns/rsync.rb