最后活跃于 1752035659

Dumpling app template - Web Awesome alpha

GyozaGuy's Avatar GyozaGuy 修订了这个 Gist 1752035659. 转到此修订

没有任何变更

GyozaGuy's Avatar GyozaGuy 修订了这个 Gist 1752035629. 转到此修订

没有任何变更

GyozaGuy's Avatar GyozaGuy 修订了这个 Gist 1747432948. 转到此修订

没有任何变更

GyozaGuy's Avatar GyozaGuy 修订了这个 Gist 1747432916. 转到此修订

1 file changed, 62 insertions

dumpling.rb(文件已创建)

@@ -0,0 +1,62 @@
1 + # Rails Application Template
2 + # Apply all uncommitted changes
3 +
4 + # Download custom .rubocop.yml from URL
5 + get 'https://gist.gyozaguy.dev/GyozaGuy/cdd6fa0cc913430d8951de685f840e6a/raw/HEAD/.rubocop.yml', '.rubocop.yml'
6 +
7 + # Remove omakase rubocop gem and add standard rubocop
8 + gsub_file 'Gemfile', /^\s+# Omakase Ruby styling.*\n\s+gem ['"]rubocop-rails-omakase['"], require: false\n/m, ''
9 + insert_into_file 'Gemfile', " gem 'rubocop'\n", after: "group :development do\n"
10 +
11 + # Define custom git source shorthand :gg
12 + # This allows gems to be specified with `gem 'name', gg: 'repo'` syntax
13 + insert_into_file 'Gemfile',
14 + "\ngit_source(:gg) { |repo| \"https://git.gyozaguy.com/\#{repo}.git\" }\n",
15 + after: 'source "https://rubygems.org"'
16 +
17 + # Add dumpling gem using the custom :gg git source shorthand
18 + # This will fetch the gem from https://git.gyozaguy.com/GyozaGuy/dumpling.git
19 + gem 'dumpling', gg: 'GyozaGuy/dumpling'
20 +
21 + # Create application_layout.rb
22 + file 'app/views/layouts/application_layout.rb', <<~RUBY
23 + class Layouts::ApplicationLayout < Components::Layout
24 + def view_template(&)
25 + doctype
26 +
27 + html(**locale_props, **theme_props(theme: 'dark')) {
28 + head {
29 + title { "\#{content_for(:page_title) || 'Loading...'} :: Replace Me" }
30 + default_meta
31 + link(href: '/icon.png', rel: 'icon', type: 'image/png')
32 + link(href: '/icon.svg', rel: 'icon', type: 'image/svg+xml')
33 + link(href: '/icon.png', rel: 'apple-touch-icon')
34 + default_stylesheets
35 + default_javascript
36 + }
37 +
38 + body(id: page_id) {
39 + main(&)
40 + }
41 + }
42 + end
43 + end
44 + RUBY
45 +
46 + # Modify application_controller.rb
47 + gsub_file 'app/controllers/application_controller.rb',
48 + 'class ApplicationController < ActionController::Base',
49 + 'class ApplicationController < Dumpling::ApplicationController'
50 +
51 + # Run RuboCop auto-correct to standardize quotes and other style issues
52 + after_bundle do
53 + say 'Running RuboCop auto-correct to standardize quotes and other style issues...'
54 + run 'bundle exec rubocop -a'
55 + say 'RuboCop auto-correction completed!'
56 + end
57 +
58 + # Remove default application.html.erb layout as we're using application_layout.rb instead
59 + remove_file 'app/views/layouts/application.html.erb'
60 +
61 + puts 'Template applied successfully!'
62 + puts 'Remember to run bundle install to update your gems'
上一页 下一页