rails_app_generator 0.0.5 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/.vscode/settings.json +3 -0
  4. data/CHANGELOG.md +23 -0
  5. data/README.md +9 -0
  6. data/after_templates/README.md +3 -0
  7. data/after_templates/___base_template.rb +1 -0
  8. data/after_templates/___r7_hotwire.rb +1 -0
  9. data/after_templates/rag_bootstrap/application-yield.html.erb +5 -0
  10. data/after_templates/rag_bootstrap/application.html.erb +4 -0
  11. data/after_templates/rag_bootstrap/component-cards-fancy.css +84 -0
  12. data/after_templates/rag_bootstrap/component-cards-fancy.html +80 -0
  13. data/after_templates/rag_bootstrap/component-cards-staff.css +90 -0
  14. data/after_templates/rag_bootstrap/component-cards-staff.html +140 -0
  15. data/after_templates/rag_bootstrap/component-cards-styled.html +31 -0
  16. data/after_templates/rag_bootstrap/component-footer.html +34 -0
  17. data/after_templates/rag_bootstrap/component-hero.html +15 -0
  18. data/after_templates/rag_bootstrap/component-nav.html +36 -0
  19. data/after_templates/rag_bootstrap/custom-bootstrap-import.scss +5 -0
  20. data/after_templates/rag_bootstrap/custom-using-css.css +3 -0
  21. data/after_templates/rag_bootstrap/custom-using-scss.scss +5 -0
  22. data/after_templates/rag_bootstrap/manifest.js +3 -0
  23. data/after_templates/rag_bootstrap.rb +1 -0
  24. data/after_templates/rag_simple.rb +25 -0
  25. data/after_templates/rag_tailwind.rb +74 -0
  26. data/exe/rag +41 -0
  27. data/lib/rails_app_generator/add_on.rb +73 -0
  28. data/lib/rails_app_generator/addons/annotate.rb +15 -0
  29. data/lib/rails_app_generator/addons/continuous_integration.rb +14 -0
  30. data/lib/rails_app_generator/addons/devise.rb +50 -0
  31. data/lib/rails_app_generator/addons/docker.rb +14 -0
  32. data/lib/rails_app_generator/addons/docker_compose.rb +13 -0
  33. data/lib/rails_app_generator/addons/dotenv.rb +13 -0
  34. data/lib/rails_app_generator/addons/factory_bot.rb +19 -0
  35. data/lib/rails_app_generator/addons/foreman.rb +15 -0
  36. data/lib/rails_app_generator/addons/generators.rb +31 -0
  37. data/lib/rails_app_generator/addons/high_voltage.rb +15 -0
  38. data/lib/rails_app_generator/addons/inline_svg.rb +11 -0
  39. data/lib/rails_app_generator/addons/irbrc.rb +13 -0
  40. data/lib/rails_app_generator/addons/lograge.rb +13 -0
  41. data/lib/rails_app_generator/addons/pundit.rb +16 -0
  42. data/lib/rails_app_generator/addons/rspec.rb +17 -0
  43. data/lib/rails_app_generator/addons/rubocop.rb +13 -0
  44. data/lib/rails_app_generator/addons/scaffold.rb +15 -0
  45. data/lib/rails_app_generator/addons/services.rb +13 -0
  46. data/lib/rails_app_generator/addons/sidekiq.rb +18 -0
  47. data/lib/rails_app_generator/addons/stimulus.rb +15 -0
  48. data/lib/rails_app_generator/addons/stimulus_components.rb +33 -0
  49. data/lib/rails_app_generator/addons/tailwind.rb +22 -0
  50. data/lib/rails_app_generator/addons/views.rb +21 -0
  51. data/lib/rails_app_generator/app_builder.rb +7 -5
  52. data/lib/rails_app_generator/app_generator.rb +187 -99
  53. data/lib/rails_app_generator/context.rb +75 -0
  54. data/lib/rails_app_generator/dependencies.rb +34 -0
  55. data/lib/rails_app_generator/notes/a1.txt +1 -1
  56. data/lib/rails_app_generator/notes/a2.txt +1 -1
  57. data/lib/rails_app_generator/notes/kw01-b.txt +86 -0
  58. data/lib/rails_app_generator/notes/kw01.txt +91 -0
  59. data/lib/rails_app_generator/options/map_option_string.rb +2 -0
  60. data/lib/rails_app_generator/options/rails_options.rb +52 -32
  61. data/lib/rails_app_generator/starter.rb +17 -8
  62. data/lib/rails_app_generator/version.rb +1 -1
  63. data/lib/rails_app_generator.rb +5 -1
  64. data/package-lock.json +2 -2
  65. data/package.json +1 -1
  66. data/profiles/rag-add-some-pages.json +11 -0
  67. data/profiles/rag-bootstrap.json +12 -0
  68. data/profiles/rag-simple.json +11 -0
  69. data/profiles/rag-tailwind.json +12 -0
  70. data/templates/README.md.erb +43 -0
  71. data/templates/addons/annotate/auto_annotate_models.rake +60 -0
  72. data/templates/addons/continuous_integration/.github/workflows/build.yml.erb +49 -0
  73. data/templates/addons/devise/app/views/devise/confirmations/new.html.erb +24 -0
  74. data/templates/addons/devise/app/views/devise/passwords/edit.html.erb +34 -0
  75. data/templates/addons/devise/app/views/devise/passwords/new.html.erb +23 -0
  76. data/templates/addons/devise/app/views/devise/registrations/edit.html.erb +62 -0
  77. data/templates/addons/devise/app/views/devise/registrations/new.html.erb +45 -0
  78. data/templates/addons/devise/app/views/devise/sessions/new.html.erb +33 -0
  79. data/templates/addons/devise/app/views/devise/shared/_error_messages.html.erb +15 -0
  80. data/templates/addons/devise/app/views/devise/shared/_form_wrap.html.erb +5 -0
  81. data/templates/addons/devise/app/views/devise/shared/_links.html.erb +25 -0
  82. data/templates/addons/devise/app/views/devise/unlocks/new.html.erb +22 -0
  83. data/templates/addons/docker/.dockerignore.erb +51 -0
  84. data/templates/addons/docker/Dockerfile.erb +45 -0
  85. data/templates/addons/docker_compose/docker-compose.yml.erb +21 -0
  86. data/templates/addons/dotenv/.env.development.erb +3 -0
  87. data/templates/addons/foreman/.foreman.erb +1 -0
  88. data/templates/addons/foreman/Procfile.dev.erb +7 -0
  89. data/templates/addons/foreman/Procfile.erb +4 -0
  90. data/templates/addons/generators/lib/generators/rails/navigation/USAGE +6 -0
  91. data/templates/addons/generators/lib/generators/rails/navigation/navigation_generator.rb +16 -0
  92. data/templates/addons/generators/lib/generators/rails/scaffold_controller_generator.rb +12 -0
  93. data/templates/addons/high_voltage/config/initializers/high_voltage.rb +6 -0
  94. data/templates/addons/irbrc/.irbrc.erb +13 -0
  95. data/templates/addons/lograge/config/initializers/lograge.rb +5 -0
  96. data/templates/addons/pundit/app/controllers/authorized_controller.rb.erb +10 -0
  97. data/templates/addons/pundit/app/policies/application_policy.rb +57 -0
  98. data/templates/addons/rspec/spec/rails_helper.rb +26 -0
  99. data/templates/addons/rspec/spec/spec_helper.rb +61 -0
  100. data/templates/addons/rubocop/.rubocop.yml.erb +37 -0
  101. data/templates/addons/scaffold/lib/templates/erb/scaffold/_form.html.erb +39 -0
  102. data/templates/addons/scaffold/lib/templates/erb/scaffold/edit.html.erb +7 -0
  103. data/templates/addons/scaffold/lib/templates/erb/scaffold/index.html.erb +34 -0
  104. data/templates/addons/scaffold/lib/templates/erb/scaffold/new.html.erb +7 -0
  105. data/templates/addons/scaffold/lib/templates/erb/scaffold/show.html.erb +18 -0
  106. data/templates/addons/services/app/services/application_service.rb +15 -0
  107. data/templates/app_x/controllers/authorized_controller.rb.erb +10 -0
  108. data/templates/app_x/controllers/errors_controller.rb.erb +24 -0
  109. data/templates/app_x/javascript/images/checkmark.svg +1 -0
  110. data/templates/app_x/javascript/images/logo.svg +1 -0
  111. data/templates/app_x/javascript/stylesheets/components.scss +206 -0
  112. data/templates/app_x/views/errors/internal_error.html.erb +14 -0
  113. data/templates/app_x/views/errors/not_found.html.erb +14 -0
  114. data/templates/app_x/views/errors/unacceptable.html.erb +14 -0
  115. data/templates/app_x/views/layouts/application.html.erb.tt +30 -0
  116. data/templates/app_x/views/pages/home.html.erb.tt +20 -0
  117. data/templates/app_x/views/shared/_flashes.html.erb.tt +12 -0
  118. data/templates/app_x/views/shared/_footer.html.erb.tt +21 -0
  119. data/templates/app_x/views/shared/_navbar.html.erb.tt +55 -0
  120. data/templates/app_x/workers/application_worker.rb +5 -0
  121. metadata +207 -3
@@ -5,38 +5,58 @@ module RailsAppGenerator
5
5
  # NOTE: Currently you need to register new options in two places
6
6
  # here and in lib/rails_app_generator/app_generator.rb
7
7
 
8
- future_option :template , type: :string # , desc: "Path to some #{name} template (can be a filesystem path or URL)"
9
- future_option :database , type: :string , default: 'sqlite3' # , desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
10
- register_option :skip_git , type: :boolean, default: false # , desc: "Skip .gitignore file"
11
- future_option :skip_keeps , type: :boolean, default: false # , desc: "Skip source control .keep files"
12
- future_option :skip_action_mailer , type: :boolean, default: false # , desc: "Skip Action Mailer files"
13
- future_option :skip_action_mailbox , type: :boolean, default: false # , desc: "Skip Action Mailbox gem"
14
- future_option :skip_action_text , type: :boolean, default: false # , desc: "Skip Action Text gem"
15
- future_option :skip_active_record , type: :boolean, default: false # , desc: "Skip Active Record files"
16
- future_option :skip_active_job , type: :boolean, default: false # , desc: "Skip Active Job"
17
- future_option :skip_active_storage , type: :boolean, default: false # , desc: "Skip Active Storage files"
18
- future_option :skip_action_cable , type: :boolean, default: false # , desc: "Skip Action Cable files"
19
- future_option :skip_asset_pipeline , type: :boolean, default: false #
20
- future_option :asset_pipeline , type: :string , default: 'sprockets' # , desc: "Choose your asset pipeline [options: sprockets (default), propshaft]"
21
- future_option :skip_javascript , type: :boolean, default: false # name == 'plugin' # , desc: "Skip JavaScript files"
22
- future_option :skip_hotwire , type: :boolean, default: false # , desc: "Skip Hotwire integration"
23
- future_option :skip_jbuilder , type: :boolean, default: false # , desc: "Skip jbuilder gem"
24
- register_option :skip_test , type: :boolean, default: false # , desc: "Skip test files"
25
- register_option :test , type: :string , default: 'rspec' # , desc: "minitest or rspec (default: rspec)"
26
- future_option :skip_system_test , type: :boolean, default: false # , desc: "Skip system test files"
27
- future_option :skip_bootsnap , type: :boolean, default: false # , desc: "Skip bootsnap gem"
28
- future_option :dev , type: :boolean, default: false # , desc: "Set up the #{name} with Gemfile pointing to your Rails checkout"
29
- future_option :edge , type: :boolean, default: false # , desc: "Set up the #{name} with Gemfile pointing to Rails repository"
30
- future_option :main , type: :boolean, default: false # , desc: "Set up the #{name} with Gemfile pointing to Rails repository main branch"
31
- future_option :rc , type: :string , default: nil # , desc: "Path to file containing extra configuration options for rails command"
32
- future_option :no_rc , type: :boolean, default: false # , desc: "Skip loading of extra configuration options from .railsrc file"
33
- future_option :help , type: :boolean # , group: :rails # , desc: "Show this help message and quit"
34
- future_option :version , type: :boolean # , group: :rails, desc: "Show Rails version number and quit"
35
- future_option :api , type: :boolean # , desc: "Preconfigure smaller stack for API only apps"
36
- future_option :minimal , type: :boolean # , desc: "Preconfigure a minimal rails app"
37
- future_option :javascript , type: :string , default: 'importmap' # , desc: "Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup]"
38
- future_option :css , type: :string # , desc: "Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass... check https://github.com/rails/cssbundling-rails]"
39
- register_option :skip_bundle , type: :boolean, default: false # , desc: "Don't run bundle install"
8
+ register_option :template , type: :string # , desc: "Path to some #{name} template (can be a filesystem path or URL)"
9
+ future_option :database , type: :string , default: 'sqlite3' # , desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
10
+ register_option :skip_git , type: :boolean, default: false # , desc: "Skip .gitignore file"
11
+ future_option :skip_keeps , type: :boolean, default: false # , desc: "Skip source control .keep files"
12
+ future_option :skip_action_mailer , type: :boolean, default: false # , desc: "Skip Action Mailer files"
13
+ future_option :skip_action_mailbox , type: :boolean, default: false # , desc: "Skip Action Mailbox gem"
14
+ future_option :skip_action_text , type: :boolean, default: false # , desc: "Skip Action Text gem"
15
+ future_option :skip_active_record , type: :boolean, default: false # , desc: "Skip Active Record files"
16
+ future_option :skip_active_job , type: :boolean, default: false # , desc: "Skip Active Job"
17
+ future_option :skip_active_storage , type: :boolean, default: false # , desc: "Skip Active Storage files"
18
+ future_option :skip_action_cable , type: :boolean, default: false # , desc: "Skip Action Cable files"
19
+ future_option :skip_asset_pipeline , type: :boolean, default: false #
20
+ future_option :asset_pipeline , type: :string , default: 'sprockets' # , desc: "Choose your asset pipeline [options: sprockets (default), propshaft]"
21
+ future_option :skip_javascript , type: :boolean, default: false # name == 'plugin' # , desc: "Skip JavaScript files"
22
+ future_option :skip_hotwire , type: :boolean, default: false # , desc: "Skip Hotwire integration"
23
+ future_option :skip_jbuilder , type: :boolean, default: false # , desc: "Skip jbuilder gem"
24
+ register_option :skip_test , type: :boolean, default: false # , desc: "Skip test files"
25
+ register_option :test , type: :string , default: 'rspec' # , desc: "minitest or rspec (default: rspec)"
26
+ future_option :skip_system_test , type: :boolean, default: false # , desc: "Skip system test files"
27
+ future_option :skip_bootsnap , type: :boolean, default: false # , desc: "Skip bootsnap gem"
28
+ future_option :dev , type: :boolean, default: false # , desc: "Set up the #{name} with Gemfile pointing to your Rails checkout"
29
+ future_option :edge , type: :boolean, default: false # , desc: "Set up the #{name} with Gemfile pointing to Rails repository"
30
+ future_option :main , type: :boolean, default: false # , desc: "Set up the #{name} with Gemfile pointing to Rails repository main branch"
31
+ future_option :rc , type: :string , default: nil # , desc: "Path to file containing extra configuration options for rails command"
32
+ future_option :no_rc , type: :boolean, default: false # , desc: "Skip loading of extra configuration options from .railsrc file"
33
+ future_option :help , type: :boolean # , group: :rails # , desc: "Show this help message and quit"
34
+ future_option :version , type: :boolean # , group: :rails, desc: "Show Rails version number and quit"
35
+ future_option :api , type: :boolean # , desc: "Preconfigure smaller stack for API only apps"
36
+ future_option :minimal , type: :boolean # , desc: "Preconfigure a minimal rails app"
37
+ future_option :javascript , type: :string , default: 'importmap' # , desc: "Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup]"
38
+ register_option :css , type: :string # , desc: "Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass... check https://github.com/rails/cssbundling-rails]"
39
+ register_option :skip_bundle , type: :boolean, default: false # , desc: "Don't run bundle install"
40
+
41
+ register_option :add_irbrc , type: :boolean, default: false
42
+ register_option :add_foreman , type: :boolean, default: false
43
+ register_option :add_dotenv , type: :boolean, default: false
44
+ register_option :add_docker , type: :boolean, default: false
45
+ register_option :add_docker_compose , type: :boolean, default: false
46
+ register_option :add_rubocop , type: :boolean, default: false
47
+ register_option :add_annotate , type: :boolean, default: false
48
+ register_option :add_continuous_integration , type: :boolean, default: false
49
+ register_option :add_high_voltage , type: :boolean, default: false
50
+ register_option :add_generators , type: :boolean, default: false
51
+ register_option :add_lograge , type: :boolean, default: false
52
+ register_option :add_pundit , type: :boolean, default: false
53
+ register_option :add_services , type: :boolean, default: false
54
+ register_option :add_sidekiq , type: :boolean, default: false
55
+ register_option :add_views , type: :boolean, default: false
56
+ register_option :add_errors , type: :boolean, default: false
57
+ register_option :add_scaffold , type: :boolean, default: false
58
+ register_option :add_factory_bot , type: :boolean, default: false
59
+ register_option :add_shoulda , type: :boolean, default: false
40
60
 
41
61
  # if options[:minimal]
42
62
  # self.options = options.merge(
@@ -29,15 +29,24 @@ module RailsAppGenerator
29
29
 
30
30
  attr_reader :app_path
31
31
  attr_reader :destination_root
32
+
33
+ # points to the original rails templates
32
34
  attr_reader :rails_template_path
33
- attr_reader :custom_template_path
35
+
36
+ # points to the overriding templates related to rails
37
+ attr_reader :override_template_path
38
+
39
+ # points to templates related to rails addons
40
+ attr_reader :addon_template_path
41
+
34
42
  attr_reader :console_output
35
43
 
36
44
  def initialize(**args)
37
- @app_path = args[:app_path] || '.'
38
- @destination_root = args[:destination_root] || Dir.pwd
39
- @rails_template_path = args[:rails_template_path] || Rails::Generators::AppGenerator.source_root
40
- @custom_template_path = args[:custom_template_path] || File.expand_path(File.join(__dir__, '../../templates'))
45
+ @app_path = args[:app_path] || '.'
46
+ @destination_root = args[:destination_root] || Dir.pwd
47
+ @rails_template_path = args[:rails_template_path] || AppGenerator.rails_template_path
48
+ @override_template_path = args[:override_template_path] || AppGenerator.override_template_path
49
+ @addon_template_path = args[:addon_template_path] || AppGenerator.addon_template_path
41
50
  end
42
51
 
43
52
  def target_path
@@ -47,9 +56,9 @@ module RailsAppGenerator
47
56
  def start(options = [])
48
57
  puts "Target path: #{target_path}"
49
58
 
50
- RailsAppGenerator::AppGenerator.source_root(rails_template_path)
51
- RailsAppGenerator::AppGenerator.source_paths << rails_template_path
52
- RailsAppGenerator::AppGenerator.source_paths << custom_template_path
59
+ # RailsAppGenerator::AppGenerator.source_root(rails_template_path)
60
+ # # RailsAppGenerator::AppGenerator.source_paths << rails_template_path
61
+ # RailsAppGenerator::AppGenerator.source_paths << addon_template_path
53
62
 
54
63
  opts = extract_rails_options(app_path, options)
55
64
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAppGenerator
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.8'
5
5
  end
@@ -17,9 +17,13 @@ require 'rails_app_generator/options/map_option_boolean_flag'
17
17
  require 'rails_app_generator/options/build_option'
18
18
  require 'rails_app_generator/options/options_builder'
19
19
  require 'rails_app_generator/options/rails_options'
20
- require 'rails_app_generator/starter'
20
+ require 'rails_app_generator/context'
21
+ require 'rails_app_generator/dependencies'
22
+ require 'rails_app_generator/add_on'
23
+ Dir[File.join(__dir__, 'rails_app_generator', 'addons', '*.rb')].sort.each { |file| require file }
21
24
  require 'rails_app_generator/app_builder'
22
25
  require 'rails_app_generator/app_generator'
26
+ require 'rails_app_generator/starter'
23
27
 
24
28
  # require "rails_app_generator/generators/base"
25
29
  # require "rails_app_generator/generators/foo_generator"
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.0.5",
3
+ "version": "0.0.8",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "rails_app_generator",
9
- "version": "0.0.5",
9
+ "version": "0.0.8",
10
10
  "devDependencies": {
11
11
  "@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
12
12
  "@semantic-release/changelog": "^6.0.1",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.0.5",
3
+ "version": "0.0.8",
4
4
  "description": "Create new Rails Application with custom opinions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
@@ -0,0 +1,11 @@
1
+ {
2
+ "args": {
3
+ "app_path": "add-some-pages",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/rag"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_bundle": true,
9
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/test.rb"
10
+ }
11
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "args": {
3
+ "app_path": "bootstrap",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/rag"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_test": true,
9
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/rag_bootstrap.rb",
10
+ "css": "bootstrap"
11
+ }
12
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "args": {
3
+ "app_path": "simple",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/rag"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_bundle": true,
9
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/rag_simple.rb"
10
+ }
11
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "args": {
3
+ "app_path": "tailwind",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/rag"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_test": true,
9
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/rag_tailwind.rb",
10
+ "css": "tailwind"
11
+ }
12
+ }
@@ -0,0 +1,43 @@
1
+ # <%= app_name.humanize %>
2
+
3
+ ## Running your App
4
+
5
+ The simplest way to start this up is by using [docker-compose](https://docs.docker.com/compose/):
6
+
7
+ ```bash
8
+ docker-compose up
9
+ ```
10
+
11
+ ```
12
+ rails db:setup
13
+ rails db:migrate
14
+ rails server
15
+ ```
16
+
17
+ Open your browser on [localhost:3000](http://localhost:3000).
18
+
19
+ ## Development
20
+
21
+ This app was generated using [Schienenzeppelin](https://github.com/hschne/schienenzeppelin) - there are tons of little tweaks to simplify your development workflow.
22
+
23
+ For more details refer to the [Documentation](https://github.com/hschne/schienenzeppelin)
24
+
25
+ ## Deployment
26
+
27
+ Deploy this application using Capistrano. Make sure you have a server set up and edit [deploy.rb](./config/deploy.rb) and [config/production.rb](./config/deploy/production.rb).
28
+
29
+ ``` ruby
30
+ # deploy.rb
31
+ set :repo_url, "git@github.com:user/your-project.git"
32
+
33
+ # production.rb
34
+ server "myserver.com", user: "deploy", roles: %w{app db web}
35
+ ```
36
+
37
+ Then run:
38
+
39
+ ```bash
40
+ cap production deploy
41
+ ```
42
+
43
+ For more information on how to prepare a server for deployment you can follow [this guide](https://gorails.com/deploy/ubuntu/20.04).
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ if Rails.env.development?
4
+ require 'annotate'
5
+ # rubocop:disable Metrics/BlockLength
6
+ task set_annotation_options: :environment do
7
+ # You can override any of these by setting an environment variable of the
8
+ # same name.
9
+ Annotate.set_defaults(
10
+ 'active_admin' => 'false',
11
+ 'additional_file_patterns' => [],
12
+ 'routes' => 'false',
13
+ 'models' => 'true',
14
+ 'position_in_routes' => 'before',
15
+ 'position_in_class' => 'before',
16
+ 'position_in_test' => 'before',
17
+ 'position_in_fixture' => 'before',
18
+ 'position_in_factory' => 'before',
19
+ 'position_in_serializer' => 'before',
20
+ 'show_foreign_keys' => 'true',
21
+ 'show_complete_foreign_keys' => 'false',
22
+ 'show_indexes' => 'true',
23
+ 'simple_indexes' => 'false',
24
+ 'model_dir' => 'app/models',
25
+ 'root_dir' => '',
26
+ 'include_version' => 'false',
27
+ 'require' => '',
28
+ 'exclude_tests' => 'true',
29
+ 'exclude_fixtures' => 'true',
30
+ 'exclude_factories' => 'true',
31
+ 'exclude_serializers' => 'true',
32
+ 'exclude_scaffolds' => 'true',
33
+ 'exclude_controllers' => 'true',
34
+ 'exclude_helpers' => 'true',
35
+ 'exclude_sti_subclasses' => 'false',
36
+ 'ignore_model_sub_dir' => 'false',
37
+ 'ignore_columns' => nil,
38
+ 'ignore_routes' => nil,
39
+ 'ignore_unknown_models' => 'false',
40
+ 'hide_limit_column_types' => 'integer,bigint,boolean',
41
+ 'hide_default_column_types' => 'json,jsonb,hstore',
42
+ 'skip_on_db_migrate' => 'false',
43
+ 'format_bare' => 'true',
44
+ 'format_rdoc' => 'false',
45
+ 'format_yard' => 'false',
46
+ 'format_markdown' => 'false',
47
+ 'sort' => 'false',
48
+ 'force' => 'false',
49
+ 'frozen' => 'false',
50
+ 'classified_sort' => 'true',
51
+ 'trace' => 'false',
52
+ 'wrapper_open' => nil,
53
+ 'wrapper_close' => nil,
54
+ 'with_comment' => 'true'
55
+ )
56
+ end
57
+ # rubocop:enable Metrics/BlockLength
58
+
59
+ Annotate.load_tasks
60
+ end
@@ -0,0 +1,49 @@
1
+ name: <%= camelized %> CI 🚀
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - master
10
+
11
+ jobs:
12
+ tests:
13
+ runs-on: ubuntu-latest
14
+ env:
15
+ RAILS_ENV: test
16
+ DATABASE_HOST: localhost
17
+ DATABASE_USERNAME: <%= app_name %>
18
+ DATABASE_PASSWORD: <%= app_name %>
19
+ services:
20
+ postgres:
21
+ image: postgres:13
22
+ env:
23
+ POSTGRES_PASSWORD: <%= app_name %>
24
+ POSTGRES_USER: <%= app_name %>
25
+ ports:
26
+ - 5432:5432
27
+
28
+ steps:
29
+ - uses: actions/checkout@v2
30
+ - name: Set up Ruby
31
+ uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: <%= RUBY_VERSION %>
34
+ bundler-cache: true
35
+ - name: Set up Node
36
+ uses: actions/setup-node@v1
37
+ with:
38
+ node-version: 14.9
39
+ - name: Install dependencies
40
+ run: |
41
+ sudo apt-get -yqq install libpq-dev build-essential libcurl4-openssl-dev
42
+ gem install bundler
43
+ bundle install --jobs 4
44
+ yarn install
45
+ - name: Setup databases
46
+ run: |
47
+ bin/rails db:setup
48
+ - name: Run tests
49
+ run: bin/rails test
@@ -0,0 +1,24 @@
1
+ <% content_for :devise_form do %>
2
+
3
+ <h2 class="pt-4 mb-8 text-4xl font-bold heading">Resend confirmation instructions</h2>
4
+
5
+ <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+
8
+ <div class="input-group">
9
+ <%= f.label :email, class: "label" %>
10
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class: "input" %>
11
+ </div>
12
+
13
+ <div class="input-group">
14
+ <%= f.submit "Resend confirmation instructions", class: "btn btn-default" %>
15
+ </div>
16
+ <% end %>
17
+
18
+ <hr class="mt-6 border" />
19
+
20
+ <%= render "devise/shared/links" %>
21
+
22
+ <% end %>
23
+
24
+ <%= render "devise/shared/form_wrap" %>
@@ -0,0 +1,34 @@
1
+ <% content_for :devise_form do %>
2
+ <h2 class="pt-4 mb-8 text-4xl font-bold heading">Change your password</h2>
3
+
4
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
5
+ <%= render "devise/shared/error_messages", resource: resource %>
6
+ <%= f.hidden_field :reset_password_token %>
7
+
8
+ <div class="input-group">
9
+ <div class="flex">
10
+ <%= f.label :password, "New password", class:"label" %>
11
+ <% if @minimum_password_length %>
12
+ <em>(<%= @minimum_password_length %> characters minimum)</em>
13
+ <% end %>
14
+ </div>
15
+ <%= f.password_field :password, autofocus: true, autocomplete: "new-password", class: "input" %>
16
+ </div>
17
+
18
+ <div class="input-group">
19
+ <%= f.label :password_confirmation, "Confirm new password", class: "label" %>
20
+ <%= f.password_field :password_confirmation, autocomplete: "off", class: "input" %>
21
+ </div>
22
+
23
+ <div class="input-group">
24
+ <%= f.submit "Change my password", class: "btn btn-default" %>
25
+ </div>
26
+ <% end %>
27
+
28
+ <hr class="mt-6 border" />
29
+
30
+ <%= render "devise/shared/links" %>
31
+
32
+ <% end %>
33
+
34
+ <%= render "devise/shared/form_wrap" %>
@@ -0,0 +1,23 @@
1
+ <% content_for :devise_form do %>
2
+
3
+ <h2 class="pt-4 mb-8 text-4xl font-bold heading">Forgot your password?</h2>
4
+
5
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+
8
+ <div class="input-group">
9
+ <%= f.label :email, class: "label" %>
10
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "input" %>
11
+ </div>
12
+
13
+ <div class="input-group">
14
+ <%= f.submit "Send me reset password instructions", class: "btn btn-default" %>
15
+ </div>
16
+ <% end %>
17
+
18
+ <hr class="mt-6 border" />
19
+
20
+ <%= render "devise/shared/links" %>
21
+ <% end %>
22
+
23
+ <%= render "devise/shared/form_wrap" %>
@@ -0,0 +1,62 @@
1
+ <% content_for :devise_form do %>
2
+ <h2 class="pt-4 mb-8 text-4xl font-bold heading">Edit <%= resource_name.to_s.humanize %></h2>
3
+
4
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
5
+
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+
8
+ <div class="input-group">
9
+ <%= f.label :name, class:"label" %>
10
+ <%= f.text_field :name, class:"input" %>
11
+ </div>
12
+
13
+ <div class="input-group">
14
+ <%= f.label :email, class:"label" %>
15
+ <%= f.email_field :email, autocomplete: "email", class:"input" %>
16
+ </div>
17
+
18
+ <div class="input-group">
19
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
20
+ <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
21
+ <% end %>
22
+ </div>
23
+
24
+ <div class="input-group">
25
+ <%= f.label :password, class:"label" %>
26
+ <%= f.password_field :password, autocomplete: "new-password", class:"input" %>
27
+ <p class="pt-1 text-sm italic text-grey-dark"> <% if @minimum_password_length %>
28
+ <%= @minimum_password_length %> characters minimum <% end %> (leave blank if you don't want to change it) </p>
29
+
30
+ </div>
31
+
32
+ <div class="input-group">
33
+ <%= f.label :password_confirmation, class: "label" %>
34
+ <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "input" %>
35
+ </div>
36
+
37
+ <div class="input-group">
38
+ <%= f.label :current_password, class: "label" %>
39
+ <%= f.password_field :current_password, autocomplete: "current-password", class: "input" %>
40
+ <p class="pt-2 text-sm italic text-grey-dark">(we need your current password to confirm your changes)</p>
41
+ </div>
42
+
43
+ <div class="input-group">
44
+ <%= f.submit "Update", class: "btn btn-default" %>
45
+ </div>
46
+ <% end %>
47
+
48
+ <hr class="mt-6 mb-3 border" />
49
+
50
+ <h3 class="mb-4 text-xl font-bold heading">Cancel my account</h3>
51
+
52
+ <div class="flex items-center justify-between">
53
+ <div class="flex-1">
54
+ <p class="py-4">Unhappy?</p>
55
+ </div>
56
+
57
+ <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-red" %>
58
+ </div>
59
+
60
+ <% end %>
61
+
62
+ <%= render 'devise/shared/form_wrap' %>
@@ -0,0 +1,45 @@
1
+ <% content_for :devise_form do %>
2
+
3
+ <h2 class="pt-4 mb-8 text-4xl font-bold heading">Sign up</h2>
4
+
5
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+
8
+ <div class="input-group">
9
+ <%= f.label :name, class:"label" %>
10
+ <%= f.text_field :name, class:"input" %>
11
+ </div>
12
+
13
+ <div class="input-group">
14
+ <%= f.label :email, class:"label" %>
15
+ <%= f.email_field :email, autocomplete: "email", class:"input" %>
16
+ </div>
17
+
18
+ <div class="input-group">
19
+ <div class="flex">
20
+ <%= f.label :password, class: "label" %>
21
+ <% if @minimum_password_length %>
22
+ <span class="pl-1 text-xs text-grey-dark"><em>(<%= @minimum_password_length %> characters minimum)</em></span>
23
+ <% end %>
24
+ </div>
25
+ <%= f.password_field :password, autocomplete: "new-password", class: "input" %>
26
+ </div>
27
+
28
+ <div class="input-group">
29
+ <%= f.label :password_confirmation, class:"label" %>
30
+ <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "input" %>
31
+ </div>
32
+
33
+ <div class="input-group">
34
+ <%= f.submit "Sign up", class: "btn btn-default" %>
35
+ </div>
36
+
37
+ <hr class="mt-6 border" />
38
+
39
+ <% end %>
40
+
41
+ <%= render "devise/shared/links" %>
42
+
43
+ <% end %>
44
+
45
+ <%= render "devise/shared/form_wrap" %>
@@ -0,0 +1,33 @@
1
+ <% content_for :devise_form do %>
2
+ <h2 class="pt-4 mb-8 text-4xl font-bold heading">Log in</h2>
3
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
4
+
5
+ <div class="input-group">
6
+ <%= f.label :email, class:"label" %>
7
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "input" %>
8
+ </div>
9
+
10
+ <div class="input-group">
11
+ <%= f.label :password, class:"label" %>
12
+ <%= f.password_field :password, autocomplete: "current-password", class: "input" %>
13
+ </div>
14
+
15
+ <div class="mb-6 input-checkbox">
16
+ <% if devise_mapping.rememberable? -%>
17
+ <%= f.check_box :remember_me %>
18
+ <%= f.label :remember_me, class:"label" %>
19
+ <% end -%>
20
+ </div>
21
+
22
+ <div class="input-group">
23
+ <%= f.submit "Log in", class: "btn btn-default" %>
24
+ </div>
25
+
26
+ <% end %>
27
+
28
+ <hr class="mt-6 border" />
29
+
30
+ <%= render "devise/shared/links" %>
31
+ <% end %>
32
+
33
+ <%= render "devise/shared/form_wrap" %>
@@ -0,0 +1,15 @@
1
+ <% if resource.errors.any? %>
2
+ <div id="error_explanation" class="text-red-500">
3
+ <h2 class="font-semibold text-lg">
4
+ <%= I18n.t("errors.messages.not_saved",
5
+ count: resource.errors.count,
6
+ resource: resource.class.model_name.human.downcase)
7
+ %>
8
+ </h2>
9
+ <ul class="list-none p-0">
10
+ <% resource.errors.full_messages.each do |message| %>
11
+ <li><%= message %></li>
12
+ <% end %>
13
+ </ul>
14
+ </div>
15
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <div class="w-full max-w-md mx-auto my-8">
2
+ <div class="bg-white border border-gray-300 rounded-lg px-8 pt-6 pb-8">
3
+ <%= yield :devise_form %>
4
+ </div>
5
+ </div>