frozen_rails 0.0.5 → 0.0.7

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 (88) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -2
  3. data/LICENSE.txt +1 -1
  4. data/README.md +45 -77
  5. data/lib/frozen_rails/appendable.rb +9 -2
  6. data/lib/frozen_rails/copyable.rb +7 -2
  7. data/lib/frozen_rails/generator.rb +0 -2
  8. data/lib/frozen_rails/taggable.rb +3 -2
  9. data/lib/frozen_rails/version.rb +1 -3
  10. data/lib/frozen_rails.rb +0 -2
  11. data/lib/generators/frozen/db_generator.rb +2 -5
  12. data/lib/generators/frozen/md_generator.rb +6 -3
  13. data/lib/generators/frozen/rails_generator.rb +6 -14
  14. data/lib/generators/frozen/seo_generator.rb +5 -7
  15. data/lib/generators/frozen/ssg_generator.rb +0 -2
  16. data/lib/generators/frozen/templates/db/database.yml +15 -2
  17. data/lib/generators/frozen/templates/db/initializers/skip_controller_tests_and_helpers.rb +9 -0
  18. data/lib/generators/frozen/templates/db/lib/generators/avo/resource/resource_generator.rb +1 -1
  19. data/lib/generators/frozen/templates/db/lib/templates/active_record/model/model.rb.tt +12 -1
  20. data/lib/generators/frozen/templates/db/lib/templates/erb/scaffold/index.html.erb.tt +14 -8
  21. data/lib/generators/frozen/templates/db/lib/templates/erb/scaffold/partial.html.erb.tt +2 -2
  22. data/lib/generators/frozen/templates/db/lib/templates/erb/scaffold/show.html.erb.tt +8 -7
  23. data/lib/generators/frozen/templates/md/assets/application.css +13 -0
  24. data/lib/generators/frozen/templates/md/assets/rouge/README.md +7 -0
  25. data/lib/generators/frozen/templates/md/assets/rouge/revert.css +11 -0
  26. data/lib/generators/frozen/templates/md/views/categories/index.html.erb +5 -3
  27. data/lib/generators/frozen/templates/md/views/categories/show.html.erb +5 -9
  28. data/lib/generators/frozen/templates/md/views/pages/show.html.erb +6 -3
  29. data/lib/generators/frozen/templates/ui/application.html.erb +32 -0
  30. data/lib/generators/frozen/templates/ui/application_component.rb +2 -0
  31. data/lib/generators/frozen/templates/ui/assets/application.js +4 -0
  32. data/lib/generators/frozen/templates/ui/assets/builds/.keep +0 -0
  33. data/lib/generators/frozen/templates/ui/assets/components/index.js +2 -0
  34. data/lib/generators/frozen/templates/ui/assets/fonts/.keep +0 -0
  35. data/lib/generators/frozen/templates/ui/assets/images/.keep +0 -0
  36. data/lib/generators/frozen/templates/ui/assets/images/pages/.keep +0 -0
  37. data/lib/generators/frozen/templates/ui/assets/jasmine/boot.js +6 -0
  38. data/lib/generators/frozen/templates/ui/assets/jasmine/support/fixtures.js +24 -0
  39. data/lib/generators/frozen/templates/ui/assets/jasmine/support/jasmine-dom.js +1 -0
  40. data/lib/generators/frozen/templates/ui/assets/jasmine/support/unpoly-test-config.js +7 -0
  41. data/lib/generators/frozen/templates/ui/assets/jasmine/support.js +1 -0
  42. data/lib/generators/frozen/templates/ui/assets/jasmine.js +5 -0
  43. data/lib/generators/frozen/templates/ui/assets/rouge/index.js +2 -0
  44. data/lib/generators/frozen/templates/ui/assets/static.js +5 -0
  45. data/lib/generators/frozen/templates/ui/assets/theme/README.md +11 -0
  46. data/lib/generators/frozen/templates/ui/assets/theme/base.css +27 -0
  47. data/lib/generators/frozen/templates/ui/assets/theme/code.css +29 -0
  48. data/lib/generators/frozen/templates/ui/assets/theme/forms.css +160 -0
  49. data/lib/generators/frozen/templates/ui/assets/theme/index.js +2 -0
  50. data/lib/generators/frozen/templates/ui/assets/theme/links.css +8 -0
  51. data/lib/generators/frozen/templates/ui/assets/theme/misc.css +150 -0
  52. data/lib/generators/frozen/templates/ui/assets/theme/parts.css +8 -0
  53. data/lib/generators/frozen/templates/ui/assets/theme/print.css +53 -0
  54. data/lib/generators/frozen/templates/ui/assets/theme/range.css +87 -0
  55. data/lib/generators/frozen/templates/ui/assets/theme/select-arrow.svg +4 -0
  56. data/lib/generators/frozen/templates/ui/assets/theme/typography.css +89 -0
  57. data/lib/generators/frozen/templates/ui/assets/theme/variables.css +49 -0
  58. data/lib/generators/frozen/templates/ui/assets/unpoly/index.js +7 -0
  59. data/lib/generators/frozen/templates/ui/demo_component/counter_component.css +18 -0
  60. data/lib/generators/frozen/templates/ui/demo_component/counter_component.html.erb +6 -0
  61. data/lib/generators/frozen/templates/ui/demo_component/counter_component.js +24 -0
  62. data/lib/generators/frozen/templates/ui/demo_component/counter_component.rb +6 -0
  63. data/lib/generators/frozen/templates/ui/demo_component/counter_component.yml +5 -0
  64. data/lib/generators/frozen/templates/ui/demo_component_tests/counter_component_preview.rb +54 -0
  65. data/lib/generators/frozen/templates/ui/demo_component_tests/counter_component_spec.js +25 -0
  66. data/lib/generators/frozen/templates/ui/demo_component_tests/counter_component_test.rb +40 -0
  67. data/lib/generators/frozen/templates/ui/demo_component_tests/docs/styleguide.md.erb +30 -0
  68. data/lib/generators/frozen/templates/ui/demo_component_tests/manual_test_component_spec.js +14 -0
  69. data/lib/generators/frozen/templates/ui/esbuild.config.js +79 -0
  70. data/lib/generators/frozen/templates/ui/jasmine/controllers/jasmine_controller.rb +12 -0
  71. data/lib/generators/frozen/templates/ui/jasmine/views/jasmine/index.html.erb +19 -0
  72. data/lib/generators/frozen/templates/ui/jasmine/views/layouts/jasmine.html.erb +17 -0
  73. data/lib/generators/frozen/templates/ui/lib/generators/component/component_generator.rb +73 -0
  74. data/lib/generators/frozen/templates/ui/lib/tasks/assets.rake +14 -0
  75. data/lib/generators/frozen/templates/ui/lib/templates/view_component/component/component.rb.tt +19 -0
  76. data/lib/generators/frozen/templates/ui/lib/templates/view_component/frozen_extensions/bem_stylesheet.css.tt +3 -0
  77. data/lib/generators/frozen/templates/ui/lib/templates/view_component/frozen_extensions/erb_template.html.erb.tt +5 -0
  78. data/lib/generators/frozen/templates/ui/lib/templates/view_component/frozen_extensions/jasmine_spec.js.tt +15 -0
  79. data/lib/generators/frozen/templates/ui/lib/templates/view_component/frozen_extensions/unpoly_compiler.js.tt +5 -0
  80. data/lib/generators/frozen/templates/ui/lib/templates/view_component/frozen_extensions/view_spec.rb.tt +21 -0
  81. data/lib/generators/frozen/templates/ui/lib/templates/view_component/preview/component_preview.rb.tt +15 -0
  82. data/lib/generators/frozen/templates/ui/lookbook/lookbook_helper.rb +38 -0
  83. data/lib/generators/frozen/ui_generator.rb +137 -41
  84. metadata +60 -5
  85. data/RELEASING.md +0 -11
  86. data/lib/generators/frozen/templates/ui/cable.yml +0 -5
  87. data/lib/generators/frozen/templates/ui/hotkey_controller.js +0 -9
  88. /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: a3e70fbae47b9cfd6742a06eb54721f5f1f182afd4ab044b19d796d3a36a08b0
4
- data.tar.gz: 468e981b06f99a821b3a58bdd8bb02f6c7fc51abdb97ea73ead08e6f93ed5f66
3
+ metadata.gz: 79009959a35c4871ccbb2848610e9d79f5403eba5f03364822ced61d5f22cc48
4
+ data.tar.gz: 9f590dcde282590241cc28fe84f0bc1030bd2163e204915be7a84d5f62ed4555
5
5
  SHA512:
6
- metadata.gz: 14f2cfa35628c1837d58828ba17ca68eefe82a6b1294e13532352000735f9ed0586cac0e55f61ca29a27f52d9ae043261dab742a04b186b7478e53b1af5170ee
7
- data.tar.gz: 3637971df5425a6dd75e9f8ccd6ceeafca2d86dffb131f29eb57788cc698460b5d3edc5aadaba69f1923640ce38d319fd8915643b506f674349f4aa8b9c1ccdc
6
+ metadata.gz: d7c120056fdfcd623249e6005551a1b3b4c847238285c956b6c98064566df5532de01ffe85d2f300ed2e2edae2748600af140b92e850f3d4836c6dd3abe4907d
7
+ data.tar.gz: 26dcf155f28dfdf23a85107d310a22f9d1f131a45bb4bb7b0674a5fe59ae1f0424d4592513978359bed24708d34dc370c0bf6b4255dc82e98e74c24ea55ba40e
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
@@ -3,113 +3,81 @@
3
3
 
4
4
  # Frozen Rails
5
5
 
6
- DISCLAIMER: I generated this repo with AI and haven't tested it yet.
7
- 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.
8
7
 
9
- This repo automates the instructions from [rails-static.com](https://rails-static.com) and some additional setup which was created by me.
10
-
11
- 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.
12
9
 
13
10
  ## Installation
14
11
 
15
- Adding to a gem:
16
-
17
- ```ruby
18
- # my-cool-gem.gemspec
19
- Gem::Specification.new do |spec|
20
- # ...
21
- spec.add_dependency "frozen_rails"
22
- # ...
23
- end
24
- ```
25
-
26
- Or adding to your project:
27
-
28
- ```ruby
29
- # Gemfile
30
- gem "frozen_rails"
12
+ ```bash
13
+ bundle add frozen_rails
31
14
  ```
32
15
 
33
- ### Supported Ruby versions
16
+ ## Prerequisites
34
17
 
35
- - Ruby (MRI) >= 3.2.0
36
- - Rails >= 8.1
18
+ - Ruby with `bundler` installed
19
+ - nvm
37
20
 
38
21
  ## Usage
39
22
 
40
- The gem ships with Rails generators under the `frozen` namespace. After including `frozen_rails` in your Rails application the following generators will be available:
41
-
23
+ The gem ships with Rails generators under the `frozen` namespace. You can run them with:
42
24
  ```bash
43
- # passes, ✅ works correctly, ❌ has test suite
44
-
45
- # - Adds `decant` with a custom extension.
46
- # - Adds `kramdown`, `rouge` and ERB interpolation for `.md` files.
47
- # - Adds application scaffold.
48
-
49
- bin/rails g frozen:md
50
- # - Prompts for a rouge theme. Pass `--rouge_theme=name` to run non-interactive.
25
+ bin/rails g frozen:GENERATOR_NAME
51
26
  ```
52
27
 
53
- ```bash
54
- # ✅ passes, ✅ works correctly, ❌ has test suite
28
+ The following generators are available:
55
29
 
56
- # - Adds `parklife` and configures ActiveStorage support
57
- # - Adds support for GitLab CI
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` |
58
37
 
59
- bin/rails g frozen:ssg
60
- ```
38
+ ## More details
61
39
 
62
40
  ```bash
63
- # passes, ✅ works correctly, ❌ has test suite
64
-
65
- # - Adds `sqlite_extensions-uuid`
66
- # - Adds `static_db`
67
- # - Adds `friendly_id`
68
- # - Adds `avo`
69
- # - Adjusts Rails scaffold generator and migration generator to be more helpful
70
-
71
- bin/rails g frozen:db
41
+ bin/rails g frozen:md
72
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.
73
47
 
74
- ```bash
75
- # ✅ passes, ❓ works correctly, ❌ has test suite
76
-
77
- # - SEO helpers
78
- # - sitemap/robots skeleton
79
-
80
- bin/rails g frozen:seo
81
- ```
48
+ ---
82
49
 
83
50
  ```bash
84
- # FUTURE: frozen:erb
85
-
86
- # - view_component
87
- # - herb
88
- # - lookbook
51
+ bin/rails g frozen:ssg
89
52
  ```
53
+ - `parklife` with ActiveStorage config (crawls rack apps and emits a static site)
54
+ - GitHub pages deployment
55
+ - GitLab pages deployment
90
56
 
91
- ```bash
92
- # ✅ passes, ❓ works correctly, ❌ has test suite
93
-
94
- # - water.css
95
- # - sample importmap pin
96
- # - Hotwire Spark & Action Cable configuration
97
- # - Stimulus hotkey controller
98
-
99
- bin/rails g frozen:ui
100
- ```
57
+ ---
101
58
 
102
59
  ```bash
103
- # 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`
104
67
 
105
- # Full Rails setup (runs all frozen generators in order)
68
+ ---
106
69
 
107
- bin/rails g frozen:rails
108
- ```
109
70
 
110
71
  ```bash
111
- # FUTURE: frozen:meetup
72
+ bin/rails g frozen:ui
112
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`
113
81
 
114
82
  ## Contributing
115
83
 
@@ -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.5"
2
+ VERSION = "0.0.7"
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 %>
@@ -0,0 +1,32 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= content_for(:title) || "Test Freeze" %></title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <meta name="apple-mobile-web-app-capable" content="yes">
7
+ <meta name="application-name" content="Test Freeze">
8
+ <meta name="mobile-web-app-capable" content="yes">
9
+ <%= csrf_meta_tags %>
10
+ <%= csp_meta_tag %>
11
+
12
+ <%= yield :head %>
13
+
14
+ <%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
15
+ <%# = tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
16
+
17
+ <link rel="icon" href="/icon.png" type="image/png">
18
+ <link rel="icon" href="/icon.svg" type="image/svg+xml">
19
+ <link rel="apple-touch-icon" href="/icon.png">
20
+ <%# Use propshaft in development and precompiled_assets in production. Very brittle. %>
21
+ <% if Rails.env.development? %>
22
+ <%= stylesheet_link_tag :app %>
23
+ <% else %>
24
+ <%= stylesheet_link_tag "application" %>
25
+ <% end %>
26
+ <%= javascript_include_tag "application", type: "module", defer: true %>
27
+ </head>
28
+
29
+ <body>
30
+ <%= yield %>
31
+ </body>
32
+ </html>
@@ -0,0 +1,2 @@
1
+ class ApplicationComponent < ViewComponent::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ import "./theme"
2
+ import "./unpoly"
3
+ import "./components"
4
+ import "./rouge"