Última atividade 1771353053

Dumpling app template

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