Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
## https://techracho.bpsinc.jp/hachi8833/2017_02_16/32827
gem 'slim-rails'
gem 'seed-fu'
gem "aws-sdk-s3", require: false
gem 'image_processing'
gem 'ransack'
# gem 'bcrypt', '~> 3.1.7'
gem_group :development, :test do
gem 'rspec-rails', '~> 3.6.0'
gem 'factory_bot_rails'
gem 'faker'
gem "pry-rails"
gem 'pry-byebug'
end
gem_group :development do
gem 'guard-bundler'
gem 'guard-rails'
gem 'guard-rspec'
gem 'brakeman'
gem 'bundler-audit'
gem "better_errors"
gem "binding_of_caller"
gem 'bullet'
gem 'foreman'
gem 'html2slim'
end
gem_group :test do
gem "launchy"
end
run 'bundle install --without production'
# Setting Rspec
generate "rspec:install"
append_to_file '.rspec' do <<~TEXT
--format documentation
--warnings
TEXT
end
environment do <<~TEXT
config.generators do |g|
g.orm :active_record
g.template_engine :slim
g.assets false
g.helper false
g.test_framework :rspec,
fixtures: false,
view_specs: false,
helper_specs: false,
routing_specs: false
end
TEXT
end
run "bundle exec guard init rspec"
# Procfile (for foreman/heroku)
procfile = <<~EOL
web: bundle exec pumactl start
rails: rails s -p 3000
webpack: bin/webpack-dev-server #replace to `webpack-serve` as soon..
EOL
create_file "Procfile", procfile
if yes? 'Do you wish to generate a root controller? (y/n)'
name = ask('What do you want to call it?').to_s.underscore
generate :controller, "#{name} show", "--skip-routes", "--no-helper", "--no-assets"
route "resource :#{name}, controller: :#{name}, only: [:show]"
route "root to: '#{name}\#show'"
end
# remove commented lines and multiple blank lines from Gemfile
# thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb
gsub_file 'Gemfile', /#\s.*\n/, "\n"
gsub_file 'Gemfile', /\n^\s*\n/, "\n"
# remove commented lines and multiple blank lines from config/routes.rb
gsub_file 'config/routes.rb', / #.*\n/, "\n"
gsub_file 'config/routes.rb', /\n^\s*\n/, "\n"
run 'bundle install'
run "for i in app/views/**/*.erb; do erb2slim $i ${i%erb}slim && rm $i; done"
# remove temporary html2slim gem from Gemfile
gsub_file 'Gemfile', /.*gem 'html2slim'\n/, "\n"
## Git
git :add => '-A'
git :commit => '-qm "ruhenheim: initial commit"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.