gem-wizard 0.0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/{gem-wizard → gem-wizard-start} +0 -0
- data/lib/gem_wizard.rb +29 -12
- data/lib/gems.json +14 -0
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7610f896cb1e67c4986c3210058b3ec2fe07e5580d113fe864fdd7f89ff88304
|
4
|
+
data.tar.gz: 3346f06c038f59f03cf1706810a8d2097b8699abdce14f9a73dc8f4178ba6a60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fa42d2c17b6513383d776ac2dbbb5b1501972e133ce55f73f43d2cc4aa1f6614b7bd6e68843a7659b6744de98f3907aae9c88d4758fd035b65edf74521b5116
|
7
|
+
data.tar.gz: aa5ac997985f27eb67aed5236a0bc560522a771c5d045df4a2289fe0f07eb8b5c375a8dec7c319900cd19e83a4cdf69bafc4a1e75e71227bb5b7578722709d33
|
File without changes
|
data/lib/gem_wizard.rb
CHANGED
@@ -1,27 +1,44 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
class GemWizard
|
2
4
|
|
5
|
+
#----- asking the right questions -----#
|
3
6
|
def self.start
|
4
|
-
|
5
|
-
|
7
|
+
file_path = File.join( File.dirname(__FILE__), 'gems.json')
|
8
|
+
file = File.read(file_path)
|
9
|
+
gems = JSON.parse(file)
|
10
|
+
|
11
|
+
@post_install_commands = []
|
12
|
+
|
13
|
+
gems.each do |gem|
|
14
|
+
puts gem['prompt']
|
6
15
|
|
7
|
-
|
16
|
+
system("bundle add #{gem['name']}") if boolean(gets.chomp)
|
8
17
|
|
9
|
-
|
18
|
+
ask_sub_prompts(gem['sub_prompts'])
|
19
|
+
end
|
10
20
|
|
11
21
|
gemify!
|
12
22
|
end
|
13
23
|
|
14
|
-
def self.
|
15
|
-
|
16
|
-
|
24
|
+
def self.ask_sub_prompts(sub_prompts)
|
25
|
+
sub_prompts.each do |prompt|
|
26
|
+
puts prompt['message']
|
17
27
|
|
18
|
-
|
19
|
-
|
28
|
+
@post_install_commands << prompt['commands_if_accepted'] if boolean(gets.chomp)
|
29
|
+
end
|
20
30
|
end
|
21
31
|
|
32
|
+
#----- where the magic happens -----#
|
22
33
|
def self.gemify!
|
23
|
-
system('bundle add haml-rails') if @use_haml == true
|
24
34
|
system('bundle install')
|
25
|
-
system('
|
35
|
+
system(@post_install_commands.flatten.join(' '))
|
36
|
+
end
|
37
|
+
|
38
|
+
#----- helper methods -----#
|
39
|
+
def self.boolean(string)
|
40
|
+
return true if 'y'.casecmp(string).zero? || 'yes'.casecmp(string).zero? || 'true'.casecmp(string).zero?
|
41
|
+
|
42
|
+
false
|
26
43
|
end
|
27
|
-
end
|
44
|
+
end
|
data/lib/gems.json
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"name": "haml-rails",
|
4
|
+
"prompt": "Do you want to use haml views instead of erb? [Y/N]",
|
5
|
+
"sub_prompts": [
|
6
|
+
{
|
7
|
+
"message": "Convert all existing view files to haml? [Y/N]",
|
8
|
+
"commands_if_accepted:": [
|
9
|
+
"HAML_RAILS_DELETE_ERB=true rails haml:erb2haml"
|
10
|
+
]
|
11
|
+
}
|
12
|
+
]
|
13
|
+
}
|
14
|
+
]
|
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.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Paul
|
@@ -9,16 +9,31 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2022-07-28 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.13.1
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.13.1
|
13
27
|
description: Install and setup essential gems for a rails application.
|
14
28
|
email: john@rockfort.city
|
15
29
|
executables:
|
16
|
-
- gem-wizard
|
30
|
+
- gem-wizard-start
|
17
31
|
extensions: []
|
18
32
|
extra_rdoc_files: []
|
19
33
|
files:
|
20
|
-
- bin/gem-wizard
|
34
|
+
- bin/gem-wizard-start
|
21
35
|
- lib/gem_wizard.rb
|
36
|
+
- lib/gems.json
|
22
37
|
homepage:
|
23
38
|
licenses:
|
24
39
|
- MIT
|