rails_app_generator 0.1.26 → 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.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +23 -0
- data/after_templates/addons/acts_as_list/_.rb +0 -14
- data/after_templates/addons/mini_magick/_.rb +1 -1
- data/docs/last_run/app_generator_class.json +406 -0
- data/docs/last_run/app_generator_data.json +44 -0
- data/docs/last_run/rails_options_class.json +406 -0
- data/docs/last_run/rails_options_data.json +53 -0
- data/exe/rag +2 -0
- data/lib/rails_app_generator/{add_on.rb → addon.rb} +3 -26
- data/lib/rails_app_generator/addon_util.rb +21 -0
- data/lib/rails_app_generator/addons/acts_as_list.rb +1 -1
- data/lib/rails_app_generator/addons/annotate.rb +1 -1
- data/lib/rails_app_generator/addons/browser.rb +1 -1
- data/lib/rails_app_generator/addons/chartkick.rb +1 -1
- data/lib/rails_app_generator/addons/continuous_integration.rb +1 -1
- data/lib/rails_app_generator/addons/devise.rb +1 -1
- data/lib/rails_app_generator/addons/docker.rb +1 -1
- data/lib/rails_app_generator/addons/docker_compose.rb +1 -1
- data/lib/rails_app_generator/addons/dotenv.rb +1 -1
- data/lib/rails_app_generator/addons/factory_bot.rb +1 -1
- data/lib/rails_app_generator/addons/faker.rb +1 -1
- data/lib/rails_app_generator/addons/foreman.rb +1 -1
- data/lib/rails_app_generator/addons/generators.rb +1 -1
- data/lib/rails_app_generator/addons/groupdate.rb +1 -1
- data/lib/rails_app_generator/addons/hexapdf.rb +1 -1
- data/lib/rails_app_generator/addons/high_voltage.rb +1 -1
- data/lib/rails_app_generator/addons/honeybadger.rb +1 -1
- data/lib/rails_app_generator/addons/httparty.rb +1 -1
- data/lib/rails_app_generator/addons/inline_svg.rb +1 -1
- data/lib/rails_app_generator/addons/irbrc.rb +1 -1
- data/lib/rails_app_generator/addons/lograge.rb +1 -1
- data/lib/rails_app_generator/addons/mini_magick.rb +1 -1
- data/lib/rails_app_generator/addons/pundit.rb +1 -1
- data/lib/rails_app_generator/addons/rails_html_sanitizer.rb +1 -1
- data/lib/rails_app_generator/addons/rspec.rb +1 -1
- data/lib/rails_app_generator/addons/rubocop.rb +1 -1
- data/lib/rails_app_generator/addons/scaffold.rb +1 -1
- data/lib/rails_app_generator/addons/services.rb +1 -1
- data/lib/rails_app_generator/addons/sidekiq.rb +2 -2
- data/lib/rails_app_generator/addons/stimulus.rb +1 -1
- data/lib/rails_app_generator/addons/stimulus_components.rb +1 -1
- data/lib/rails_app_generator/addons/tailwind.rb +1 -1
- data/lib/rails_app_generator/addons/twilio_ruby.rb +13 -0
- data/lib/rails_app_generator/addons/views.rb +1 -1
- data/lib/rails_app_generator/app_generator.rb +39 -172
- data/lib/rails_app_generator/cli/profile.rb +3 -1
- data/lib/rails_app_generator/configuration/rag_configuration.rb +18 -0
- data/lib/rails_app_generator/configuration/rag_configuration_extension.rb +14 -0
- data/lib/rails_app_generator/context.rb +1 -1
- data/lib/rails_app_generator/dependencies.rb +2 -2
- data/lib/rails_app_generator/options/build_option.rb +14 -9
- data/lib/rails_app_generator/options/options_builder.rb +67 -44
- data/lib/rails_app_generator/options/rails_options.rb +6 -68
- data/lib/rails_app_generator/rag_initializer.rb +250 -0
- data/lib/rails_app_generator/util.rb +26 -0
- data/lib/rails_app_generator/version.rb +1 -1
- data/lib/rails_app_generator.rb +8 -3
- data/package-lock.json +2 -2
- data/package.json +1 -1
- data/profiles/addons/mini_magick.json +2 -1
- data/tasks/addon.thor +4 -4
- data/templates/thor_task/addon/addon.tt +3 -7
- metadata +26 -7
- data/lib/rails_app_generator/addons/xmen.rb +0 -17
- data/lib/rails_app_generator/generators/advisories_generator.rb +0 -18
- data/lib/rails_app_generator/generators/base.rb +0 -60
- data/lib/rails_app_generator/generators/foo_generator.rb +0 -17
@@ -4,7 +4,7 @@ module RailsAppGenerator
|
|
4
4
|
# Custom add-ons for RailsAppGenerator
|
5
5
|
module AddOns
|
6
6
|
# Add Hexapdf to rails application
|
7
|
-
class Hexapdf <
|
7
|
+
class Hexapdf < RailsAppGenerator::Addon
|
8
8
|
required_gem gem.version('hexapdf', '0.24.0', 'HexaPDF is a pure Ruby library with an accompanying application for working with PDF files.')
|
9
9
|
|
10
10
|
def apply; end
|
@@ -4,7 +4,7 @@ module RailsAppGenerator
|
|
4
4
|
# Custom add-ons for RailsAppGenerator
|
5
5
|
module AddOns
|
6
6
|
# Add Honeybadger to rails application
|
7
|
-
class Honeybadger <
|
7
|
+
class Honeybadger < RailsAppGenerator::Addon
|
8
8
|
required_gem gem.version('honeybadger', '4.12.1', 'Make managing application errors a more pleasant experience.')
|
9
9
|
|
10
10
|
def apply
|
@@ -4,7 +4,7 @@ module RailsAppGenerator
|
|
4
4
|
# Custom add-ons for RailsAppGenerator
|
5
5
|
module AddOns
|
6
6
|
# Add Httparty to rails application
|
7
|
-
class Httparty <
|
7
|
+
class Httparty < RailsAppGenerator::Addon
|
8
8
|
required_gem gem.version('httparty', '0.20.0', 'Makes http fun! Also, makes consuming restful web services dead easy.')
|
9
9
|
|
10
10
|
def apply; end
|
@@ -4,7 +4,7 @@ module RailsAppGenerator
|
|
4
4
|
# Custom add-ons for RailsAppGenerator
|
5
5
|
module AddOns
|
6
6
|
# Add LogRage - Tame Rails' multi-line logging into a single line per request
|
7
|
-
class Lograge <
|
7
|
+
class Lograge < RailsAppGenerator::Addon
|
8
8
|
def apply
|
9
9
|
template 'config/initializers/lograge.rb'
|
10
10
|
end
|
@@ -4,7 +4,7 @@ module RailsAppGenerator
|
|
4
4
|
# Custom add-ons for RailsAppGenerator
|
5
5
|
module AddOns
|
6
6
|
# Add MiniMagick to rails application
|
7
|
-
class MiniMagick <
|
7
|
+
class MiniMagick < RailsAppGenerator::Addon
|
8
8
|
required_gem gem.version('mini_magick', '4.11.0', 'Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick')
|
9
9
|
|
10
10
|
def apply; end
|
@@ -6,7 +6,7 @@ module RailsAppGenerator
|
|
6
6
|
# Add Pundit - Pundit provides a set of helpers which guide you in
|
7
7
|
# leveraging regular Ruby classes and object oriented design patterns
|
8
8
|
# to build a simple, robust and scalable authorization system.
|
9
|
-
class Pundit <
|
9
|
+
class Pundit < RailsAppGenerator::Addon
|
10
10
|
def apply
|
11
11
|
directory 'app/policies', 'app/policies'
|
12
12
|
template 'app/controllers/authorized_controller.rb.erb', 'app/controllers/authorized_controller.rb'
|
@@ -4,7 +4,7 @@ module RailsAppGenerator
|
|
4
4
|
# Custom add-ons for RailsAppGenerator
|
5
5
|
module AddOns
|
6
6
|
# Add Rails HTML Sanitizer
|
7
|
-
class RailsHtmlSanitizer <
|
7
|
+
class RailsHtmlSanitizer < RailsAppGenerator::Addon
|
8
8
|
required_gem gem.version('rails-html-sanitizer', '1.4.3',
|
9
9
|
'Rails Html Sanitizers are responsible for sanitizing HTML fragments in Rails applications, i.e. in the sanitize, sanitize_css, strip_tags and strip_links methods')
|
10
10
|
|
@@ -6,9 +6,9 @@ module RailsAppGenerator
|
|
6
6
|
# Add Sidekiq to rails application
|
7
7
|
#
|
8
8
|
# Sidekiq is a job server that can be used to process jobs in the background.
|
9
|
-
# `Sidekiq` is a subclass of `
|
9
|
+
# `Sidekiq` is a subclass of `Addon` that adds a `apply` method that says "setup sidekiq" and
|
10
10
|
# copies the `app/workers` directory from the `templates` directory to the `app` directory
|
11
|
-
class Sidekiq <
|
11
|
+
class Sidekiq < RailsAppGenerator::Addon
|
12
12
|
def apply
|
13
13
|
say 'setup sidekiq'
|
14
14
|
directory('app/workers', 'app/workers')
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RailsAppGenerator
|
4
|
+
# Custom add-ons for RailsAppGenerator
|
5
|
+
module AddOns
|
6
|
+
# Add TwilioRuby to rails application
|
7
|
+
class TwilioRuby < RailsAppGenerator::Addon
|
8
|
+
required_gem gem.version('twilio-ruby', '5.70.0', 'The official library for communicating with the Twilio REST API, building TwiML, and generating Twilio JWT Capability Tokens')
|
9
|
+
|
10
|
+
def apply; end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -5,158 +5,6 @@
|
|
5
5
|
module RailsAppGenerator
|
6
6
|
# AppGenerator is a wrapper for Rails::AppGenerator
|
7
7
|
class AppGenerator < Rails::Generators::AppGenerator
|
8
|
-
class_option :test , type: :string , default: 'rspec'
|
9
|
-
|
10
|
-
# Gem Current Latest Requested Groups
|
11
|
-
# aws-sdk
|
12
|
-
# capistrano-bundler 1.6.0 2.1.0 ~> 1.2 development, test
|
13
|
-
# capybara 3.33.0 3.37.1 = 3.33.0 development, test
|
14
|
-
# clamby 1.6.6 1.6.8 = 1.6.6 default
|
15
|
-
# createsend 5.1.1 6.0.0 ~> 5.1 default
|
16
|
-
# database_cleaner 1.7.0 2.0.1 = 1.7.0 development, test
|
17
|
-
# erubi 1.10.0 1.11.0
|
18
|
-
# factory_bot 5.2.0 6.2.1
|
19
|
-
# factory_bot_rails 5.2.0 6.2.0 = 5.2.0 development, test
|
20
|
-
# guard-bundler 2.2.1 3.0.0 = 2.2.1 development, test
|
21
|
-
# guard-rubocop 1.4.0 1.5.0 = 1.4.0 development, test
|
22
|
-
# http-accept 1.7.0 2.2.0
|
23
|
-
# net-ssh 6.1.0 7.0.1
|
24
|
-
# oauth2 1.4.10 2.0.6
|
25
|
-
# omniauth-oauth2 1.7.3 1.8.0
|
26
|
-
# paper_trail 10.3.1 12.3.0 ~> 10.3 default
|
27
|
-
# pg 0.21.0 1.4.2 ~> 0.20 default
|
28
|
-
# pg_search 2.3.0 2.3.6 ~> 2.0 default
|
29
|
-
# pry 0.13.1 0.14.1
|
30
|
-
# public_suffix 2.0.5 5.0.0 ~> 2.0 default
|
31
|
-
# pusher 1.4.3 2.0.2 ~> 1.3 default
|
32
|
-
# rack-mini-profiler 0.10.7 3.0.0 ~> 0.10 default
|
33
|
-
# rack-test 0.6.3 2.0.2
|
34
|
-
# rails 5.0.7.2 7.0.3.1 = 5.0.7.2 default
|
35
|
-
# railties 5.0.7.2 7.0.3.1
|
36
|
-
# ransack 1.8.10 3.2.1 ~> 1.8 default
|
37
|
-
# redis 3.3.5 4.7.1 ~> 3.3 default
|
38
|
-
# redis-store 1.6.0 1.9.1
|
39
|
-
# regexp_parser 1.8.2 2.5.0
|
40
|
-
# rspec 3.10.0 3.11.0
|
41
|
-
# rspec-core 3.10.1 3.11.0 = 3.10.1 development, test
|
42
|
-
# rspec-expectations 3.10.1 3.11.0 = 3.10.1 development, test
|
43
|
-
# rspec-mocks 3.10.2 3.11.1 = 3.10.2 development, test
|
44
|
-
# rspec-rails 4.1.2 5.1.2 = 4.1.2 development, test
|
45
|
-
# rspec-support 3.10.2 3.11.0 = 3.10.2 development, test
|
46
|
-
# rubyzip 1.3.0 2.3.2 ~> 1.3 default
|
47
|
-
# scenic 1.5.4 1.6.0 = 1.5.4 default
|
48
|
-
# scout_apm 4.1.2 5.2.0 ~> 4.1 default
|
49
|
-
# selenium-webdriver 3.142.7 4.3.0 = 3.142.7 development, test
|
50
|
-
# shoulda-matchers 4.0.1 5.1.0 = 4.0.1 development, test
|
51
|
-
# sidekiq 4.2.10 6.5.1 ~> 4.2 default
|
52
|
-
# sidekiq-pool 1.9.3 2.0.1 ~> 1.8 default
|
53
|
-
# sidekiq-unique-jobs 6.0.25 7.1.27 ~> 6.0 default
|
54
|
-
# spring 2.1.1 4.0.0 ~> 2.0 development, test
|
55
|
-
# sprockets 3.7.2 4.1.1 ~> 3.7 default
|
56
|
-
# sprockets-rails 3.2.2 3.4.2
|
57
|
-
# timecop 0.8.1 0.9.5 = 0.8.1 development, test
|
58
|
-
# tzinfo 1.2.10 2.0.5
|
59
|
-
# uglifier 3.2.0 4.2.0 ~> 3.2 default
|
60
|
-
# unicorn 5.8.0 6.1.0 ~> 5.3 default
|
61
|
-
# webmock 3.13.0 3.16.0 = 3.13.0 development, test
|
62
|
-
# websocket-driver 0.6.5 0.7.5
|
63
|
-
|
64
|
-
# acts_as_list 0.9.19 1.0.4 ~> 0.9 default
|
65
|
-
# arel 7.1.4 9.0.0
|
66
|
-
# bigdecimal 1.4.4 3.1.2 ~> 1.4 development, test
|
67
|
-
# binding_of_caller 0.8.0 1.0.0 ~> 0.8 default
|
68
|
-
# browser 2.7.1 5.3.1 ~> 2.3 default
|
69
|
-
# capistrano-bundler 1.6.0 2.1.0 ~> 1.2 development, test
|
70
|
-
# capybara 3.33.0 3.37.1 = 3.33.0 development, test
|
71
|
-
# chartkick 2.3.5 4.2.0 ~> 2.3 default
|
72
|
-
# childprocess 3.0.0 4.1.0
|
73
|
-
# clamby 1.6.6 1.6.8 = 1.6.6 default
|
74
|
-
# createsend 5.1.1 6.0.0 ~> 5.1 default
|
75
|
-
# database_cleaner 1.7.0 2.0.1 = 1.7.0 development, test
|
76
|
-
# factory_bot 5.2.0 6.2.1
|
77
|
-
# factory_bot_rails 5.2.0 6.2.0 = 5.2.0 development, test
|
78
|
-
# faker 1.9.6 2.22.0 ~> 1.7 default
|
79
|
-
# groupdate 4.3.0 6.1.0 ~> 4.1 default
|
80
|
-
# guard-bundler 2.2.1 3.0.0 = 2.2.1 development, test
|
81
|
-
# guard-rubocop 1.4.0 1.5.0 = 1.4.0 development, test
|
82
|
-
# hashie 3.6.0 5.0.0
|
83
|
-
# http-accept 1.7.0 2.1.1
|
84
|
-
# k_log 0.0.18 0.0.33 = 0.0.18 development, test
|
85
|
-
# net-ssh 6.1.0 7.0.1
|
86
|
-
# oauth2 1.4.10 2.0.6
|
87
|
-
# omniauth-oauth2 1.7.3 1.8.0
|
88
|
-
# paper_trail 10.3.1 12.3.0 ~> 10.3 default
|
89
|
-
# pg 0.21.0 1.4.2 ~> 0.20 default
|
90
|
-
# pg_search 2.3.0 2.3.6 ~> 2.0 default
|
91
|
-
# pry 0.13.1 0.14.1
|
92
|
-
# public_suffix 2.0.5 5.0.0 ~> 2.0 default
|
93
|
-
# pusher 1.4.3 2.0.2 ~> 1.3 default
|
94
|
-
# rack-mini-profiler 0.10.7 3.0.0 ~> 0.10 default
|
95
|
-
# rack-test 0.6.3 2.0.2
|
96
|
-
# rails 5.0.7.2 7.0.3.1 = 5.0.7.2 default
|
97
|
-
# railties 5.0.7.2 7.0.3.1
|
98
|
-
# ransack 1.8.10 3.2.1 ~> 1.8 default
|
99
|
-
# redis 3.3.5 4.7.1 ~> 3.3 default
|
100
|
-
# redis-store 1.6.0 1.9.1
|
101
|
-
# regexp_parser 1.8.2 2.5.0
|
102
|
-
# rspec 3.10.0 3.11.0
|
103
|
-
# rspec-core 3.10.1 3.11.0 = 3.10.1 development, test
|
104
|
-
# rspec-expectations 3.10.1 3.11.0 = 3.10.1 development, test
|
105
|
-
# rspec-mocks 3.10.2 3.11.1 = 3.10.2 development, test
|
106
|
-
# rspec-rails 4.1.2 5.1.2 = 4.1.2 development, test
|
107
|
-
# rspec-support 3.10.2 3.11.0 = 3.10.2 development, test
|
108
|
-
# rubyzip 1.3.0 2.3.2 ~> 1.3 default
|
109
|
-
# scenic 1.5.4 1.6.0 = 1.5.4 default
|
110
|
-
# scout_apm 4.1.2 5.2.0 ~> 4.1 default
|
111
|
-
# selenium-webdriver 3.142.7 4.3.0 = 3.142.7 development, test
|
112
|
-
# shoulda-matchers 4.0.1 5.1.0 = 4.0.1 development, test
|
113
|
-
# sidekiq 4.2.10 6.5.1 ~> 4.2 default
|
114
|
-
# sidekiq-pool 1.9.3 2.0.1 ~> 1.8 default
|
115
|
-
# sidekiq-unique-jobs 6.0.25 7.1.27 ~> 6.0 default
|
116
|
-
# spring 2.1.1 4.0.0 ~> 2.0 development, test
|
117
|
-
# sprockets 3.7.2 4.1.1 ~> 3.7 default
|
118
|
-
# sprockets-rails 3.2.2 3.4.2
|
119
|
-
# timecop 0.8.1 0.9.5 = 0.8.1 development, test
|
120
|
-
# tzinfo 1.2.10 2.0.5
|
121
|
-
# uglifier 3.2.0 4.2.0 ~> 3.2 default
|
122
|
-
# unicorn 5.8.0 6.1.0 ~> 5.3 default
|
123
|
-
# webmock 3.13.0 3.14.0 = 3.13.0 development, test
|
124
|
-
# websocket-driver 0.6.5 0.7.5
|
125
|
-
|
126
|
-
class_option :add_irbrc , type: :boolean, default: false
|
127
|
-
class_option :add_foreman , type: :boolean, default: false
|
128
|
-
class_option :add_devise , type: :boolean, default: false
|
129
|
-
class_option :add_dotenv , type: :boolean, default: false
|
130
|
-
class_option :add_docker , type: :boolean, default: false
|
131
|
-
class_option :add_docker_compose , type: :boolean, default: false
|
132
|
-
class_option :add_rubocop , type: :boolean, default: false
|
133
|
-
class_option :add_annotate , type: :boolean, default: false
|
134
|
-
class_option :add_continuous_integration , type: :boolean, default: false
|
135
|
-
class_option :add_high_voltage , type: :boolean, default: false
|
136
|
-
class_option :add_generators , type: :boolean, default: false
|
137
|
-
class_option :add_lograge , type: :boolean, default: false
|
138
|
-
class_option :add_pundit , type: :boolean, default: false
|
139
|
-
class_option :add_services , type: :boolean, default: false
|
140
|
-
class_option :add_sidekiq , type: :boolean, default: false
|
141
|
-
class_option :add_views , type: :boolean, default: false
|
142
|
-
class_option :add_errors , type: :boolean, default: false
|
143
|
-
class_option :add_scaffold , type: :boolean, default: false
|
144
|
-
class_option :add_factory_bot , type: :boolean, default: false
|
145
|
-
class_option :add_shoulda , type: :boolean, default: false
|
146
|
-
|
147
|
-
# NEW GEM ADDONS
|
148
|
-
class_option :add_acts_as_list , type: :boolean, default: false
|
149
|
-
class_option :add_browser , type: :boolean, default: false
|
150
|
-
class_option :add_chartkick , type: :boolean, default: false
|
151
|
-
class_option :add_faker , type: :boolean, default: false
|
152
|
-
class_option :add_groupdate , type: :boolean, default: false
|
153
|
-
class_option :add_hexapdf , type: :boolean, default: false
|
154
|
-
class_option :add_httparty , type: :boolean, default: false
|
155
|
-
class_option :add_honeybadger , type: :boolean, default: false
|
156
|
-
class_option :add_mini_magick , type: :boolean, default: false
|
157
|
-
class_option :add_rails_html_sanitizer , type: :boolean, default: false
|
158
|
-
class_option :add_twilio_ruby , type: :boolean, default: false
|
159
|
-
|
160
8
|
class << self
|
161
9
|
# points to the original rails templates
|
162
10
|
attr_writer :rails_template_path
|
@@ -179,6 +27,35 @@ module RailsAppGenerator
|
|
179
27
|
@addon_template_path ||= gem_template_path('rails_app_generator', 'templates/addons/%<addon>s')
|
180
28
|
end
|
181
29
|
|
30
|
+
def add_class_option(option)
|
31
|
+
find_name = option.name.to_s
|
32
|
+
existing_option = class_options.find { |class_option| class_option[1].name == find_name }
|
33
|
+
|
34
|
+
return if existing_option
|
35
|
+
|
36
|
+
args = {
|
37
|
+
type: option.type,
|
38
|
+
default: option.default,
|
39
|
+
required: option.required
|
40
|
+
}
|
41
|
+
|
42
|
+
# for some reason, Railties uses :desc while thor uses :description and thor has nice humanization when key is missing
|
43
|
+
args[:desc] = option.description unless option.description
|
44
|
+
|
45
|
+
class_option(option.name, **args)
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_h
|
49
|
+
thor_options = class_options.map { |o| o[1] }
|
50
|
+
options_hash = RailsAppGenerator::Util.thor_options_to_hash(thor_options)
|
51
|
+
|
52
|
+
# class_options_detailed: options_hash,
|
53
|
+
{
|
54
|
+
class_option_keys: options_hash.map { |option| option[:name] },
|
55
|
+
class_options: options_hash.map { |option| option.slice(:name, :description, :type, :default, :required) }
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
182
59
|
private
|
183
60
|
|
184
61
|
def gem_template_path(gem_name, template_path)
|
@@ -202,16 +79,11 @@ module RailsAppGenerator
|
|
202
79
|
|
203
80
|
attr_reader :addon_instances
|
204
81
|
|
205
|
-
# attr_reader :before_bundle_addon_callbacks
|
206
|
-
# attr_reader :after_bundle_addon_callbacks
|
207
|
-
|
208
82
|
def initialize(*args)
|
209
83
|
super
|
210
84
|
|
211
85
|
@force_copy = false
|
212
86
|
@addon_instances = []
|
213
|
-
# @before_bundle_addon_callbacks = []
|
214
|
-
# @after_bundle_addon_callbacks = []
|
215
87
|
|
216
88
|
# puts '----------------------------------------------------'
|
217
89
|
# puts options
|
@@ -271,6 +143,8 @@ module RailsAppGenerator
|
|
271
143
|
# end
|
272
144
|
|
273
145
|
def create_root_files
|
146
|
+
RailsAppGenerator::Util.write_last_run('app_generator_data.json', to_h)
|
147
|
+
|
274
148
|
super
|
275
149
|
|
276
150
|
add_if(:irbrc)
|
@@ -331,6 +205,12 @@ module RailsAppGenerator
|
|
331
205
|
end
|
332
206
|
|
333
207
|
no_commands do
|
208
|
+
def to_h
|
209
|
+
{
|
210
|
+
options: options
|
211
|
+
}
|
212
|
+
end
|
213
|
+
|
334
214
|
# https://codingpackets.com/blog/rails-generators-cheat-sheet/
|
335
215
|
|
336
216
|
# OLD style will be removed soon
|
@@ -492,13 +372,6 @@ module RailsAppGenerator
|
|
492
372
|
end
|
493
373
|
end
|
494
374
|
|
495
|
-
# def apply(context = Context.new({}))
|
496
|
-
# instance = new(context)
|
497
|
-
# return unless instance.uses?
|
498
|
-
|
499
|
-
# instance.apply
|
500
|
-
# end
|
501
|
-
|
502
375
|
def add_if(addon)
|
503
376
|
add(addon) if active?(addon)
|
504
377
|
end
|
@@ -526,7 +399,7 @@ module RailsAppGenerator
|
|
526
399
|
def uses?(addon)
|
527
400
|
return false unless active?(addon)
|
528
401
|
|
529
|
-
addon =
|
402
|
+
addon = AddonUtil.get(addon)
|
530
403
|
Dependencies.new(addon, context).satisfied?
|
531
404
|
end
|
532
405
|
|
@@ -538,14 +411,8 @@ module RailsAppGenerator
|
|
538
411
|
end
|
539
412
|
end
|
540
413
|
|
541
|
-
def addon_classes
|
542
|
-
AddOns.constants
|
543
|
-
.map { |addon_klass_name| AddOns.const_get(addon_klass_name) }
|
544
|
-
.select { |klass| klass.is_a?(Class) && klass.respond_to?(:addon_name) }
|
545
|
-
end
|
546
|
-
|
547
414
|
def active_addon_classes
|
548
|
-
|
415
|
+
AddonUtil.classes.select { |klass| active?(klass.addon_name) }
|
549
416
|
end
|
550
417
|
|
551
418
|
def addon_gemfile_entries
|
@@ -26,7 +26,9 @@ module RailsAppGenerator
|
|
26
26
|
args = profile[:args]
|
27
27
|
opts = RailsAppGenerator::RailsOptions.new(profile[:opts])
|
28
28
|
|
29
|
-
|
29
|
+
RailsAppGenerator::Util.write_last_run('rails_options_data.json', opts.to_h)
|
30
|
+
|
31
|
+
starter = RailsAppGenerator::Starter.new(args)
|
30
32
|
|
31
33
|
starter.delete_target_folder
|
32
34
|
starter.start(opts)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RailsAppGenerator
|
4
|
+
# Structure for storing Rails Application Generator configuration
|
5
|
+
class RagConfiguration
|
6
|
+
# include KLog::Logging
|
7
|
+
|
8
|
+
attr_reader :options
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@options = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_option(name, **args)
|
15
|
+
@options << RailsAppGenerator::BuildOption.new(name, **args)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RailsAppGenerator
|
4
|
+
# Register this configuration access extension for Rag configuration
|
5
|
+
module RagConfigurationExtension
|
6
|
+
def rag
|
7
|
+
return @rag if defined? @rag
|
8
|
+
|
9
|
+
@rag = RagConfiguration.new
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
KConfig::Configuration.register(:rag, RailsAppGenerator::RagConfigurationExtension)
|
@@ -24,8 +24,8 @@ module RailsAppGenerator
|
|
24
24
|
|
25
25
|
return true if @context.default_addons.include?(addon)
|
26
26
|
|
27
|
-
visited <<
|
28
|
-
dependencies =
|
27
|
+
visited << RailsAppGenerator::Addon
|
28
|
+
dependencies = AddonUtil.get(addon).dependencies - visited
|
29
29
|
dependencies.each do |dependency|
|
30
30
|
return false unless dependencies_satisfied?(dependency, visited)
|
31
31
|
end
|
@@ -6,17 +6,12 @@ module RailsAppGenerator
|
|
6
6
|
# This class maps closely (but not exactly) to Thor's options
|
7
7
|
# The pattern is not exactly the same, it is easy to map the options
|
8
8
|
# you need from other generators such as: railties/lib/rails/generators/app_base.rb
|
9
|
-
#
|
10
|
-
# @example
|
11
|
-
# class_option :skip_git, type: :boolean, default: false, desc: "Skip .gitignore file"
|
12
|
-
# becomes
|
13
|
-
# register_option :skip_git, type: :boolean, default: false, desc: "Skip .gitignore file"
|
14
9
|
class BuildOption
|
15
|
-
attr_reader :name, :
|
10
|
+
attr_reader :name, :description, :type, :default, :required, :mapper
|
16
11
|
|
17
|
-
def initialize(**args)
|
18
|
-
@name =
|
19
|
-
@
|
12
|
+
def initialize(name, **args)
|
13
|
+
@name = name
|
14
|
+
@description = args[:description] || ''
|
20
15
|
@type = args[:type] || :string
|
21
16
|
@required = args.fetch(:required, false)
|
22
17
|
@default = args[:default] || sane_default
|
@@ -27,6 +22,16 @@ module RailsAppGenerator
|
|
27
22
|
|
28
23
|
def cmd_option(value); end
|
29
24
|
|
25
|
+
def to_h
|
26
|
+
{
|
27
|
+
name: name,
|
28
|
+
description: description,
|
29
|
+
type: type,
|
30
|
+
default: default,
|
31
|
+
required: required
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
30
35
|
private
|
31
36
|
|
32
37
|
def sane_default
|