rails_app_generator 0.1.28 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/generators/project-plan.rb +6 -3
  3. data/.rubocop.yml +2 -1
  4. data/CHANGELOG.md +29 -0
  5. data/after_templates/addons/acts_as_list/_.rb +0 -14
  6. data/after_templates/addons/mini_magick/_.rb +1 -1
  7. data/after_templates/application/printspeak/_.rb +55 -0
  8. data/after_templates/{rag_tailwind/component-section-begin.html → application/printspeak/app/assets/images/.keep} +0 -0
  9. data/after_templates/application/printspeak/app/assets/images/about/1.jpg +0 -0
  10. data/after_templates/application/printspeak/app/assets/images/about/2.jpg +0 -0
  11. data/after_templates/application/printspeak/app/assets/images/about/3.jpg +0 -0
  12. data/after_templates/application/printspeak/app/assets/images/about/4.jpg +0 -0
  13. data/after_templates/application/printspeak/app/assets/images/close-icon.svg +1 -0
  14. data/after_templates/application/printspeak/app/assets/images/header-bg.jpg +0 -0
  15. data/after_templates/application/printspeak/app/assets/images/logos/facebook.svg +34 -0
  16. data/after_templates/application/printspeak/app/assets/images/logos/google.svg +35 -0
  17. data/after_templates/application/printspeak/app/assets/images/logos/ibm.svg +24 -0
  18. data/after_templates/application/printspeak/app/assets/images/logos/microsoft.svg +42 -0
  19. data/after_templates/application/printspeak/app/assets/images/map-image.png +0 -0
  20. data/after_templates/application/printspeak/app/assets/images/navbar-logo.svg +1 -0
  21. data/after_templates/application/printspeak/app/assets/images/portfolio/1.jpg +0 -0
  22. data/after_templates/application/printspeak/app/assets/images/portfolio/2.jpg +0 -0
  23. data/after_templates/application/printspeak/app/assets/images/portfolio/3.jpg +0 -0
  24. data/after_templates/application/printspeak/app/assets/images/portfolio/4.jpg +0 -0
  25. data/after_templates/application/printspeak/app/assets/images/portfolio/5.jpg +0 -0
  26. data/after_templates/application/printspeak/app/assets/images/portfolio/6.jpg +0 -0
  27. data/after_templates/application/printspeak/app/assets/images/portfolio/alphagraphics.jpeg +0 -0
  28. data/after_templates/application/printspeak/app/assets/images/portfolio/brochure-transformed.jpeg +0 -0
  29. data/after_templates/application/printspeak/app/assets/images/portfolio/brochure.jpeg +0 -0
  30. data/after_templates/application/printspeak/app/assets/images/portfolio/kwikkopy.png +0 -0
  31. data/after_templates/application/printspeak/app/assets/images/portfolio/kwikkopy2.png +0 -0
  32. data/after_templates/application/printspeak/app/assets/images/printspeak-logo.svg +19 -0
  33. data/after_templates/application/printspeak/app/assets/images/team/1.jpg +0 -0
  34. data/after_templates/application/printspeak/app/assets/images/team/2.jpg +0 -0
  35. data/after_templates/application/printspeak/app/assets/images/team/3.jpg +0 -0
  36. data/after_templates/application/printspeak/app/assets/stylesheets/application.bootstrap.scss +3 -0
  37. data/after_templates/application/printspeak/app/assets/stylesheets/home/_global.scss +52 -0
  38. data/after_templates/application/printspeak/app/assets/stylesheets/home/_variables.scss +8 -0
  39. data/after_templates/application/printspeak/app/assets/stylesheets/home/components/_buttons.scss +24 -0
  40. data/after_templates/application/printspeak/app/assets/stylesheets/home/components/_navbar.scss +92 -0
  41. data/after_templates/application/printspeak/app/assets/stylesheets/home/sections/_contact.scss +71 -0
  42. data/after_templates/application/printspeak/app/assets/stylesheets/home/sections/_footer.scss +9 -0
  43. data/after_templates/application/printspeak/app/assets/stylesheets/home/sections/_masthead.scss +52 -0
  44. data/after_templates/application/printspeak/app/assets/stylesheets/home/sections/_portfolio.scss +108 -0
  45. data/after_templates/application/printspeak/app/assets/stylesheets/home/sections/_team.scss +24 -0
  46. data/after_templates/application/printspeak/app/assets/stylesheets/home/sections/_timeline.scss +214 -0
  47. data/after_templates/application/printspeak/app/assets/stylesheets/home/styles.scss +24 -0
  48. data/after_templates/application/printspeak/app/assets/stylesheets/home/variables/_colors.scss +15 -0
  49. data/after_templates/application/printspeak/app/assets/stylesheets/home/variables/_typography.scss +54 -0
  50. data/after_templates/application/printspeak/app/controllers/home_controller.rb +7 -0
  51. data/after_templates/application/printspeak/app/views/home/index.html.erb +321 -0
  52. data/after_templates/application/printspeak/app/views/layouts/_alerts.html.erb +2 -0
  53. data/after_templates/application/printspeak/app/views/layouts/_footer.html.erb +16 -0
  54. data/after_templates/application/printspeak/app/views/layouts/_navbar.html.erb +14 -0
  55. data/after_templates/application/printspeak/app/views/layouts/application.html.erb +29 -0
  56. data/after_templates/{rag_printspeak → application/printspeak/app/views}/page/_footer.html.erb +0 -0
  57. data/after_templates/{rag_printspeak → application/printspeak/app/views}/page/architecture.html.erb +0 -0
  58. data/after_templates/{rag_printspeak → application/printspeak/app/views}/page/blog.html.erb +0 -0
  59. data/after_templates/{rag_printspeak → application/printspeak/app/views}/page/faq.html.erb +0 -0
  60. data/after_templates/application/printspeak/app/views/page/page_controller.rb +27 -0
  61. data/after_templates/{rag_printspeak → application/printspeak/app/views}/page/readme.html.erb +0 -0
  62. data/after_templates/application/printspeak/db/seeds.rb +16 -0
  63. data/after_templates/printspeak_bak/_.rb +36 -0
  64. data/after_templates/{rag_printspeak → printspeak_bak}/application_controller.rb +0 -0
  65. data/after_templates/{rag_printspeak → printspeak_bak}/faq.html.erb +0 -0
  66. data/after_templates/{rag_printspeak → printspeak_bak}/layouts/_footer.html.erb +0 -0
  67. data/after_templates/{rag_printspeak → printspeak_bak}/layouts/_head.html.erb +0 -0
  68. data/after_templates/{rag_printspeak → printspeak_bak}/layouts/_navbar.html.erb +0 -0
  69. data/after_templates/{rag_printspeak → printspeak_bak}/layouts/application.html.erb +0 -0
  70. data/after_templates/printspeak_bak/page/_footer.html.erb +184 -0
  71. data/after_templates/printspeak_bak/page/architecture.html.erb +33 -0
  72. data/after_templates/printspeak_bak/page/blog.html.erb +44 -0
  73. data/after_templates/printspeak_bak/page/faq.html.erb +2 -0
  74. data/after_templates/{rag_printspeak → printspeak_bak}/page/home.html.erb +0 -0
  75. data/after_templates/{rag_printspeak → printspeak_bak}/page/page_controller.rb +0 -0
  76. data/after_templates/printspeak_bak/page/readme.html.erb +49 -0
  77. data/after_templates/{rag_bootstrap.rb → rag/bootstrap/_.rb} +1 -1
  78. data/after_templates/{rag_bootstrap → rag/bootstrap}/application-yield.html.erb +0 -0
  79. data/after_templates/{rag_bootstrap → rag/bootstrap}/application.html.erb +0 -0
  80. data/after_templates/{rag_bootstrap → rag/bootstrap}/component-cards-fancy.css +0 -0
  81. data/after_templates/{rag_bootstrap → rag/bootstrap}/component-cards-fancy.html +0 -0
  82. data/after_templates/{rag_bootstrap → rag/bootstrap}/component-cards-staff.css +0 -0
  83. data/after_templates/{rag_bootstrap → rag/bootstrap}/component-cards-staff.html +0 -0
  84. data/after_templates/{rag_bootstrap → rag/bootstrap}/component-cards-styled.html +0 -0
  85. data/after_templates/{rag_bootstrap → rag/bootstrap}/component-footer.html +0 -0
  86. data/after_templates/{rag_bootstrap → rag/bootstrap}/component-hero.html +0 -0
  87. data/after_templates/{rag_bootstrap → rag/bootstrap}/component-modal.html +0 -0
  88. data/after_templates/{rag_bootstrap → rag/bootstrap}/component-nav.html +0 -0
  89. data/after_templates/{rag_bootstrap → rag/bootstrap}/custom-bootstrap-import.scss +0 -0
  90. data/after_templates/{rag_bootstrap → rag/bootstrap}/custom-using-css.css +0 -0
  91. data/after_templates/{rag_bootstrap → rag/bootstrap}/custom-using-scss.scss +0 -0
  92. data/after_templates/{rag_bootstrap → rag/bootstrap}/manifest.js +0 -0
  93. data/after_templates/{rag_devise.rb → rag/devise/_.rb} +1 -1
  94. data/after_templates/{rag_devise → rag/devise}/application.html.erb +0 -0
  95. data/after_templates/{rag_devise → rag/devise}/application_controller.rb +0 -0
  96. data/after_templates/{rag_devise → rag/devise}/config/initializers/devise_turbo.rb +0 -0
  97. data/after_templates/{rag_devise → rag/devise}/layouts/_alerts.html.erb +0 -0
  98. data/after_templates/{rag_devise → rag/devise}/layouts/_footer.html.erb +0 -0
  99. data/after_templates/{rag_devise → rag/devise}/layouts/_navbar.html.erb +0 -0
  100. data/after_templates/{rag_devise → rag/devise}/layouts/application.html.erb +0 -0
  101. data/after_templates/{rag_devise → rag/devise}/post/_post.html.erb +0 -0
  102. data/after_templates/{rag_devise → rag/devise}/post/post.rb +0 -0
  103. data/after_templates/{rag_devise → rag/devise}/post/posts_controller.rb +0 -0
  104. data/after_templates/{rag_devise → rag/devise}/seed_data.rb +0 -0
  105. data/after_templates/{rag_devise → rag/devise}/turbo_controller.rb +0 -0
  106. data/after_templates/{rag_devise → rag/devise}/user.rb +0 -0
  107. data/after_templates/{rag_import_map.rb → rag/import_map/_.rb} +1 -1
  108. data/after_templates/{rag_import_map → rag/import_map}/component-sortable.html +0 -0
  109. data/after_templates/{rag_import_map → rag/import_map}/home.css +0 -0
  110. data/after_templates/{rag_import_map → rag/import_map}/position_controller.js +0 -0
  111. data/after_templates/{rag_simple.rb → rag/simple/_.rb} +1 -1
  112. data/after_templates/{rag_tailwind.rb → rag/tailwind/_.rb} +1 -1
  113. data/after_templates/{rag_tailwind → rag/tailwind}/component-cta.html +0 -0
  114. data/after_templates/{rag_tailwind → rag/tailwind}/component-faq.html +0 -0
  115. data/after_templates/{rag_tailwind → rag/tailwind}/component-footer.html +0 -0
  116. data/after_templates/{rag_tailwind → rag/tailwind}/component-hero.html +0 -0
  117. data/after_templates/{rag_tailwind → rag/tailwind}/component-nav.html +0 -0
  118. data/after_templates/{rag_tailwind/component-section-end.html → rag/tailwind/component-section-begin.html} +0 -0
  119. data/after_templates/{rag_tailwind_emulating_bootstrap/home/index.html.erb → rag/tailwind/component-section-end.html} +0 -0
  120. data/after_templates/{rag_tailwind_daisyui.rb → rag/tailwind_daisyui/_.rb} +1 -1
  121. data/after_templates/{rag_tailwind_daisyui → rag/tailwind_daisyui}/index.html.erb +0 -0
  122. data/after_templates/{rag_tailwind_emulating_bootstrap → rag/tailwind_emulating_bootstrap}/Procfile.dev +0 -0
  123. data/after_templates/{rag_tailwind_emulating_bootstrap.rb → rag/tailwind_emulating_bootstrap/_.rb} +1 -1
  124. data/after_templates/{rag_tailwind_emulating_bootstrap → rag/tailwind_emulating_bootstrap}/application.html.erb +0 -0
  125. data/after_templates/{rag_tailwind_emulating_bootstrap → rag/tailwind_emulating_bootstrap}/application.tailwind.css +0 -0
  126. data/after_templates/{rag_tailwind_emulating_bootstrap → rag/tailwind_emulating_bootstrap}/application_controller.rb +0 -0
  127. data/after_templates/{rag_tailwind_emulating_bootstrap → rag/tailwind_emulating_bootstrap}/home/_example.html.erb +0 -0
  128. data/after_templates/{rag_tailwind_emulating_bootstrap → rag/tailwind_emulating_bootstrap}/home/bootstrap.html.erb +0 -0
  129. data/after_templates/{rag_tailwind_emulating_bootstrap → rag/tailwind_emulating_bootstrap}/home/home_controller.rb +0 -0
  130. data/after_templates/rag/tailwind_emulating_bootstrap/home/index.html.erb +0 -0
  131. data/after_templates/{rag_tailwind_emulating_bootstrap → rag/tailwind_emulating_bootstrap}/home/tailwind.html.erb +0 -0
  132. data/after_templates/{rag_tailwind_hotwire.rb → rag/tailwind_hotwire/_.rb} +1 -1
  133. data/after_templates/{rag_tailwind_hotwire → rag/tailwind_hotwire}/home/controller.rb +0 -0
  134. data/after_templates/{rag_tailwind_hotwire → rag/tailwind_hotwire}/home/helper.rb +0 -0
  135. data/after_templates/{rag_tailwind_hotwire → rag/tailwind_hotwire}/home/increment.html.erb +0 -0
  136. data/after_templates/{rag_tailwind_hotwire → rag/tailwind_hotwire}/home/index.html +0 -0
  137. data/after_templates/{rag_tailwind_hotwire_flash.rb → rag/tailwind_hotwire_flash/_.rb} +1 -1
  138. data/after_templates/{rag_tailwind_hotwire_form.rb → rag/tailwind_hotwire_form/_.rb} +1 -1
  139. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/_contact.html.erb +0 -0
  140. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/_count.html.erb +0 -0
  141. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/_flash.html.erb +0 -0
  142. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/_form.html.erb +0 -0
  143. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/_list.html.erb +0 -0
  144. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/application.html.erb +0 -0
  145. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/application.js +0 -0
  146. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/application.tailwind.css +0 -0
  147. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/application_helper.rb +0 -0
  148. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/contact.rb +0 -0
  149. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/contacts_controller.rb +0 -0
  150. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/create.turbo_stream.erb +0 -0
  151. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/edit.html.erb +0 -0
  152. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/index.html.erb +0 -0
  153. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/new.html.erb +0 -0
  154. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/show.html.erb +0 -0
  155. data/after_templates/{rag_tailwind_hotwire_form → rag/tailwind_hotwire_form}/update.turbo_stream.erb +0 -0
  156. data/after_templates/{rag_tailwind_hotwire_form_search.rb → rag/tailwind_hotwire_form_search/_.rb} +1 -3
  157. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/_contact.html.erb +0 -0
  158. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/_count.html.erb +0 -0
  159. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/_flash.html.erb +0 -0
  160. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/_form.html.erb +0 -0
  161. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/_list.html.erb +0 -0
  162. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/_theme_changer.html.erb +0 -0
  163. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/application.html.erb +0 -0
  164. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/application.js +0 -0
  165. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/application.tailwind.css +0 -0
  166. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/application_helper.rb +0 -0
  167. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/contact.rb +0 -0
  168. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/contacts_controller.rb +0 -0
  169. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/create.turbo_stream.erb +0 -0
  170. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/edit.html.erb +0 -0
  171. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/index.html.erb +0 -0
  172. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/new.html.erb +0 -0
  173. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/search_controller.js +0 -0
  174. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/show.html.erb +0 -0
  175. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/theme_changer_controller.js +0 -0
  176. data/after_templates/{rag_tailwind_hotwire_form_search → rag/tailwind_hotwire_form_search}/update.turbo_stream.erb +0 -0
  177. data/docs/last_run/app_generator_class.json +430 -0
  178. data/docs/last_run/app_generator_data.json +49 -0
  179. data/docs/last_run/rails_options_class.json +430 -0
  180. data/docs/last_run/rails_options_data.json +57 -0
  181. data/docs/project-plan/project.drawio +49 -46
  182. data/docs/project-plan/project_todo.svg +1 -1
  183. data/exe/rag +2 -0
  184. data/lib/rails_app_generator/addons/annotate.rb +0 -3
  185. data/lib/rails_app_generator/addons/twilio_ruby.rb +13 -0
  186. data/lib/rails_app_generator/app_generator.rb +37 -162
  187. data/lib/rails_app_generator/cli/profile.rb +3 -1
  188. data/lib/rails_app_generator/configuration/rag_configuration.rb +18 -0
  189. data/lib/rails_app_generator/configuration/rag_configuration_extension.rb +14 -0
  190. data/lib/rails_app_generator/options/build_option.rb +14 -9
  191. data/lib/rails_app_generator/options/options_builder.rb +57 -9
  192. data/lib/rails_app_generator/options/rails_options.rb +6 -68
  193. data/lib/rails_app_generator/rag_initializer.rb +252 -0
  194. data/lib/rails_app_generator/util.rb +26 -0
  195. data/lib/rails_app_generator/version.rb +1 -1
  196. data/lib/rails_app_generator.rb +4 -1
  197. data/package-lock.json +2 -2
  198. data/package.json +1 -1
  199. data/profiles/addons/mini_magick.json +2 -1
  200. data/profiles/application/printspeak.json +12 -0
  201. data/profiles/default/printspeak.json +12 -0
  202. data/profiles/{rag-printspeak.json → printspeak.json} +3 -2
  203. data/profiles/{rag-bootstrap.json → rag/bootstrap.json} +1 -1
  204. data/profiles/{rag-devise.json → rag/devise.json} +1 -1
  205. data/profiles/{rag-import-map.json → rag/import-map.json} +1 -1
  206. data/profiles/{rag-simple.json → rag/simple.json} +3 -2
  207. data/profiles/{rag-tailwind-daisyui.json → rag/tailwind-daisyui.json} +1 -1
  208. data/profiles/{rag-tailwind-emulating-bootstrap.json → rag/tailwind-emulating-bootstrap.json} +2 -3
  209. data/profiles/{rag-tailwind-hotwire-flash.json → rag/tailwind-hotwire-flash.json} +1 -1
  210. data/profiles/{rag-tailwind-hotwire-form-search.json → rag/tailwind-hotwire-form-search.json} +1 -1
  211. data/profiles/{rag-tailwind-hotwire-form.json → rag/tailwind-hotwire-form.json} +1 -1
  212. data/profiles/{rag-tailwind-hotwire.json → rag/tailwind-hotwire.json} +1 -1
  213. data/profiles/{rag-tailwind.json → rag/tailwind.json} +3 -2
  214. data/tasks/profile.thor +1 -1
  215. data/templates/thor_task/addon/addon.tt +2 -6
  216. data/templates/thor_task/profile/after_template.rb +1 -0
  217. metadata +208 -130
  218. data/after_templates/rag_printspeak.rb +0 -36
  219. data/profiles/rag-add-some-pages.json +0 -11
  220. data/profiles/rag-sample.json +0 -13
@@ -26,7 +26,9 @@ module RailsAppGenerator
26
26
  args = profile[:args]
27
27
  opts = RailsAppGenerator::RailsOptions.new(profile[:opts])
28
28
 
29
- starter = RailsAppGenerator::Starter.new(args)
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)
@@ -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, :desc, :type, :default, :required, :mapper
10
+ attr_reader :name, :description, :type, :default, :required, :mapper
16
11
 
17
- def initialize(**args)
18
- @name = args[:name]
19
- @desc = args[:desc] || ''
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
@@ -21,34 +21,76 @@ module RailsAppGenerator
21
21
  @class_options_lookup ||= {}
22
22
  end
23
23
 
24
- # Future options are placeholders for options that are not yet implemented
25
- def future_option(name, **args); end
26
-
27
24
  # Register an option with the builder, this method has the same signature as Thor.
28
25
  #
29
26
  # This is so options can be used interchangeably between OptionsBuilder and Thor.
30
27
  def class_option(name, **args)
31
- return if class_options_lookup.key?(name)
28
+ option = BuildOption.new(name, args)
29
+
30
+ add_class_option(option)
31
+ end
32
32
 
33
- option = BuildOption.new(**{ name: name }.merge(args))
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
34
39
 
35
- class_options_lookup[name] = option
40
+ class_options_lookup[option.name.to_sym] = option
36
41
  class_options << option
37
42
  end
38
43
 
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)
52
+
53
+ add_class_option(option)
54
+ end
55
+
39
56
  def reset
40
57
  @class_options = nil
41
58
  @class_options_lookup = nil
42
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
+ }
66
+ end
43
67
  end
44
68
 
69
+ # rubocop:disable Metrics/AbcSize
45
70
  def cmd_line_options
46
- self.class.class_options.map do |option|
71
+ available_options = options.clone
72
+
73
+ result = self.class.class_options.map do |option|
47
74
  mapper = option.mapper
48
- value = options[option.name]
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
+
49
84
  mapper.map(option.name, value)
50
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'
51
92
  end
93
+ # rubocop:enable Metrics/AbcSize
52
94
 
53
95
  def debug
54
96
  puts '[ Options JSON ]----------------------------------------------------'
@@ -57,10 +99,16 @@ module RailsAppGenerator
57
99
  puts cmd_line_options
58
100
  end
59
101
 
102
+ def to_h
103
+ {
104
+ options: options
105
+ }
106
+ end
107
+
60
108
  private
61
109
 
62
110
  def default_options
63
- self.class.class_options.to_h { |option| [option.name, option.default] }
111
+ self.class.class_options.to_h { |option| [option.name.to_sym, option.default] }
64
112
  end
65
113
  end
66
114
  end
@@ -2,74 +2,12 @@
2
2
 
3
3
  module RailsAppGenerator
4
4
  class RailsOptions < OptionsBuilder
5
- # NOTE: Currently you need to register new options in two places
6
- # here and in lib/rails_app_generator/app_generator.rb
7
- class_option :template , type: :string # , desc: "Path to some #{name} template (can be a filesystem path or URL)"
8
- future_option :database , type: :string , default: 'sqlite3' # , desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
9
- class_option :skip_git , type: :boolean, default: false # , desc: "Skip .gitignore file"
10
- future_option :skip_keeps , type: :boolean, default: false # , desc: "Skip source control .keep files"
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
- class_option :skip_test , type: :boolean, default: false # , desc: "Skip test files"
24
- class_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
- class_option :css , type: :string # , desc: "Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass... check https://github.com/rails/cssbundling-rails]"
38
- class_option :skip_bundle , type: :boolean, default: false # , desc: "Don't run bundle install"
39
-
40
- class_option :add_irbrc , type: :boolean, default: false
41
- class_option :add_foreman , type: :boolean, default: false
42
- class_option :add_devise , type: :boolean, default: false
43
- class_option :add_dotenv , type: :boolean, default: false
44
- class_option :add_docker , type: :boolean, default: false
45
- class_option :add_docker_compose , type: :boolean, default: false
46
- class_option :add_rubocop , type: :boolean, default: false
47
- class_option :add_annotate , type: :boolean, default: false
48
- class_option :add_continuous_integration , type: :boolean, default: false
49
- class_option :add_high_voltage , type: :boolean, default: false
50
- class_option :add_generators , type: :boolean, default: false
51
- class_option :add_lograge , type: :boolean, default: false
52
- class_option :add_pundit , type: :boolean, default: false
53
- class_option :add_services , type: :boolean, default: false
54
- class_option :add_sidekiq , type: :boolean, default: false
55
- class_option :add_views , type: :boolean, default: false
56
- class_option :add_errors , type: :boolean, default: false
57
- class_option :add_scaffold , type: :boolean, default: false
58
- class_option :add_factory_bot , type: :boolean, default: false
59
- class_option :add_shoulda , type: :boolean, default: false
60
-
61
- # NEW GEM ADDONS
62
- class_option :add_acts_as_list , type: :boolean, default: false
63
- class_option :add_browser , type: :boolean, default: false
64
- class_option :add_chartkick , type: :boolean, default: false
65
- class_option :add_faker , type: :boolean, default: false
66
- class_option :add_groupdate , type: :boolean, default: false
67
- class_option :add_hexapdf , type: :boolean, default: false
68
- class_option :add_httparty , type: :boolean, default: false
69
- class_option :add_honeybadger , type: :boolean, default: false
70
- class_option :add_mini_magick , type: :boolean, default: false
71
- class_option :add_rails_html_sanitizer , type: :boolean, default: false
72
- class_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,252 @@
1
+ # frozen_string_literal: true
2
+
3
+ # frozen__tring_literal: true
4
+
5
+ KConfig.configure do |config|
6
+ rag = config.rag
7
+ # https://railsbytes.com/public/templates
8
+ # http://www.railscomposer.com/
9
+ # https://github.com/RailsApps/rails-composer
10
+ # https://github.com/carbonfive/raygun-rails
11
+ # https://github.com/abhaynikam/boring_generators
12
+
13
+ # rag.add_option :test , type: :string , default: 'rspec'
14
+
15
+ # # Gem Current Latest Requested Groups
16
+ # # aws-sdk
17
+ # # capistrano-bundler 1.6.0 2.1.0 ~> 1.2 development, test
18
+ # # capybara 3.33.0 3.37.1 = 3.33.0 development, test
19
+ # # clamby 1.6.6 1.6.8 = 1.6.6 default
20
+ # # createsend 5.1.1 6.0.0 ~> 5.1 default
21
+ # # database_cleaner 1.7.0 2.0.1 = 1.7.0 development, test
22
+ # # erubi 1.10.0 1.11.0
23
+ # # factory_bot 5.2.0 6.2.1
24
+ # # factory_bot_rails 5.2.0 6.2.0 = 5.2.0 development, test
25
+ # # guard-bundler 2.2.1 3.0.0 = 2.2.1 development, test
26
+ # # guard-rubocop 1.4.0 1.5.0 = 1.4.0 development, test
27
+ # # http-accept 1.7.0 2.2.0
28
+ # # net-ssh 6.1.0 7.0.1
29
+ # # oauth2 1.4.10 2.0.6
30
+ # # omniauth-oauth2 1.7.3 1.8.0
31
+ # # paper_trail 10.3.1 12.3.0 ~> 10.3 default
32
+ # # pg 0.21.0 1.4.2 ~> 0.20 default
33
+ # # pg_search 2.3.0 2.3.6 ~> 2.0 default
34
+ # # pry 0.13.1 0.14.1
35
+ # # public_suffix 2.0.5 5.0.0 ~> 2.0 default
36
+ # # pusher 1.4.3 2.0.2 ~> 1.3 default
37
+ # # rack-mini-profiler 0.10.7 3.0.0 ~> 0.10 default
38
+ # # rack-test 0.6.3 2.0.2
39
+ # # rails 5.0.7.2 7.0.3.1 = 5.0.7.2 default
40
+ # # railties 5.0.7.2 7.0.3.1
41
+ # # ransack 1.8.10 3.2.1 ~> 1.8 default
42
+ # # redis 3.3.5 4.7.1 ~> 3.3 default
43
+ # # redis-store 1.6.0 1.9.1
44
+ # # regexp_parser 1.8.2 2.5.0
45
+ # # rspec 3.10.0 3.11.0
46
+ # # rspec-core 3.10.1 3.11.0 = 3.10.1 development, test
47
+ # # rspec-expectations 3.10.1 3.11.0 = 3.10.1 development, test
48
+ # # rspec-mocks 3.10.2 3.11.1 = 3.10.2 development, test
49
+ # # rspec-rails 4.1.2 5.1.2 = 4.1.2 development, test
50
+ # # rspec-support 3.10.2 3.11.0 = 3.10.2 development, test
51
+ # # rubyzip 1.3.0 2.3.2 ~> 1.3 default
52
+ # # scenic 1.5.4 1.6.0 = 1.5.4 default
53
+ # # scout_apm 4.1.2 5.2.0 ~> 4.1 default
54
+ # # selenium-webdriver 3.142.7 4.3.0 = 3.142.7 development, test
55
+ # # shoulda-matchers 4.0.1 5.1.0 = 4.0.1 development, test
56
+ # # sidekiq 4.2.10 6.5.1 ~> 4.2 default
57
+ # # sidekiq-pool 1.9.3 2.0.1 ~> 1.8 default
58
+ # # sidekiq-unique-jobs 6.0.25 7.1.27 ~> 6.0 default
59
+ # # spring 2.1.1 4.0.0 ~> 2.0 development, test
60
+ # # sprockets 3.7.2 4.1.1 ~> 3.7 default
61
+ # # sprockets-rails 3.2.2 3.4.2
62
+ # # timecop 0.8.1 0.9.5 = 0.8.1 development, test
63
+ # # tzinfo 1.2.10 2.0.5
64
+ # # uglifier 3.2.0 4.2.0 ~> 3.2 default
65
+ # # unicorn 5.8.0 6.1.0 ~> 5.3 default
66
+ # # webmock 3.13.0 3.16.0 = 3.13.0 development, test
67
+ # # websocket-driver 0.6.5 0.7.5
68
+
69
+ # # acts_as_list 0.9.19 1.0.4 ~> 0.9 default
70
+ # # arel 7.1.4 9.0.0
71
+ # # bigdecimal 1.4.4 3.1.2 ~> 1.4 development, test
72
+ # # binding_of_caller 0.8.0 1.0.0 ~> 0.8 default
73
+ # # browser 2.7.1 5.3.1 ~> 2.3 default
74
+ # # capistrano-bundler 1.6.0 2.1.0 ~> 1.2 development, test
75
+ # # capybara 3.33.0 3.37.1 = 3.33.0 development, test
76
+ # # chartkick 2.3.5 4.2.0 ~> 2.3 default
77
+ # # childprocess 3.0.0 4.1.0
78
+ # # clamby 1.6.6 1.6.8 = 1.6.6 default
79
+ # # createsend 5.1.1 6.0.0 ~> 5.1 default
80
+ # # database_cleaner 1.7.0 2.0.1 = 1.7.0 development, test
81
+ # # factory_bot 5.2.0 6.2.1
82
+ # # factory_bot_rails 5.2.0 6.2.0 = 5.2.0 development, test
83
+ # # faker 1.9.6 2.22.0 ~> 1.7 default
84
+ # # groupdate 4.3.0 6.1.0 ~> 4.1 default
85
+ # # guard-bundler 2.2.1 3.0.0 = 2.2.1 development, test
86
+ # # guard-rubocop 1.4.0 1.5.0 = 1.4.0 development, test
87
+ # # hashie 3.6.0 5.0.0
88
+ # # http-accept 1.7.0 2.1.1
89
+ # # k_log 0.0.18 0.0.33 = 0.0.18 development, test
90
+ # # net-ssh 6.1.0 7.0.1
91
+ # # oauth2 1.4.10 2.0.6
92
+ # # omniauth-oauth2 1.7.3 1.8.0
93
+ # # paper_trail 10.3.1 12.3.0 ~> 10.3 default
94
+ # # pg 0.21.0 1.4.2 ~> 0.20 default
95
+ # # pg_search 2.3.0 2.3.6 ~> 2.0 default
96
+ # # pry 0.13.1 0.14.1
97
+ # # public_suffix 2.0.5 5.0.0 ~> 2.0 default
98
+ # # pusher 1.4.3 2.0.2 ~> 1.3 default
99
+ # # rack-mini-profiler 0.10.7 3.0.0 ~> 0.10 default
100
+ # # rack-test 0.6.3 2.0.2
101
+ # # rails 5.0.7.2 7.0.3.1 = 5.0.7.2 default
102
+ # # railties 5.0.7.2 7.0.3.1
103
+ # # ransack 1.8.10 3.2.1 ~> 1.8 default
104
+ # # redis 3.3.5 4.7.1 ~> 3.3 default
105
+ # # redis-store 1.6.0 1.9.1
106
+ # # regexp_parser 1.8.2 2.5.0
107
+ # # rspec 3.10.0 3.11.0
108
+ # # rspec-core 3.10.1 3.11.0 = 3.10.1 development, test
109
+ # # rspec-expectations 3.10.1 3.11.0 = 3.10.1 development, test
110
+ # # rspec-mocks 3.10.2 3.11.1 = 3.10.2 development, test
111
+ # # rspec-rails 4.1.2 5.1.2 = 4.1.2 development, test
112
+ # # rspec-support 3.10.2 3.11.0 = 3.10.2 development, test
113
+ # # rubyzip 1.3.0 2.3.2 ~> 1.3 default
114
+ # # scenic 1.5.4 1.6.0 = 1.5.4 default
115
+ # # scout_apm 4.1.2 5.2.0 ~> 4.1 default
116
+ # # selenium-webdriver 3.142.7 4.3.0 = 3.142.7 development, test
117
+ # # shoulda-matchers 4.0.1 5.1.0 = 4.0.1 development, test
118
+ # # sidekiq 4.2.10 6.5.1 ~> 4.2 default
119
+ # # sidekiq-pool 1.9.3 2.0.1 ~> 1.8 default
120
+ # # sidekiq-unique-jobs 6.0.25 7.1.27 ~> 6.0 default
121
+ # # spring 2.1.1 4.0.0 ~> 2.0 development, test
122
+ # # sprockets 3.7.2 4.1.1 ~> 3.7 default
123
+ # # sprockets-rails 3.2.2 3.4.2
124
+ # # timecop 0.8.1 0.9.5 = 0.8.1 development, test
125
+ # # tzinfo 1.2.10 2.0.5
126
+ # # uglifier 3.2.0 4.2.0 ~> 3.2 default
127
+ # # unicorn 5.8.0 6.1.0 ~> 5.3 default
128
+ # # webmock 3.13.0 3.14.0 = 3.13.0 development, test
129
+ # # websocket-driver 0.6.5 0.7.5
130
+
131
+ # rag.add_option :skip_namespace , type: :boolean , default: false , description: "Skip namespace (affects only isolated engines)"
132
+ # rag.add_option :skip_collision_check , type: :boolean , default: false , description: "Skip collision check"
133
+ rag.add_option :force , type: :boolean , default: nil , description: 'Overwrite files that already exist'
134
+ # XXX rag.add_option :pretend , type: :boolean , default: nil , description: "Run but do not make any changes"
135
+ # XXX rag.add_option :quiet , type: :boolean , default: nil , description: "Suppress status output"
136
+ # XXX rag.add_option :skip , type: :boolean , default: nil , description: "Skip files that already exist"
137
+ # 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"
138
+ # XXX rag.add_option :template , type: :string , default: nil , description: "Path to some application template (can be a filesystem path or URL)"
139
+ # rag.add_option :database , type: :string , default: "sqlite3" , description: "Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)"
140
+ # rag.add_option :skip_git , type: :boolean , default: false , description: "Skip .gitignore file"
141
+ # rag.add_option :skip_keeps , type: :boolean , default: false , description: "Skip source control .keep files"
142
+ # rag.add_option :skip_action_mailer , type: :boolean , default: false , description: "Skip Action Mailer files"
143
+ # rag.add_option :skip_action_mailbox , type: :boolean , default: false , description: "Skip Action Mailbox gem"
144
+ # rag.add_option :skip_action_text , type: :boolean , default: false , description: "Skip Action Text gem"
145
+ # rag.add_option :skip_active_record , type: :boolean , default: false , description: "Skip Active Record files"
146
+ # rag.add_option :skip_active_job , type: :boolean , default: false , description: "Skip Active Job"
147
+ # rag.add_option :skip_active_storage , type: :boolean , default: false , description: "Skip Active Storage files"
148
+ # rag.add_option :skip_action_cable , type: :boolean , default: false , description: "Skip Action Cable files"
149
+ # rag.add_option :skip_asset_pipeline , type: :boolean , default: false , description: "Indicates when to generate skip asset pipeline"
150
+ # rag.add_option :asset_pipeline , type: :string , default: "sprockets" , description: "Choose your asset pipeline [options: sprockets (default), propshaft]"
151
+ # rag.add_option :skip_javascript , type: :boolean , default: false , description: "Skip JavaScript files"
152
+ # rag.add_option :skip_hotwire , type: :boolean , default: false , description: "Skip Hotwire integration"
153
+ # rag.add_option :skip_jbuilder , type: :boolean , default: false , description: "Skip jbuilder gem"
154
+ # rag.add_option :skip_test , type: :boolean , default: false , description: "Skip test files"
155
+ # rag.add_option :skip_system_test , type: :boolean , default: false , description: "Skip system test files"
156
+ # rag.add_option :skip_bootsnap , type: :boolean , default: false , description: "Skip bootsnap gem"
157
+ # rag.add_option :dev , type: :boolean , default: false , description: "Set up the application with Gemfile pointing to your Rails checkout"
158
+ # rag.add_option :edge , type: :boolean , default: false , description: "Set up the application with Gemfile pointing to Rails repository"
159
+ rag.add_option :note , type: :string , default: nil , description: "Set a note or comment"
160
+ # rag.add_option :main , type: :boolean , default: false , description: "Set up the application with Gemfile pointing to Rails repository main branch"
161
+ # rag.add_option :rc , type: :string , default: nil , description: "Path to file containing extra configuration options for rails command"
162
+ # rag.add_option :no_rc , type: :boolean , default: false , description: "Skip loading of extra configuration options from .railsrc file"
163
+ # rag.add_option :help , type: :boolean , default: nil , description: "Show this help message and quit"
164
+ # rag.add_option :version , type: :boolean , default: nil , description: "Show Rails version number and quit"
165
+ # rag.add_option :api , type: :boolean , default: false , description: "Preconfigure smaller stack for API only apps"
166
+ # rag.add_option :minimal , type: :boolean , default: nil , description: "Preconfigure a minimal rails app"
167
+ # rag.add_option :javascript , type: :string , default: "importmap" , description: "Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup]"
168
+ # 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]"
169
+ # rag.add_option :skip_bundle , type: :boolean , default: false , description: "Don't run bundle install"
170
+
171
+ # future_option :database , type: :string , default: 'sqlite3' # , description: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
172
+ # rag.add_option :skip_git , type: :boolean, default: false # , description: "Skip .gitignore file"
173
+ # future_option :skip_keeps , type: :boolean, default: false # , description: "Skip source control .keep files"
174
+ # future_option :skip_action_mailer , type: :boolean, default: false # , description: "Skip Action Mailer files"
175
+ # future_option :skip_action_mailbox , type: :boolean, default: false # , description: "Skip Action Mailbox gem"
176
+ # future_option :skip_action_text , type: :boolean, default: false # , description: "Skip Action Text gem"
177
+ # future_option :skip_active_record , type: :boolean, default: false # , description: "Skip Active Record files"
178
+ # future_option :skip_active_job , type: :boolean, default: false # , description: "Skip Active Job"
179
+ # future_option :skip_active_storage , type: :boolean, default: false # , description: "Skip Active Storage files"
180
+ # future_option :skip_action_cable , type: :boolean, default: false # , description: "Skip Action Cable files"
181
+ # future_option :skip_asset_pipeline , type: :boolean, default: false #
182
+ # future_option :asset_pipeline , type: :string , default: 'sprockets' # , description: "Choose your asset pipeline [options: sprockets (default), propshaft]"
183
+ # future_option :skip_javascript , type: :boolean, default: false # name == 'plugin' # , description: "Skip JavaScript files"
184
+ # future_option :skip_hotwire , type: :boolean, default: false # , description: "Skip Hotwire integration"
185
+ # future_option :skip_jbuilder , type: :boolean, default: false # , description: "Skip jbuilder gem"
186
+ # rag.add_option :skip_test , type: :boolean, default: false # , description: "Skip test files"
187
+ rag.add_option :test , type: :string , default: 'rspec' # , description: "minitest or rspec (default: rspec)"
188
+ # future_option :skip_system_test , type: :boolean, default: false # , description: "Skip system test files"
189
+ # future_option :skip_bootsnap , type: :boolean, default: false # , description: "Skip bootsnap gem"
190
+ # future_option :dev , type: :boolean, default: false # , description: "Set up the #{name} with Gemfile pointing to your Rails checkout"
191
+ # future_option :edge , type: :boolean, default: false # , description: "Set up the #{name} with Gemfile pointing to Rails repository"
192
+ # future_option :main , type: :boolean, default: false # , description: "Set up the #{name} with Gemfile pointing to Rails repository main branch"
193
+ # future_option :rc , type: :string , default: nil # , description: "Path to file containing extra configuration options for rails command"
194
+ # future_option :no_rc , type: :boolean, default: false # , description: "Skip loading of extra configuration options from .railsrc file"
195
+ # future_option :help , type: :boolean # , group: :rails # , description: "Show this help message and quit"
196
+ # future_option :version , type: :boolean # , group: :rails, description: "Show Rails version number and quit"
197
+ # future_option :api , type: :boolean # , description: "Preconfigure smaller stack for API only apps"
198
+ # future_option :minimal , type: :boolean # , description: "Preconfigure a minimal rails app"
199
+ # future_option :javascript , type: :string , default: 'importmap' # , description: "Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup]"
200
+ # rag.add_option :css , type: :string , description: "Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass... check https://github.com/rails/cssbundling-rails]"
201
+ # rag.add_option :skip_bundle , type: :boolean, default: false , description: "Don't run bundle install"
202
+
203
+ # rag.add_option :add_irbrc , type: :boolean, default: false
204
+ # rag.add_option :add_foreman , type: :boolean, default: false
205
+ rag.add_option :add_devise , type: :boolean, default: false
206
+ # rag.add_option :add_dotenv , type: :boolean, default: false
207
+ # rag.add_option :add_docker , type: :boolean, default: false
208
+ # rag.add_option :add_docker_compose , type: :boolean, default: false
209
+ # rag.add_option :add_rubocop , type: :boolean, default: false
210
+ rag.add_option :add_annotate , type: :boolean, default: false
211
+ # rag.add_option :add_continuous_integration , type: :boolean, default: false
212
+ # rag.add_option :add_high_voltage , type: :boolean, default: false
213
+ # rag.add_option :add_generators , type: :boolean, default: false
214
+ # rag.add_option :add_lograge , type: :boolean, default: false
215
+ # rag.add_option :add_pundit , type: :boolean, default: false
216
+ # rag.add_option :add_services , type: :boolean, default: false
217
+ # rag.add_option :add_sidekiq , type: :boolean, default: false
218
+ # rag.add_option :add_views , type: :boolean, default: false
219
+ # rag.add_option :add_errors , type: :boolean, default: false
220
+ # rag.add_option :add_scaffold , type: :boolean, default: false
221
+ # rag.add_option :add_factory_bot , type: :boolean, default: false
222
+ # rag.add_option :add_shoulda , type: :boolean, default: false
223
+
224
+ # NEW GEM ADDONS
225
+ rag.add_option :add_acts_as_list , type: :boolean, default: false
226
+ rag.add_option :add_browser , type: :boolean, default: false
227
+ rag.add_option :add_chartkick , type: :boolean, default: false
228
+ rag.add_option :add_faker , type: :boolean, default: false
229
+ rag.add_option :add_groupdate , type: :boolean, default: false
230
+ rag.add_option :add_hexapdf , type: :boolean, default: false
231
+ rag.add_option :add_httparty , type: :boolean, default: false
232
+ rag.add_option :add_honeybadger , type: :boolean, default: false
233
+ rag.add_option :add_mini_magick , type: :boolean, default: false , description: 'Add Mini Magick gem'
234
+ rag.add_option :add_rails_html_sanitizer , type: :boolean, default: false
235
+ rag.add_option :add_twilio_ruby , type: :boolean, default: false
236
+ end
237
+
238
+ # Make sure that RailsOptions reflect the options available from Railties
239
+ RailsAppGenerator::AppGenerator.class_options.each do |class_option|
240
+ thor_option = class_option[1]
241
+ # puts "Adding railties class_option onto RailsOptions: #{thor_option.name}"
242
+ RailsAppGenerator::RailsOptions.add_thor_class_option(thor_option)
243
+ end
244
+ # Make sure that RailsOptions reflect the options available from custom configuration
245
+ KConfig.configuration.rag.options.each do |option|
246
+ RailsAppGenerator::RailsOptions.add_class_option(option)
247
+ RailsAppGenerator::AppGenerator.add_class_option(option)
248
+ end
249
+
250
+ # Debugging code
251
+ RailsAppGenerator::Util.write_last_run('rails_options_class.json', RailsAppGenerator::RailsOptions.to_h)
252
+ 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAppGenerator
4
- VERSION = '0.1.28'
4
+ VERSION = '0.2.2'
5
5
  end
@@ -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'
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.1.28",
3
+ "version": "0.2.2",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "rails_app_generator",
9
- "version": "0.1.28",
9
+ "version": "0.2.2",
10
10
  "dependencies": {
11
11
  "daisyui": "^2.20.0"
12
12
  },
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.1.28",
3
+ "version": "0.2.2",
4
4
  "description": "Create new Rails Application with custom opinions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
@@ -7,6 +7,7 @@
7
7
  "skip_git": true,
8
8
  "skip_test": true,
9
9
  "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/mini_magick/_.rb",
10
- "add_mini_magick": true
10
+ "add_mini_magick": true,
11
+ "force": true
11
12
  }
12
13
  }
@@ -0,0 +1,12 @@
1
+ {
2
+ "args": {
3
+ "app_path": "printspeak",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/application"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_test": true,
9
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/application/printspeak/_.rb",
10
+ "add_printspeak": true
11
+ }
12
+ }