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
@@ -13,39 +13,84 @@ module RailsAppGenerator
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class << self
|
16
|
-
def
|
17
|
-
@
|
16
|
+
def class_options
|
17
|
+
@class_options ||= []
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
@
|
20
|
+
def class_options_lookup
|
21
|
+
@class_options_lookup ||= {}
|
22
22
|
end
|
23
23
|
|
24
|
-
#
|
25
|
-
|
24
|
+
# Register an option with the builder, this method has the same signature as Thor.
|
25
|
+
#
|
26
|
+
# This is so options can be used interchangeably between OptionsBuilder and Thor.
|
27
|
+
def class_option(name, **args)
|
28
|
+
option = BuildOption.new(name, args)
|
26
29
|
|
27
|
-
|
28
|
-
|
30
|
+
add_class_option(option)
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_class_option(option)
|
34
|
+
if class_options_lookup.key?(option.name)
|
35
|
+
# raise ArgumentError, "Option #{option.name} already registered"
|
36
|
+
puts "Option #{option.name} already registered"
|
37
|
+
return
|
38
|
+
end
|
39
|
+
|
40
|
+
class_options_lookup[option.name.to_sym] = option
|
41
|
+
class_options << option
|
42
|
+
end
|
29
43
|
|
30
|
-
|
44
|
+
def add_thor_class_option(thor_option)
|
45
|
+
args = {
|
46
|
+
description: thor_option.description,
|
47
|
+
type: thor_option.type,
|
48
|
+
default: thor_option.default,
|
49
|
+
required: thor_option.required
|
50
|
+
}
|
51
|
+
option = BuildOption.new(thor_option.name, args)
|
31
52
|
|
32
|
-
|
33
|
-
registered_options << option
|
53
|
+
add_class_option(option)
|
34
54
|
end
|
35
55
|
|
36
56
|
def reset
|
37
|
-
@
|
38
|
-
@
|
57
|
+
@class_options = nil
|
58
|
+
@class_options_lookup = nil
|
59
|
+
end
|
60
|
+
|
61
|
+
def to_h
|
62
|
+
{
|
63
|
+
class_option_keys: class_options.map(&:name),
|
64
|
+
class_options: class_options.map(&:to_h)
|
65
|
+
}
|
39
66
|
end
|
40
67
|
end
|
41
68
|
|
69
|
+
# rubocop:disable Metrics/AbcSize
|
42
70
|
def cmd_line_options
|
43
|
-
|
71
|
+
available_options = options.clone
|
72
|
+
|
73
|
+
result = self.class.class_options.map do |option|
|
44
74
|
mapper = option.mapper
|
45
|
-
|
75
|
+
key = option.name.to_sym
|
76
|
+
value = options[key]
|
77
|
+
available_options.delete(key)
|
78
|
+
# if available_options.delete(option.name.to_sym)
|
79
|
+
# puts "option IS registered: #{option.name}"
|
80
|
+
# else
|
81
|
+
# puts "option not registered: #{option.name}"
|
82
|
+
# end
|
83
|
+
|
46
84
|
mapper.map(option.name, value)
|
47
85
|
end.reject(&:blank?)
|
86
|
+
|
87
|
+
return result if available_options.empty?
|
88
|
+
|
89
|
+
puts "options not registered: #{available_options.keys.join(', ')}"
|
90
|
+
result
|
91
|
+
# raise 'Unknown options'
|
48
92
|
end
|
93
|
+
# rubocop:enable Metrics/AbcSize
|
49
94
|
|
50
95
|
def debug
|
51
96
|
puts '[ Options JSON ]----------------------------------------------------'
|
@@ -54,38 +99,16 @@ module RailsAppGenerator
|
|
54
99
|
puts cmd_line_options
|
55
100
|
end
|
56
101
|
|
102
|
+
def to_h
|
103
|
+
{
|
104
|
+
options: options
|
105
|
+
}
|
106
|
+
end
|
107
|
+
|
57
108
|
private
|
58
109
|
|
59
110
|
def default_options
|
60
|
-
self.class.
|
111
|
+
self.class.class_options.to_h { |option| [option.name.to_sym, option.default] }
|
61
112
|
end
|
62
113
|
end
|
63
|
-
|
64
|
-
# opts = [
|
65
|
-
# "--skip-namespace",
|
66
|
-
# "--skip-collision-check",
|
67
|
-
# "--skip-git",
|
68
|
-
# "--skip-keeps",
|
69
|
-
# "--skip-action-mailer",
|
70
|
-
# "--skip-action-mailbox",
|
71
|
-
# "--skip-action-text",
|
72
|
-
# "--skip-active-record",
|
73
|
-
# "--skip-active-job",
|
74
|
-
# "--skip-active-storage",
|
75
|
-
# "--skip-action-cable",
|
76
|
-
# "--skip-asset-pipeline",
|
77
|
-
# "--skip-javascript",
|
78
|
-
# "--skip-hotwire",
|
79
|
-
# "--skip-jbuilder",
|
80
|
-
# "--skip-test",
|
81
|
-
# "--skip-system-test",
|
82
|
-
# "--skip-bootsnap",
|
83
|
-
# "--skip-bundle"
|
84
|
-
# ]
|
85
|
-
|
86
|
-
# opts = [
|
87
|
-
# "--skip-git",
|
88
|
-
# "--skip-test",
|
89
|
-
# "--skip-bundle"
|
90
|
-
# ]
|
91
114
|
end
|
@@ -2,74 +2,12 @@
|
|
2
2
|
|
3
3
|
module RailsAppGenerator
|
4
4
|
class RailsOptions < OptionsBuilder
|
5
|
-
#
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
future_option :skip_action_mailer , type: :boolean, default: false # , desc: "Skip Action Mailer files"
|
12
|
-
future_option :skip_action_mailbox , type: :boolean, default: false # , desc: "Skip Action Mailbox gem"
|
13
|
-
future_option :skip_action_text , type: :boolean, default: false # , desc: "Skip Action Text gem"
|
14
|
-
future_option :skip_active_record , type: :boolean, default: false # , desc: "Skip Active Record files"
|
15
|
-
future_option :skip_active_job , type: :boolean, default: false # , desc: "Skip Active Job"
|
16
|
-
future_option :skip_active_storage , type: :boolean, default: false # , desc: "Skip Active Storage files"
|
17
|
-
future_option :skip_action_cable , type: :boolean, default: false # , desc: "Skip Action Cable files"
|
18
|
-
future_option :skip_asset_pipeline , type: :boolean, default: false #
|
19
|
-
future_option :asset_pipeline , type: :string , default: 'sprockets' # , desc: "Choose your asset pipeline [options: sprockets (default), propshaft]"
|
20
|
-
future_option :skip_javascript , type: :boolean, default: false # name == 'plugin' # , desc: "Skip JavaScript files"
|
21
|
-
future_option :skip_hotwire , type: :boolean, default: false # , desc: "Skip Hotwire integration"
|
22
|
-
future_option :skip_jbuilder , type: :boolean, default: false # , desc: "Skip jbuilder gem"
|
23
|
-
register_option :skip_test , type: :boolean, default: false # , desc: "Skip test files"
|
24
|
-
register_option :test , type: :string , default: 'rspec' # , desc: "minitest or rspec (default: rspec)"
|
25
|
-
future_option :skip_system_test , type: :boolean, default: false # , desc: "Skip system test files"
|
26
|
-
future_option :skip_bootsnap , type: :boolean, default: false # , desc: "Skip bootsnap gem"
|
27
|
-
future_option :dev , type: :boolean, default: false # , desc: "Set up the #{name} with Gemfile pointing to your Rails checkout"
|
28
|
-
future_option :edge , type: :boolean, default: false # , desc: "Set up the #{name} with Gemfile pointing to Rails repository"
|
29
|
-
future_option :main , type: :boolean, default: false # , desc: "Set up the #{name} with Gemfile pointing to Rails repository main branch"
|
30
|
-
future_option :rc , type: :string , default: nil # , desc: "Path to file containing extra configuration options for rails command"
|
31
|
-
future_option :no_rc , type: :boolean, default: false # , desc: "Skip loading of extra configuration options from .railsrc file"
|
32
|
-
future_option :help , type: :boolean # , group: :rails # , desc: "Show this help message and quit"
|
33
|
-
future_option :version , type: :boolean # , group: :rails, desc: "Show Rails version number and quit"
|
34
|
-
future_option :api , type: :boolean # , desc: "Preconfigure smaller stack for API only apps"
|
35
|
-
future_option :minimal , type: :boolean # , desc: "Preconfigure a minimal rails app"
|
36
|
-
future_option :javascript , type: :string , default: 'importmap' # , desc: "Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup]"
|
37
|
-
register_option :css , type: :string # , desc: "Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass... check https://github.com/rails/cssbundling-rails]"
|
38
|
-
register_option :skip_bundle , type: :boolean, default: false # , desc: "Don't run bundle install"
|
39
|
-
|
40
|
-
register_option :add_irbrc , type: :boolean, default: false
|
41
|
-
register_option :add_foreman , type: :boolean, default: false
|
42
|
-
register_option :add_devise , type: :boolean, default: false
|
43
|
-
register_option :add_dotenv , type: :boolean, default: false
|
44
|
-
register_option :add_docker , type: :boolean, default: false
|
45
|
-
register_option :add_docker_compose , type: :boolean, default: false
|
46
|
-
register_option :add_rubocop , type: :boolean, default: false
|
47
|
-
register_option :add_annotate , type: :boolean, default: false
|
48
|
-
register_option :add_continuous_integration , type: :boolean, default: false
|
49
|
-
register_option :add_high_voltage , type: :boolean, default: false
|
50
|
-
register_option :add_generators , type: :boolean, default: false
|
51
|
-
register_option :add_lograge , type: :boolean, default: false
|
52
|
-
register_option :add_pundit , type: :boolean, default: false
|
53
|
-
register_option :add_services , type: :boolean, default: false
|
54
|
-
register_option :add_sidekiq , type: :boolean, default: false
|
55
|
-
register_option :add_views , type: :boolean, default: false
|
56
|
-
register_option :add_errors , type: :boolean, default: false
|
57
|
-
register_option :add_scaffold , type: :boolean, default: false
|
58
|
-
register_option :add_factory_bot , type: :boolean, default: false
|
59
|
-
register_option :add_shoulda , type: :boolean, default: false
|
60
|
-
|
61
|
-
# NEW GEM ADDONS
|
62
|
-
register_option :add_acts_as_list , type: :boolean, default: false
|
63
|
-
register_option :add_browser , type: :boolean, default: false
|
64
|
-
register_option :add_chartkick , type: :boolean, default: false
|
65
|
-
register_option :add_faker , type: :boolean, default: false
|
66
|
-
register_option :add_groupdate , type: :boolean, default: false
|
67
|
-
register_option :add_hexapdf , type: :boolean, default: false
|
68
|
-
register_option :add_httparty , type: :boolean, default: false
|
69
|
-
register_option :add_honeybadger , type: :boolean, default: false
|
70
|
-
register_option :add_mini_magick , type: :boolean, default: false
|
71
|
-
register_option :add_rails_html_sanitizer , type: :boolean, default: false
|
72
|
-
register_option :add_twilio_ruby , type: :boolean, default: false
|
5
|
+
# FIND MORE TEMPLATES HERE
|
6
|
+
# https://railsbytes.com/public/templates
|
7
|
+
# http://www.railscomposer.com/
|
8
|
+
# https://github.com/RailsApps/rails-composer
|
9
|
+
# https://github.com/carbonfive/raygun-rails
|
10
|
+
# https://github.com/abhaynikam/boring_generators
|
73
11
|
|
74
12
|
# if options[:minimal]
|
75
13
|
# self.options = options.merge(
|
@@ -0,0 +1,250 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# frozen__tring_literal: true
|
4
|
+
|
5
|
+
KConfig.configure do |config|
|
6
|
+
# https://railsbytes.com/public/templates
|
7
|
+
# http://www.railscomposer.com/
|
8
|
+
# https://github.com/RailsApps/rails-composer
|
9
|
+
# https://github.com/carbonfive/raygun-rails
|
10
|
+
# https://github.com/abhaynikam/boring_generators
|
11
|
+
|
12
|
+
# config.rag.add_option :test , type: :string , default: 'rspec'
|
13
|
+
|
14
|
+
# # Gem Current Latest Requested Groups
|
15
|
+
# # aws-sdk
|
16
|
+
# # capistrano-bundler 1.6.0 2.1.0 ~> 1.2 development, test
|
17
|
+
# # capybara 3.33.0 3.37.1 = 3.33.0 development, test
|
18
|
+
# # clamby 1.6.6 1.6.8 = 1.6.6 default
|
19
|
+
# # createsend 5.1.1 6.0.0 ~> 5.1 default
|
20
|
+
# # database_cleaner 1.7.0 2.0.1 = 1.7.0 development, test
|
21
|
+
# # erubi 1.10.0 1.11.0
|
22
|
+
# # factory_bot 5.2.0 6.2.1
|
23
|
+
# # factory_bot_rails 5.2.0 6.2.0 = 5.2.0 development, test
|
24
|
+
# # guard-bundler 2.2.1 3.0.0 = 2.2.1 development, test
|
25
|
+
# # guard-rubocop 1.4.0 1.5.0 = 1.4.0 development, test
|
26
|
+
# # http-accept 1.7.0 2.2.0
|
27
|
+
# # net-ssh 6.1.0 7.0.1
|
28
|
+
# # oauth2 1.4.10 2.0.6
|
29
|
+
# # omniauth-oauth2 1.7.3 1.8.0
|
30
|
+
# # paper_trail 10.3.1 12.3.0 ~> 10.3 default
|
31
|
+
# # pg 0.21.0 1.4.2 ~> 0.20 default
|
32
|
+
# # pg_search 2.3.0 2.3.6 ~> 2.0 default
|
33
|
+
# # pry 0.13.1 0.14.1
|
34
|
+
# # public_suffix 2.0.5 5.0.0 ~> 2.0 default
|
35
|
+
# # pusher 1.4.3 2.0.2 ~> 1.3 default
|
36
|
+
# # rack-mini-profiler 0.10.7 3.0.0 ~> 0.10 default
|
37
|
+
# # rack-test 0.6.3 2.0.2
|
38
|
+
# # rails 5.0.7.2 7.0.3.1 = 5.0.7.2 default
|
39
|
+
# # railties 5.0.7.2 7.0.3.1
|
40
|
+
# # ransack 1.8.10 3.2.1 ~> 1.8 default
|
41
|
+
# # redis 3.3.5 4.7.1 ~> 3.3 default
|
42
|
+
# # redis-store 1.6.0 1.9.1
|
43
|
+
# # regexp_parser 1.8.2 2.5.0
|
44
|
+
# # rspec 3.10.0 3.11.0
|
45
|
+
# # rspec-core 3.10.1 3.11.0 = 3.10.1 development, test
|
46
|
+
# # rspec-expectations 3.10.1 3.11.0 = 3.10.1 development, test
|
47
|
+
# # rspec-mocks 3.10.2 3.11.1 = 3.10.2 development, test
|
48
|
+
# # rspec-rails 4.1.2 5.1.2 = 4.1.2 development, test
|
49
|
+
# # rspec-support 3.10.2 3.11.0 = 3.10.2 development, test
|
50
|
+
# # rubyzip 1.3.0 2.3.2 ~> 1.3 default
|
51
|
+
# # scenic 1.5.4 1.6.0 = 1.5.4 default
|
52
|
+
# # scout_apm 4.1.2 5.2.0 ~> 4.1 default
|
53
|
+
# # selenium-webdriver 3.142.7 4.3.0 = 3.142.7 development, test
|
54
|
+
# # shoulda-matchers 4.0.1 5.1.0 = 4.0.1 development, test
|
55
|
+
# # sidekiq 4.2.10 6.5.1 ~> 4.2 default
|
56
|
+
# # sidekiq-pool 1.9.3 2.0.1 ~> 1.8 default
|
57
|
+
# # sidekiq-unique-jobs 6.0.25 7.1.27 ~> 6.0 default
|
58
|
+
# # spring 2.1.1 4.0.0 ~> 2.0 development, test
|
59
|
+
# # sprockets 3.7.2 4.1.1 ~> 3.7 default
|
60
|
+
# # sprockets-rails 3.2.2 3.4.2
|
61
|
+
# # timecop 0.8.1 0.9.5 = 0.8.1 development, test
|
62
|
+
# # tzinfo 1.2.10 2.0.5
|
63
|
+
# # uglifier 3.2.0 4.2.0 ~> 3.2 default
|
64
|
+
# # unicorn 5.8.0 6.1.0 ~> 5.3 default
|
65
|
+
# # webmock 3.13.0 3.16.0 = 3.13.0 development, test
|
66
|
+
# # websocket-driver 0.6.5 0.7.5
|
67
|
+
|
68
|
+
# # acts_as_list 0.9.19 1.0.4 ~> 0.9 default
|
69
|
+
# # arel 7.1.4 9.0.0
|
70
|
+
# # bigdecimal 1.4.4 3.1.2 ~> 1.4 development, test
|
71
|
+
# # binding_of_caller 0.8.0 1.0.0 ~> 0.8 default
|
72
|
+
# # browser 2.7.1 5.3.1 ~> 2.3 default
|
73
|
+
# # capistrano-bundler 1.6.0 2.1.0 ~> 1.2 development, test
|
74
|
+
# # capybara 3.33.0 3.37.1 = 3.33.0 development, test
|
75
|
+
# # chartkick 2.3.5 4.2.0 ~> 2.3 default
|
76
|
+
# # childprocess 3.0.0 4.1.0
|
77
|
+
# # clamby 1.6.6 1.6.8 = 1.6.6 default
|
78
|
+
# # createsend 5.1.1 6.0.0 ~> 5.1 default
|
79
|
+
# # database_cleaner 1.7.0 2.0.1 = 1.7.0 development, test
|
80
|
+
# # factory_bot 5.2.0 6.2.1
|
81
|
+
# # factory_bot_rails 5.2.0 6.2.0 = 5.2.0 development, test
|
82
|
+
# # faker 1.9.6 2.22.0 ~> 1.7 default
|
83
|
+
# # groupdate 4.3.0 6.1.0 ~> 4.1 default
|
84
|
+
# # guard-bundler 2.2.1 3.0.0 = 2.2.1 development, test
|
85
|
+
# # guard-rubocop 1.4.0 1.5.0 = 1.4.0 development, test
|
86
|
+
# # hashie 3.6.0 5.0.0
|
87
|
+
# # http-accept 1.7.0 2.1.1
|
88
|
+
# # k_log 0.0.18 0.0.33 = 0.0.18 development, test
|
89
|
+
# # net-ssh 6.1.0 7.0.1
|
90
|
+
# # oauth2 1.4.10 2.0.6
|
91
|
+
# # omniauth-oauth2 1.7.3 1.8.0
|
92
|
+
# # paper_trail 10.3.1 12.3.0 ~> 10.3 default
|
93
|
+
# # pg 0.21.0 1.4.2 ~> 0.20 default
|
94
|
+
# # pg_search 2.3.0 2.3.6 ~> 2.0 default
|
95
|
+
# # pry 0.13.1 0.14.1
|
96
|
+
# # public_suffix 2.0.5 5.0.0 ~> 2.0 default
|
97
|
+
# # pusher 1.4.3 2.0.2 ~> 1.3 default
|
98
|
+
# # rack-mini-profiler 0.10.7 3.0.0 ~> 0.10 default
|
99
|
+
# # rack-test 0.6.3 2.0.2
|
100
|
+
# # rails 5.0.7.2 7.0.3.1 = 5.0.7.2 default
|
101
|
+
# # railties 5.0.7.2 7.0.3.1
|
102
|
+
# # ransack 1.8.10 3.2.1 ~> 1.8 default
|
103
|
+
# # redis 3.3.5 4.7.1 ~> 3.3 default
|
104
|
+
# # redis-store 1.6.0 1.9.1
|
105
|
+
# # regexp_parser 1.8.2 2.5.0
|
106
|
+
# # rspec 3.10.0 3.11.0
|
107
|
+
# # rspec-core 3.10.1 3.11.0 = 3.10.1 development, test
|
108
|
+
# # rspec-expectations 3.10.1 3.11.0 = 3.10.1 development, test
|
109
|
+
# # rspec-mocks 3.10.2 3.11.1 = 3.10.2 development, test
|
110
|
+
# # rspec-rails 4.1.2 5.1.2 = 4.1.2 development, test
|
111
|
+
# # rspec-support 3.10.2 3.11.0 = 3.10.2 development, test
|
112
|
+
# # rubyzip 1.3.0 2.3.2 ~> 1.3 default
|
113
|
+
# # scenic 1.5.4 1.6.0 = 1.5.4 default
|
114
|
+
# # scout_apm 4.1.2 5.2.0 ~> 4.1 default
|
115
|
+
# # selenium-webdriver 3.142.7 4.3.0 = 3.142.7 development, test
|
116
|
+
# # shoulda-matchers 4.0.1 5.1.0 = 4.0.1 development, test
|
117
|
+
# # sidekiq 4.2.10 6.5.1 ~> 4.2 default
|
118
|
+
# # sidekiq-pool 1.9.3 2.0.1 ~> 1.8 default
|
119
|
+
# # sidekiq-unique-jobs 6.0.25 7.1.27 ~> 6.0 default
|
120
|
+
# # spring 2.1.1 4.0.0 ~> 2.0 development, test
|
121
|
+
# # sprockets 3.7.2 4.1.1 ~> 3.7 default
|
122
|
+
# # sprockets-rails 3.2.2 3.4.2
|
123
|
+
# # timecop 0.8.1 0.9.5 = 0.8.1 development, test
|
124
|
+
# # tzinfo 1.2.10 2.0.5
|
125
|
+
# # uglifier 3.2.0 4.2.0 ~> 3.2 default
|
126
|
+
# # unicorn 5.8.0 6.1.0 ~> 5.3 default
|
127
|
+
# # webmock 3.13.0 3.14.0 = 3.13.0 development, test
|
128
|
+
# # websocket-driver 0.6.5 0.7.5
|
129
|
+
|
130
|
+
# config.rag.add_option :skip_namespace , type: :boolean , default: false , description: "Skip namespace (affects only isolated engines)"
|
131
|
+
# config.rag.add_option :skip_collision_check , type: :boolean , default: false , description: "Skip collision check"
|
132
|
+
config.rag.add_option :force , type: :boolean , default: nil , description: 'Overwrite files that already exist'
|
133
|
+
# XXX config.rag.add_option :pretend , type: :boolean , default: nil , description: "Run but do not make any changes"
|
134
|
+
# XXX config.rag.add_option :quiet , type: :boolean , default: nil , description: "Suppress status output"
|
135
|
+
# XXX config.rag.add_option :skip , type: :boolean , default: nil , description: "Skip files that already exist"
|
136
|
+
# config.rag.add_option :ruby , type: :string , default: "/Users/davidcruwys/.asdf/installs/ruby/2.7.6/bin/ruby" , description: "Path to the Ruby binary of your choice"
|
137
|
+
# XXX config.rag.add_option :template , type: :string , default: nil , description: "Path to some application template (can be a filesystem path or URL)"
|
138
|
+
# config.rag.add_option :database , type: :string , default: "sqlite3" , description: "Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)"
|
139
|
+
# config.rag.add_option :skip_git , type: :boolean , default: false , description: "Skip .gitignore file"
|
140
|
+
# config.rag.add_option :skip_keeps , type: :boolean , default: false , description: "Skip source control .keep files"
|
141
|
+
# config.rag.add_option :skip_action_mailer , type: :boolean , default: false , description: "Skip Action Mailer files"
|
142
|
+
# config.rag.add_option :skip_action_mailbox , type: :boolean , default: false , description: "Skip Action Mailbox gem"
|
143
|
+
# config.rag.add_option :skip_action_text , type: :boolean , default: false , description: "Skip Action Text gem"
|
144
|
+
# config.rag.add_option :skip_active_record , type: :boolean , default: false , description: "Skip Active Record files"
|
145
|
+
# config.rag.add_option :skip_active_job , type: :boolean , default: false , description: "Skip Active Job"
|
146
|
+
# config.rag.add_option :skip_active_storage , type: :boolean , default: false , description: "Skip Active Storage files"
|
147
|
+
# config.rag.add_option :skip_action_cable , type: :boolean , default: false , description: "Skip Action Cable files"
|
148
|
+
# config.rag.add_option :skip_asset_pipeline , type: :boolean , default: false , description: "Indicates when to generate skip asset pipeline"
|
149
|
+
# config.rag.add_option :asset_pipeline , type: :string , default: "sprockets" , description: "Choose your asset pipeline [options: sprockets (default), propshaft]"
|
150
|
+
# config.rag.add_option :skip_javascript , type: :boolean , default: false , description: "Skip JavaScript files"
|
151
|
+
# config.rag.add_option :skip_hotwire , type: :boolean , default: false , description: "Skip Hotwire integration"
|
152
|
+
# config.rag.add_option :skip_jbuilder , type: :boolean , default: false , description: "Skip jbuilder gem"
|
153
|
+
# config.rag.add_option :skip_test , type: :boolean , default: false , description: "Skip test files"
|
154
|
+
# config.rag.add_option :skip_system_test , type: :boolean , default: false , description: "Skip system test files"
|
155
|
+
# config.rag.add_option :skip_bootsnap , type: :boolean , default: false , description: "Skip bootsnap gem"
|
156
|
+
# config.rag.add_option :dev , type: :boolean , default: false , description: "Set up the application with Gemfile pointing to your Rails checkout"
|
157
|
+
# config.rag.add_option :edge , type: :boolean , default: false , description: "Set up the application with Gemfile pointing to Rails repository"
|
158
|
+
# config.rag.add_option :main , type: :boolean , default: false , description: "Set up the application with Gemfile pointing to Rails repository main branch"
|
159
|
+
# config.rag.add_option :rc , type: :string , default: nil , description: "Path to file containing extra configuration options for rails command"
|
160
|
+
# config.rag.add_option :no_rc , type: :boolean , default: false , description: "Skip loading of extra configuration options from .railsrc file"
|
161
|
+
# config.rag.add_option :help , type: :boolean , default: nil , description: "Show this help message and quit"
|
162
|
+
# config.rag.add_option :version , type: :boolean , default: nil , description: "Show Rails version number and quit"
|
163
|
+
# config.rag.add_option :api , type: :boolean , default: false , description: "Preconfigure smaller stack for API only apps"
|
164
|
+
# config.rag.add_option :minimal , type: :boolean , default: nil , description: "Preconfigure a minimal rails app"
|
165
|
+
# config.rag.add_option :javascript , type: :string , default: "importmap" , description: "Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup]"
|
166
|
+
# config.rag.add_option :css , type: :string , default: nil , description: "Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass... check https://github.com/rails/cssbundling-rails]"
|
167
|
+
# config.rag.add_option :skip_bundle , type: :boolean , default: false , description: "Don't run bundle install"
|
168
|
+
|
169
|
+
# future_option :database , type: :string , default: 'sqlite3' # , description: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
|
170
|
+
# config.rag.add_option :skip_git , type: :boolean, default: false # , description: "Skip .gitignore file"
|
171
|
+
# future_option :skip_keeps , type: :boolean, default: false # , description: "Skip source control .keep files"
|
172
|
+
# future_option :skip_action_mailer , type: :boolean, default: false # , description: "Skip Action Mailer files"
|
173
|
+
# future_option :skip_action_mailbox , type: :boolean, default: false # , description: "Skip Action Mailbox gem"
|
174
|
+
# future_option :skip_action_text , type: :boolean, default: false # , description: "Skip Action Text gem"
|
175
|
+
# future_option :skip_active_record , type: :boolean, default: false # , description: "Skip Active Record files"
|
176
|
+
# future_option :skip_active_job , type: :boolean, default: false # , description: "Skip Active Job"
|
177
|
+
# future_option :skip_active_storage , type: :boolean, default: false # , description: "Skip Active Storage files"
|
178
|
+
# future_option :skip_action_cable , type: :boolean, default: false # , description: "Skip Action Cable files"
|
179
|
+
# future_option :skip_asset_pipeline , type: :boolean, default: false #
|
180
|
+
# future_option :asset_pipeline , type: :string , default: 'sprockets' # , description: "Choose your asset pipeline [options: sprockets (default), propshaft]"
|
181
|
+
# future_option :skip_javascript , type: :boolean, default: false # name == 'plugin' # , description: "Skip JavaScript files"
|
182
|
+
# future_option :skip_hotwire , type: :boolean, default: false # , description: "Skip Hotwire integration"
|
183
|
+
# future_option :skip_jbuilder , type: :boolean, default: false # , description: "Skip jbuilder gem"
|
184
|
+
# config.rag.add_option :skip_test , type: :boolean, default: false # , description: "Skip test files"
|
185
|
+
config.rag.add_option :test , type: :string , default: 'rspec' # , description: "minitest or rspec (default: rspec)"
|
186
|
+
# future_option :skip_system_test , type: :boolean, default: false # , description: "Skip system test files"
|
187
|
+
# future_option :skip_bootsnap , type: :boolean, default: false # , description: "Skip bootsnap gem"
|
188
|
+
# future_option :dev , type: :boolean, default: false # , description: "Set up the #{name} with Gemfile pointing to your Rails checkout"
|
189
|
+
# future_option :edge , type: :boolean, default: false # , description: "Set up the #{name} with Gemfile pointing to Rails repository"
|
190
|
+
# future_option :main , type: :boolean, default: false # , description: "Set up the #{name} with Gemfile pointing to Rails repository main branch"
|
191
|
+
# future_option :rc , type: :string , default: nil # , description: "Path to file containing extra configuration options for rails command"
|
192
|
+
# future_option :no_rc , type: :boolean, default: false # , description: "Skip loading of extra configuration options from .railsrc file"
|
193
|
+
# future_option :help , type: :boolean # , group: :rails # , description: "Show this help message and quit"
|
194
|
+
# future_option :version , type: :boolean # , group: :rails, description: "Show Rails version number and quit"
|
195
|
+
# future_option :api , type: :boolean # , description: "Preconfigure smaller stack for API only apps"
|
196
|
+
# future_option :minimal , type: :boolean # , description: "Preconfigure a minimal rails app"
|
197
|
+
# future_option :javascript , type: :string , default: 'importmap' # , description: "Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup]"
|
198
|
+
# config.rag.add_option :css , type: :string , description: "Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass... check https://github.com/rails/cssbundling-rails]"
|
199
|
+
# config.rag.add_option :skip_bundle , type: :boolean, default: false , description: "Don't run bundle install"
|
200
|
+
|
201
|
+
# config.rag.add_option :add_irbrc , type: :boolean, default: false
|
202
|
+
# config.rag.add_option :add_foreman , type: :boolean, default: false
|
203
|
+
# config.rag.add_option :add_devise , type: :boolean, default: false
|
204
|
+
# config.rag.add_option :add_dotenv , type: :boolean, default: false
|
205
|
+
# config.rag.add_option :add_docker , type: :boolean, default: false
|
206
|
+
# config.rag.add_option :add_docker_compose , type: :boolean, default: false
|
207
|
+
# config.rag.add_option :add_rubocop , type: :boolean, default: false
|
208
|
+
# config.rag.add_option :add_annotate , type: :boolean, default: false
|
209
|
+
# config.rag.add_option :add_continuous_integration , type: :boolean, default: false
|
210
|
+
# config.rag.add_option :add_high_voltage , type: :boolean, default: false
|
211
|
+
# config.rag.add_option :add_generators , type: :boolean, default: false
|
212
|
+
# config.rag.add_option :add_lograge , type: :boolean, default: false
|
213
|
+
# config.rag.add_option :add_pundit , type: :boolean, default: false
|
214
|
+
# config.rag.add_option :add_services , type: :boolean, default: false
|
215
|
+
# config.rag.add_option :add_sidekiq , type: :boolean, default: false
|
216
|
+
# config.rag.add_option :add_views , type: :boolean, default: false
|
217
|
+
# config.rag.add_option :add_errors , type: :boolean, default: false
|
218
|
+
# config.rag.add_option :add_scaffold , type: :boolean, default: false
|
219
|
+
# config.rag.add_option :add_factory_bot , type: :boolean, default: false
|
220
|
+
# config.rag.add_option :add_shoulda , type: :boolean, default: false
|
221
|
+
|
222
|
+
# NEW GEM ADDONS
|
223
|
+
config.rag.add_option :add_acts_as_list , type: :boolean, default: false
|
224
|
+
config.rag.add_option :add_browser , type: :boolean, default: false
|
225
|
+
config.rag.add_option :add_chartkick , type: :boolean, default: false
|
226
|
+
config.rag.add_option :add_faker , type: :boolean, default: false
|
227
|
+
config.rag.add_option :add_groupdate , type: :boolean, default: false
|
228
|
+
config.rag.add_option :add_hexapdf , type: :boolean, default: false
|
229
|
+
config.rag.add_option :add_httparty , type: :boolean, default: false
|
230
|
+
config.rag.add_option :add_honeybadger , type: :boolean, default: false
|
231
|
+
config.rag.add_option :add_mini_magick , type: :boolean, default: false , description: 'Add Mini Magick gem'
|
232
|
+
config.rag.add_option :add_rails_html_sanitizer , type: :boolean, default: false
|
233
|
+
config.rag.add_option :add_twilio_ruby , type: :boolean, default: false
|
234
|
+
end
|
235
|
+
|
236
|
+
# Make sure that RailsOptions reflect the options available from Railties
|
237
|
+
RailsAppGenerator::AppGenerator.class_options.each do |class_option|
|
238
|
+
thor_option = class_option[1]
|
239
|
+
# puts "Adding railties class_option onto RailsOptions: #{thor_option.name}"
|
240
|
+
RailsAppGenerator::RailsOptions.add_thor_class_option(thor_option)
|
241
|
+
end
|
242
|
+
# Make sure that RailsOptions reflect the options available from custom configuration
|
243
|
+
KConfig.configuration.rag.options.each do |option|
|
244
|
+
RailsAppGenerator::RailsOptions.add_class_option(option)
|
245
|
+
RailsAppGenerator::AppGenerator.add_class_option(option)
|
246
|
+
end
|
247
|
+
|
248
|
+
# Debugging code
|
249
|
+
RailsAppGenerator::Util.write_last_run('rails_options_class.json', RailsAppGenerator::RailsOptions.to_h)
|
250
|
+
RailsAppGenerator::Util.write_last_run('app_generator_class.json', RailsAppGenerator::AppGenerator.to_h)
|
@@ -21,6 +21,32 @@ module RailsAppGenerator
|
|
21
21
|
heading = "- [ #{heading} ]"
|
22
22
|
puts heading.length > len ? heading : heading.ljust(len, '-')
|
23
23
|
end
|
24
|
+
|
25
|
+
def write_last_run(file, data)
|
26
|
+
file = File.join('~/dev/kgems/rails_app_generator/docs/last_run/', file)
|
27
|
+
write_json(file, data)
|
28
|
+
end
|
29
|
+
|
30
|
+
def write_json(file, data)
|
31
|
+
file = File.expand_path(file)
|
32
|
+
puts "Write to #{file}"
|
33
|
+
FileUtils.mkdir_p(File.dirname(file))
|
34
|
+
File.write(file, JSON.pretty_generate(data))
|
35
|
+
end
|
36
|
+
|
37
|
+
# Take array of Thor::Option and extract the data as a hash
|
38
|
+
#
|
39
|
+
# You can find the array on the class_options reader
|
40
|
+
def thor_options_to_hash(thor_options)
|
41
|
+
common_keys = thor_options.flat_map(&:instance_variables).uniq
|
42
|
+
common_keys = common_keys.map { |k| k.to_s.delete_prefix('@').to_sym }
|
43
|
+
|
44
|
+
thor_options.map do |option|
|
45
|
+
common_keys.each_with_object({}) do |key, result|
|
46
|
+
result[key] = option.send(key) if option.respond_to?(key)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
24
50
|
end
|
25
51
|
end
|
26
52
|
end
|
data/lib/rails_app_generator.rb
CHANGED
@@ -6,11 +6,14 @@ require 'rails/generators'
|
|
6
6
|
require 'rails/generators/app_name'
|
7
7
|
require 'rails/generators/rails/app/app_generator'
|
8
8
|
require 'bundler'
|
9
|
+
require 'k_config'
|
9
10
|
|
10
11
|
require 'rails_app_generator/version'
|
12
|
+
require 'rails_app_generator/util'
|
13
|
+
require 'rails_app_generator/configuration/rag_configuration'
|
14
|
+
require 'rails_app_generator/configuration/rag_configuration_extension'
|
11
15
|
require 'rails_app_generator/cli/diff'
|
12
16
|
require 'rails_app_generator/cli/profile'
|
13
|
-
require 'rails_app_generator/util'
|
14
17
|
require 'rails_app_generator/diff/file_pair'
|
15
18
|
require 'rails_app_generator/diff/compare_info'
|
16
19
|
require 'rails_app_generator/diff/processor'
|
@@ -25,13 +28,15 @@ require 'rails_app_generator/options/options_builder'
|
|
25
28
|
require 'rails_app_generator/options/rails_options'
|
26
29
|
require 'rails_app_generator/context'
|
27
30
|
require 'rails_app_generator/dependencies'
|
28
|
-
require 'rails_app_generator/
|
29
|
-
|
31
|
+
require 'rails_app_generator/addon'
|
32
|
+
require 'rails_app_generator/addon_util'
|
30
33
|
require 'rails_app_generator/formatted_gem_entry'
|
31
34
|
require 'rails_app_generator/app_builder'
|
32
35
|
require 'rails_app_generator/app_generator'
|
33
36
|
require 'rails_app_generator/starter'
|
34
37
|
|
38
|
+
Dir[File.join(__dir__, 'rails_app_generator', 'addons', '*.rb')].sort.each { |file| require file }
|
39
|
+
|
35
40
|
module RailsAppGenerator
|
36
41
|
# raise RailsAppGenerator::Error, 'Sample message'
|
37
42
|
Error = Class.new(StandardError)
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "rails_app_generator",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.2.0",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "rails_app_generator",
|
9
|
-
"version": "0.
|
9
|
+
"version": "0.2.0",
|
10
10
|
"dependencies": {
|
11
11
|
"daisyui": "^2.20.0"
|
12
12
|
},
|
data/package.json
CHANGED
data/tasks/addon.thor
CHANGED
@@ -6,8 +6,8 @@ require 'net/http'
|
|
6
6
|
require 'json'
|
7
7
|
require_relative 'gem_info'
|
8
8
|
|
9
|
-
# Thor task to create a new
|
10
|
-
class
|
9
|
+
# Thor task to create a new Addon for Rails App Generator
|
10
|
+
class Addon < Thor
|
11
11
|
include Thor::Actions
|
12
12
|
|
13
13
|
source_root(File.expand_path('../templates/thor_task', File.dirname(__FILE__)))
|
@@ -27,9 +27,9 @@ class AddOn < Thor
|
|
27
27
|
|
28
28
|
# method_option :from, :required => true
|
29
29
|
desc 'new', 'Create a new Addon for Rails App Generator'
|
30
|
-
method_option :gem , type: :string, default: nil, desc: 'Add required_gem helper to the
|
30
|
+
method_option :gem , type: :string, default: nil, desc: 'Add required_gem helper to the Addon. Gem name is looked up to find version and description'
|
31
31
|
method_option :force, type: :boolean, default: false, desc: 'Overwrite existing files'
|
32
|
-
method_option :depends_on, type: :string, desc: 'This
|
32
|
+
method_option :depends_on, type: :string, desc: 'This Addon depends on another Addon/Gem. active_record is a common dependency'
|
33
33
|
def new(name)
|
34
34
|
self.name = snake(name)
|
35
35
|
self.data = build_data
|
@@ -1,17 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# class_option :add_<%= data.name_snake %>, type: :boolean, default: false
|
6
|
-
# add_if(:<%= data.name_snake %>)
|
7
|
-
# lib/rails_app_generator/options/rails_options.rb
|
8
|
-
# register_option :add_<%= data.name_snake %>, type: :boolean, default: false
|
3
|
+
# lib/rails_app_generator/rag_initializer.rb
|
4
|
+
# config.rag.add_option :add_<%= data.name_snake %> , type: :boolean, default: false
|
9
5
|
|
10
6
|
module RailsAppGenerator
|
11
7
|
# Custom add-ons for RailsAppGenerator
|
12
8
|
module AddOns
|
13
9
|
# Add <%= data.name_camel %> to rails application
|
14
|
-
class <%= data.name_camel %> <
|
10
|
+
class <%= data.name_camel %> < RailsAppGenerator::Addon
|
15
11
|
<%= data.addon_config_code %>
|
16
12
|
def apply
|
17
13
|
say 'Setting up <%= data.name_camel %>'
|