Skip to content

Instantly share code, notes, and snippets.

@kbuckler
Forked from bscofield/gist:181842
Created January 18, 2010 05:03
Show Gist options
  • Select an option

  • Save kbuckler/279795 to your computer and use it in GitHub Desktop.

Select an option

Save kbuckler/279795 to your computer and use it in GitHub Desktop.
# mongo_template.rb
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
# add basic layout to start
file 'app/views/layouts/application.html.erb', <<-ERB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Application!</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :all %>
<%= yield :head %>
</head>
<body>
<%= yield %>
</body>
</html>
ERB
# MongoDB FTW!
db_name = ask('What should I call the database? ')
initializer 'database.rb', <<-CODE
MongoMapper.database = "#{db_name}-\#{Rails.env}"
CODE
file 'config/database.yml', <<-CODE
# Using MongoDB
CODE
environment 'config.frameworks -= [:active_record]'
gem 'mongo_mapper'
# Testing
gem 'mocha'
gem 'thoughtbot-shoulda', :lib => 'shoulda/rails', :source => 'http://gems.github.com'
# Gem management
rake 'gems:unpack'
rake 'rails:freeze:gems'
# source control
file '.gitignore', <<-FILES
.DS_Store
**/.DS_Store
log/*
tmp/*
tmp/**/*
config/database.yml
coverage/*
coverage/**/*
FILES
git :init
git :add => '.'
git :commit => '-a -m "Initial commit"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment