env_bro 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +1 -1
- data/lib/env_bro/version.rb +1 -1
- data/lib/generators/env_bro/install/install_generator.rb +17 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9df4fc28acfe1ed6dd8893dbcdbfc44c179f29d38182250b400b01972d1e156b
|
|
4
|
+
data.tar.gz: 2e2237a10f5337e0aabb232431096ea6352af08dedc367656212093cc98f1870
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9deb98e680ecad5343371d9a075ce5b312837185508543d3d62120547f877434ce490c52dad7e6f1f1750cced9cd50fd9c0d3ee62dc6ffbdb713054bdac10430
|
|
7
|
+
data.tar.gz: e1d0586feacd8e660c0d31cc6c167fef6dd6284fd8125c69aa07c5343d2e66d00523f20a9b2835ca60536da1ef06f3323ffe40a54144cb6fb9abda0a93705e9c
|
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
|
|
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
|
|
data/lib/env_bro/version.rb
CHANGED
|
@@ -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
|
-
|
|
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 => "#{
|
|
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 #{
|
|
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
|