Zuletzt aktiv 1771353053

Dumpling app template

GyozaGuy's Avatar GyozaGuy hat die Gist bearbeitet 1771353053. Zu Änderung gehen

1 file changed, 4 deletions

dumpling.rb

@@ -13,10 +13,6 @@ insert_into_file 'Gemfile', " gem 'rubocop'\n", after: "group :development do\n
13 13 insert_into_file 'Gemfile',
14 14 "\n\nsource 'https://git.gyozaguy.com/api/packages/GyozaGuy/rubygems' do\n\tgem 'dumpling', '~> 1.0'\nend"
15 15
16 - # Add dumpling gem using the custom :gg git source shorthand
17 - # This will fetch the gem from https://git.gyozaguy.com/GyozaGuy/dumpling.git
18 - gem 'dumpling', gg: 'GyozaGuy/dumpling'
19 -
20 16 # Create application_layout.rb
21 17 file 'app/views/layouts/application_layout.rb', <<~RUBY
22 18 class Layouts::ApplicationLayout < Components::Layout

GyozaGuy's Avatar GyozaGuy hat die Gist bearbeitet 1771352999. Zu Änderung gehen

1 file changed, 1 insertion, 2 deletions

dumpling.rb

@@ -11,8 +11,7 @@ insert_into_file 'Gemfile', " gem 'rubocop'\n", after: "group :development do\n
11 11 # Define custom git source shorthand :gg
12 12 # This allows gems to be specified with `gem 'name', gg: 'repo'` syntax
13 13 insert_into_file 'Gemfile',
14 - "\ngit_source(:gg) { |repo| \"https://git.gyozaguy.com/\#{repo}.git\" }\n",
15 - after: 'source "https://rubygems.org"'
14 + "\n\nsource 'https://git.gyozaguy.com/api/packages/GyozaGuy/rubygems' do\n\tgem 'dumpling', '~> 1.0'\nend"
16 15
17 16 # Add dumpling gem using the custom :gg git source shorthand
18 17 # This will fetch the gem from https://git.gyozaguy.com/GyozaGuy/dumpling.git

GyozaGuy's Avatar GyozaGuy hat die Gist bearbeitet 1752035725. Zu Änderung gehen

Keine Änderungen

GyozaGuy's Avatar GyozaGuy hat die Gist bearbeitet 1752035715. Zu Änderung gehen

1 file changed, 62 insertions

dumpling.rb(Datei erstellt)

@@ -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) {
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'
Neuer Älter