convox_installer 1.0.3 → 1.0.4

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: cd8e113c9a4319ce892f33540ea945422a11041a14a18c4539de5ee13e74f2da
4
- data.tar.gz: 199a6eca04906a4bf456d2bd24ab04701a95a28691c66bde7f31b1bfa3b563aa
3
+ metadata.gz: c61afa4dfbb14346d5dc9c07eb23eca17eb1e612c8fe659c74d78fc154810479
4
+ data.tar.gz: b85f7bf5513cad08955f4a7ebc8c66f35ef0995d1d481bb2779af069a2980d0b
5
5
  SHA512:
6
- metadata.gz: 17f21de2b431bd5c6e2f5b38540dd1ff83cab2fc897520a8b54cad5e8ab2c5172a1da792b2aff5fbda43f6a847875950b6686ef4c9d42e6b6eeeccfb46486e68
7
- data.tar.gz: e410c8359a5799097a7a79b5c0985141f874c36542cff8ab9c10be21c3dcd1aaefaceb168607e05d9342577f2f2f07bf7f8885d463227d934f9a59531b080820
6
+ metadata.gz: f4878d00fbe6b6111a8c316f6eb6c691f11ee5b5846628b46e1dde39eea2f2b6c510951f924e1ca51002808cdaba9662af70cd2be618627d25af94e1cb8a1a67
7
+ data.tar.gz: 9340387ce40c3ee1d41823ccc5c959638172944161c3f6ea3c74f8048d5d53706770bffcdf08f3fc464dac5543abd8f4c3f79584555da2be2f4d684fe5f083a3
data/.bundle/config CHANGED
@@ -1,2 +1,2 @@
1
1
  ---
2
- BUNDLE_JOBS: "8"
2
+ BUNDLE_JOBS: "16"
data/README.md CHANGED
@@ -8,13 +8,13 @@ Please note that the code quality is not very good, and the test coverage needs
8
8
 
9
9
  ## Features
10
10
 
11
- * Idempotent. If this script crashes, you can restart it and it will pick up
11
+ - Idempotent. If this script crashes, you can restart it and it will pick up
12
12
  where it left off. Every step looks up the existing state, and only makes a change
13
13
  if things are not yet set up (or out of sync).
14
- * Ensures that the `convox` and `aws` CLI tools are installed
15
- * Wraps the `convox` CLI and parses JSON output from API calls
16
- * Add n Docker Repository (e.g. ECR registry)
17
- * Set up an S3 bucket with an optional CORS policy
14
+ - Ensures that the `convox` and `aws` CLI tools are installed
15
+ - Wraps the `convox` CLI and parses JSON output from API calls
16
+ - Add n Docker Repository (e.g. ECR registry)
17
+ - Set up an S3 bucket with an optional CORS policy
18
18
 
19
19
  ## Introduction
20
20
 
@@ -47,11 +47,10 @@ You should create a new git repo for your own installation script, and then use
47
47
 
48
48
  You can see a complete example in [`examples/full_installation.rb`](./examples/full_installation.rb).
49
49
 
50
-
51
50
  ## Config
52
51
 
53
52
  Config is loaded from ENV vars, or from saved JSON data at
54
- `~/.convox/installer_config`. The script will save all of the user's responses into `~/.convox/installer_config`.
53
+ `./.installer_config`. The script will save all of the user's responses into `./.installer_config` (in the current directory).
55
54
 
56
55
  ## Customize the Config Prompts
57
56
 
@@ -97,7 +96,7 @@ Shows a heading and optional details.
97
96
 
98
97
  #### Config Prompt
99
98
 
100
- * A config prompt with a default value:
99
+ - A config prompt with a default value:
101
100
 
102
101
  ```ruby
103
102
  {
@@ -108,7 +107,7 @@ Shows a heading and optional details.
108
107
  }
109
108
  ```
110
109
 
111
- * Set a value from a `Proc`, and don't prompt the user:
110
+ - Set a value from a `Proc`, and don't prompt the user:
112
111
 
113
112
  ```ruby
114
113
  {
@@ -118,7 +117,7 @@ Shows a heading and optional details.
118
117
  }
119
118
  ```
120
119
 
121
- * Set a value, and hide this setting from the user (even in the summary):
120
+ - Set a value, and hide this setting from the user (even in the summary):
122
121
 
123
122
  ```ruby
124
123
  {
@@ -128,7 +127,6 @@ Shows a heading and optional details.
128
127
  },
129
128
  ```
130
129
 
131
-
132
130
  ## `ConvoxInstaller` DSL
133
131
 
134
132
  #### `ensure_requirements!`
@@ -137,7 +135,7 @@ Makes sure that the `convox` and `aws` CLI tools are installed on this system. I
137
135
 
138
136
  #### `prompt_for_config`
139
137
 
140
- Loads config from ENV vars, or from saved config at `~/.convox/installer_config`.
138
+ Loads config from ENV vars, or from saved config at `./.installer_config`.
141
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.
142
140
 
143
141
  #### `backup_convox_host_and_rack`
@@ -146,7 +144,7 @@ If there are any existing files at `~/.convox/host` or `~/.convox/rack`, this me
146
144
 
147
145
  #### `install_convox`
148
146
 
149
- * **Required Config:** `aws_region`, `aws_access_key_id`, `aws_secret_access_key`,
147
+ - **Required Config:** `aws_region`, `aws_access_key_id`, `aws_secret_access_key`,
150
148
  `stack_name`, `instance_type`
151
149
 
152
150
  Runs `convox rack install ...`. Has some validations to ensure that all required settings are present.
@@ -165,19 +163,17 @@ Returns a Ruby hash with all convox rack data.
165
163
 
166
164
  #### `create_convox_app!`
167
165
 
168
- * **Required Config:** `convox_app_name`
166
+ - **Required Config:** `convox_app_name`
169
167
 
170
168
  Checks if the app already exists. If not, calls `convox apps create ... --wait` to create a new app. Then waits for the app to be ready. (Avoids an occasional race condition.)
171
169
 
172
-
173
170
  #### `set_default_app_for_directory!`
174
171
 
175
172
  Writes the app name into `./.convox/app` (in the current directory.) The `convox` CLI reads this file, so you don't need to specify the `--app` flag for future commands.
176
173
 
177
-
178
174
  #### `create_s3_bucket!`
179
175
 
180
- * **Required Config:** `s3_bucket_name`
176
+ - **Required Config:** `s3_bucket_name`
181
177
 
182
178
  Creates an S3 bucket from the `:s3_bucket_name` config setting. This is not a default setting, so you can add something like this to your custom `@prompts`:
183
179
 
@@ -195,11 +191,11 @@ The `:value` `Proc` will generate a bucket name with a random suffix. (Avoids co
195
191
 
196
192
  #### `set_s3_bucket_cors_policy`
197
193
 
198
- * **Required Config:** `s3_bucket_name`
194
+ - **Required Config:** `s3_bucket_name`
199
195
 
200
196
  Set up a CORS policy for your S3 bucket. (`:s3_bucket_name`)
201
197
 
202
- *Note: If the `:s3_bucket_cors_policy` setting is not provided, then this method does nothing.*
198
+ _Note: If the `:s3_bucket_cors_policy` setting is not provided, then this method does nothing._
203
199
 
204
200
  You should set `:s3_bucket_cors_policy` to a JSON string. Here's how I set this up in my own `install.rb` script:
205
201
 
@@ -226,10 +222,9 @@ JSON
226
222
  ]
227
223
  ```
228
224
 
229
-
230
225
  #### `s3_bucket_details`
231
226
 
232
- * **Required Config:** `s3_bucket_name`
227
+ - **Required Config:** `s3_bucket_name`
233
228
 
234
229
  Get the S3 bucket details for `s3_bucket_name`. Parses the URL and returns a hash:
235
230
 
@@ -243,16 +238,15 @@ Get the S3 bucket details for `s3_bucket_name`. Parses the URL and returns a has
243
238
 
244
239
  I use these S3 bucket details to set env variables for my app. (`convox env set ...`)
245
240
 
246
-
247
241
  #### `add_docker_registry!`
248
242
 
249
- * **Required Config:** `docker_registry_url`, `docker_registry_username`, `docker_registry_password`
243
+ - **Required Config:** `docker_registry_url`, `docker_registry_username`, `docker_registry_password`
250
244
 
251
245
  Checks the list of registries to see if `docker_registry_url` has already been added. If not, runs `convox registries add ...` to add a new Docker registry (e.g. Docker Hub, ECR).
252
246
 
253
247
  #### `default_service_domain_name`
254
248
 
255
- * **Required Config:** `convox_app_name`, `default_service`
249
+ - **Required Config:** `convox_app_name`, `default_service`
256
250
 
257
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.)
258
252
 
@@ -284,7 +278,6 @@ If you want to run `convox env set MYVAR=value`, then you would call:
284
278
  run_convox_command! 'env set MYVAR=value'
285
279
  ```
286
280
 
287
-
288
281
  ## License
289
282
 
290
283
  [MIT](./LICENSE)
@@ -7,10 +7,10 @@ require "securerandom"
7
7
 
8
8
  module ConvoxInstaller
9
9
  class Config
10
+ CONFIG_FILE = File.expand_path("./.installer_config").freeze
11
+
10
12
  attr_accessor :logger, :config, :prompts, :highline
11
13
 
12
- CONFIG_FILE = File.expand_path("~/.convox/installer_config").freeze
13
-
14
14
  DEFAULT_PROMPTS = [
15
15
  {
16
16
  key: :stack_name,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ConvoxInstaller
4
- VERSION = "1.0.3"
4
+ VERSION = "1.0.4"
5
5
  end
@@ -4,12 +4,16 @@ require "convox_installer"
4
4
  require "securerandom"
5
5
 
6
6
  RSpec.describe ConvoxInstaller::Config do
7
+ before(:each) do
8
+ stub_const('ConvoxInstaller::Config::CONFIG_FILE', '/path/to/.installer_config')
9
+ end
10
+
7
11
  after(:each) do
8
12
  ENV.delete "AWS_REGION"
9
13
  ENV.delete "AWS_ACCESS_KEY_ID"
10
14
  end
11
15
 
12
- it "loads the saved config from ~/.convox/installer_config" do
16
+ it "loads the saved config from ./.installer_config" do
13
17
  expect(described_class).to receive(:config_file_exists?).and_return(true)
14
18
  expect(described_class).to receive(:read_config_file).and_return(
15
19
  '{ "config": { "aws_region": "us-west-2", "aws_access_key_id": "1234" } }'
@@ -88,7 +92,7 @@ Please enter your AWS Access Key ID: Please enter your AWS Secret Access Key:
88
92
  AWS Access Key ID: asdf
89
93
  AWS Secret Access Key: xkcd
90
94
 
91
- We've saved your configuration to: /Users/ndbroadbent/.convox/installer_config
95
+ We've saved your configuration to: /path/to/.installer_config
92
96
  If anything goes wrong during the installation, you can restart the script to reload the config and continue.
93
97
 
94
98
  Please double check all of these configuration details.
@@ -110,7 +114,7 @@ Please enter your AWS Access Key ID: |asdf| Please enter your AWS Secret Access
110
114
  AWS Access Key ID: sdfg
111
115
  AWS Secret Access Key: xkcd
112
116
 
113
- We've saved your configuration to: /Users/ndbroadbent/.convox/installer_config
117
+ We've saved your configuration to: /path/to/.installer_config
114
118
  If anything goes wrong during the installation, you can restart the script to reload the config and continue.
115
119
 
116
120
  Please double check all of these configuration details.
@@ -218,7 +222,7 @@ Please enter your Docker Registry Access Key ID: Please enter your Docker Regist
218
222
  Admin Email: admin@test.com
219
223
  Admin Password: 99a6f67de0c7a117
220
224
 
221
- We've saved your configuration to: /Users/ndbroadbent/.convox/installer_config
225
+ We've saved your configuration to: /path/to/.installer_config
222
226
  If anything goes wrong during the installation, you can restart the script to reload the config and continue.
223
227
 
224
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.3
4
+ version: 1.0.4
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-22 00:00:00.000000000 Z
11
+ date: 2021-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline