Created
January 15, 2010 02:30
-
-
Save Florent2/277742 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# flo_template.rb | |
# inspired from http://github.com/jeremymcanally/rails-templates/blob/master/daring.rb | |
# reference for Rails template syntax: lib/rails_generator/generators/applications/app/template_runner.rb | |
# Delete unnecessary files | |
run "rm public/index.html" | |
run "rm public/favicon.ico" | |
run "rm public/robots.txt" | |
run "rm public/javascripts/*" | |
# Copy database.yml for distribution use | |
run "cp config/database.yml config/database.yml.example" | |
# Set up git repository | |
git :init | |
# Set up .gitignore files | |
file ".gitignore", <<-END | |
.DS_Store | |
log/*.log | |
tmp/**/* | |
db/*.sqlite3 | |
config/database.yml | |
END | |
plugin 'asset_packager', :git => 'git://github.com/sbecker/asset_packager.git' | |
plugin 'auto_focusable_forms', :git => "git://github.com/dcadenas/auto_focusable_forms.git" | |
gem 'haml' | |
gem 'populator', :env => [:development] | |
gem 'faker', :env => [:development] | |
gem 'nifty-generators', :lib => false, :env => [:development] | |
gem 'rspec', :lib => false, :env => [:test] | |
gem 'rspec-rails', :lib => false, :env => [:test] | |
gem 'remarkable_rails', :lib => false, :env => [:test] | |
gem 'webrat', :env => [:test] | |
gem 'machinist', :env => [:test] | |
rake "gems:install" | |
generate :nifty_layout | |
generate :rspec | |
run "spork --bootstrap" | |
file 'spec/spec_helper.rb', | |
%q{ | |
require 'rubygems' | |
require 'spork' | |
Spork.prefork do | |
# Loading more in this block will cause your tests to run faster. However, | |
# if you change any configuration or code from libraries loaded here, you'll | |
# need to restart spork for it take effect. | |
# This file is copied to ~/spec when you run 'ruby script/generate rspec' | |
# from the project root directory. | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment')) | |
require 'spec/autorun' | |
require 'spec/rails' | |
require 'remarkable_rails' | |
require File.expand_path(File.dirname(__FILE__) + "/blueprints") | |
# Requires supporting files with custom matchers and macros, etc, | |
# in ./support/ and its subdirectories. | |
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f} | |
end | |
Spork.each_run do | |
# This code will be run each time you run your specs. | |
ActiveRecord::Base.establish_connection # make sure that the db connection is ready. | |
Spec::Runner.configure do |config| | |
# If you're not using ActiveRecord you should remove these | |
# lines, delete config/database.yml and disable :active_record | |
# in your config/boot.rb | |
config.use_transactional_fixtures = true | |
config.use_instantiated_fixtures = false | |
config.fixture_path = RAILS_ROOT + '/spec/fixtures/' | |
config.before(:all) { Sham.reset(:before_all) } | |
config.before(:each) { Sham.reset(:before_each) } | |
end | |
end | |
} | |
file 'spec/blueprints.rb', | |
%q{ | |
require 'machinist/active_record' | |
require 'sham' | |
} | |
generate :cucumber | |
run "spork cuc --bootstrap" | |
file 'features/support/env.rb', | |
%q{ | |
require 'rubygems' | |
require 'spork' | |
Spork.prefork do | |
# Loading more in this block will cause your tests to run faster. However, | |
# if you change any configuration or code from libraries loaded here, you'll | |
# need to restart spork for it take effect. | |
ENV["RAILS_ENV"] ||= "cucumber" | |
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') | |
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support | |
require 'cucumber/rails/rspec' | |
require 'cucumber/rails/world' | |
require 'cucumber/rails/active_record' | |
require 'cucumber/web/tableish' | |
require 'webrat' | |
require 'webrat/core/matchers' | |
require 'cucumber/webrat/element_locator' # Deprecated in favor of #tableish - remove this line if you don't use #element_at or #table_at | |
Webrat.configure do |config| | |
config.mode = :rails | |
config.open_error_files = false # Set to true if you want error pages to pop up in the browser | |
end | |
end | |
Spork.each_run do | |
# This code will be run each time you run your specs. | |
# If you set this to false, any error raised from within your app will bubble | |
# up to your step definition and out to cucumber unless you catch it somewhere | |
# on the way. You can make Rails rescue errors and render error pages on a | |
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag. | |
# | |
# If you set this to true, Rails will rescue all errors and render error | |
# pages, more or less in the same way your application would behave in the | |
# default production environment. It's not recommended to do this for all | |
# of your scenarios, as this makes it hard to discover errors in your application. | |
ActionController::Base.allow_rescue = false | |
# If you set this to true, each scenario will run in a database transaction. | |
# You can still turn off transactions on a per-scenario basis, simply tagging | |
# a feature or scenario with the @no-txn tag. If you are using Capybara, | |
# tagging with @culerity or @javascript will also turn transactions off. | |
# | |
# If you set this to false, transactions will be off for all scenarios, | |
# regardless of whether you use @no-txn or not. | |
# | |
# Beware that turning transactions off will leave data in your database | |
# after each scenario, which can lead to hard-to-debug failures in | |
# subsequent scenarios. If you do this, we recommend you create a Before | |
# block that will explicitly put your database in a known state. | |
Cucumber::Rails::World.use_transactional_fixtures = true | |
# How to clean your database when transactions are turned off. See | |
# http://github.com/bmabey/database_cleaner for more info. | |
require 'database_cleaner' | |
DatabaseCleaner.strategy = :truncation | |
end | |
} | |
gem 'machinist', :env => [:cucumber] | |
gem 'pickle', :env => [:cucumber] | |
git :add => "." | |
git :commit => "-a -m 'initial commit'" | |
puts "new Rails app generation successful :)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment