rails-interactive 0.1.8 → 2.0.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.
- checksums.yaml +4 -4
- data/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +9 -0
- data/.github/workflows/main.yml +57 -57
- data/.rubocop.yml +9 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +77 -72
- data/bin/console +2 -9
- data/lib/cli/categories.rb +18 -0
- data/lib/cli/commands.rb +22 -0
- data/lib/cli/config/categories.yml +51 -0
- data/lib/cli/config/commands.yml +128 -0
- data/lib/cli/message.rb +55 -0
- data/lib/cli/prompt.rb +42 -0
- data/lib/{rails_interactive → cli}/templates/setup_avo.rb +0 -0
- data/lib/cli/templates/setup_awesome_print.rb +4 -0
- data/lib/cli/templates/setup_better_errors.rb +8 -0
- data/lib/{rails_interactive → cli}/templates/setup_brakeman.rb +0 -0
- data/lib/cli/templates/setup_bullet.rb +7 -0
- data/lib/{rails_interactive → cli}/templates/setup_cancancan.rb +0 -0
- data/lib/{rails_interactive → cli}/templates/setup_devise.rb +0 -0
- data/lib/cli/templates/setup_faker.rb +5 -0
- data/lib/cli/templates/setup_friendly_id.rb +5 -0
- data/lib/{rails_interactive → cli}/templates/setup_graphql.rb +0 -0
- data/lib/{rails_interactive → cli}/templates/setup_haml.rb +0 -0
- data/lib/{rails_interactive → cli}/templates/setup_kaminari.rb +0 -0
- data/lib/cli/templates/setup_letter_opener.rb +15 -0
- data/lib/{rails_interactive → cli}/templates/setup_omniauth.rb +0 -0
- data/lib/{rails_interactive → cli}/templates/setup_pundit.rb +0 -0
- data/lib/{rails_interactive → cli}/templates/setup_rails_admin.rb +0 -0
- data/lib/{rails_interactive → cli}/templates/setup_rspec.rb +0 -0
- data/lib/{rails_interactive → cli}/templates/setup_rubocop.rb +0 -0
- data/lib/{rails_interactive → cli}/templates/setup_sidekiq.rb +0 -0
- data/lib/{rails_interactive → cli}/templates/setup_slim.rb +0 -0
- data/lib/{rails_interactive → cli}/templates/setup_standardrb.rb +0 -0
- data/lib/cli/utils.rb +48 -0
- data/lib/{rails_interactive → cli}/version.rb +3 -1
- data/lib/rails_interactive.rb +68 -81
- data/rails-interactive.gemspec +4 -2
- metadata +60 -20
- data/lib/rails_interactive/message.rb +0 -52
- data/lib/rails_interactive/prompt.rb +0 -40
data/lib/cli/message.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "colorize"
|
4
|
+
|
5
|
+
module RailsInteractive
|
6
|
+
class CLI
|
7
|
+
# Utils class for the interactive CLI module
|
8
|
+
class Message
|
9
|
+
def self.greet
|
10
|
+
render_ascii
|
11
|
+
puts "Welcome to Rails Interactive CLI".colorize(:yellow)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.help
|
15
|
+
puts "bin/interactive new - Create a new Rails Project".colorize(:yellow)
|
16
|
+
puts "bin/interactive help - List all commands".colorize(:yellow)
|
17
|
+
exit
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.render_ascii
|
21
|
+
# rubocop:disable Naming/HeredocDelimiterNaming
|
22
|
+
puts <<-'EOF'
|
23
|
+
_____ _ _ _____ _ _ _
|
24
|
+
| __ \ (_) | |_ _| | | | | (_)
|
25
|
+
| |__) |__ _ _| |___ | | _ __ | |_ ___ _ __ __ _ ___| |_ ___ _____
|
26
|
+
| _ // _` | | / __| | | | '_ \| __/ _ \ '__/ _` |/ __| __| \ \ / / _ \
|
27
|
+
| | \ \ (_| | | \__ \_| |_| | | | || __/ | | (_| | (__| |_| |\ V / __/
|
28
|
+
|_| \_\__,_|_|_|___/_____|_| |_|\__\___|_| \__,_|\___|\__|_| \_/ \___|
|
29
|
+
|
30
|
+
EOF
|
31
|
+
# rubocop:enable Naming/HeredocDelimiterNaming
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.prepare
|
35
|
+
puts ""
|
36
|
+
puts "Project created successfully ✅".colorize(:green)
|
37
|
+
puts "Go to your project folder and ready to go 🎉".colorize(:green)
|
38
|
+
rails_commands
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.rails_commands
|
42
|
+
puts "You can run several commands:".colorize(:green)
|
43
|
+
|
44
|
+
puts "Starts the webpack development server".colorize(:cyan)
|
45
|
+
puts "> bin/webpack-dev-server".colorize(:yellow)
|
46
|
+
|
47
|
+
puts "Starts the rails server".colorize(:cyan)
|
48
|
+
puts "> bin/rails s or bin/rails server".colorize(:yellow)
|
49
|
+
|
50
|
+
puts "Starts the rails console".colorize(:cyan)
|
51
|
+
puts "> bin/rails c or bin/rails console".colorize(:yellow)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/cli/prompt.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tty/prompt"
|
4
|
+
|
5
|
+
module RailsInteractive
|
6
|
+
class CLI
|
7
|
+
# Prompt class for commands
|
8
|
+
class Prompt
|
9
|
+
# Create a new instance
|
10
|
+
#
|
11
|
+
# @param msg [String] the message to display
|
12
|
+
# @param type [String] the type of prompt
|
13
|
+
# @param options [Array] the options to display
|
14
|
+
# @param required [Boolean] whether the prompt value is required
|
15
|
+
#
|
16
|
+
# @return [Interactive::Prompt] the new instance
|
17
|
+
def initialize(msg, type, options = nil, required: false)
|
18
|
+
@msg = msg
|
19
|
+
@type = type
|
20
|
+
@options = options
|
21
|
+
@required = required
|
22
|
+
@prompt = TTY::Prompt.new
|
23
|
+
end
|
24
|
+
|
25
|
+
# Perform the prompt
|
26
|
+
#
|
27
|
+
# @return [String] the value of the prompt
|
28
|
+
def perform
|
29
|
+
case @type
|
30
|
+
when "ask"
|
31
|
+
@prompt.ask(@msg, required: @required)
|
32
|
+
when "select"
|
33
|
+
@prompt.select(@msg, @options, required: @required)
|
34
|
+
when "multi_select"
|
35
|
+
@prompt.multi_select(@msg, @options)
|
36
|
+
else
|
37
|
+
puts "Invalid parameter"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
run 'bundle add letter_opener --group "development"'
|
4
|
+
|
5
|
+
Bundler.with_unbundled_env { run "bundle install" }
|
6
|
+
|
7
|
+
inject_into_file "config/environments/development.rb", after: "config.action_mailer.perform_caching = false\n" do
|
8
|
+
<<-RUBY
|
9
|
+
|
10
|
+
config.action_mailer.delivery_method = :letter_opener
|
11
|
+
config.action_mailer.perform_deliveries = true
|
12
|
+
RUBY
|
13
|
+
end
|
14
|
+
|
15
|
+
puts "Letter Opener is now installed!"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/cli/utils.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "fileutils"
|
4
|
+
|
5
|
+
module RailsInteractive
|
6
|
+
class CLI
|
7
|
+
class Utils
|
8
|
+
def self.humanize(value)
|
9
|
+
return nil if value.nil?
|
10
|
+
|
11
|
+
value
|
12
|
+
.gsub(/^[\s_]+|[\s_]+$/, "")
|
13
|
+
.gsub(/[_\s]+/, " ")
|
14
|
+
.gsub(/^[a-z]/, &:upcase)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.remove_templates(_project_name)
|
18
|
+
FileUtils.rm_rf("templates")
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.go_to_project_directory(project_name)
|
22
|
+
Dir.chdir "./#{project_name}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.copy_templates_to_project(project_name)
|
26
|
+
FileUtils.cp_r "#{__dir__}/templates", "./#{project_name}"
|
27
|
+
|
28
|
+
go_to_project_directory(project_name)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.handle_multi_options(multi_options)
|
32
|
+
multi_options.each do |value|
|
33
|
+
system("bin/rails app:template LOCATION=templates/setup_#{value}.rb")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.handle_option(option)
|
38
|
+
system("bin/rails app:template LOCATION=templates/setup_#{option}.rb")
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.sign_project
|
42
|
+
file = "README.md"
|
43
|
+
msg = "\n> This project was generated by [Rails Interactive CLI](https://github.com/oguzsh/rails-interactive)"
|
44
|
+
File.write(file, msg, mode: "a+")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/rails_interactive.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
4
|
-
require "
|
5
|
-
require "
|
3
|
+
require "cli/prompt"
|
4
|
+
require "cli/message"
|
5
|
+
require "cli/commands"
|
6
|
+
require "cli/categories"
|
7
|
+
require "cli/utils"
|
6
8
|
|
7
9
|
module RailsInteractive
|
8
10
|
# CLI class for the interactive CLI module
|
9
11
|
class CLI
|
10
12
|
def initialize
|
11
13
|
@inputs = {}
|
14
|
+
@commands = Commands.new
|
15
|
+
@categories = Categories.new
|
12
16
|
end
|
13
17
|
|
14
18
|
def perform(key)
|
@@ -23,117 +27,100 @@ module RailsInteractive
|
|
23
27
|
end
|
24
28
|
end
|
25
29
|
|
30
|
+
private
|
31
|
+
|
32
|
+
def categories_with_commands
|
33
|
+
@categories.all.each do |category|
|
34
|
+
commands = []
|
35
|
+
@commands.all.each { |command| commands << command if command["category"] == category["name"] }
|
36
|
+
category["commands"] = commands
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
26
40
|
def initialize_project
|
27
41
|
name
|
28
42
|
type
|
29
43
|
database
|
30
|
-
features
|
31
|
-
code_quality_tool
|
32
|
-
template_engines
|
33
|
-
admin_panel
|
34
|
-
testing_tools
|
35
|
-
|
36
|
-
create
|
37
|
-
end
|
38
|
-
|
39
|
-
def create
|
40
|
-
# Install gems
|
41
|
-
system("bin/setup")
|
42
|
-
# Create project
|
43
|
-
system(setup)
|
44
44
|
|
45
|
-
|
45
|
+
categories_with_commands.each do |category|
|
46
|
+
category_name = category["name"]
|
47
|
+
category_type = category["type"]
|
48
|
+
category_command_list = create_command_list(category["commands"], category_type)
|
46
49
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
handle_multi_options(key: :features)
|
52
|
-
|
53
|
-
# Code Quality Template
|
54
|
-
system("bin/rails app:template LOCATION=templates/setup_#{@inputs[:code_quality_tool]}.rb")
|
55
|
-
|
56
|
-
# HTML Template Engines
|
57
|
-
system("bin/rails app:template LOCATION=templates/setup_#{@inputs[:template_engine]}.rb")
|
58
|
-
|
59
|
-
# Admin Panel Template
|
60
|
-
system("bin/rails app:template LOCATION=templates/setup_#{@inputs[:admin_panel]}.rb")
|
61
|
-
|
62
|
-
# Testing tools Template
|
63
|
-
handle_multi_options(key: :testing_tools)
|
50
|
+
@inputs[category_name.to_sym] =
|
51
|
+
Prompt.new("Choose #{Utils.humanize(category_name)} gems: ", category_type.to_s,
|
52
|
+
category_command_list).perform
|
53
|
+
end
|
64
54
|
|
65
|
-
|
66
|
-
Message.prepare
|
55
|
+
create_project
|
67
56
|
end
|
68
57
|
|
69
58
|
def setup
|
70
59
|
base = "rails new"
|
71
60
|
cmd = ""
|
72
61
|
|
73
|
-
@inputs.first(3).each { |_key, value| cmd += "#{value} " }
|
74
|
-
|
75
|
-
"#{base} #{cmd}".strip!
|
76
|
-
end
|
62
|
+
@inputs.first(3).each { |_key, value| cmd += "#{value} " unless value.empty? }
|
77
63
|
|
78
|
-
|
79
|
-
FileUtils.cp_r "#{__dir__}/rails_interactive/templates", "./#{@inputs[:name]}"
|
64
|
+
"#{base} #{cmd} -q"
|
80
65
|
end
|
81
66
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
67
|
+
def create_project
|
68
|
+
# Install gems
|
69
|
+
system("bin/setup")
|
70
|
+
# Create project
|
71
|
+
system(setup)
|
72
|
+
# Install gems
|
73
|
+
intall_gems
|
74
|
+
# Prepare project requirements and give instructions
|
75
|
+
Utils.sign_project
|
76
|
+
Message.prepare
|
88
77
|
end
|
89
78
|
|
90
|
-
def
|
91
|
-
|
92
|
-
end
|
79
|
+
def create_command_list(commands, category_type)
|
80
|
+
return nil if commands.nil? || category_type.nil?
|
93
81
|
|
94
|
-
|
95
|
-
types = { "App" => "", "API" => "--api" }
|
96
|
-
@inputs[:type] = Prompt.new("Choose project type: ", "select", types, required: true).perform
|
97
|
-
end
|
82
|
+
list = category_type == "select" ? {} : []
|
98
83
|
|
99
|
-
|
100
|
-
|
84
|
+
commands.each do |command|
|
85
|
+
if list.is_a?(Hash)
|
86
|
+
list["None"] = nil
|
87
|
+
list[command["name"]] = command["identifier"]
|
88
|
+
else
|
89
|
+
list << command["identifier"]
|
90
|
+
end
|
91
|
+
end
|
101
92
|
|
102
|
-
|
93
|
+
list
|
103
94
|
end
|
104
95
|
|
105
|
-
def
|
106
|
-
|
96
|
+
def intall_gems
|
97
|
+
# Copy template files to project folder
|
98
|
+
Utils.copy_templates_to_project(@inputs[:name])
|
107
99
|
|
108
|
-
@inputs
|
109
|
-
|
100
|
+
@inputs.each do |key, value|
|
101
|
+
next if %i[name type database].include?(key) || value.is_a?(Array) && value.empty? || value.nil?
|
110
102
|
|
111
|
-
|
112
|
-
|
103
|
+
Utils.handle_multi_options(value) if value.is_a?(Array)
|
104
|
+
Utils.handle_option(value) if value.is_a?(String)
|
105
|
+
end
|
113
106
|
|
114
|
-
|
115
|
-
|
107
|
+
# Remove templates folder from project folder
|
108
|
+
Utils.remove_templates(@inputs[:name])
|
116
109
|
end
|
117
110
|
|
118
|
-
def
|
119
|
-
|
120
|
-
|
121
|
-
@inputs[:admin_panel] =
|
122
|
-
Prompt.new("Choose project's admin panel: ", "select", admin_panel).perform
|
111
|
+
def name
|
112
|
+
@inputs[:name] = Prompt.new("Project name: ", "ask", required: true).perform
|
123
113
|
end
|
124
114
|
|
125
|
-
def
|
126
|
-
|
127
|
-
|
128
|
-
@inputs[:testing_tools] =
|
129
|
-
Prompt.new("Choose project's testing tools: ", "multi_select", testing_tools).perform
|
115
|
+
def type
|
116
|
+
types = { "App" => "", "Api" => "--api" }
|
117
|
+
@inputs[:type] = Prompt.new("Type: ", "select", types, required: true).perform
|
130
118
|
end
|
131
119
|
|
132
|
-
def
|
133
|
-
|
120
|
+
def database
|
121
|
+
database_types = { "PostgreSQL" => "-d postgresql", "MySQL" => "-d mysql", "SQLite" => "" }
|
134
122
|
|
135
|
-
@inputs[:
|
136
|
-
Prompt.new("Choose project's template engine: ", "select", template_engines).perform
|
123
|
+
@inputs[:database] = Prompt.new("Database: ", "select", database_types, required: true).perform
|
137
124
|
end
|
138
125
|
end
|
139
126
|
end
|
data/rails-interactive.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "lib/
|
3
|
+
require_relative "lib/cli/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "rails-interactive"
|
7
|
-
spec.version = RailsInteractive::VERSION
|
7
|
+
spec.version = RailsInteractive::CLI::VERSION
|
8
8
|
spec.authors = ["Oguzhan Ince"]
|
9
9
|
spec.email = ["oguzhan824@gmail.com"]
|
10
10
|
|
@@ -29,9 +29,11 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "bundler"
|
30
30
|
spec.add_development_dependency "byebug", "~> 11.1.2"
|
31
31
|
spec.add_development_dependency "colorize"
|
32
|
+
spec.add_development_dependency "pry"
|
32
33
|
spec.add_development_dependency "rake"
|
33
34
|
spec.add_development_dependency "rspec"
|
34
35
|
spec.add_development_dependency "rubocop"
|
36
|
+
spec.add_development_dependency "yaml"
|
35
37
|
|
36
38
|
spec.add_dependency "tty-prompt"
|
37
39
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-interactive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oguzhan Ince
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: yaml
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: tty-prompt
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,6 +147,7 @@ extensions: []
|
|
119
147
|
extra_rdoc_files: []
|
120
148
|
files:
|
121
149
|
- ".github/FUNDING.yml"
|
150
|
+
- ".github/PULL_REQUEST_TEMPLATE/pull_request_template.md"
|
122
151
|
- ".github/workflows/main.yml"
|
123
152
|
- ".github/workflows/rspec_rubocop.yml"
|
124
153
|
- ".gitignore"
|
@@ -134,25 +163,36 @@ files:
|
|
134
163
|
- bin/console
|
135
164
|
- bin/rails-interactive
|
136
165
|
- bin/setup
|
166
|
+
- lib/cli/categories.rb
|
167
|
+
- lib/cli/commands.rb
|
168
|
+
- lib/cli/config/categories.yml
|
169
|
+
- lib/cli/config/commands.yml
|
170
|
+
- lib/cli/message.rb
|
171
|
+
- lib/cli/prompt.rb
|
172
|
+
- lib/cli/templates/setup_avo.rb
|
173
|
+
- lib/cli/templates/setup_awesome_print.rb
|
174
|
+
- lib/cli/templates/setup_better_errors.rb
|
175
|
+
- lib/cli/templates/setup_brakeman.rb
|
176
|
+
- lib/cli/templates/setup_bullet.rb
|
177
|
+
- lib/cli/templates/setup_cancancan.rb
|
178
|
+
- lib/cli/templates/setup_devise.rb
|
179
|
+
- lib/cli/templates/setup_faker.rb
|
180
|
+
- lib/cli/templates/setup_friendly_id.rb
|
181
|
+
- lib/cli/templates/setup_graphql.rb
|
182
|
+
- lib/cli/templates/setup_haml.rb
|
183
|
+
- lib/cli/templates/setup_kaminari.rb
|
184
|
+
- lib/cli/templates/setup_letter_opener.rb
|
185
|
+
- lib/cli/templates/setup_omniauth.rb
|
186
|
+
- lib/cli/templates/setup_pundit.rb
|
187
|
+
- lib/cli/templates/setup_rails_admin.rb
|
188
|
+
- lib/cli/templates/setup_rspec.rb
|
189
|
+
- lib/cli/templates/setup_rubocop.rb
|
190
|
+
- lib/cli/templates/setup_sidekiq.rb
|
191
|
+
- lib/cli/templates/setup_slim.rb
|
192
|
+
- lib/cli/templates/setup_standardrb.rb
|
193
|
+
- lib/cli/utils.rb
|
194
|
+
- lib/cli/version.rb
|
137
195
|
- lib/rails_interactive.rb
|
138
|
-
- lib/rails_interactive/message.rb
|
139
|
-
- lib/rails_interactive/prompt.rb
|
140
|
-
- lib/rails_interactive/templates/setup_avo.rb
|
141
|
-
- lib/rails_interactive/templates/setup_brakeman.rb
|
142
|
-
- lib/rails_interactive/templates/setup_cancancan.rb
|
143
|
-
- lib/rails_interactive/templates/setup_devise.rb
|
144
|
-
- lib/rails_interactive/templates/setup_graphql.rb
|
145
|
-
- lib/rails_interactive/templates/setup_haml.rb
|
146
|
-
- lib/rails_interactive/templates/setup_kaminari.rb
|
147
|
-
- lib/rails_interactive/templates/setup_omniauth.rb
|
148
|
-
- lib/rails_interactive/templates/setup_pundit.rb
|
149
|
-
- lib/rails_interactive/templates/setup_rails_admin.rb
|
150
|
-
- lib/rails_interactive/templates/setup_rspec.rb
|
151
|
-
- lib/rails_interactive/templates/setup_rubocop.rb
|
152
|
-
- lib/rails_interactive/templates/setup_sidekiq.rb
|
153
|
-
- lib/rails_interactive/templates/setup_slim.rb
|
154
|
-
- lib/rails_interactive/templates/setup_standardrb.rb
|
155
|
-
- lib/rails_interactive/version.rb
|
156
196
|
- rails-interactive.gemspec
|
157
197
|
homepage: https://github.com/oguzsh/rails-interactive
|
158
198
|
licenses:
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "colorize"
|
4
|
-
|
5
|
-
module RailsInteractive
|
6
|
-
# Utils class for the interactive CLI module
|
7
|
-
class Message
|
8
|
-
def self.greet
|
9
|
-
render_ascii
|
10
|
-
puts "Welcome to Rails Interactive CLI".colorize(:yellow)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.help
|
14
|
-
puts "bin/interactive new - Create a new Rails Project".colorize(:yellow)
|
15
|
-
puts "bin/interactive help - List all commands".colorize(:yellow)
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.render_ascii
|
20
|
-
# rubocop:disable Naming/HeredocDelimiterNaming
|
21
|
-
puts <<-'EOF'
|
22
|
-
___ _ _ _ ____ _ _
|
23
|
-
|_ _|_ __ | |_ ___ _ __ __ _ ___| |_(_)_ _____| _ \ __ _(_) |___
|
24
|
-
| || '_ \| __/ _ \ '__/ _` |/ __| __| \ \ / / _ \ |_) / _` | | / __|
|
25
|
-
| || | | | || __/ | | (_| | (__| |_| |\ V / __/ _ < (_| | | \__ \
|
26
|
-
|___|_| |_|\__\___|_| \__,_|\___|\__|_| \_/ \___|_| \_\__,_|_|_|___/
|
27
|
-
|
28
|
-
EOF
|
29
|
-
# rubocop:enable Naming/HeredocDelimiterNaming
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.prepare
|
33
|
-
puts ""
|
34
|
-
puts "Project created successfully ✅".colorize(:green)
|
35
|
-
puts "Go to your project folder and ready to go 🎉".colorize(:green)
|
36
|
-
rails_commands
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.rails_commands
|
40
|
-
puts "You can run several commands:".colorize(:green)
|
41
|
-
|
42
|
-
puts "Starts the webpack development server".colorize(:cyan)
|
43
|
-
puts "> bin/webpack-dev-server".colorize(:yellow)
|
44
|
-
|
45
|
-
puts "Starts the rails server".colorize(:cyan)
|
46
|
-
puts "> bin/rails s or bin/rails server".colorize(:yellow)
|
47
|
-
|
48
|
-
puts "Starts the rails console".colorize(:cyan)
|
49
|
-
puts "> bin/rails c or bin/rails console".colorize(:yellow)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|