Skip to content

Instantly share code, notes, and snippets.

@lguardiola
Created February 22, 2011 20:39
Show Gist options
  • Save lguardiola/839342 to your computer and use it in GitHub Desktop.
Save lguardiola/839342 to your computer and use it in GitHub Desktop.
rails 3 template for jquery replacement
# Here is where we reap the benefits of the modularity in Rails 3.
# What this says is that we want to use RSpec as the test framework and we want to generate fixtures
# with our generated specs, but we don't want to generate view specs and
# that instead of fixtures, we actually want to use factory girl and
# we want the factories to be put into spec/factories. Whew! So does this all work?
config.generators do |generator|
generator.test_framework :rspec, :fixture => true, :views => true
generator.fixture_replacement :factory_girl, :dir => "spec/factories"
end
# devise
apply 'https://gist.github.com/raw/839342/devise.rb'
if yes?('Would you like to use Cucumber for BDD?')
gem 'cucumber-rails', :group => [:development, :test]
gem 'capybara', :group => [:development, :test]
generate('cucumber:install')
# TODO: write generator
end
if yes?('Would you like to install Devise?')
gem('devise')
begin
model_name = ask('What would you like the auth model to be called? [user]')
model_name = 'user' if model_name.blank?
generate('devise:install')
generate('devise', model_name)
end until no?('Would you like add another auth model to authenticate?')
end
if yes?('Would you like to install Geolocalization gems?')
gem 'geokit-rails3'
# TODO: write config
end
gem 'haml'
gem 'haml-rails'
gem 'hpricot', :group => [:development, :test]
gem 'ruby_parser', :group => [:development, :test]
if yes?('Would you like to use JQuery instead Prototype?')
gem 'jquery-rails'
jquery_options = '--version=1'
jquery_options << ' --ui' unless no?('Would you like to use JQuery UI for interface?')
generate('jquery:install', options)
end
gem 'rspec', :group => [:development, :test]
gem 'rspec-rails', :group => [:development, :test]
gem 'factory_girl_rails', :group => [:development, :test]
# replace config defaults
get 'https://gist.github.com/raw/839342/application_4_rspec.rb' do |content|
application(content)
# TODO: write factory template generator
end
# autotest
if yes?('Would you like to use autotest?')
gem 'autotest-rails', :group => [:development, :test]
gem 'autotest-growl', :group => [:development, :test]
gem 'autotest-notification', :group => [:development, :test]
end
if yes?('Would you like to manage forms with simple_form?')
gem 'simple_form'
generate('simple_form:install')
end
# cucumber
apply 'https://gist.github.com/raw/839342/cucumber.rb'
# rspec
apply 'https://gist.github.com/raw/839342/rspec.rb'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment