docker_rails_proxy 0.0.4 → 0.0.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d0a319496777448c5a39f6f26198f968431caa7
|
4
|
+
data.tar.gz: 0a676fa8a764a8990aaa4c2465c589061c02f809
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e927e9b628e8c76446d751726f031cb0cb14ca4cce3366d81af0e32f204e6cc58b922d5fa1be975c4fa3b51cda76edd9346b7594c353acfd4716ff1da30e0992
|
7
|
+
data.tar.gz: fb0b69285552f3c0549584877c9c752d96dab24e0728d8a90f681bc33c253302f269ba650b0a414b34a1badb54650f186ac42ff0d8d13f388c987843b0cd4bc3
|
data/README.md
CHANGED
@@ -1 +1,17 @@
|
|
1
|
-
|
1
|
+
### To release a new version
|
2
|
+
|
3
|
+
Update `lib/docker_rails_proxy/version.rb` with the new version and commit that change.
|
4
|
+
|
5
|
+
**Git Tag**
|
6
|
+
```bash
|
7
|
+
git tag v0.0.1
|
8
|
+
git push origin v0.0.1
|
9
|
+
```
|
10
|
+
|
11
|
+
**Gem Build**
|
12
|
+
|
13
|
+
The user on rubygems.org is eureaktechteam@gmail.com. Credentials are in 1password "Eureka Tech" vault
|
14
|
+
```bash
|
15
|
+
gem build docker_rails_proxy.gemspec
|
16
|
+
gem push docker_rails_proxy-0.0.1.gem
|
17
|
+
```
|
@@ -68,6 +68,7 @@ module DockerRailsProxy
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def fswatch_start
|
71
|
+
puts 'fswatch has been started'
|
71
72
|
PTY.spawn(FSWATCH_CMD) do |stdout, stdin, pid|
|
72
73
|
begin
|
73
74
|
stdout.each { |path| sync_or_kill(path: path, pid: pid) }
|
@@ -75,8 +76,13 @@ module DockerRailsProxy
|
|
75
76
|
$stderr.puts EIO_ERROR
|
76
77
|
end
|
77
78
|
end
|
79
|
+
|
78
80
|
rescue PTY::ChildExited
|
79
81
|
$stderr.puts '"The fswatch process exited!'
|
82
|
+
|
83
|
+
# Captures Ctrl-C
|
84
|
+
rescue Exception
|
85
|
+
puts 'fswatch has been stopped'
|
80
86
|
end
|
81
87
|
|
82
88
|
def sync_or_kill(path:, pid:)
|
@@ -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(
|
27
|
+
options[:jsonfile] = options[:ymlfile].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"
|
@@ -122,7 +122,30 @@ module DockerRailsProxy
|
|
122
122
|
).strip.split(' ')
|
123
123
|
|
124
124
|
print_options(key_pairs, "Choose an option for #{key} and press [ENTER]")
|
125
|
-
parameters[key] = get_option(key_pairs
|
125
|
+
parameters[key] = get_option(key_pairs)
|
126
|
+
|
127
|
+
when 'List<AWS::EC2::Subnet::Id>'
|
128
|
+
subnets_data ||= JSON.load %x(
|
129
|
+
aws ec2 describe-subnets --profile '#{options[:profile]}'
|
130
|
+
).strip
|
131
|
+
|
132
|
+
subnets = {}
|
133
|
+
|
134
|
+
subnets_data['Subnets'].map{|h|
|
135
|
+
subnets[h['SubnetId']] = "#{h['SubnetId']} (#{h['CidrBlock']})"
|
136
|
+
}
|
137
|
+
|
138
|
+
# By VPCs
|
139
|
+
subnets_data['Subnets']
|
140
|
+
.group_by{|h| h['VpcId'] }
|
141
|
+
.map{|vpc_id, subnets_attrs|
|
142
|
+
vpc = [vpc_id, subnets_attrs.first['DefaultForAz'] ? '(Default)' : nil].compact.join(' ')
|
143
|
+
subnet_ids = subnets_attrs.map{|h| h['SubnetId']}.join(',')
|
144
|
+
subnets[subnet_ids] = "#{vpc}: [#{subnet_ids}]"
|
145
|
+
}
|
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)
|
126
149
|
|
127
150
|
else
|
128
151
|
value ||= attrs['Default']
|
@@ -137,14 +160,14 @@ module DockerRailsProxy
|
|
137
160
|
parameters[key] = value if parameters[key].blank?
|
138
161
|
else
|
139
162
|
print_options(allowed_values, "Choose an option for #{key} and press [ENTER] (Default: #{value})")
|
140
|
-
parameters[key] = get_option(allowed_values, value)
|
163
|
+
parameters[key] = get_option(allowed_values, default: value)
|
141
164
|
end
|
142
165
|
end
|
143
166
|
end
|
144
167
|
end
|
145
168
|
|
146
169
|
self.parameters = parameters.map do |key, value|
|
147
|
-
|
170
|
+
%{'ParameterKey="#{key}",ParameterValue="#{value}",UsePreviousValue=false'}
|
148
171
|
end
|
149
172
|
end
|
150
173
|
|
data/lib/docker_rails_proxy.rb
CHANGED
@@ -3,6 +3,8 @@ Dir[File.expand_path('../docker_rails_proxy/extends/*.rb', __FILE__)].map do |f|
|
|
3
3
|
end
|
4
4
|
|
5
5
|
module DockerRailsProxy
|
6
|
+
NUMBER_REGEXP = /^\d+$/.freeze
|
7
|
+
|
6
8
|
COMMANDS = Dir[File.expand_path('../docker_rails_proxy/commands/*.rb', __FILE__)].map do |f|
|
7
9
|
File.basename(f, '.rb').parameterize
|
8
10
|
end.freeze
|
@@ -79,13 +81,21 @@ module DockerRailsProxy
|
|
79
81
|
values.each_with_index { |v, i| puts "#{i}) #{v}" }
|
80
82
|
end
|
81
83
|
|
82
|
-
def get_option(values, default
|
84
|
+
def get_option(values, default: nil, array: false)
|
83
85
|
flush_stdin
|
84
86
|
print ": "
|
85
87
|
option = $stdin.gets.chomp
|
86
88
|
|
87
89
|
return default if option.blank?
|
88
|
-
|
90
|
+
|
91
|
+
if array
|
92
|
+
options = option.split(',')
|
93
|
+
return nil unless options.map{|o| o =~ NUMBER_REGEXP }.all?
|
94
|
+
|
95
|
+
options.map{|o| values[o.to_i].split(',') }.flatten.compact.uniq.join(',')
|
96
|
+
else
|
97
|
+
values[option.to_i] if option =~ NUMBER_REGEXP
|
98
|
+
end
|
89
99
|
end
|
90
100
|
|
91
101
|
def flush_stdin
|
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.
|
4
|
+
version: 0.0.5
|
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: 2016-
|
12
|
+
date: 2016-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Configures docker-compose and provides rails command helpers
|
15
15
|
email:
|