3 changed files with 191 additions and 0 deletions
-
20install.sh
-
160src/local_rails.template.rb
-
11src/railsrc
@ -0,0 +1,20 @@ |
|||
#!/usr/bin/env bash |
|||
|
|||
# CONSTANTS |
|||
|
|||
BASEDIR=$(dirname "$0") |
|||
|
|||
# FUNCTIONS |
|||
|
|||
function install { |
|||
mkdir -p $HOME/.local/rails |
|||
ln -sf $(realpath $BASEDIR/src/railsrc) $HOME/.railsrc |
|||
ln -sf $(realpath $BASEDIR/src/local_rails.template.rb) $HOME/.local/rails/template.rb |
|||
|
|||
echo Rails Templating stuff installed succesfully! |
|||
} |
|||
|
|||
# MAIN |
|||
|
|||
install |
|||
|
|||
@ -0,0 +1,160 @@ |
|||
run "rm .ruby-version" |
|||
|
|||
# GEMFILE |
|||
file "Gemfile", <<-CODE |
|||
ruby '#{`ruby -v | cut -d" " -f2`.strip}' |
|||
source 'https://rubygems.org' |
|||
|
|||
gem 'bootsnap', require: false |
|||
gem 'dotenv-rails' |
|||
gem 'importmap-rails' |
|||
gem 'propshaft' |
|||
gem 'puma' |
|||
gem 'rails' |
|||
gem 'solid_cable' |
|||
gem 'solid_cache' |
|||
gem 'solid_queue' |
|||
gem 'sqlite3' |
|||
gem 'stimulus-rails' |
|||
gem 'tailwindcss-rails' |
|||
gem 'thruster', require: false |
|||
gem 'turbo-rails' |
|||
|
|||
group :development do |
|||
gem 'debug' |
|||
gem 'erb-formatter' |
|||
gem 'error_highlight' |
|||
gem 'htmlbeautifier' |
|||
gem 'rails_live_reload' |
|||
gem 'rubocop', require: false |
|||
gem 'rubocop-packaging' |
|||
gem 'rubocop-performance' |
|||
gem 'rubocop-rspec' |
|||
gem 'rubocop-shopify' |
|||
gem 'rubocop-thread_safety' |
|||
gem 'ruby-lsp-rails' |
|||
end |
|||
CODE |
|||
|
|||
# CODIUM |
|||
|
|||
inside '.vscode' do |
|||
file "extensions.json", <<-CODE |
|||
{ |
|||
"recommendations": [ |
|||
"aki77.rails-db-schema", |
|||
"aliariff.vscode-erb-beautify", |
|||
"bierner.markdown-mermaid", |
|||
"bpruitt-goddard.mermaid-markdown-syntax-highlighting", |
|||
"bradlc.vscode-tailwindcss", |
|||
"formulahendry.auto-close-tag", |
|||
"formulahendry.auto-rename-tag", |
|||
"jgclark.vscode-todo-highlight", |
|||
"redhat.vscode-yaml", |
|||
"shopify.ruby-lsp", |
|||
"waderyan.gitblame", |
|||
"yzhang.markdown-all-in-one", |
|||
"mads-hartmann.bash-ide-vscode", |
|||
"etsi0.class-collapse", |
|||
] |
|||
} |
|||
CODE |
|||
file 'settings.json', <<-CODE |
|||
{ |
|||
// -----------------256-color ANSI SUPPORT ---------------- |
|||
"terminal.integrated.shellIntegration.enabled": false, |
|||
"terminal.integrated.minimumContrastRatio": 1, |
|||
"terminal.integrated.drawBoldTextInBrightColors": false, |
|||
"workbench.colorCustomizations": { |
|||
"terminal.background": "#1f1f1f", |
|||
"terminal.ansiYellow": "#b38210" //BROWN UNIX ANSI |
|||
}, |
|||
"workbench.colorTheme": "Default Dark Modern", |
|||
// --------------------------------------------------------- |
|||
"[ruby]": { |
|||
"editor.defaultFormatter": "Shopify.ruby-lsp", // Use the Ruby LSP as the default formatter |
|||
"editor.semanticHighlighting.enabled": true, // Enable semantic highlighting |
|||
"editor.formatOnType": true // Enable formatting while typing |
|||
}, |
|||
"[erb]": { |
|||
"editor.defaultFormatter": "aliariff.vscode-erb-beautify", |
|||
}, |
|||
"debug.internalConsoleOptions": "neverOpen", |
|||
"editor.formatOnSave": true, |
|||
"editor.tabSize": 2, // Use 2 spaces for indentation |
|||
"editor.insertSpaces": true, |
|||
"emmet.includeLanguages": { |
|||
"erb": "html" |
|||
}, |
|||
"files.associations": { |
|||
"*.html.erb": "erb", |
|||
"*.tailwind.css": "tailwindcss", |
|||
}, |
|||
"tailwindCSS.emmetCompletions": true, |
|||
"todohighlight.enableDiagnostics": true, |
|||
"todohighlight.include": [ |
|||
"**/*.js", |
|||
"**/*.html", |
|||
"**/*.css", |
|||
"**/*.rb", |
|||
"**/*.txt", |
|||
"**/*.md", |
|||
"**/*.erb", |
|||
"**/*.rake" |
|||
], |
|||
"vscode-erb-beautify.keepBlankLines": 1, |
|||
"terminal.integrated.cursorBlinking": true, |
|||
"terminal.integrated.localEchoEnabled": "off", |
|||
"terminal.integrated.fontLigatures.enabled": true, |
|||
"class-collapse.languages.supportedLanguages": [ |
|||
"erb", |
|||
"html", |
|||
"javascript", |
|||
"markdown", |
|||
], |
|||
"class-collapse.style.openCollapseOpacity": 0.7, |
|||
"class-collapse.style.placeholderTextColor": "#FFFF0055", |
|||
"class-collapse.style.placeholderText": "≈", |
|||
} |
|||
CODE |
|||
|
|||
end |
|||
|
|||
# RUBOCOP |
|||
file ".rubocop.yml", <<-CODE |
|||
AllCops: |
|||
TargetRubyVersion: #{`ruby -v | cut -d" " -f2 | grep -oE "[0-9]+\.[0-9]+"`.strip} |
|||
NewCops: enable |
|||
Exclude: |
|||
- "db/schema.rb" |
|||
|
|||
Style/FrozenStringLiteralComment: |
|||
Enabled: false |
|||
|
|||
Style/Documentation: |
|||
Enabled: false |
|||
CODE |
|||
|
|||
|
|||
after_bundle do |
|||
|
|||
generate(:controller, "#{@app_name} index") |
|||
route "root to: '#{@app_name}#index'" |
|||
|
|||
# bin/dev |
|||
file "bin/dev", <<-CODE |
|||
#!/usr/bin/env bash |
|||
|
|||
# launch rails with puma plugin tailwindcss with no 'Done in ms' messages! |
|||
rails server 2>&1 | grep -vE '(^Done in |^sh: 1: watchman)' |
|||
CODE |
|||
run "rm Procfile.dev" |
|||
run "grep -q 'plugin :tailwindcss' config/puma.rb || sed -i -E 's/(plugin :tmp_restart)/\\1\\n\\n# Run the Tailwindcss watcher alongside Puma\\nplugin :tailwindcss if ENV.fetch(\"RAILS_ENV\", \"development\") == \"development\"/' config/puma.rb" |
|||
|
|||
initialized_git=system('test -f ~/.gitconfig && grep email ~/.gitconfig && grep name ~/.gitconfig') |
|||
if initialized_git |
|||
git :init |
|||
git add: "." |
|||
git commit: %Q{ -m 'initial commit' } |
|||
end |
|||
end |
|||
@ -0,0 +1,11 @@ |
|||
--force |
|||
--css=tailwind |
|||
|
|||
--skip-ci |
|||
--skip-docker |
|||
--skip-kamal |
|||
--skip-jbuilder |
|||
--skip-brakeman |
|||
--skip-system-test |
|||
|
|||
--template=~/.local/rails/template.rb |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue