env_bro 0.1.0 → 0.1.2

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
  SHA256:
3
- metadata.gz: 1f301689d1d2681e1d23b16f86096cc97c14824c932cf4612fede79b9c6b6803
4
- data.tar.gz: 48cc9e85161a1b69d3d3e55a5fe4fc977a77679b22d4d0ff8445490ac5d0006a
3
+ metadata.gz: 3a59b7350b701724e75c49dd18a2b49c547d26c310148309e815926cabbeb748
4
+ data.tar.gz: 602af135dd3431a9fcc12dbaf15d144b63436a6d508b9b80464f7d9a5446a504
5
5
  SHA512:
6
- metadata.gz: 50852fb63ffc0305c19e15d9f9dc530f4d3e8df1ddcb00c76d821a90b5b6f872bac641bfc62a110e3c48f353302c59928cef834f6ed03d91f01fd60b35f92fd4
7
- data.tar.gz: 6cfb17faf7c08792749b74cb67a5a4d8e214d9200d0f0bbfa73e81660e6407aa446fde5a498b4f438e4be7a59c622c91c820e01115fbe3773a4fb2166e3c8385
6
+ metadata.gz: 2225c57379b3649247942f9c29c231532f33caeb8b0e2e62c05d7e385fde182ba749336ea4a4f0e4b9b34693d5adc3d066b624ab9e6815959bb05168d2061fdf
7
+ data.tar.gz: 786be05f5a2ef29c88530975c95e7219ff68acd24d8f77e457db76d58ccc12d89b05dc98b1db37b1c3c845e49e9716019bca9073ebfa4afee806234929b054a8
data/README.md CHANGED
@@ -39,7 +39,7 @@ gem "env_bro", git: "https://github.com/rubydevro/env_bro.git"
39
39
  ```
40
40
 
41
41
  ```sh
42
- bin/rails generate env_bro:install # initializer, route, migration (--mount-path=/admin/env)
42
+ bin/rails generate env_bro:install # initializer, route (asks for the path; or --mount-path=/admin/env), migration
43
43
  bin/rails db:migrate
44
44
  ```
45
45
 
@@ -4,7 +4,8 @@ class CreateEnvBroAuditEvents < ActiveRecord::Migration[7.1]
4
4
  t.string :event, null: false
5
5
  t.string :user_label
6
6
  t.string :environment, null: false
7
- t.json :details, null: false, default: {}
7
+ # No column default: MySQL rejects defaults on JSON columns. Audit.record always sets it.
8
+ t.json :details, null: false
8
9
 
9
10
  # proposal_created: the id embedded in the file's metadata and the SHA-256 of the file handed out.
10
11
  # proposal_deployed: the SHA-256 of the file found running.
@@ -1,3 +1,3 @@
1
1
  module EnvBro
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -8,7 +8,10 @@ module EnvBro
8
8
 
9
9
  desc "Adds the EnvBro initializer, mounts the engine and copies its migrations."
10
10
 
11
- class_option :mount_path, type: :string, default: "/admin/env", desc: "Where to mount EnvBro"
11
+ DEFAULT_MOUNT_PATH = "/admin/env"
12
+
13
+ class_option :mount_path, type: :string,
14
+ desc: "Where to mount EnvBro (asked interactively when omitted, default #{DEFAULT_MOUNT_PATH})"
12
15
 
13
16
  def copy_initializer
14
17
  copy_file "env_bro.rb", "config/initializers/env_bro.rb"
@@ -19,7 +22,7 @@ module EnvBro
19
22
  if File.exist?(routes) && File.read(routes).include?("EnvBro::Engine")
20
23
  say_status :skip, "EnvBro::Engine is already mounted", :yellow
21
24
  else
22
- route %(mount EnvBro::Engine => "#{options[:mount_path]}")
25
+ route %(mount EnvBro::Engine => "#{mount_path}")
23
26
  end
24
27
  end
25
28
 
@@ -33,9 +36,20 @@ module EnvBro
33
36
  EnvBro is installed. Next:
34
37
  1. bin/rails db:migrate
35
38
  2. Set who may propose, review and reveal in config/initializers/env_bro.rb
36
- 3. Visit #{options[:mount_path]}
39
+ 3. Visit #{mount_path}
37
40
  TEXT
38
41
  end
42
+
43
+ private
44
+ # --mount-path wins; otherwise ask when someone is at the terminal.
45
+ def mount_path
46
+ @mount_path ||= begin
47
+ path = options[:mount_path].presence
48
+ path ||= ask("Where should EnvBro be mounted?", default: DEFAULT_MOUNT_PATH) if $stdin.tty?
49
+ path = path.to_s.strip.presence || DEFAULT_MOUNT_PATH
50
+ "/" + path.delete_prefix("/").delete_suffix("/")
51
+ end
52
+ end
39
53
  end
40
54
  end
41
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: env_bro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruby Dev SRL
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubygems_version: 4.0.22
94
+ rubygems_version: 4.0.10
95
95
  specification_version: 4
96
96
  summary: Propose changes to Rails encrypted credentials without holding the keys.
97
97
  test_files: []