-
-
Save napcs/920968 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
# Copyright 2011 Sam Elliott | |
# Released under MIT Licence | |
app_name = File.basename(Dir.pwd) | |
git :init | |
# Remove rails.png and index.html | |
remove_file("public/index.html") | |
remove_file("public/images/rails.png") | |
create_file("public/images/.gitkeep") | |
# Remove Bullsh*t README Contents | |
remove_file("README") | |
create_file("README", <<-README) | |
#{app_name.capitalize} | |
#{"="*app_name.length} | |
TODOS: | |
------ | |
* <whatever> | |
* | |
README | |
gsub_file("config/routes.rb", %r{^\s+#(.*)$\n}, "") | |
gsub_file("config/routes.rb", %r{end$}, "\nend") | |
# Debugger | |
gem("ruby-debug19", :group => [:development, :test]) | |
# Haml | |
haml = yes?("Haml?") | |
if haml | |
gem("haml-rails") | |
end | |
# MongoDB | |
mongo = yes?("Mongo?") | |
if mongo | |
gem("mongoid") | |
gem("bson_ext") | |
generate("mongoid:config") | |
gsub_file("config/application.rb", %r{require 'rails/all'}) do | |
<<REQUIRES | |
require "action_controller/railtie" | |
require "action_mailer/railtie" | |
require "active_resource/railtie" | |
REQUIRES | |
end | |
end | |
# RSpec | |
rspec = yes?("RSpec?") | |
if rspec | |
remove_dir("test") | |
append_to_file(".gitignore", "test/\n") | |
gem("rspec-rails", :group => [:development, :test]) | |
gem("fuubar", :group => [:development, :test]) | |
generate("rspec:install") | |
append_to_file(".rspec", <<RSPEC) | |
--format Fuubar | |
RSPEC | |
# Mongoid Support | |
if mongo | |
gem("mongoid-rspec", :group => [:development, :test]) | |
empty_directory("spec/support") | |
create_file("spec/support/mongoid_support.rb", <<-MONGOID) | |
RSpec.configure do |configuration| | |
configuration.include Mongoid::Matchers | |
end | |
MONGOID | |
end | |
end | |
# Factory Girl | |
fg = yes?("Factory Girl?") | |
if fg | |
gem("factory_girl_rails", :group => [:development, :test]) | |
if rspec | |
create_file("spec/factories.rb") | |
end | |
end | |
application <<-APP | |
config.generators do |g| | |
#{"g.orm :mongoid" if mongo} | |
#{"g.template_engine :haml" if haml} | |
#{"g.test_framework :rspec, | |
:view_specs => false, | |
:helper_specs => false, | |
:routing_specs => false, | |
:integration_tool => false" if rspec} | |
g.helper false | |
g.fixture false | |
end | |
APP | |
git :add => "." | |
git :commit => "-m 'First Commit!'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment