convox_installer 1.0.6 → 1.0.9
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 -2
- data/lib/convox/client.rb +3 -3
- data/lib/convox_installer/config.rb +9 -5
- data/lib/convox_installer/version.rb +1 -1
- data/spec/lib/convox_installer/config_spec.rb +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e3e80d423ba3cf14865e0b541207471286dcfa32956bfbc22c3fd4ff0818413
|
4
|
+
data.tar.gz: 031f35af824c717ee140a281d22e4793c06b83a05182709a1803c60a23692ad6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a96d285b7778b693394fd5bb7c5f7157aa74513e6302337bbfab2b9714d4b1b425f1b2033cb0fdf488625cfb9c835c09ea7a05f7426a47ab2c681ded07c3cc55
|
7
|
+
data.tar.gz: 368b58ededb07344ecd232838ba6229bbf93d4d3da345f5292eb4dfd213514b0b13138ea334857c54b53887eebf83b251938f5ff942bda410e7cb49ee0e46033
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ You can see a complete example in [`examples/full_installation.rb`](./examples/f
|
|
50
50
|
## Config
|
51
51
|
|
52
52
|
Config is loaded from ENV vars, or from saved JSON data at
|
53
|
-
`./.installer_config`. The script will save all of the user's responses into `./.installer_config` (in the current directory).
|
53
|
+
`./.installer_config.json`. The script will save all of the user's responses into `./.installer_config.json` (in the current directory).
|
54
54
|
|
55
55
|
## Customize the Config Prompts
|
56
56
|
|
@@ -135,7 +135,7 @@ Makes sure that the `convox` and `aws` CLI tools are installed on this system. I
|
|
135
135
|
|
136
136
|
#### `prompt_for_config`
|
137
137
|
|
138
|
-
Loads config from ENV vars, or from saved config at `./.installer_config`.
|
138
|
+
Loads config from ENV vars, or from saved config at `./.installer_config.json`.
|
139
139
|
If any config settings are missing, it prompts the user for input. Finally, it shows a summary of the config, and asks the user if they want to proceed with the installation. If the user enters `y` (or `yes`), the `prompt_for_config` method completes. If they enter `n` (or `no`), we loop over every setting and let them press "enter" to keep the current value, or provide a new value to correct any mistakes.
|
140
140
|
|
141
141
|
#### `backup_convox_host_and_rack`
|
data/lib/convox/client.rb
CHANGED
@@ -23,6 +23,8 @@ module Convox
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def backup_convox_host_and_rack
|
26
|
+
FileUtils.mkdir_p CONVOX_DIR
|
27
|
+
|
26
28
|
%w[host rack].each do |f|
|
27
29
|
path = File.join(CONVOX_DIR, f)
|
28
30
|
if File.exist?(path)
|
@@ -70,9 +72,7 @@ module Convox
|
|
70
72
|
def rack_already_installed?
|
71
73
|
require_config(%i[ aws_region stack_name ])
|
72
74
|
|
73
|
-
unless File.exist?(AUTH_FILE)
|
74
|
-
raise "Could not find auth file at #{AUTH_FILE}!"
|
75
|
-
end
|
75
|
+
return unless File.exist?(AUTH_FILE)
|
76
76
|
|
77
77
|
region = config.fetch(:aws_region)
|
78
78
|
stack_name = config.fetch(:stack_name)
|
@@ -7,7 +7,7 @@ require "securerandom"
|
|
7
7
|
|
8
8
|
module ConvoxInstaller
|
9
9
|
class Config
|
10
|
-
CONFIG_FILE = File.expand_path("./.installer_config").freeze
|
10
|
+
CONFIG_FILE = File.expand_path("./.installer_config.json").freeze
|
11
11
|
|
12
12
|
attr_accessor :logger, :config, :prompts, :highline
|
13
13
|
|
@@ -129,7 +129,11 @@ module ConvoxInstaller
|
|
129
129
|
return if config[key]
|
130
130
|
|
131
131
|
default = prompt[:value]
|
132
|
-
config[key] = default.is_a?(Proc)
|
132
|
+
config[key] = if default.is_a?(Proc)
|
133
|
+
default.arity == 0 ? default.call : default.call(config)
|
134
|
+
else
|
135
|
+
default
|
136
|
+
end
|
133
137
|
save_config_to_file
|
134
138
|
return
|
135
139
|
end
|
@@ -154,7 +158,7 @@ module ConvoxInstaller
|
|
154
158
|
logger.debug "Loading saved config from #{CONFIG_FILE}..."
|
155
159
|
|
156
160
|
loaded_config = JSON.parse(Config.read_config_file)["config"].symbolize_keys
|
157
|
-
self.config = config.merge(loaded_config)
|
161
|
+
self.config = config.merge(loaded_config)
|
158
162
|
end
|
159
163
|
|
160
164
|
def load_config_from_env
|
@@ -170,8 +174,8 @@ module ConvoxInstaller
|
|
170
174
|
|
171
175
|
def save_config_to_file
|
172
176
|
# FileUtils.mkdir_p File.expand_path("~/.convox")
|
173
|
-
File.open(CONFIG_FILE,
|
174
|
-
f.puts(
|
177
|
+
File.open(CONFIG_FILE, 'w') do |f|
|
178
|
+
f.puts(JSON.pretty_generate(config: config))
|
175
179
|
end
|
176
180
|
end
|
177
181
|
|
@@ -5,7 +5,7 @@ require "securerandom"
|
|
5
5
|
|
6
6
|
RSpec.describe ConvoxInstaller::Config do
|
7
7
|
before(:each) do
|
8
|
-
stub_const('ConvoxInstaller::Config::CONFIG_FILE', '/path/to/.installer_config')
|
8
|
+
stub_const('ConvoxInstaller::Config::CONFIG_FILE', '/path/to/.installer_config.json')
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:each) do
|
@@ -13,7 +13,7 @@ RSpec.describe ConvoxInstaller::Config do
|
|
13
13
|
ENV.delete "AWS_ACCESS_KEY_ID"
|
14
14
|
end
|
15
15
|
|
16
|
-
it "loads the saved config from ./.installer_config" do
|
16
|
+
it "loads the saved config from ./.installer_config.json" do
|
17
17
|
expect(described_class).to receive(:config_file_exists?).and_return(true)
|
18
18
|
expect(described_class).to receive(:read_config_file).and_return(
|
19
19
|
'{ "config": { "aws_region": "us-west-2", "aws_access_key_id": "1234" } }'
|
@@ -92,7 +92,7 @@ Please enter your AWS Access Key ID: Please enter your AWS Secret Access Key:
|
|
92
92
|
AWS Access Key ID: asdf
|
93
93
|
AWS Secret Access Key: xkcd
|
94
94
|
|
95
|
-
We've saved your configuration to: /path/to/.installer_config
|
95
|
+
We've saved your configuration to: /path/to/.installer_config.json
|
96
96
|
If anything goes wrong during the installation, you can restart the script to reload the config and continue.
|
97
97
|
|
98
98
|
Please double check all of these configuration details.
|
@@ -114,7 +114,7 @@ Please enter your AWS Access Key ID: |asdf| Please enter your AWS Secret Access
|
|
114
114
|
AWS Access Key ID: sdfg
|
115
115
|
AWS Secret Access Key: xkcd
|
116
116
|
|
117
|
-
We've saved your configuration to: /path/to/.installer_config
|
117
|
+
We've saved your configuration to: /path/to/.installer_config.json
|
118
118
|
If anything goes wrong during the installation, you can restart the script to reload the config and continue.
|
119
119
|
|
120
120
|
Please double check all of these configuration details.
|
@@ -157,7 +157,7 @@ EOS
|
|
157
157
|
{
|
158
158
|
key: :admin_password,
|
159
159
|
title: "Admin Password",
|
160
|
-
value: -> () { SecureRandom.hex(8) },
|
160
|
+
value: -> (c) { SecureRandom.hex(8) },
|
161
161
|
},
|
162
162
|
]
|
163
163
|
|
@@ -222,7 +222,7 @@ Please enter your Docker Registry Access Key ID: Please enter your Docker Regist
|
|
222
222
|
Admin Email: admin@test.com
|
223
223
|
Admin Password: 99a6f67de0c7a117
|
224
224
|
|
225
|
-
We've saved your configuration to: /path/to/.installer_config
|
225
|
+
We've saved your configuration to: /path/to/.installer_config.json
|
226
226
|
If anything goes wrong during the installation, you can restart the script to reload the config and continue.
|
227
227
|
|
228
228
|
Please double check all of these configuration details.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: convox_installer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Form Applications Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
|
-
rubygems_version: 3.
|
131
|
+
rubygems_version: 3.2.11
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Build a Convox installation workflow
|