convox_installer 1.0.4 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c61afa4dfbb14346d5dc9c07eb23eca17eb1e612c8fe659c74d78fc154810479
4
- data.tar.gz: b85f7bf5513cad08955f4a7ebc8c66f35ef0995d1d481bb2779af069a2980d0b
3
+ metadata.gz: ae064bb3fa4954c0edd52b0d97127477ed73f0059c36b6c71f0f091b5b93608e
4
+ data.tar.gz: 8cadcac34a2eeaf4b68f323b5e9c2dd9ec528be4cf14a5fe2b9145cb0cb9d8cd
5
5
  SHA512:
6
- metadata.gz: f4878d00fbe6b6111a8c316f6eb6c691f11ee5b5846628b46e1dde39eea2f2b6c510951f924e1ca51002808cdaba9662af70cd2be618627d25af94e1cb8a1a67
7
- data.tar.gz: 9340387ce40c3ee1d41823ccc5c959638172944161c3f6ea3c74f8048d5d53706770bffcdf08f3fc464dac5543abd8f4c3f79584555da2be2f4d684fe5f083a3
6
+ metadata.gz: b4ba638e5dffe9ab773f4b5f5bad934fc112c2cdc2cede74ca7e8ae2351bf900d33a7681ec20e9bbcbd7813e62e1e4b927aa78ba30041ec0cc3644bd2a753f4e
7
+ data.tar.gz: a1e4ef7404bf7da3d425c0d5ac0192d035949bf3467a28fee45b244316e07473cff3dcfe361768f7f638984ac1949c5ccdc68d5cb9ddcfc16c1da1bcb9c19186
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`
@@ -250,7 +250,7 @@ Checks the list of registries to see if `docker_registry_url` has already been a
250
250
 
251
251
  Parses the rack router ELB name and region, and returns the default `convox.site` domain for your default service. (You can visit this URL in the browser to access your app.)
252
252
 
253
- Example: `myapp-web.rackname-Route-ABCDFE123456-123456789.us-west-2.convox.site`
253
+ Example: `myapp-web.rackname-route-abcdfe123456-123456789.us-west-2.convox.site`
254
254
 
255
255
  Set a default service in your config prompts (e.g. `web`):
256
256
 
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)
@@ -375,7 +375,8 @@ module Convox
375
375
  app = config.fetch(:convox_app_name)
376
376
  service = config.fetch(:default_service)
377
377
 
378
- "#{app}-#{service}.#{elb_name_and_region}.convox.site"
378
+ # Need to return downcase host so that `config.hosts` works with Rails applications
379
+ "#{app}-#{service}.#{elb_name_and_region}.convox.site".downcase
379
380
  end
380
381
  end
381
382
 
@@ -7,8 +7,8 @@ require "securerandom"
7
7
 
8
8
  module ConvoxInstaller
9
9
  class Config
10
- CONFIG_FILE = File.expand_path("./.installer_config").freeze
11
-
10
+ CONFIG_FILE = File.expand_path("./.installer_config.json").freeze
11
+
12
12
  attr_accessor :logger, :config, :prompts, :highline
13
13
 
14
14
  DEFAULT_PROMPTS = [
@@ -129,7 +129,7 @@ module ConvoxInstaller
129
129
  return if config[key]
130
130
 
131
131
  default = prompt[:value]
132
- config[key] = default.is_a?(Proc) ? default.call : default
132
+ config[key] = default.is_a?(Proc) ? default.call(config) : default
133
133
  save_config_to_file
134
134
  return
135
135
  end
@@ -154,7 +154,7 @@ module ConvoxInstaller
154
154
  logger.debug "Loading saved config from #{CONFIG_FILE}..."
155
155
 
156
156
  loaded_config = JSON.parse(Config.read_config_file)["config"].symbolize_keys
157
- self.config = config.merge(loaded_config).slice(*config_keys)
157
+ self.config = config.merge(loaded_config)
158
158
  end
159
159
 
160
160
  def load_config_from_env
@@ -169,9 +169,9 @@ module ConvoxInstaller
169
169
  end
170
170
 
171
171
  def save_config_to_file
172
- FileUtils.mkdir_p File.expand_path("~/.convox")
173
- File.open(CONFIG_FILE, "w") do |f|
174
- f.puts({config: config}.to_json)
172
+ # FileUtils.mkdir_p File.expand_path("~/.convox")
173
+ File.open(CONFIG_FILE, 'w') do |f|
174
+ f.puts(JSON.pretty_generate(config: config))
175
175
  end
176
176
  end
177
177
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ConvoxInstaller
4
- VERSION = "1.0.4"
4
+ VERSION = "1.0.8"
5
5
  end
@@ -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
4
+ version: 1.0.8
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: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2021-11-12 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.1.2
131
+ rubygems_version: 3.2.11
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Build a Convox installation workflow