frozen_rails 0.0.4 → 0.0.6

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 (89) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -2
  3. data/LICENSE.txt +1 -1
  4. data/README.md +46 -82
  5. data/Rakefile +20 -0
  6. data/lib/frozen_rails/appendable.rb +9 -2
  7. data/lib/frozen_rails/copyable.rb +7 -2
  8. data/lib/frozen_rails/generator.rb +0 -2
  9. data/lib/frozen_rails/taggable.rb +3 -2
  10. data/lib/frozen_rails/version.rb +1 -3
  11. data/lib/frozen_rails.rb +0 -2
  12. data/lib/generators/frozen/db_generator.rb +2 -5
  13. data/lib/generators/frozen/md_generator.rb +6 -3
  14. data/lib/generators/frozen/rails_generator.rb +6 -14
  15. data/lib/generators/frozen/seo_generator.rb +5 -7
  16. data/lib/generators/frozen/ssg_generator.rb +0 -2
  17. data/lib/generators/frozen/templates/db/database.yml +15 -2
  18. data/lib/generators/frozen/templates/db/initializers/skip_controller_tests_and_helpers.rb +9 -0
  19. data/lib/generators/frozen/templates/db/lib/generators/avo/resource/resource_generator.rb +1 -1
  20. data/lib/generators/frozen/templates/db/lib/templates/active_record/model/model.rb.tt +12 -1
  21. data/lib/generators/frozen/templates/db/lib/templates/erb/scaffold/index.html.erb.tt +14 -8
  22. data/lib/generators/frozen/templates/db/lib/templates/erb/scaffold/partial.html.erb.tt +2 -2
  23. data/lib/generators/frozen/templates/db/lib/templates/erb/scaffold/show.html.erb.tt +8 -7
  24. data/lib/generators/frozen/templates/md/assets/application.css +13 -0
  25. data/lib/generators/frozen/templates/md/assets/rouge/README.md +7 -0
  26. data/lib/generators/frozen/templates/md/assets/rouge/revert.css +11 -0
  27. data/lib/generators/frozen/templates/md/views/categories/index.html.erb +5 -3
  28. data/lib/generators/frozen/templates/md/views/categories/show.html.erb +5 -9
  29. data/lib/generators/frozen/templates/md/views/pages/show.html.erb +6 -3
  30. data/lib/generators/frozen/templates/ssg/.gitlab-ci.yml +34 -0
  31. data/lib/generators/frozen/templates/ui/application.html.erb +27 -0
  32. data/lib/generators/frozen/templates/ui/application_component.rb +2 -0
  33. data/lib/generators/frozen/templates/ui/assets/application.js +4 -0
  34. data/lib/generators/frozen/templates/ui/assets/builds/.keep +0 -0
  35. data/lib/generators/frozen/templates/ui/assets/components/index.js +2 -0
  36. data/lib/generators/frozen/templates/ui/assets/fonts/.keep +0 -0
  37. data/lib/generators/frozen/templates/ui/assets/images/.keep +0 -0
  38. data/lib/generators/frozen/templates/ui/assets/images/pages/.keep +0 -0
  39. data/lib/generators/frozen/templates/ui/assets/jasmine/boot.js +6 -0
  40. data/lib/generators/frozen/templates/ui/assets/jasmine/support/fixtures.js +24 -0
  41. data/lib/generators/frozen/templates/ui/assets/jasmine/support/jasmine-dom.js +1 -0
  42. data/lib/generators/frozen/templates/ui/assets/jasmine/support/unpoly-test-config.js +7 -0
  43. data/lib/generators/frozen/templates/ui/assets/jasmine/support.js +1 -0
  44. data/lib/generators/frozen/templates/ui/assets/jasmine.js +5 -0
  45. data/lib/generators/frozen/templates/ui/assets/rouge/index.js +2 -0
  46. data/lib/generators/frozen/templates/ui/assets/static.js +5 -0
  47. data/lib/generators/frozen/templates/ui/assets/theme/README.md +11 -0
  48. data/lib/generators/frozen/templates/ui/assets/theme/base.css +27 -0
  49. data/lib/generators/frozen/templates/ui/assets/theme/code.css +29 -0
  50. data/lib/generators/frozen/templates/ui/assets/theme/forms.css +160 -0
  51. data/lib/generators/frozen/templates/ui/assets/theme/index.js +2 -0
  52. data/lib/generators/frozen/templates/ui/assets/theme/links.css +8 -0
  53. data/lib/generators/frozen/templates/ui/assets/theme/misc.css +150 -0
  54. data/lib/generators/frozen/templates/ui/assets/theme/parts.css +8 -0
  55. data/lib/generators/frozen/templates/ui/assets/theme/print.css +53 -0
  56. data/lib/generators/frozen/templates/ui/assets/theme/range.css +87 -0
  57. data/lib/generators/frozen/templates/ui/assets/theme/select-arrow.svg +4 -0
  58. data/lib/generators/frozen/templates/ui/assets/theme/typography.css +89 -0
  59. data/lib/generators/frozen/templates/ui/assets/theme/variables.css +49 -0
  60. data/lib/generators/frozen/templates/ui/assets/unpoly/index.js +7 -0
  61. data/lib/generators/frozen/templates/ui/demo_component/counter_component.css +18 -0
  62. data/lib/generators/frozen/templates/ui/demo_component/counter_component.html.erb +6 -0
  63. data/lib/generators/frozen/templates/ui/demo_component/counter_component.js +24 -0
  64. data/lib/generators/frozen/templates/ui/demo_component/counter_component.rb +6 -0
  65. data/lib/generators/frozen/templates/ui/demo_component/counter_component.yml +5 -0
  66. data/lib/generators/frozen/templates/ui/demo_component_tests/counter_component_preview.rb +54 -0
  67. data/lib/generators/frozen/templates/ui/demo_component_tests/counter_component_spec.js +25 -0
  68. data/lib/generators/frozen/templates/ui/demo_component_tests/counter_component_test.rb +40 -0
  69. data/lib/generators/frozen/templates/ui/demo_component_tests/docs/styleguide.md.erb +30 -0
  70. data/lib/generators/frozen/templates/ui/demo_component_tests/manual_test_component_spec.js +14 -0
  71. data/lib/generators/frozen/templates/ui/esbuild.config.js +79 -0
  72. data/lib/generators/frozen/templates/ui/jasmine/controllers/jasmine_controller.rb +12 -0
  73. data/lib/generators/frozen/templates/ui/jasmine/views/jasmine/index.html.erb +19 -0
  74. data/lib/generators/frozen/templates/ui/jasmine/views/layouts/jasmine.html.erb +17 -0
  75. data/lib/generators/frozen/templates/ui/lib/generators/component/component_generator.rb +72 -0
  76. data/lib/generators/frozen/templates/ui/lib/tasks/assets.rake +14 -0
  77. data/lib/generators/frozen/templates/ui/lib/templates/view_component/component/component.rb.tt +19 -0
  78. data/lib/generators/frozen/templates/ui/lib/templates/view_component/frozen_extensions/bem_stylesheet.css.tt +3 -0
  79. data/lib/generators/frozen/templates/ui/lib/templates/view_component/frozen_extensions/erb_template.html.erb.tt +5 -0
  80. data/lib/generators/frozen/templates/ui/lib/templates/view_component/frozen_extensions/jasmine_spec.js.tt +15 -0
  81. data/lib/generators/frozen/templates/ui/lib/templates/view_component/frozen_extensions/unpoly_compiler.js.tt +5 -0
  82. data/lib/generators/frozen/templates/ui/lib/templates/view_component/frozen_extensions/view_spec.rb.tt +21 -0
  83. data/lib/generators/frozen/templates/ui/lib/templates/view_component/preview/component_preview.rb.tt +15 -0
  84. data/lib/generators/frozen/templates/ui/lookbook/lookbook_helper.rb +38 -0
  85. data/lib/generators/frozen/ui_generator.rb +135 -41
  86. metadata +68 -10
  87. data/lib/generators/frozen/templates/ui/cable.yml +0 -5
  88. data/lib/generators/frozen/templates/ui/hotkey_controller.js +0 -9
  89. /data/lib/generators/frozen/templates/db/initializers/{readonly_routes.rb → skip_writing_routes.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d1e4038850bfbf0972c64d50c2de0ef854c1165cbef4f6fba5c63cc963d5e39
4
- data.tar.gz: 47a78650b8de3d17aa463157c78c1242789389e4b0df03b56eeef9057efe9fbd
3
+ metadata.gz: abfb64658cf3eb104b953a8d190c82634ee962c5a8544e0584165252faf5cd3e
4
+ data.tar.gz: aa118f15dc15ffac611e4fd2e71c871812d483a23b40ee58e74e4fd3ea4f07cd
5
5
  SHA512:
6
- metadata.gz: d33940e9f7a07bc38a4dcdcdb867396b137e5a2bb265207fb46e45c1b65a3593f30127bd63f23ed12c5aa5d01dde3aa924a83049178f3be71d34108b5aca67c7
7
- data.tar.gz: 3a7a176184cf0b5d87b0a4727187e5ee89ee46e11fbf7a2a13d66a05efcb9a759f72f973c243bab36b962514e94303f1ecc00b3058fcde5a1dbdbf4893faa25d
6
+ metadata.gz: db3cd433980b66bc6b213baf6c9eee08e4ce3753c3a325b91b333b7a0d7a962f1a7fcbae5913578b8a5eb9e16bc03536c9b4fe01759a45dfc38a18176904418a
7
+ data.tar.gz: 443cfd39ae00fa7d3814a1f7ea88403321bcb521c085e188b0ad6d87788af0a71d79fa2c4057c4481273a95dad29f93600233309d968ee28b225ebf21c7bb4b2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
- # Change log
1
+ # Changelog
2
+
3
+ > :warning: This project is not inteded for public usage yet.
4
+
5
+ I will start keeping a changelog as soon as that happens.
6
+
7
+ This project adheres to [Break Versioning](https://www.taoensso.com/break-versioning).
8
+
9
+ ## [Unreleased]
10
+
11
+ ### Breaking
12
+
13
+ ### Non-breaking
2
14
 
3
- ## master
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2024 Klaus Weidinger
1
+ Copyright (c) 2025 Klaus Weidinger
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,124 +1,88 @@
1
- [![Gem Version](https://badge.fury.io/rb/dunkelziffer.svg)](https://rubygems.org/gems/dunkelziffer)
1
+ [![Gem Version](https://badge.fury.io/rb/frozen_rails.svg)](https://rubygems.org/gems/frozen_rails)
2
2
  [![Build](https://github.com/dunkelziffer/frozen_rails/workflows/Build/badge.svg)](https://github.com/dunkelziffer/frozen_rails/actions)
3
- [![JRuby Build](https://github.com/dunkelziffer/frozen_rails/workflows/JRuby%20Build/badge.svg)](https://github.com/dunkelziffer/frozen_rails/actions)
4
3
 
5
4
  # Frozen Rails
6
5
 
7
- DISCLAIMER: I generated this repo with AI and haven't tested it yet.
8
- I will verify manually verify the functionality and use AI to generate a test suite as soon as I get to it. Until then, use at your own risk.
6
+ This repo automates the instructions from [rails-static.com](https://rails-static.com) and a lot of additional setup which was created by me.
9
7
 
10
- This repo automates the instructions from [rails-static.com](https://rails-static.com) and some additional setup which was created by me.
11
-
12
- Running the full setup `bin/rails g frozen:rails` should turn a fresh Rails application into a full static-site generator that supports Markdown AND structured data (SQLite). The SSG is very developer-focused and might be cumbersome to use for non-devs.
8
+ Running the full setup `bin/rails g frozen:rails` turns a fresh Rails application into a full static site generator that supports Markdown AND structured data (SQLite). The SSG is very developer-focused and might be cumbersome to use for non-devs.
13
9
 
14
10
  ## Installation
15
11
 
16
- Adding to a gem:
17
-
18
- ```ruby
19
- # my-cool-gem.gemspec
20
- Gem::Specification.new do |spec|
21
- # ...
22
- spec.add_dependency "frozen_rails"
23
- # ...
24
- end
25
- ```
26
-
27
- Or adding to your project:
28
-
29
- ```ruby
30
- # Gemfile
31
- gem "frozen_rails"
12
+ ```bash
13
+ bundle add frozen_rails
32
14
  ```
33
15
 
34
- ### Supported Ruby versions
16
+ ## Prerequisites
35
17
 
36
- - Ruby (MRI) >= 2.7.0
37
- - JRuby >= 9.3.0
18
+ - Ruby with `bundler` installed
19
+ - nvm
38
20
 
39
21
  ## Usage
40
22
 
41
- The gem ships with Rails generators under the `frozen` namespace. After including `frozen_rails` in your Rails application the following generators will be available:
42
-
23
+ The gem ships with Rails generators under the `frozen` namespace. You can run them with:
43
24
  ```bash
44
- # passes, ✅ works correctly, ❌ has test suite
45
-
46
- # - Adds `decant` with a custom extension.
47
- # - Adds `kramdown`, `rouge` and ERB interpolation for `.md` files.
48
- # - Adds application scaffold.
49
-
50
- bin/rails g frozen:md
51
- # - Prompts for a rouge theme. Pass `--rouge_theme=name` to run non-interactive.
25
+ bin/rails g frozen:GENERATOR_NAME
52
26
  ```
53
27
 
54
- ```bash
55
- # ✅ passes, ✅ works correctly, ❌ has test suite
28
+ The following generators are available:
56
29
 
57
- # - Adds `parklife`
58
- # - Adds `.gitlab-ci.yml` and tweaks parklife config.
30
+ | Generator | Functionality |
31
+ | --- | --- |
32
+ | `frozen:rails` | Runs `frozen:md`, `frozen:ssg`, `frozen:db` and `frozen:ui` |
33
+ | `frozen:md` | Sets up Markdown processing similar to `rails-static.com` |
34
+ | `frozen:ssg` | Sets up deploying to GitHub & GitLab pages, similar to `rails-static.com` |
35
+ | `frozen:db` | Sets up `static_db`, `avo`, `friendly_id` and fully customizes `bin/rails g scaffold` |
36
+ | `frozen:ui` | Sets up `view_component`, `lookbook`, `esbuild`, `unpoly`, `jasmine` and fully customizes `bin/rails g component` |
59
37
 
60
- bin/rails g frozen:ssg
61
- ```
38
+ ## More details
62
39
 
63
40
  ```bash
64
- # passes, ✅ works correctly, ❌ has test suite
65
-
66
- # - Adds `sqlite_extensions-uuid`
67
- # - Adds `static_db`
68
- # - Adds `friendly_id`
69
- # - Adds `avo`
70
- # - Adjusts Rails scaffold generator and migration generator to be more helpful
71
-
72
- bin/rails g frozen:db
41
+ bin/rails g frozen:md
73
42
  ```
43
+ - `decant` (picks up Markdown files and provides a nice interface)
44
+ - `kramdown` (Markdown processing) with ERB interpolation
45
+ - `rouge` (syntax highlighting for Markdown code blocks)
46
+ - Routes for pages and categories.
74
47
 
75
- ```bash
76
- # ✅ passes, ❓ works correctly, ❌ has test suite
77
-
78
- # - SEO helpers
79
- # - sitemap/robots skeleton
80
-
81
- bin/rails g frozen:seo
82
- ```
48
+ ---
83
49
 
84
50
  ```bash
85
- # FUTURE: frozen:erb
86
-
87
- # - view_component
88
- # - herb
89
- # - lookbook
51
+ bin/rails g frozen:ssg
90
52
  ```
53
+ - `parklife` with ActiveStorage config (crawls rack apps and emits a static site)
54
+ - GitHub pages deployment
55
+ - GitLab pages deployment
91
56
 
92
- ```bash
93
- # ✅ passes, ❓ works correctly, ❌ has test suite
94
-
95
- # - water.css
96
- # - sample importmap pin
97
- # - Hotwire Spark & Action Cable configuration
98
- # - Stimulus hotkey controller
99
-
100
- bin/rails g frozen:ui
101
- ```
57
+ ---
102
58
 
103
59
  ```bash
104
- # passes, ❓ works correctly, ❌ has test suite
60
+ bin/rails g frozen:db
61
+ ```
62
+ - `static_db` (SQLite <-> YAML converter)
63
+ - `sqlite_extensions-uuid` (SQLite UUID support to avoid YAML merge conflicts)
64
+ - `friendly_id` (for prettier URLs)
65
+ - `avo` (a full admin panel)
66
+ - Adjusts `bin/rails g scaffold`
105
67
 
106
- # Full Rails setup (runs all frozen generators in order)
68
+ ---
107
69
 
108
- bin/rails g frozen:rails
109
- ```
110
70
 
111
71
  ```bash
112
- # FUTURE: frozen:meetup
72
+ bin/rails g frozen:ui
113
73
  ```
74
+ - `esbuild` and `precompiled_assets` (Rails asset pipeline alternative)
75
+ - `Unpoly` (Hotwire alternative)
76
+ - `water.css` (CSS base theme)
77
+ - `Jasmine` (JS test runner)
78
+ - `view_component`
79
+ - `lookbook`
80
+ - Adjusts `bin/rails g component`
114
81
 
115
82
  ## Contributing
116
83
 
117
84
  Bug reports and pull requests are welcome on GitHub at [https://github.com/dunkelziffer/frozen_rails](https://github.com/dunkelziffer/frozen_rails).
118
85
 
119
- ## Credits
120
-
121
- This gem is generated via [`newgem` template](https://github.com/palkan/newgem) by [@palkan](https://github.com/palkan).
122
86
 
123
87
  ## License
124
88
 
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ begin
9
+ require "rubocop/rake_task"
10
+ RuboCop::RakeTask.new
11
+
12
+ RuboCop::RakeTask.new("rubocop:md") do |task|
13
+ task.options << %w[-c .rubocop-md.yml]
14
+ end
15
+ rescue LoadError
16
+ task(:rubocop) { }
17
+ task("rubocop:md") { }
18
+ end
19
+
20
+ task default: %w[rubocop rubocop:md spec]
@@ -3,8 +3,15 @@ module Appendable
3
3
 
4
4
  private
5
5
 
6
- def append_to_application_config(content)
7
- inject_into_file "config/application.rb", optimize_indentation("\n#{content}", 4), before: / end\nend(?:\n)\z/, verbose: false
6
+ def append_to_application_config(content, env: nil)
7
+ case env
8
+ when nil
9
+ inject_into_file "config/application.rb", optimize_indentation("\n#{content}", 4), before: / end\nend(?:\n)\z/, verbose: false
10
+ when "development", "production", "test"
11
+ inject_into_file "config/environments/#{env}.rb", optimize_indentation("\n#{content}", 2), before: /end(?:\n)\z/, verbose: false
12
+ else
13
+ raise "Unknown env: #{env}"
14
+ end
8
15
  end
9
16
 
10
17
  def append_to_routes(content)
@@ -3,10 +3,15 @@ module Copyable
3
3
 
4
4
  private
5
5
 
6
- def copy_directory(source, target, **options)
6
+ def copy_directory(source, target, hidden: true, **options)
7
7
  base = File.join(self.class.source_root, source)
8
- Dir.glob("#{base}/**/*").each do |path|
8
+
9
+ glob_options = hidden ? [ File::FNM_DOTMATCH ] : []
10
+
11
+ Dir.glob("#{base}/**/*", *glob_options).each do |path|
9
12
  next if File.directory?(path)
13
+ next if hidden && (File.basename(path) == "." || File.basename(path) == "..")
14
+
10
15
  rel = path.delete_prefix("#{base}/")
11
16
  copy_file "#{source}/#{rel}", "#{target}/#{rel}", **options
12
17
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators"
4
2
  require "frozen_rails/appendable"
5
3
  require "frozen_rails/bundleable"
@@ -24,8 +24,9 @@ module Taggable
24
24
 
25
25
  def add_frozen_gemfile_tags(env: nil)
26
26
  unless File.read("Gemfile").include?(frozen_start_tag(env:))
27
- newlines = env ? "\n" : "\n\n"
28
- tags = "#{frozen_start_tag(env:)}#{newlines}#{frozen_end_tag(env:)}"
27
+ space_between = env ? "\n" : "\n\n"
28
+ space_after = env ? "\n" : ""
29
+ tags = "#{frozen_start_tag(env:)}#{space_between}#{frozen_end_tag(env:)}#{space_after}"
29
30
  insert_into_file "Gemfile", tags, after: frozen_tags_after(env:)
30
31
  end
31
32
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module FrozenRails # :nodoc:
4
- VERSION = "0.0.4"
2
+ VERSION = "0.0.6"
5
3
  end
data/lib/frozen_rails.rb CHANGED
@@ -1,3 +1 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "frozen_rails/version"
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "frozen_rails/generator"
4
2
 
5
3
  module Frozen
@@ -48,8 +46,7 @@ module Frozen
48
46
  append_to_application_config <<~RUBY
49
47
  # frozen:db
50
48
  config.generators do |g|
51
- g.orm :active_record, primary_key_type: :uuid
52
- g.test_framework nil
49
+ g.orm :active_record, primary_key_type: :string
53
50
  g.helper nil
54
51
  end
55
52
  config.active_storage.draw_routes = true
@@ -116,7 +113,7 @@ module Frozen
116
113
  end
117
114
  RUBY
118
115
 
119
- run "b rubocop -a config/initializers/avo.rb"
116
+ run "bin/rubocop -a config/initializers/avo.rb"
120
117
  end
121
118
 
122
119
  def migrate_and_cleanup_db
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "frozen_rails/generator"
4
2
 
5
3
  module Frozen
@@ -55,6 +53,11 @@ module Frozen
55
53
  RUBY
56
54
  end
57
55
 
56
+ def prepare_rouge
57
+ copy_directory "assets/rouge", "app/assets/rouge"
58
+ copy_file "assets/application.css", "app/assets/application.css", force: true
59
+ end
60
+
58
61
  def generate_rouge_css_stylesheet
59
62
  theme = options[:rouge_theme]
60
63
 
@@ -77,7 +80,7 @@ module Frozen
77
80
  theme ||= "github"
78
81
 
79
82
  say_status :info, "Generating Rouge CSS for theme #{theme}", :blue
80
- run "rougify style #{theme} > app/assets/stylesheets/rouge.css"
83
+ run "rougify style #{theme} > app/assets/rouge/rouge.css"
81
84
  end
82
85
  end
83
86
  end
@@ -1,36 +1,28 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "rails/generators"
4
2
  require "frozen_rails/taggable"
5
3
 
6
4
  module Frozen
7
5
  module Generators
8
- # A meta-generator that runs the other frozen generators in a sensible order.
9
6
  class RailsGenerator < Rails::Generators::Base
10
7
  include Taggable
11
8
 
12
- desc "Run all frozen setup generators (md, db, seo, ui, dx, ssg)"
9
+ desc "Run all frozen setup generators (md, ssg, db, ui, seo)"
13
10
 
14
- # The method name doesn't matter much; Thor runs all public methods in
15
- # order defined by source.
16
11
  def run_all
17
12
  say_status :info, "invoking frozen:md"
18
13
  invoke "frozen:md", [], cleanup_frozen_tags: false
19
14
 
15
+ say_status :info, "invoking frozen:ssg"
16
+ invoke "frozen:ssg", [], cleanup_frozen_tags: false
17
+
20
18
  say_status :info, "invoking frozen:db"
21
19
  invoke "frozen:db", [], cleanup_frozen_tags: false
22
20
 
23
- say_status :info, "invoking frozen:seo"
24
- invoke "frozen:seo", [], cleanup_frozen_tags: false
25
-
26
21
  say_status :info, "invoking frozen:ui"
27
22
  invoke "frozen:ui", [], cleanup_frozen_tags: false
28
23
 
29
- say_status :info, "invoking frozen:dx"
30
- invoke "frozen:dx", [], cleanup_frozen_tags: false
31
-
32
- say_status :info, "invoking frozen:ssg"
33
- invoke "frozen:ssg", [], cleanup_frozen_tags: false
24
+ # say_status :info, "invoking frozen:seo"
25
+ # invoke "frozen:seo", [], cleanup_frozen_tags: false
34
26
 
35
27
  cleanup_all_frozen_tags!
36
28
  end
@@ -1,17 +1,15 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "frozen_rails/generator"
4
2
 
5
3
  module Frozen
6
4
  module Generators
7
5
  class SeoGenerator < FrozenRails::Generator
8
- source_root File.expand_path("templates", __dir__)
6
+ source_root File.expand_path("templates/seo", __dir__)
9
7
 
10
8
  desc "Add SEO helpers, metadata partials and sitemap/robots models"
11
9
 
12
10
  # add meta partial and update layout
13
11
  def create_og_partial
14
- template "seo/_og_meta_tags.html.erb", "app/views/layouts/_og_meta_tags.html.erb"
12
+ template "_og_meta_tags.html.erb", "app/views/layouts/_og_meta_tags.html.erb"
15
13
  end
16
14
 
17
15
  def inject_layout_tags
@@ -96,9 +94,9 @@ module Frozen
96
94
 
97
95
  # sitemap models
98
96
  def create_sitemap_models
99
- template "seo/sitemap.rb", "app/models/sitemap.rb"
100
- template "seo/sitemap_entry.rb", "app/models/sitemap/entry.rb"
101
- template "seo/robots_generatable.rb", "app/models/sitemap/robots_generatable.rb"
97
+ template "sitemap.rb", "app/models/sitemap.rb"
98
+ template "sitemap_entry.rb", "app/models/sitemap/entry.rb"
99
+ template "robots_generatable.rb", "app/models/sitemap/robots_generatable.rb"
102
100
  end
103
101
 
104
102
  def remove_default_robots
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "frozen_rails/generator"
4
2
 
5
3
  module Frozen
@@ -14,5 +14,18 @@ test:
14
14
  database: storage/test.sqlite3
15
15
 
16
16
  production:
17
- <<: *default
18
- database: storage/production.sqlite3
17
+ primary:
18
+ <<: *default
19
+ database: storage/production.sqlite3
20
+ cache:
21
+ <<: *default
22
+ database: storage/production_cache.sqlite3
23
+ migrations_paths: db/cache_migrate
24
+ queue:
25
+ <<: *default
26
+ database: storage/production_queue.sqlite3
27
+ migrations_paths: db/queue_migrate
28
+ cable:
29
+ <<: *default
30
+ database: storage/production_cable.sqlite3
31
+ migrations_paths: db/cable_migrate
@@ -0,0 +1,9 @@
1
+ ActiveSupport.on_load(:active_record) do
2
+ require "rails/generators"
3
+ require "rails/generators/rails/scaffold_controller/scaffold_controller_generator"
4
+
5
+ Rails::Generators::ScaffoldControllerGenerator.class_eval do
6
+ remove_hook_for :test_framework
7
+ remove_hook_for :helper
8
+ end
9
+ end
@@ -5,7 +5,7 @@ module Generators
5
5
  class ResourceGenerator
6
6
  no_tasks do
7
7
  def field_string(name, type, options)
8
- return "field :slug, as: :id, format_using: -> { link_to value, main_app.polymorphic_path(record) }" if name.to_sym == :slug
8
+ return "field :slug, as: :id, format_using: -> { link_to value, main_app.polymorphic_path(record), \"data-turbo\": false }" if name.to_sym == :slug
9
9
  "field :#{name}, as: :#{type}#{options}"
10
10
  end
11
11
 
@@ -2,7 +2,18 @@
2
2
  class <%= class_name %> < <%= parent_class_name.classify %>
3
3
  <% if attributes.any? { |a| a.name.to_s == "slug" } -%>
4
4
  include FriendlyId
5
- friendly_id :<%= attributes.reject { |a| a.name.to_s == "slug" }.select { |a| a.type.to_s == "string" }.first.name %>
5
+ <% if (derived_from = attributes.reject { |a| a.name.to_s == "slug" }.select { |a| a.type.to_s == "string" }.first) -%>
6
+ friendly_id :<%= derived_from.name %>
7
+ <% else -%>
8
+ friendly_id :slug_candidates
9
+
10
+ # TODO: implement
11
+ def slug_candidates
12
+ [
13
+ "TODO"
14
+ ]
15
+ end
16
+ <% end -%>
6
17
  <% end -%>
7
18
  <% attributes.select(&:reference?).each do |attribute| -%>
8
19
  belongs_to :<%= attribute.name %><%= ", polymorphic: true" if attribute.polymorphic? %>
@@ -1,14 +1,20 @@
1
- <p style="color: green"><%%= notice %></p>
2
-
3
1
  <%% content_for :title, "<%= human_name.pluralize %>" %>
4
2
 
5
3
  <h1><%= human_name.pluralize %></h1>
6
4
 
7
- <div id="<%= plural_table_name %>">
5
+ <%% if Rails.env.development? %>
6
+ <p>
7
+ <%%= link_to "✏️", avo.resources_<%= index_helper(type: :path) %>, "up-follow": false %>
8
+ </p>
9
+ <%% end %>
10
+
11
+ <ul id="<%= plural_table_name %>">
8
12
  <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
9
- <%%= render <%= singular_table_name %> %>
10
- <p>
11
- <%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(singular_table_name) %> %>
12
- </p>
13
+ <li>
14
+ <%%= render <%= singular_table_name %> %>
15
+ <p>
16
+ <%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(singular_table_name) %> %>
17
+ </p>
18
+ </li>
13
19
  <%% end %>
14
- </div>
20
+ </ul>
@@ -1,4 +1,4 @@
1
- <div id="<%%= dom_id <%= singular_name %> %>">
1
+ <article id="<%%= dom_id <%= singular_name %> %>">
2
2
  <% attributes.reject(&:password_digest?).each do |attribute| -%>
3
3
  <p>
4
4
  <strong><%= attribute.human_name %>:</strong>
@@ -14,4 +14,4 @@
14
14
  </p>
15
15
 
16
16
  <% end -%>
17
- </div>
17
+ </article>
@@ -1,10 +1,11 @@
1
- <p style="color: green"><%%= notice %></p>
1
+ <%% content_for :title, "<%= human_name %>: #{@<%= singular_table_name %>.slug}" %>
2
2
 
3
3
  <%%= render @<%= singular_table_name %> %>
4
4
 
5
- <div>
6
- <%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %> %>
7
- <%% if Rails.env.development? %>
8
- <%%= link_to "Edit", avo.resources_<%= show_helper(type: :path) %> %>
9
- <%% end %>
10
- </div>
5
+ <%% if Rails.env.development? %>
6
+ <p>
7
+ <%%= link_to "✏️", avo.resources_<%= show_helper(type: :path) %>, "up-follow": false %>
8
+ </p>
9
+ <%% end %>
10
+
11
+ <%%= link_to "Back to all <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %> %>
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css.
3
+ *
4
+ * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
5
+ * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
6
+ * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
7
+ * depending on specificity.
8
+ *
9
+ * Consider organizing styles into separate files for maintainability.
10
+ *
11
+ *= require rouge/revert
12
+ *= require rouge/rouge
13
+ */
@@ -0,0 +1,7 @@
1
+ # rouge syntax highlighting
2
+
3
+ Put your `rouge.css` stylesheet into this directory.
4
+
5
+ ```bash
6
+ rougify style THEME > app/assets/rouge/rouge.css
7
+ ```
@@ -0,0 +1,11 @@
1
+ /*
2
+ Revert all previous styles and reset to the user agent defaults.
3
+ The rouge "module" needs to be last in the CSS bundle or later
4
+ styles will mess up the syntax highlighting again.
5
+ This intentionally removes our base theme so the rouge styles win.
6
+ */
7
+ .highlight,
8
+ .highlight * {
9
+ all: revert;
10
+ }
11
+ /* Manually re-apply spacing rules below, if desired. */
@@ -1,5 +1,7 @@
1
- <nav>
1
+ <h1>All categories</h1>
2
+
3
+ <ul>
2
4
  <% @categories.each do |category| %>
3
- <%= link_to category %>
5
+ <li><%= link_to category %></li>
4
6
  <% end %>
5
- </nav>
7
+ </ul>
@@ -1,13 +1,9 @@
1
- <nav>
2
- <%= link_to "Back to all categories", categories_path %>
3
- </nav>
1
+ <%= link_to "Back to all categories", categories_path %>
4
2
 
5
- <h1><%= @category.title %></h1>
3
+ <h1><%= @category.title %> - Articles</h1>
6
4
 
7
5
  <ul>
8
- <% @category.pages.each do |page| %>
9
- <li>
10
- <%= link_to page %>
11
- </li>
12
- <% end %>
6
+ <% @category.pages.each do |page| %>
7
+ <li><%= link_to page %></li>
8
+ <% end %>
13
9
  </ul>
@@ -1,5 +1,8 @@
1
- <% @page.categories.each do |category| %>
2
- <%= link_to category %>
3
- <% end %>
1
+ <span>
2
+ Categories:
3
+ <% @page.categories.each do |category| %>
4
+ <%= link_to category %>
5
+ <% end %>
6
+ </span>
4
7
 
5
8
  <%= render_content_from @page %>