kowl 0.0.1

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.
Files changed (250) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +7 -0
  3. data/README.md +383 -0
  4. data/bin/console +14 -0
  5. data/bin/kowl +106 -0
  6. data/bin/setup +13 -0
  7. data/lib/kowl/actions.rb +240 -0
  8. data/lib/kowl/docker.rb +447 -0
  9. data/lib/kowl/generators/README.md +5 -0
  10. data/lib/kowl/generators/action_generator.rb +113 -0
  11. data/lib/kowl/generators/admin_generator.rb +114 -0
  12. data/lib/kowl/generators/assets_generator.rb +188 -0
  13. data/lib/kowl/generators/base.rb +40 -0
  14. data/lib/kowl/generators/circleci_generator.rb +11 -0
  15. data/lib/kowl/generators/config_generator.rb +180 -0
  16. data/lib/kowl/generators/controller_generator.rb +64 -0
  17. data/lib/kowl/generators/database_generator.rb +42 -0
  18. data/lib/kowl/generators/decorators_generator.rb +16 -0
  19. data/lib/kowl/generators/docker_generator.rb +40 -0
  20. data/lib/kowl/generators/dotfiles_generator.rb +73 -0
  21. data/lib/kowl/generators/libs_generator.rb +19 -0
  22. data/lib/kowl/generators/mailer_generator.rb +58 -0
  23. data/lib/kowl/generators/misc_generator.rb +20 -0
  24. data/lib/kowl/generators/overrides/app_base.rb +15 -0
  25. data/lib/kowl/generators/overrides/app_builder.rb +58 -0
  26. data/lib/kowl/generators/overrides/app_generator.rb +249 -0
  27. data/lib/kowl/generators/pages_generator.rb +46 -0
  28. data/lib/kowl/generators/routes_generator.rb +20 -0
  29. data/lib/kowl/generators/sidekiq_generator.rb +31 -0
  30. data/lib/kowl/generators/staging_generator.rb +14 -0
  31. data/lib/kowl/generators/test_generator.rb +42 -0
  32. data/lib/kowl/generators/text_files_generator.rb +41 -0
  33. data/lib/kowl/generators/users_and_auth_generator.rb +143 -0
  34. data/lib/kowl/generators/uuid_generator.rb +39 -0
  35. data/lib/kowl/generators/views_and_helpers_generator.rb +104 -0
  36. data/lib/kowl/geodb.rb +96 -0
  37. data/lib/kowl/helpers.rb +139 -0
  38. data/lib/kowl/templates/Gemfile.erb.tt +253 -0
  39. data/lib/kowl/templates/README.md.erb +33 -0
  40. data/lib/kowl/templates/app/assets/javascripts/semantic.js.tt +26 -0
  41. data/lib/kowl/templates/app/assets/stylesheets/administrate/application.scss +44 -0
  42. data/lib/kowl/templates/app/assets/stylesheets/bootstrap/_custom_styling.scss +38 -0
  43. data/lib/kowl/templates/app/assets/stylesheets/bootstrap/application-mailer.scss +1 -0
  44. data/lib/kowl/templates/app/assets/stylesheets/bootstrap/application.scss +14 -0
  45. data/lib/kowl/templates/app/assets/stylesheets/bootstrap/components/_alerts.scss +7 -0
  46. data/lib/kowl/templates/app/assets/stylesheets/bootstrap/components/_errors.scss +28 -0
  47. data/lib/kowl/templates/app/assets/stylesheets/bootstrap/components/_navbar.scss +17 -0
  48. data/lib/kowl/templates/app/assets/stylesheets/bootstrap/variables.scss +6 -0
  49. data/lib/kowl/templates/app/assets/stylesheets/semantic/_custom_styling.scss +20 -0
  50. data/lib/kowl/templates/app/assets/stylesheets/semantic/application.scss +24 -0
  51. data/lib/kowl/templates/app/controllers/admin/application_controller.rb +29 -0
  52. data/lib/kowl/templates/app/controllers/admin/login_activities_controller.rb +29 -0
  53. data/lib/kowl/templates/app/controllers/admin/users_controller.rb +37 -0
  54. data/lib/kowl/templates/app/controllers/concerns/auth/authentication.rb +18 -0
  55. data/lib/kowl/templates/app/controllers/concerns/auth/authorization.rb +20 -0
  56. data/lib/kowl/templates/app/controllers/concerns/auth/error_handlers.rb +27 -0
  57. data/lib/kowl/templates/app/controllers/concerns/noauth/error_handlers.rb +25 -0
  58. data/lib/kowl/templates/app/controllers/users_controller.rb +17 -0
  59. data/lib/kowl/templates/app/dashboards/login_activity_dashboard.rb.tt +59 -0
  60. data/lib/kowl/templates/app/dashboards/rich_text_body_dashboard.rb.tt +17 -0
  61. data/lib/kowl/templates/app/dashboards/user_dashboard.rb.tt +60 -0
  62. data/lib/kowl/templates/app/fields/gravatar_field.rb +10 -0
  63. data/lib/kowl/templates/app/fields/rich_text_area_field.rb +8 -0
  64. data/lib/kowl/templates/app/inputs/rich_text_area_input.rb +11 -0
  65. data/lib/kowl/templates/app/javascript/administrate/components/date_time_picker.js.tt +32 -0
  66. data/lib/kowl/templates/app/javascript/administrate/components/table.js.tt +49 -0
  67. data/lib/kowl/templates/app/javascript/administrate/index.js +3 -0
  68. data/lib/kowl/templates/app/javascript/packs/administrate.js.tt +21 -0
  69. data/lib/kowl/templates/app/javascript/packs/semantic.js +11 -0
  70. data/lib/kowl/templates/app/mailers/application_mailer.rb +7 -0
  71. data/lib/kowl/templates/app/mailers/devise_mailer.rb +5 -0
  72. data/lib/kowl/templates/app/models/login_activity.rb.tt +29 -0
  73. data/lib/kowl/templates/app/models/user.rb.tt +72 -0
  74. data/lib/kowl/templates/app/policies/application_policy.rb +38 -0
  75. data/lib/kowl/templates/app/policies/login_activity_policy.rb +35 -0
  76. data/lib/kowl/templates/app/policies/user_policy.rb +43 -0
  77. data/lib/kowl/templates/app/views/admin/templates/navigation.erb.tt +23 -0
  78. data/lib/kowl/templates/app/views/admin/views/application/_javascript.html.erb +21 -0
  79. data/lib/kowl/templates/app/views/admin/views/users/_collection.html.erb +102 -0
  80. data/lib/kowl/templates/app/views/admin/views/users/_form.html.erb +46 -0
  81. data/lib/kowl/templates/app/views/admin/views/users/edit.html.erb +36 -0
  82. data/lib/kowl/templates/app/views/admin/views/users/index.html.erb +66 -0
  83. data/lib/kowl/templates/app/views/fields/gravatar_field/_form.html.erb +6 -0
  84. data/lib/kowl/templates/app/views/fields/gravatar_field/_index.html.erb +1 -0
  85. data/lib/kowl/templates/app/views/fields/gravatar_field/_show.html.erb +1 -0
  86. data/lib/kowl/templates/app/views/fields/rich_text_area_field/_form.html.erb +6 -0
  87. data/lib/kowl/templates/app/views/fields/rich_text_area_field/_index.html.erb +1 -0
  88. data/lib/kowl/templates/app/views/fields/rich_text_area_field/_show.html.erb +1 -0
  89. data/lib/kowl/templates/app/views/layouts/admin.html.erb.tt +47 -0
  90. data/lib/kowl/templates/app/views/layouts/devise_mailer.html.erb +14 -0
  91. data/lib/kowl/templates/app/views/pages/welcome/bootstrap.html.erb +18 -0
  92. data/lib/kowl/templates/app/views/pages/welcome/bootstrap.html.haml +17 -0
  93. data/lib/kowl/templates/app/views/pages/welcome/bootstrap.html.slim +17 -0
  94. data/lib/kowl/templates/app/views/pages/welcome/default.html.erb +0 -0
  95. data/lib/kowl/templates/app/views/pages/welcome/default.html.haml +0 -0
  96. data/lib/kowl/templates/app/views/pages/welcome/default.html.slim +0 -0
  97. data/lib/kowl/templates/app/views/pages/welcome/semantic.html.erb +20 -0
  98. data/lib/kowl/templates/app/views/pages/welcome/semantic.html.haml +17 -0
  99. data/lib/kowl/templates/app/views/pages/welcome/semantic.html.slim +17 -0
  100. data/lib/kowl/templates/app/views/shared/footer/bootstrap.html.erb.tt +5 -0
  101. data/lib/kowl/templates/app/views/shared/footer/bootstrap.html.haml.tt +3 -0
  102. data/lib/kowl/templates/app/views/shared/footer/bootstrap.html.slim.tt +3 -0
  103. data/lib/kowl/templates/app/views/shared/footer/semantic.html.erb.tt +7 -0
  104. data/lib/kowl/templates/app/views/shared/footer/semantic.html.haml.tt +5 -0
  105. data/lib/kowl/templates/app/views/shared/footer/semantic.html.slim.tt +5 -0
  106. data/lib/kowl/templates/app/views/shared/navigation/bootstrap.html.erb.tt +51 -0
  107. data/lib/kowl/templates/app/views/shared/navigation/bootstrap.html.haml.tt +36 -0
  108. data/lib/kowl/templates/app/views/shared/navigation/bootstrap.html.slim.tt +36 -0
  109. data/lib/kowl/templates/app/views/shared/navigation/semantic.html.erb.tt +48 -0
  110. data/lib/kowl/templates/app/views/shared/navigation/semantic.html.haml.tt +36 -0
  111. data/lib/kowl/templates/app/views/shared/navigation/semantic.html.slim.tt +36 -0
  112. data/lib/kowl/templates/app/workers/scheduler/pghero_scheduler.rb +11 -0
  113. data/lib/kowl/templates/config/autoprefixer.yml +4 -0
  114. data/lib/kowl/templates/config/db/mysql.yml.tt +43 -0
  115. data/lib/kowl/templates/config/db/oracle.yml.tt +29 -0
  116. data/lib/kowl/templates/config/db/postgresql.yml.tt +37 -0
  117. data/lib/kowl/templates/config/db/sqlite3.yml.tt +20 -0
  118. data/lib/kowl/templates/config/db/sqlserver.yml.tt +28 -0
  119. data/lib/kowl/templates/config/initializers/administrate.rb.tt +9 -0
  120. data/lib/kowl/templates/config/initializers/bullet.rb +21 -0
  121. data/lib/kowl/templates/config/initializers/devise-security.rb +44 -0
  122. data/lib/kowl/templates/config/initializers/devise_argon2.rb +29 -0
  123. data/lib/kowl/templates/config/initializers/faker.rb +6 -0
  124. data/lib/kowl/templates/config/initializers/generators.rb.tt +31 -0
  125. data/lib/kowl/templates/config/initializers/geocoder.rb +10 -0
  126. data/lib/kowl/templates/config/initializers/letter_opener.rb +13 -0
  127. data/lib/kowl/templates/config/initializers/lockbox.rb +11 -0
  128. data/lib/kowl/templates/config/initializers/logging.rb +6 -0
  129. data/lib/kowl/templates/config/initializers/lograge.rb +7 -0
  130. data/lib/kowl/templates/config/initializers/logstop.rb +4 -0
  131. data/lib/kowl/templates/config/initializers/middleware.rb +9 -0
  132. data/lib/kowl/templates/config/initializers/oj.rb +7 -0
  133. data/lib/kowl/templates/config/initializers/pagy.rb.tt +16 -0
  134. data/lib/kowl/templates/config/initializers/postmark.rb +8 -0
  135. data/lib/kowl/templates/config/initializers/rack_attack.rb.tt +71 -0
  136. data/lib/kowl/templates/config/initializers/sass.rb +5 -0
  137. data/lib/kowl/templates/config/initializers/sidekiq.rb +11 -0
  138. data/lib/kowl/templates/config/initializers/simpleform/semantic.rb +225 -0
  139. data/lib/kowl/templates/config/initializers/slim.rb +6 -0
  140. data/lib/kowl/templates/config/initializers/sparkpost.rb +13 -0
  141. data/lib/kowl/templates/config/routes.rb.tt +28 -0
  142. data/lib/kowl/templates/config/sidekiq.yml.tt +17 -0
  143. data/lib/kowl/templates/db/migrations/create_action_text_tables.action_text.rb.tt +16 -0
  144. data/lib/kowl/templates/db/migrations/create_active_storage_tables.active_storage.rb.tt +29 -0
  145. data/lib/kowl/templates/db/migrations/devise.rb.tt +59 -0
  146. data/lib/kowl/templates/db/migrations/login_activities.rb.tt +41 -0
  147. data/lib/kowl/templates/db/seeds.rb.tt +14 -0
  148. data/lib/kowl/templates/docker/Dockerfile.alpine.tt +92 -0
  149. data/lib/kowl/templates/docker/Dockerfile.debian.tt +133 -0
  150. data/lib/kowl/templates/docker/docker-compose.yml.tt +55 -0
  151. data/lib/kowl/templates/docker/mysql/Dockerfile.tt +15 -0
  152. data/lib/kowl/templates/dotfiles/Aptfile.tt +34 -0
  153. data/lib/kowl/templates/dotfiles/Brewfile.tt +49 -0
  154. data/lib/kowl/templates/dotfiles/Procfile.tt +12 -0
  155. data/lib/kowl/templates/dotfiles/codeclimate.yml +76 -0
  156. data/lib/kowl/templates/dotfiles/coffeelint.json +10 -0
  157. data/lib/kowl/templates/dotfiles/coffeelintignore +15 -0
  158. data/lib/kowl/templates/dotfiles/dockerignore +23 -0
  159. data/lib/kowl/templates/dotfiles/editorconfig +13 -0
  160. data/lib/kowl/templates/dotfiles/env.tt +58 -0
  161. data/lib/kowl/templates/dotfiles/erb-lint.yml +10 -0
  162. data/lib/kowl/templates/dotfiles/erdconfig.tt +24 -0
  163. data/lib/kowl/templates/dotfiles/eslintignore +20 -0
  164. data/lib/kowl/templates/dotfiles/eslintrc.js +31 -0
  165. data/lib/kowl/templates/dotfiles/fasterer.yml +14 -0
  166. data/lib/kowl/templates/dotfiles/foreman +1 -0
  167. data/lib/kowl/templates/dotfiles/gitattributes +15 -0
  168. data/lib/kowl/templates/dotfiles/gitignore +69 -0
  169. data/lib/kowl/templates/dotfiles/haml-lint.yml +23 -0
  170. data/lib/kowl/templates/dotfiles/jsbeautifyrc +15 -0
  171. data/lib/kowl/templates/dotfiles/jshintrc +3 -0
  172. data/lib/kowl/templates/dotfiles/mailmap +3 -0
  173. data/lib/kowl/templates/dotfiles/nvmrc +1 -0
  174. data/lib/kowl/templates/dotfiles/prettierignore +21 -0
  175. data/lib/kowl/templates/dotfiles/prettierrc.js +62 -0
  176. data/lib/kowl/templates/dotfiles/pryrc +7 -0
  177. data/lib/kowl/templates/dotfiles/rspec +3 -0
  178. data/lib/kowl/templates/dotfiles/rubocop.yml.tt +78 -0
  179. data/lib/kowl/templates/dotfiles/scss-lint.yml +132 -0
  180. data/lib/kowl/templates/dotfiles/simplecov +19 -0
  181. data/lib/kowl/templates/dotfiles/slim-lint.yml +23 -0
  182. data/lib/kowl/templates/dotfiles/slugignore +10 -0
  183. data/lib/kowl/templates/dotfiles/yamllint +7 -0
  184. data/lib/kowl/templates/dotfiles/yarnclean +46 -0
  185. data/lib/kowl/templates/lib/tasks/stats.rake +42 -0
  186. data/lib/kowl/templates/tests/factories/README.md +0 -0
  187. data/lib/kowl/templates/tests/factories/login_activity.rb +11 -0
  188. data/lib/kowl/templates/tests/factories/user.rb +11 -0
  189. data/lib/kowl/templates/tests/minitest/README.md +3 -0
  190. data/lib/kowl/templates/tests/minitest/application_system_test_case.rb +7 -0
  191. data/lib/kowl/templates/tests/minitest/controllers/pages_controller_test.rb +10 -0
  192. data/lib/kowl/templates/tests/minitest/models/login_activity_test.rb +8 -0
  193. data/lib/kowl/templates/tests/minitest/models/user_test.rb +15 -0
  194. data/lib/kowl/templates/tests/minitest/policies/login_activity_policy_test.rb +7 -0
  195. data/lib/kowl/templates/tests/minitest/policies/user_policy_test.rb +7 -0
  196. data/lib/kowl/templates/tests/minitest/support/capybara.rb +38 -0
  197. data/lib/kowl/templates/tests/minitest/support/database_cleaner.rb +20 -0
  198. data/lib/kowl/templates/tests/minitest/support/database_cleaner_support.rb +15 -0
  199. data/lib/kowl/templates/tests/minitest/support/deferred_garbage_collection.rb +21 -0
  200. data/lib/kowl/templates/tests/minitest/support/devise.rb +16 -0
  201. data/lib/kowl/templates/tests/minitest/support/factories.rb +6 -0
  202. data/lib/kowl/templates/tests/minitest/support/formulaic.rb +8 -0
  203. data/lib/kowl/templates/tests/minitest/support/helpers/devise_helper.rb +57 -0
  204. data/lib/kowl/templates/tests/minitest/support/papertrail.rb +17 -0
  205. data/lib/kowl/templates/tests/minitest/support/pundit.rb +0 -0
  206. data/lib/kowl/templates/tests/minitest/support/shoulda.rb +11 -0
  207. data/lib/kowl/templates/tests/minitest/support/simplecov.rb +8 -0
  208. data/lib/kowl/templates/tests/minitest/test_helper.rb +17 -0
  209. data/lib/kowl/templates/tests/rspec/README.md +9 -0
  210. data/lib/kowl/templates/tests/rspec/controllers/admin/application_controller_spec.rb +12 -0
  211. data/lib/kowl/templates/tests/rspec/controllers/admin/users_controller_spec.rb +14 -0
  212. data/lib/kowl/templates/tests/rspec/controllers/pages_controller_spec.rb +10 -0
  213. data/lib/kowl/templates/tests/rspec/features/README.md +15 -0
  214. data/lib/kowl/templates/tests/rspec/features/visitor_sign_up_spec.rb +25 -0
  215. data/lib/kowl/templates/tests/rspec/helpers/application_helper_spec.rb +7 -0
  216. data/lib/kowl/templates/tests/rspec/helpers/pages_helper_spec.rb +15 -0
  217. data/lib/kowl/templates/tests/rspec/models/login_activity_spec.rb +11 -0
  218. data/lib/kowl/templates/tests/rspec/models/user_spec.rb +21 -0
  219. data/lib/kowl/templates/tests/rspec/policies/login_activity_policy_spec.rb +59 -0
  220. data/lib/kowl/templates/tests/rspec/policies/user_policy_spec.rb +56 -0
  221. data/lib/kowl/templates/tests/rspec/rails_helper.rb +72 -0
  222. data/lib/kowl/templates/tests/rspec/requests/pages_spec.rb +11 -0
  223. data/lib/kowl/templates/tests/rspec/spec_helper.rb +96 -0
  224. data/lib/kowl/templates/tests/rspec/support/bullet.rb +17 -0
  225. data/lib/kowl/templates/tests/rspec/support/capybara.rb +37 -0
  226. data/lib/kowl/templates/tests/rspec/support/controller_testing.rb +10 -0
  227. data/lib/kowl/templates/tests/rspec/support/database_cleaner.rb +55 -0
  228. data/lib/kowl/templates/tests/rspec/support/deferred_garbage_collection.rb +32 -0
  229. data/lib/kowl/templates/tests/rspec/support/devise.rb +21 -0
  230. data/lib/kowl/templates/tests/rspec/support/factories.rb +5 -0
  231. data/lib/kowl/templates/tests/rspec/support/formulaic.rb +8 -0
  232. data/lib/kowl/templates/tests/rspec/support/helpers/devise_helpers.rb +56 -0
  233. data/lib/kowl/templates/tests/rspec/support/papertrail.rb +5 -0
  234. data/lib/kowl/templates/tests/rspec/support/pi_ci.rb +6 -0
  235. data/lib/kowl/templates/tests/rspec/support/pundit.rb +6 -0
  236. data/lib/kowl/templates/tests/rspec/support/shoulda.rb +10 -0
  237. data/lib/kowl/templates/tests/rspec/support/sidekiq.rb +10 -0
  238. data/lib/kowl/templates/tests/rspec/support/simplecov.rb +7 -0
  239. data/lib/kowl/templates/tests/rspec/support/warden.rb +8 -0
  240. data/lib/kowl/templates/text_files/AUTHORS.md +4 -0
  241. data/lib/kowl/templates/text_files/CHANGELOG.md.tt +12 -0
  242. data/lib/kowl/templates/text_files/CODE_OF_CONDUCT.md +76 -0
  243. data/lib/kowl/templates/text_files/TODO.md +7 -0
  244. data/lib/kowl/templates/text_files/VERSION +1 -0
  245. data/lib/kowl/templates/text_files/humans.txt.tt +15 -0
  246. data/lib/kowl/templates/text_files/robots.txt.tt +6 -0
  247. data/lib/kowl/templates/text_files/security.txt +6 -0
  248. data/lib/kowl/version.rb +9 -0
  249. data/lib/kowl.rb +18 -0
  250. metadata +404 -0
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators'
4
+ require_relative 'base'
5
+
6
+ module Kowl
7
+ class ViewsAndHelpersGenerator < Kowl::Generators::Base
8
+ hide!
9
+ source_root File.expand_path(File.join('..', 'templates', 'app', 'views'), File.dirname(__FILE__))
10
+ class_option :framework, type: :string, default: 'bootstrap'
11
+ class_option :skip_pagination, type: :boolean, default: false
12
+ class_option :simpleform, type: :boolean, default: false
13
+ class_option :skip_javascript, type: :boolean, default: false
14
+ class_option :skip_turbolinks, type: :boolean, default: false
15
+ class_option :template_engine, type: :string, default: 'erb'
16
+ class_option :noauth, type: :boolean, default: false
17
+
18
+ # Generate templates with framework and templae_engine with required application options
19
+ def generate_templates
20
+ # Generate views using bootstrap and semanic view generators
21
+ gen_tags = []
22
+ gen_tags.push("--template-engine=#{options[:template_engine]}")
23
+ gen_tags.push('--simpleform') if options[:simpleform]
24
+ gen_tags.push('--pagination') unless options[:skip_pagination]
25
+ gen_tags.push('--devise') unless options[:noauth]
26
+ gen_tags.push('--skip_javascript') if options[:skip_javascript]
27
+ gen_tags.push('--skip_turbolinks') if options[:skip_turbolinks]
28
+ gen_tags.push('--metatags')
29
+ gen_tags.push('--layout')
30
+ generate("#{options[:framework]}:install #{gen_tags.join(' ')}") if %w[bootstrap semantic].include? options[:framework]
31
+ end
32
+
33
+ # If template engine isn't set for erb remove application.erb
34
+ def remove_application_layout
35
+ remove_file 'app/views/layouts/application.html.erb' if %w[slim haml].include? options[:template_engine]
36
+ end
37
+
38
+ # Inject navigation header into application layout file based on template_engine/framework
39
+ def inject_header_into_layout
40
+ # prefix, includes, postfix
41
+ # Pre and Postfix is determined if the template engine is ERB, Slim, or HAML
42
+ nav_str = "#{template_prefix}= render 'shared/navigation'#{template_postfix}\n"
43
+ match = { 'erb' => /\s\<body\>\n/,
44
+ 'haml' => /\s%body\n/,
45
+ 'slim' => /\sbody\n/ }
46
+ insert_into_file "app/views/layouts/application.html.#{options[:template_engine]}", optimize_indentation(nav_str, 4), after: match[options[:template_engine]]
47
+ end
48
+
49
+ # Generate an application navigation view based on framework/template_engine
50
+ def copy_navigation
51
+ template("shared/navigation/#{options[:framework]}.html.#{options[:template_engine]}.tt", "app/views/shared/_navigation.html.#{options[:template_engine]}") if %w[bootstrap semantic].include? options[:framework]
52
+ end
53
+
54
+ # Generate an application footer view based on framework/template_engine
55
+ def copy_footer
56
+ template("shared/footer/#{options[:framework]}.html.#{options[:template_engine]}.tt", "app/views/shared/_footer.html.#{options[:template_engine]}") if %w[bootstrap semantic].include? options[:framework]
57
+ end
58
+
59
+ # Inject view template partial into application layout
60
+ def inject_footer_into_layout
61
+ footer_str = "#{template_prefix}= render 'shared/footer'#{template_postfix}\n"
62
+ if options[:template_engine] == 'erb'
63
+ insert_into_file 'app/views/layouts/application.html.erb', optimize_indentation(footer_str, 4), before: " </body>\n"
64
+ else
65
+ append_to_file "app/views/layouts/application.html.#{options[:template_engine]}", optimize_indentation(footer_str, 4)
66
+ end
67
+ end
68
+
69
+ # Skip a flash type if the key is a cookie/session timeone, since this can occure so regularly
70
+ def update_application_helpers
71
+ flash_str = <<~STR
72
+ \n# remove any blank devise timeout errors
73
+ flash.delete(:timedout)
74
+ STR
75
+
76
+ # User to prevent blank devise timeout error from flashing up
77
+ insert_into_file 'app/helpers/application_helper.rb', "\n#{optimize_indentation(flash_str.strip, 4)}", after: "return '' unless flash.any?\n" if options[:framework] == 'bootstrap'
78
+
79
+ # Make applicaction_helper immutable
80
+ insert_into_file 'app/helpers/application_helper.rb', "# frozen_string_literal: true\n\n", before: "module ApplicationHelper\n"
81
+ end
82
+
83
+ private
84
+
85
+ # Returns the application erb ruby tag prefix based on the views template_engine
86
+ def template_prefix
87
+ return '' unless options[:template_engine] == 'erb'
88
+
89
+ '<%'
90
+ end
91
+
92
+ # Returns the application erb ruby tag postfix based on the views template_engine
93
+ def template_postfix
94
+ return '' unless options[:template_engine] == 'erb'
95
+
96
+ ' %>'
97
+ end
98
+
99
+ # Check to see if the current application will be using erb or not
100
+ def using_erb?
101
+ options[:template_engine] == 'erb'
102
+ end
103
+ end
104
+ end
data/lib/kowl/geodb.rb ADDED
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ # https://github.com/gitcoinco/code_fund_ads/blob/b87cc931f167dadc96904cec8d653d76bc55b021/app/jobs/download_and_extract_maxmind_file_job.rb
4
+ # https://cobwwweb.com/download-collection-of-images-from-url-using-ruby
5
+ require 'net/http'
6
+ require 'fileutils'
7
+ require 'zlib'
8
+ require 'rubygems/package'
9
+
10
+ # Used for fetching the GeoLite db from maxmind
11
+ class GeoDB
12
+ GEOLITE_URL = 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz'
13
+
14
+ # Begin creating folders and being downloadding the GeoLite db
15
+ # @param path [String] the applications relative path
16
+ # @return [Boolean] if the GeoLite2 database was successfully downloaded and decompressed
17
+ def self.perform(path)
18
+ const_set('GEOLIB_DIR', File.join(path, 'db/maxmind'))
19
+ const_set('GEOLIB_PATH', File.join(GEOLIB_DIR, 'GeoLite2-City.tar.gz'))
20
+
21
+ FileUtils.mkdir_p GEOLIB_DIR
22
+ download
23
+ extract
24
+ rescue => e
25
+ puts "Error while setting up GeoLite DB - #{e.message}"
26
+ end
27
+
28
+ # Download the file from the GEOLITE url
29
+ # @return [Boolean] returns if the the file was succcessfully downloaded
30
+ def self.download
31
+ FileUtils.rm_f GEOLIB_PATH
32
+ res = Net::HTTP.get_response(URI.parse(GEOLITE_URL))
33
+ File.open(GEOLIB_PATH, 'wb') do |f|
34
+ f.write(res.body)
35
+ end
36
+ rescue => e
37
+ puts 'GeoLite2 database could not be downloaded at this time.'
38
+ puts e.message if e.message
39
+ end
40
+
41
+ private
42
+
43
+ # Extract the GEOLIB tar.gz file into the application
44
+ # @return [Boolean] if the file was sucessfully decompressed
45
+ def self.extract
46
+ untar(unzip(GEOLIB_PATH))
47
+ end
48
+
49
+ # Uncompress the zipfile
50
+ # https://www.rubydoc.info/gems/folio/0.4.0/ZipUtils.ungzip
51
+ # @param file [String] the specific file path/name
52
+ # @param options [Hash] any specific options required for decompressing the file [:dryrun] || [:noop]
53
+ # @return [Boolean] if the File was sucessfully decompressed
54
+ def self.unzip(file, options = {})
55
+ # Decompress the file to the specified location
56
+ fname = File.join(GEOLIB_DIR, File.basename(file).chomp(File.extname(file)))
57
+ # Remove unzipped file if it already exists for any reason
58
+ FileUtils.rm_f fname
59
+ Zlib::GzipReader.open(file) do |gz|
60
+ File.open(fname, 'wb'){ |f| f << gz.read }
61
+ end unless options[:dryrun] || options[:noop]
62
+ FileUtils.rm_f GEOLIB_PATH
63
+ File.expand_path(fname)
64
+ rescue => e
65
+ puts "Error occured while extracting the geolite database #{e}"
66
+ end
67
+
68
+ # Untar the specified file
69
+ # @param tarred_path [String] the specific filename/path for the tar file
70
+ # @return [Boolean] if the file was successfully decompressed
71
+ def self.untar(tarred_path)
72
+ Gem::Package::TarReader.new File.open(tarred_path) do |tar|
73
+ tar.each do |tarfile|
74
+ next if tarfile.directory?
75
+
76
+ destination = db_destinsation(tarfile.full_name)
77
+ FileUtils.mkdir_p File.dirname(destination)
78
+ File.open destination, 'wb' do |f|
79
+ f.print tarfile.read
80
+ end
81
+ end
82
+ end
83
+ FileUtils.rm_rf tarred_path
84
+ rescue => e
85
+ puts "And error occurred while decompressing the database: #{e}"
86
+ end
87
+
88
+ # The destination of where the tarfile is loaded
89
+ # @param file [String] the specific geolite database file locattion
90
+ # @return [String] to the GEOLIB database file
91
+ def self.db_destinsation(file)
92
+ file_arr = file.split('/')
93
+ file = (file_arr.count > 1 ? file_arr.last : file_arr)
94
+ File.join(GEOLIB_DIR, file)
95
+ end
96
+ end
@@ -0,0 +1,139 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##################################################
4
+ # Helper methods used to assist through the template building
5
+ # => similar to the functions used in Rails::Generators::AppBase
6
+ ##################################################
7
+
8
+ # Method required when processing the gemfile
9
+ # - https://raw.githubusercontent.com/liukun-lk/rails_start_template/master/template.rb
10
+ # - https://github.com/manuelvanrijn/rails-template/blob/master/template.rb
11
+ # @param name [String] Specific gem you are wanting to check the requirements for
12
+ def gemfile_requirement(name)
13
+ @original_gemfile ||= IO.read('Gemfile')
14
+ req = @original_gemfile[/gem\s+['"]#{name}['"]\s*(,[><~= \t\d\.\w'"]*)?.*$/, 1]
15
+ req && req.tr("'", %(")).strip.sub(/^,\s*"/, ', "')
16
+ end
17
+
18
+ # Determine which gem will be used for the projects CSS framework
19
+ # @param css_framework [String] Which CSSFramework the developer wants to use with the application
20
+ # @return [String] The specific gem that will be used for the applications CSS framework
21
+ def template_engine_gem_str(css_framework = '')
22
+ case css_framework.to_s
23
+ when 'semantic'
24
+ 'semantic_ui'
25
+ else
26
+ 'bootstrap'
27
+ end
28
+ end
29
+
30
+ # https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/templates/Gemfile.tt#L9
31
+ # Add a gem to the Gemfile
32
+ # @param gem [String] Specfic gem name that you want to add to the gemfile
33
+ # @return [String] Returns the gem entry for the gemfile
34
+ def gem_to_gemfile(gem)
35
+ gem_str = <<~GEM
36
+ #{gem.comment ? "# #{gem.comment}" : ''}
37
+ #{(gem.commented_out ? '#' : '')}gem '#{gem.name}'#{gem_version_str(gem)}#{gem_options(gem)}
38
+ GEM
39
+
40
+ gem_str.strip
41
+ end
42
+
43
+ # If the gem requires a specific version, determine it
44
+ # @param gem [String] - To determine if the specified gems requires a specific version to run with the application
45
+ # @return [String] - If the gem require a specific version, it will return that version entry for the gemfile
46
+ def gem_version_str(gem)
47
+ return '' unless gem.version
48
+
49
+ # "#{gem.version ? ", '#{gem.version}'" : ''}"
50
+ ", '#{gem.version}'"
51
+ end
52
+
53
+ # If the requested gem requires additional options (ie: require: false) return this
54
+ # @param gem [String] The specified gem you want to use
55
+ # @return [String] If the gem requires additional opotions in the gemfile, return these as a string
56
+ def gem_options(gem)
57
+ return '' unless gem.options.any?
58
+
59
+ options_str = gem.options.map { |k, v| "#{k}: #{v.inspect}" }.join(', ')
60
+ ", #{options_str}" unless options_str.blank?
61
+ end
62
+
63
+ # Make a directory in the applications directory path
64
+ # @param dir [String] The name of the directory you want to create
65
+ def mk_appdir(dir)
66
+ path = Rails.root.join(dir)
67
+ FileUtils.mkdir(path) unless File.directory?(path)
68
+ end
69
+
70
+ # If you want all lines of the string to be indented a specific amount
71
+ # @param str [String] - The multiline string in which you want to indent
72
+ # @return [String] - An indented version of thee string that was passed to the function
73
+ def indent_all_lines(str, spaces = 2)
74
+ return '' if str.nil? || str.blank?
75
+
76
+ str.strip.split(/\n/).map { |line| optimize_indentation(line, spaces.to_i) }.join('')
77
+ end
78
+
79
+ # Used to add additional assets to be considered when compiling your assets
80
+ # @param str [String] Asset string file to add to the file, ie: `application-mailer.scss`
81
+ def add_to_assets(asset_str)
82
+ append_to_file('config/initializers/assets.rb', "Rails.application.config.assets.precompile += %w( #{asset_str} )\n") unless asset_str.blank?
83
+ end
84
+
85
+ # Add a specific line to the config/routes.rb file
86
+ # @param route_str [String] The specific route you want to add to the applications route file
87
+ def add_to_routes(route_str = '')
88
+ inject_into_file('config/routes.rb', optimize_indentation("#{route_str.strip}\n", 2), after: "\s# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html\n")
89
+ end
90
+
91
+ ##################################################
92
+ # Used to create highlights when running `kowl -h` (usage summary displayed by the binstub)
93
+ ##################################################
94
+
95
+ # Highlight the specific string
96
+ # @param str [String] The string in which you wish to highlight
97
+ # @return [String] The specified string concatenated between terminal encoded character sequences
98
+ def highlight(str = '')
99
+ return '' if str.blank?
100
+
101
+ str = str.split('=')
102
+ str.count > 1 ? "\e[32m#{str[0]}=\e[33m#{str[1]}\e[0m" : "\e[32m#{str[0]}\e[0m"
103
+ end
104
+
105
+ # Highlight the default values for specified flag
106
+ # @param str [String] The default values for the specified parameter
107
+ # @return [String] the specified text string surrounded by terminal string highlights
108
+ def dh(str = '')
109
+ return '' if str.blank?
110
+
111
+ str = str.split(': ')
112
+ str.count > 1 ? "\e[36m#{str[0]}: \e[31m#{str[1]}\e[0m" : "\e[34m#{str[0]}\e[0m"
113
+ end
114
+
115
+ # Used to create and return the .env file database configuration for the specific environment
116
+ # @param database [String] the database adapater in which the application will be connecting to
117
+ # @param env [String] the environment which the env file is bring created for
118
+ # @return [String] a list of database parameters for the specific database connection
119
+ def dotfile_databases(database, env)
120
+ return '' if database == 'sqlite3'
121
+
122
+ db = { username: "DB_USER=appUser123\n",
123
+ password: "DB_PASSWORD=App($)Password\n",
124
+ sid: '',
125
+ host: '' }
126
+
127
+ case database
128
+ when 'oracle'
129
+ db = { username: "DB_USER=system\n",
130
+ password: "DB_PASSWORD=oracle\n",
131
+ sid: "DB_SID=xe\n" }
132
+ when 'sqlserver'
133
+ db[:username] = "DB_USER=SA\n"
134
+ db[:password] = "DB_PASSWORD=yourStrong(!)Password\n"
135
+ end
136
+ db[:host] = "DB_HOST=localhost\n" unless env == 'docker'
137
+
138
+ "#{db[:username]}#{db[:password]}#{db[:host]}#{db[:sid]}"
139
+ end
@@ -0,0 +1,253 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
+
6
+ # ruby '<%= RUBY_VERSION %>'
7
+ gem 'rails', '<%= Kowl::RAILS_VERSION %>'
8
+ gem 'puma', '~> 4.3' # Use Puma as the applications web server
9
+ # gem 'iodine', '~> 0.7' # An extremely fast and concurrent Application Server (works well with websockets)
10
+ # gem 'falcon' # A high-performance web server for Ruby, supporting HTTP/1, HTTP/2 and TLS
11
+ # Falon => https://www.codeotaku.com/journal/2019-02/falcon-early-hints/index
12
+ gem 'rack', '~> 2.2'
13
+
14
+ # Gems required for running rails with RUBY_VERSION >= 2.7
15
+ if RUBY_VERSION >= '2.7'
16
+ gem 'e2mmap'
17
+ gem 'thwait'
18
+ end
19
+
20
+ ##############################
21
+ ### Database
22
+ ##############################
23
+ <%- if options[:database] != 'sqlite3' -%>
24
+ <% if options[:database] == 'oracle' -%>
25
+ gem 'ruby-oci8' #, github: 'kubo/ruby-oci8', platforms: :ruby # only for CRuby users
26
+ gem 'activerecord-oracle_enhanced-adapter', '~> 6.0.0'
27
+ <% elsif options[:database] == 'sqlserver' -%>gem 'activerecord-sqlserver-adapter', github: 'rails-sqlserver/activerecord-sqlserver-adapter', branch: '6-0-dev'
28
+ <% elsif database_gemfile_entry -%>
29
+ <%= indent_all_lines(gem_to_gemfile(database_gemfile_entry)) -%>
30
+ <% end -%>
31
+ <% end -%>
32
+ <%- if options[:database] == 'postgresql' -%>
33
+ gem 'pghero', '>= 2.4' # https://github.com/ankane/pghero/blob/master/guides/Rails.md
34
+ gem 'pg_query' # Used by pghero to suggest recommended indexes
35
+ <% end -%>
36
+ gem 'sqlite3'<%= gemfile_requirement('sqlite3') %>
37
+ gem 'strong_migrations' # Catch unsafe migrations
38
+ <%- unless options[:skip_erd] -%>
39
+ gem 'rails-erd', group: :development # Generate an application ERD
40
+ <%- end -%>
41
+
42
+ ##############################
43
+ ### Assets
44
+ ##############################
45
+ gem 'autoprefixer-rails' # add vendor prefixes to particular css properties
46
+ gem 'font-awesome-sass'
47
+ <%- if options[:framework] == 'bootstrap' -%>
48
+ gem 'bootstrap', '~> 4.4'
49
+ <% elsif options[:framework] == 'semantic' -%>
50
+ gem 'semantic-ui-sass'#, github: 'doabit/semantic-ui-sass'
51
+ <%- end -%>
52
+ gem 'sass-rails', '~> 6.0' # Libsass for rails pipeline (fast sass-rails replacement)
53
+ <%- unless options[:skip_turbolinks] -%>
54
+ gem 'turbolinks'<%= gemfile_requirement('turbolinks') %> # turbolinks for browsing your application faster
55
+ <%- end -%>
56
+ <%- if %w[bootstrap semantic].include? options[:framework] -%>
57
+ gem '<%= template_engine_gem_str(options[:framework]) %>_views_generator', group: :development
58
+ <%- end -%>
59
+ <%- unless options[:skip_javascript] -%>
60
+ gem 'webpacker', '~> <%= Kowl::WEBPACKER_VERSION %>'
61
+ <%- end -%>
62
+
63
+ ##############################
64
+ # ActionText/ActiveStorage
65
+ # Used because some gems such as administate still have assets build into the gem
66
+ ##############################
67
+ gem 'image_processing' # Used for processing ActionStorage uploads with imagemagick and/or vip
68
+ # gem 'active_storage_validations' # Used for validating active storage uploads
69
+
70
+ <%- unless options[:noauth] -%>
71
+ ##############################
72
+ # Admin/Dashboard
73
+ ##############################
74
+ gem 'administrate', github: 'thoughtbot/administrate' # Admin dashboard
75
+
76
+ ##############################
77
+ # Authorization, Authentication [Roles], and permissions
78
+ ##############################
79
+ gem 'argon2', '>= 2' # https://ankane.org/devise-argon2
80
+ gem 'authtrail' # For tracking devise login activity
81
+ gem 'devise', github: 'plataformatec/devise' # Rails based user authentication
82
+ gem 'devise-security' # Additional security measures for devise
83
+ gem 'valid_email2' # Stronger email validator (Includes RFC, blackist, and whitelist validations)
84
+ gem 'pretender' # Allows superusers to emulate being another user
85
+ gem 'pundit' # A slim user authorization library
86
+ gem 'maxminddb' # Used by AuthTrail, used to prevent geocoder from making remote API Requests to geocoder service
87
+
88
+ # Additional devise plugins to consider
89
+ # gem 'devise-i18n' # For i18n translation support
90
+ # gem 'devise_invalidatable`, github: 'madkins/devise_invalidatable'
91
+ # gem 'devise-uncommon_password', github: 'HCLarsen/devise-uncommon_password'
92
+ # -> Avatars
93
+ # gem 'gravatar_image_tag'
94
+ # gem 'letter_avatar', github: 'ksz2k/letter_avatar'
95
+ # -> User Profile data
96
+ # gem 'name_of_person' # Official bootcamp gem for presenting user names
97
+ <%- end -%>
98
+
99
+ <%- unless options[:skip_sidekiq] -%>
100
+ ##############################
101
+ # Background jobs and Redis
102
+ ##############################
103
+ gem 'hiredis' # C based adapter for connecting to redis
104
+ gem 'sidekiq', '>= 6.0' # For scheduling background jobs
105
+ gem 'sidekiq-failures' # Shows you a list of failed sidekiq jobs
106
+ gem 'sidekiq-scheduler' # Lightweight job scheduler (mimicks cron scheduling)
107
+ gem 'sidekiq-status' # View the status of any currently running sidekiq jobs
108
+ # gem 'sidekiq-bulk' # Easy bulk processing
109
+ # gem 'sidekiq-unique-jobs' # Ensures only unique jobs are being ran at any given time
110
+ <%- end -%>
111
+
112
+ <%- unless options[:skip_mailer] -%>
113
+ ##############################
114
+ # Mailers
115
+ ##############################
116
+ gem 'bootstrap-email'
117
+ <%= mailer_gems(options[:mailer]) %>, group: :production
118
+ group :development do
119
+ gem 'letter_opener'
120
+ gem 'letter_opener_web', '~> 1.0'
121
+ end
122
+ <%- end -%>
123
+
124
+
125
+ ##############################
126
+ # Misc
127
+ ##############################
128
+ gem 'auto_strip_attributes', '~> 2.5' # Reduce needing to add before_validation hooks to the models to cleanup attributes
129
+ gem 'fast_jsonapi', github: 'fast-jsonapi/fast_jsonapi' # A lightening fast json serializer
130
+ gem 'jbuilder'<%= gemfile_requirement('jbuilder') %> # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
131
+ gem 'meta-tags' # Used for adding dynamic titles when switching between pages.
132
+ gem 'oj' # For faster json generating and parsing
133
+ <% if options[:simpleform] -%>
134
+ gem 'simple_form', '~> 5.0' # A DSL to make forms easier to work with
135
+ <% end -%>
136
+ <% unless options[:skip_pagination] -%>
137
+ gem 'pagy', '~> 3.7' # An extremely fast pagination alternative
138
+ <% end -%>
139
+ <%- unless options[:template_engine].to_s == 'erb' -%>
140
+ gem '<%= options[:template_engine] %>-rails'
141
+ <%- end -%>
142
+
143
+ ##############################
144
+ ### Performance Optimizations
145
+ ##############################
146
+ gem 'attendance' # Speed up for ActiveRecord#present? (removes additional query requests)
147
+ gem 'bootsnap', require: false # Reduces boot times through caching
148
+ gem 'fast_blank', platform: :mri # fast implementation of .blank?
149
+
150
+ ##############################
151
+ ### Responses, Errors, and Security
152
+ ##############################
153
+ gem 'dotenv-rails', groups: [:development, :test]
154
+ gem 'rack-attack' # Rack middleware for blocking & throttling
155
+ # gem 'rack-protection', github: 'https://github.com/sinatra/sinatra/tree/master/rack-protection'
156
+ # gem 'secure_headers' # Manages application of security headers with many safe defaults
157
+ gem 'slowpoke' # Utilize Rack::Timeout to kill long running requests
158
+
159
+ ##############################
160
+ ### Security (Data Security)
161
+ ##############################
162
+ <%- if options[:encrypt] %>
163
+ gem 'blind_index' # Securely search encrypted database fields
164
+ gem 'lockbox' # Modern encryption for Rails (For encrypting sensitive information within the database)
165
+ gem 'rbnacl' # Ruby binding for libsodium
166
+ <%- end -%>
167
+ gem 'lograge' # For cleaning up your application logs
168
+ gem 'logstop' # Keep personally identifiable information (PII) out of your logs
169
+ # gem 'honeybadger' # For Exception logging (logs the applications backtrace)
170
+
171
+ ##############################
172
+ ### Structure [Presentors, Decorators, etc.]
173
+ ##############################
174
+ gem 'active_decorator'
175
+
176
+ ##############################
177
+ ### Development/Testing gems
178
+ ##############################
179
+ group :development, :test do
180
+ gem 'brakeman'
181
+ gem 'bundler-audit', github: 'rubysec/bundler-audit'
182
+ gem 'byebug', platforms: %i[mri mingw x64_mingw]
183
+ <%- unless options[:test_engine] == 'none' -%>
184
+ gem 'factory_bot_rails' # For building objects associated with your models
185
+ gem 'faker' # for generating sample data
186
+ <%- end -%>
187
+ <%= pry_gems(options[:skip_pry]) -%>
188
+
189
+ # --- Linters (Asset testing, Static Code Analyzers)
190
+ # gem 'inquisition', github: 'rubygarage/inquisition'
191
+ <%= template_linter_gems(options[:template_engine]) %>
192
+ gem 'scss_lint', require: false
193
+ gem 'rails_best_practices' # for testing for rails best practice methods
194
+ gem 'rubocop', require: false # github: 'rubocop-hq/rubocop'
195
+ gem 'rubocop-performance', '~> 1.5', require: false
196
+ gem 'rubocop-rails', '~> 2.3', require: false
197
+ <%= robocop_test_engine(options[:test_engine], options[:skip_tests]) %>
198
+ # gem 'rubycritic', require: false # Code Quality analyzer
199
+ end
200
+
201
+ group :development do
202
+ gem 'annotate'
203
+ gem 'better_errors' # dev: better error messages
204
+ # gem 'binding_of_caller'
205
+ gem 'bullet' # For logging all unnecessary N+1 queries and unused eager_loaded associations
206
+ gem 'listen'<%= gemfile_requirement('listen') %>
207
+ <%- unless options[:skip_spring] -%>
208
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
209
+ gem 'spring'
210
+ gem 'spring-watcher-listen'<%= gemfile_requirement('spring-watcher-listen') %>
211
+ <%- end -%>
212
+ gem 'web-console'<%= gemfile_requirement('web-console') %>
213
+ end
214
+
215
+ <%- unless options[:test_engine] == 'none' || options[:skip_tests] -%>
216
+ group :test do
217
+ gem 'database_cleaner' # For flushing the database between tests
218
+ <%- if options[:test_engine] == 'minitest' -%>
219
+ gem 'minitest'
220
+ gem 'minitest-reporters' # used to enhance basic minitest capibilities
221
+ <%- elsif options[:test_engine] == 'rspec' -%>
222
+ gem 'cucumber-rails', require: false
223
+ gem 'formulaic' # For generating form based test submissions
224
+ gem 'fuubar' # RSpec progress bar
225
+ # gem 'parallel_tests' # needs to be ran against a database other than sqlite3
226
+ gem 'pig-ci-rails' # For displaying application memory metrics while running tests
227
+ <%- unless options[:noauth] -%>
228
+ gem 'pundit-matchers' # RSpec matchers for testing Pundit authorization policies
229
+ <%- end -%>
230
+ gem 'rspec-rails', '>= 3.9'
231
+ <%- unless options[:skip_sidekiq] -%>
232
+ gem 'rspec-sidekiq'
233
+ <%- end -%>
234
+ <%- end -%>
235
+ gem 'rails-controller-testing' # , github: 'rails/rails-controller-testing'
236
+ gem 'simplecov' # generate html report on the applications test results
237
+ gem 'shoulda' # Write easy to understand and maintainable tests
238
+ gem 'test-prof' # For profiling tests, rspec, and factories
239
+ gem 'timecop' # For time based testing (time travel)
240
+
241
+ ##############################
242
+ ### integration testing
243
+ ##############################
244
+ # Adds support for Capybara system testing and selenium driver
245
+ gem 'capybara'<%= gemfile_requirement('capybara') %>
246
+ gem 'selenium-webdriver'
247
+ gem 'webdrivers', '~> 4.0'
248
+ end
249
+ <%- end -%>
250
+
251
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
252
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
253
+ gem 'kowl'
@@ -0,0 +1,33 @@
1
+ # <%= app_name %>
2
+
3
+ ## Rails Build Environment
4
+
5
+ **Ruby:** <%= RUBY_VERSION %>
6
+
7
+ **Rails:** <%= Rails::VERSION::STRING %>
8
+
9
+ **Database:** <%= options[:database] %>
10
+
11
+ **Additional Info**
12
+
13
+ <%- unless options[:skip_erd] -%>
14
+ ## Database Structure (ERD)
15
+
16
+ ![](<%= app_name.parameterize %>_erd.png)
17
+
18
+ <%- end -%>
19
+ ## Getting Started
20
+
21
+ ### Prerequisites
22
+
23
+ Things you need to do in order for the software to run.
24
+
25
+ ```shell
26
+ bundle install
27
+ rails db:migrate db:seed
28
+ rails s
29
+ ```
30
+
31
+ ### Installing
32
+
33
+ A step-by-step guide on how to install the software to run and function as intended.
@@ -0,0 +1,26 @@
1
+ //= require rails-ujs
2
+ //= require jquery3
3
+ //= require jquery_ujs
4
+ //= require semantic-ui
5
+ //= require activestorage
6
+ <%- unless options[:skip_javascript] -%>
7
+ //= require turbolinks
8
+ <%- end -%>
9
+ //= require_tree .
10
+
11
+ <%- if options[:skip_javascript] -%>
12
+ $(document).ready(function() {
13
+ <%- else -%>
14
+ $(document).on("turbolinks:load",function(){
15
+ <%- end -%>
16
+ // Allow the user to close the flash messages
17
+ $('.message .close')
18
+ .on('click', function(){
19
+ $(this).closest('.message').transition('fade');
20
+ });
21
+
22
+ // Automatically close flash messages after 3 seconds
23
+ window.setTimeout(function() {
24
+ $('.message').transition('fade');
25
+ }, 3000);
26
+ });