gem-wizard 0.1.1 → 0.2.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gem_wizard.rb +13 -3
  3. data/lib/gems.json +14 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7610f896cb1e67c4986c3210058b3ec2fe07e5580d113fe864fdd7f89ff88304
4
- data.tar.gz: 3346f06c038f59f03cf1706810a8d2097b8699abdce14f9a73dc8f4178ba6a60
3
+ metadata.gz: c0308f010276c86971acb8eeff4c0bea275a307e2dde8d39e93e544225dae295
4
+ data.tar.gz: 2b0ef8d841129b958c1b35b222411835ea02dcb18d7da1a2e19a4368b7c0ea97
5
5
  SHA512:
6
- metadata.gz: 2fa42d2c17b6513383d776ac2dbbb5b1501972e133ce55f73f43d2cc4aa1f6614b7bd6e68843a7659b6744de98f3907aae9c88d4758fd035b65edf74521b5116
7
- data.tar.gz: aa5ac997985f27eb67aed5236a0bc560522a771c5d045df4a2289fe0f07eb8b5c375a8dec7c319900cd19e83a4cdf69bafc4a1e75e71227bb5b7578722709d33
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
- system("bundle add #{gem['name']}") if boolean(gets.chomp)
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
- ask_sub_prompts(gem['sub_prompts'])
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
- @post_install_commands << prompt['commands_if_accepted'] if boolean(gets.chomp)
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
- "commands_if_accepted:": [
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
  ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-wizard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Paul