Guest User

Untitled

a guest
Oct 31st, 2018
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. generators = []
  2. puts 'Spinning up a new app, captain!'
  3.  
  4. run 'rm public/index.html'
  5. run 'rm public/images/rails.png'
  6. run 'rm README'
  7. run 'touch README'
  8.  
  9. gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'
  10. gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'
  11.  
  12. gem 'mongoid'
  13. gem 'devise'
  14. gem_group :development, :test do
  15. gem 'simplecov'
  16. gem 'guard-rspec'
  17. end
  18.  
  19. gem_group :test do
  20. gem 'rspec'
  21. gem 'rspec-rails'
  22. gem 'cucumber'
  23. gem 'capybara'
  24. gem 'launchy'
  25. gem 'cucumber-rails'
  26. gem 'factory_girl_rails'
  27. gem 'forgery'
  28. gem "database_cleaner"
  29. gem "mongoid-rspec"
  30. gem "email_spec"
  31. gem "launchy"
  32. gem "shoulda"
  33. gem "poltergeist"
  34.  
  35. end
  36.  
  37. gem_group :development do
  38. gem 'sextant'
  39. gem 'pry-rails'
  40. gem 'thin'
  41. gem 'quiet_assets'
  42. end
  43.  
  44. gem 'figaro'
  45.  
  46. run 'bundle install'
  47.  
  48. run 'rails generate mongoid:config'
  49.  
  50.  
  51. run 'rails g rspec:install'
  52. generators << "g.test_framework :rspec"
  53.  
  54. run 'rails g cucumber:install'
  55. # generators << "g.integration_tool :cucumber"
  56.  
  57. run 'rails g figaro:install'
  58.  
  59.  
  60. # if devise
  61. run 'rails generate devise:install'
  62. gsub_file 'config/environments/development.rb', /# Don't care if the mailer can't send/, '### ActionMailer Config'
  63. gsub_file 'config/environments/development.rb', /config.action_mailer.raise_delivery_errors = false/ do
  64. <<-RUBY
  65. config.action_mailer.default_url_options = { :host => 'localhost:3000' }
  66. # A dummy setup for development - no deliveries, but logged
  67. config.action_mailer.delivery_method = :smtp
  68. config.action_mailer.perform_deliveries = false
  69. config.action_mailer.raise_delivery_errors = true
  70. config.action_mailer.default :charset => "utf-8"
  71. RUBY
  72. end
  73. gsub_file 'config/environments/production.rb', /config.i18n.fallbacks = true/ do
  74. <<-RUBY
  75. config.i18n.fallbacks = true
  76.  
  77. config.action_mailer.default_url_options = { :host => 'yourhost.com' }
  78. ### ActionMailer Config
  79. # Setup for production - deliveries, no errors raised
  80. config.action_mailer.delivery_method = :smtp
  81. config.action_mailer.perform_deliveries = true
  82. config.action_mailer.raise_delivery_errors = false
  83. config.action_mailer.default :charset => "utf-8"
  84. RUBY
  85. end
  86.  
  87. run 'rails generate devise User'
  88. # run 'rails generate migration add_name_to_user name:string'
  89.  
  90. gsub_file 'app/models/user.rb', /attr_accessible :email, :password, :password_confirmation, :remember_me/ do
  91. <<-RUBY
  92. field :name
  93. validates_uniqueness_of :email, :case_sensitive => false
  94. attr_accessible :name, :email, :password, :password_confirmation, :remember_me
  95. RUBY
  96. end
  97.  
  98. append_file 'db/seeds.rb' do <<-FILE
  99. puts 'SETTING UP DEFAULT USER LOGIN'
  100. user = User.create! :name => "New User", :email => 'user@test.com', :password => 'passwordplease', :password_confirmation => 'passwordplease'
  101. puts 'New user created: ' << user.name
  102. FILE
  103. end
  104.  
  105. # run 'rake db:migrate'
  106. run 'rake db:test:prepare'
  107. run 'rake db:seed'
  108. # end
  109.  
  110.  
  111. # Configuration
  112. generators = <<-GENERATORS
  113. config.generators do |g|
  114. g.stylesheets false
  115. #{generators.join("\n\t\t\t")}
  116. end
  117. GENERATORS
  118. application generators
  119.  
  120.  
  121. generate(:controller, "home index")
  122. gsub_file 'config/routes.rb', /get \"home\/index\"/, 'root :to => "home#index"'
  123.  
  124. git :init
  125. git :add => '.'
  126. git :commit => "-m 'Initial commit'"
  127.  
  128. # if devise
  129. puts "Note: Devise is currently using a user's email as an identifier. You may want to change this."
  130. puts "The seed user is email 'user@test.com' pass 'passwordplease'."
Add Comment
Please, Sign In to add comment