rails-interactive 0.1.6 → 0.1.7
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/FUNDING.yml +2 -1
- data/lib/rails_interactive/templates/setup_avo.rb +10 -0
- data/lib/rails_interactive/templates/setup_rails_admin.rb +10 -0
- data/lib/rails_interactive/templates/setup_rspec.rb +13 -0
- data/lib/rails_interactive/templates/setup_rubocop.rb +10 -0
- data/lib/rails_interactive/templates/setup_standardrb.rb +10 -0
- data/lib/rails_interactive/version.rb +1 -1
- data/lib/rails_interactive.rb +70 -14
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6afcb39a24c3349eeb1612c9718ec6eac30719daf817adba40db94cdb75b09f9
|
4
|
+
data.tar.gz: '0981f8d0e62091899e86bc90cefe2bb8bd6ad54830bc46f8ba87e6b85cfd201b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c000dc682e8459d7909ade1944799cf9106dba51eda6158d1106ff5f065f381ee3633b4521dbc51af949442e334fa289e9199f3d43e72be477cc112259ac0506
|
7
|
+
data.tar.gz: a909ff4109ea75853bfbfb7e4a1343c1812d8c2c4c9accfb92da62fb2dd5fee71d15406879e612a2e433d59bf0b591d726ddeb0a513aa5f9c057d9f95642b477
|
data/.github/FUNDING.yml
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
run "rails db:prepare"
|
4
|
+
run "bundle add avo"
|
5
|
+
|
6
|
+
Bundler.with_unbundled_env { run "bundle install" }
|
7
|
+
|
8
|
+
rails_command("generate avo:install")
|
9
|
+
|
10
|
+
puts "Avo is installed! You can go to http://localhost:3000/avo for next steps"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
run "rails db:prepare"
|
4
|
+
run "bundle add rails_admin"
|
5
|
+
|
6
|
+
Bundler.with_unbundled_env { run "bundle install" }
|
7
|
+
|
8
|
+
rails_command("generate rails_admin:install")
|
9
|
+
|
10
|
+
puts "RailsAdmin is installed! You can go to your admin panel at /admin"
|
data/lib/rails_interactive.rb
CHANGED
@@ -24,16 +24,13 @@ module RailsInteractive
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def initialize_project
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
features = %w[devise cancancan omniauth pundit brakeman sidekiq]
|
36
|
-
@inputs[:features] = Prompt.new("Choose project features: ", "multi_select", features).perform
|
27
|
+
name
|
28
|
+
type
|
29
|
+
database
|
30
|
+
features
|
31
|
+
code_quality_tool
|
32
|
+
admin_panel
|
33
|
+
testing_tools
|
37
34
|
|
38
35
|
create
|
39
36
|
end
|
@@ -48,9 +45,18 @@ module RailsInteractive
|
|
48
45
|
|
49
46
|
# Move to project folder and install gems
|
50
47
|
Dir.chdir "./#{@inputs[:name]}"
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
|
49
|
+
# Features Templates
|
50
|
+
handle_multi_options(key: :features)
|
51
|
+
|
52
|
+
# Code Quality Template
|
53
|
+
system("bin/rails app:template LOCATION=templates/setup_#{@inputs[:code_quality_tool]}.rb")
|
54
|
+
|
55
|
+
# Admin Panel Template
|
56
|
+
system("bin/rails app:template LOCATION=templates/setup_#{@inputs[:admin_panel]}.rb")
|
57
|
+
|
58
|
+
# Testing tools Template
|
59
|
+
handle_multi_options(key: :testing_tools)
|
54
60
|
|
55
61
|
# Prepare project requirements and give instructions
|
56
62
|
Message.prepare
|
@@ -60,7 +66,7 @@ module RailsInteractive
|
|
60
66
|
base = "rails new"
|
61
67
|
cmd = ""
|
62
68
|
|
63
|
-
@inputs.each { |_key, value| cmd += "#{value} " }
|
69
|
+
@inputs.first(3).each { |_key, value| cmd += "#{value} " }
|
64
70
|
|
65
71
|
"#{base} #{cmd}".strip!
|
66
72
|
end
|
@@ -68,5 +74,55 @@ module RailsInteractive
|
|
68
74
|
def copy_templates_to_project
|
69
75
|
FileUtils.cp_r "#{__dir__}/rails_interactive/templates", "./#{@inputs[:name]}"
|
70
76
|
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def handle_multi_options(key:)
|
81
|
+
@inputs[key].each do |value|
|
82
|
+
system("bin/rails app:template LOCATION=templates/setup_#{value}.rb")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def name
|
87
|
+
@inputs[:name] = Prompt.new("Enter the name of the project: ", "ask", required: true).perform
|
88
|
+
end
|
89
|
+
|
90
|
+
def type
|
91
|
+
types = { "App" => "", "API" => "--api" }
|
92
|
+
@inputs[:type] = Prompt.new("Choose project type: ", "select", types, required: true).perform
|
93
|
+
end
|
94
|
+
|
95
|
+
def database
|
96
|
+
database_types = { "PostgreSQL" => "-d postgresql", "MySQL" => "-d mysql", "SQLite" => "" }
|
97
|
+
|
98
|
+
@inputs[:database] = Prompt.new("Choose project's database: ", "select", database_types, required: true).perform
|
99
|
+
end
|
100
|
+
|
101
|
+
def features
|
102
|
+
features = %w[devise cancancan omniauth pundit brakeman sidekiq]
|
103
|
+
|
104
|
+
@inputs[:features] = Prompt.new("Choose project features: ", "multi_select", features).perform
|
105
|
+
end
|
106
|
+
|
107
|
+
def code_quality_tool
|
108
|
+
code_quality_tool = { "Rubocop" => "rubocop", "StandardRB" => "standardrb" }
|
109
|
+
|
110
|
+
@inputs[:code_quality_tool] =
|
111
|
+
Prompt.new("Choose project code quality tool: ", "select", code_quality_tool).perform
|
112
|
+
end
|
113
|
+
|
114
|
+
def admin_panel
|
115
|
+
admin_panel = { "RailsAdmin" => "rails_admin", "Avo" => "avo" }
|
116
|
+
|
117
|
+
@inputs[:admin_panel] =
|
118
|
+
Prompt.new("Choose project's admin panel: ", "select", admin_panel).perform
|
119
|
+
end
|
120
|
+
|
121
|
+
def testing_tools
|
122
|
+
testing_tools = %w[rspec]
|
123
|
+
|
124
|
+
@inputs[:testing_tools] =
|
125
|
+
Prompt.new("Choose project's testing tools: ", "multi_select", testing_tools).perform
|
126
|
+
end
|
71
127
|
end
|
72
128
|
end
|
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.1.
|
4
|
+
version: 0.1.7
|
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-04-
|
11
|
+
date: 2022-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -137,12 +137,17 @@ files:
|
|
137
137
|
- lib/rails_interactive.rb
|
138
138
|
- lib/rails_interactive/message.rb
|
139
139
|
- lib/rails_interactive/prompt.rb
|
140
|
+
- lib/rails_interactive/templates/setup_avo.rb
|
140
141
|
- lib/rails_interactive/templates/setup_brakeman.rb
|
141
142
|
- lib/rails_interactive/templates/setup_cancancan.rb
|
142
143
|
- lib/rails_interactive/templates/setup_devise.rb
|
143
144
|
- lib/rails_interactive/templates/setup_omniauth.rb
|
144
145
|
- lib/rails_interactive/templates/setup_pundit.rb
|
146
|
+
- lib/rails_interactive/templates/setup_rails_admin.rb
|
147
|
+
- lib/rails_interactive/templates/setup_rspec.rb
|
148
|
+
- lib/rails_interactive/templates/setup_rubocop.rb
|
145
149
|
- lib/rails_interactive/templates/setup_sidekiq.rb
|
150
|
+
- lib/rails_interactive/templates/setup_standardrb.rb
|
146
151
|
- lib/rails_interactive/version.rb
|
147
152
|
- rails-interactive.gemspec
|
148
153
|
homepage: https://github.com/oguzsh/rails-interactive
|