gem-wizard 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gem_wizard.rb +13 -3
- data/lib/gems.json +14 -1
- 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: c0308f010276c86971acb8eeff4c0bea275a307e2dde8d39e93e544225dae295
|
4
|
+
data.tar.gz: 2b0ef8d841129b958c1b35b222411835ea02dcb18d7da1a2e19a4368b7c0ea97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb5e3c8744359d39c844d5cb17a766ca1383c245b34e3de28254e9795fb035be27a8ad2f6e3458cce4d7d0115c91e296b156f276cb26e7c7ea642ee39080b7d3
|
7
|
+
data.tar.gz: cd53651c2cad1d34b8fcc49f5d6544f0dc8d3d41141cbd81f7988a8889c6e155642bcaedcbac74500ad36244a4166fb0c3ff1487a185df8da2f929122876a26b
|
data/lib/gem_wizard.rb
CHANGED
@@ -8,14 +8,20 @@ class GemWizard
|
|
8
8
|
file = File.read(file_path)
|
9
9
|
gems = JSON.parse(file)
|
10
10
|
|
11
|
+
@pre_install_commands = []
|
11
12
|
@post_install_commands = []
|
12
13
|
|
13
14
|
gems.each do |gem|
|
14
15
|
puts gem['prompt']
|
15
16
|
|
16
|
-
|
17
|
+
if boolean(gets.chomp)
|
18
|
+
gem_groups = gem['gem_groups'].join(' ') unless gem['gem_groups'].nil?
|
19
|
+
command = "bundle add #{gem['name']} #{!gem_groups.nil? ? "--group #{gem_groups}" : nil}"
|
17
20
|
|
18
|
-
|
21
|
+
@pre_install_commands << command
|
22
|
+
|
23
|
+
ask_sub_prompts(gem['sub_prompts'])
|
24
|
+
end
|
19
25
|
end
|
20
26
|
|
21
27
|
gemify!
|
@@ -25,12 +31,16 @@ class GemWizard
|
|
25
31
|
sub_prompts.each do |prompt|
|
26
32
|
puts prompt['message']
|
27
33
|
|
28
|
-
|
34
|
+
if boolean(gets.chomp)
|
35
|
+
@pre_install_commands << prompt['pre_install_commands'] unless prompt['pre_install_commands'].nil?
|
36
|
+
@post_install_commands << prompt['post_install_commands'] unless prompt['post_install_commands'].nil?
|
37
|
+
end
|
29
38
|
end
|
30
39
|
end
|
31
40
|
|
32
41
|
#----- where the magic happens -----#
|
33
42
|
def self.gemify!
|
43
|
+
system(@pre_install_commands.flatten.join(' '))
|
34
44
|
system('bundle install')
|
35
45
|
system(@post_install_commands.flatten.join(' '))
|
36
46
|
end
|
data/lib/gems.json
CHANGED
@@ -5,10 +5,23 @@
|
|
5
5
|
"sub_prompts": [
|
6
6
|
{
|
7
7
|
"message": "Convert all existing view files to haml? [Y/N]",
|
8
|
-
"
|
8
|
+
"post_install_commands:": [
|
9
9
|
"HAML_RAILS_DELETE_ERB=true rails haml:erb2haml"
|
10
10
|
]
|
11
11
|
}
|
12
12
|
]
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"name": "better_errors",
|
16
|
+
"gem_groups": ["development"],
|
17
|
+
"prompt": "Do you want to use better errors to view errors on the browser? [Y/N]",
|
18
|
+
"sub_prompts": [
|
19
|
+
{
|
20
|
+
"message": "Do you want to use advanced features like REPL, local/instance variable inspection and pretty stack frame names? [Y/N]",
|
21
|
+
"pre_install_commands:": [
|
22
|
+
"bundle add binding_of_caller --group 'development'"
|
23
|
+
]
|
24
|
+
}
|
25
|
+
]
|
13
26
|
}
|
14
27
|
]
|