Skip to content

Instantly share code, notes, and snippets.

@snusnu
Created February 8, 2010 03:09
Show Gist options
  • Save snusnu/297849 to your computer and use it in GitHub Desktop.
Save snusnu/297849 to your computer and use it in GitHub Desktop.
gsub_file 'config/application.rb', /require 'rails\/all'/ do
<<-RUBY
# Pick the frameworks you want:
require 'action_controller/railtie'
require 'rails3_datamapper/railtie'
require 'action_mailer/railtie'
# require 'active_resource/railtie'
# require 'rails/test_unit/railtie'
RUBY
end
remove_file 'Gemfile'
create_file 'Gemfile' do
<<-GEMFILE
source 'http://gemcutter.org'
gem 'rails', '3.0.0.beta'
gem 'data_objects', '0.10.1'
gem 'do_sqlite3', '0.10.1'
git 'git://github.com/snusnu/dm-core.git', 'branch' => 'active_support'
git "git://github.com/snusnu/dm-more.git", 'branch' => 'active_support'
git 'git://github.com/dkubb/rails3_datamapper.git'
gem 'dm-core'
gem 'dm-types'
gem 'dm-validations'
gem 'dm-constraints'
gem 'dm-aggregates'
gem 'dm-timestamps'
gem 'dm-migrations'
gem 'dm-observer'
gem 'rails3_datamapper'
GEMFILE
end
remove_file 'config/database.yml'
create_file 'config/database.yml' do
<<-YAML
defaults: &defaults
adapter: sqlite3
development:
database: rails3_app_development.db
<<: *defaults
# Add more repositories
# repositories:
# repo1:
# adapter: postgresql
# database: sample_development
# username: the_user
# password: secrets
# host: localhost
# repo2:
# ...
test:
database: rails3_app_test.db
<<: *defaults
production:
database: rails3_app_production.db
<<: *defaults
YAML
end
# remove Prototype defaults
remove_file 'public/javascripts/controls.js'
remove_file 'public/javascripts/dragdrop.js'
remove_file 'public/javascripts/effects.js'
remove_file 'public/javascripts/prototype.js'
# add XHTML 1.0 Strict layout, with jQuery from Google
create_file 'app/views/layouts/application.html.erb' do
<<-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" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>
<%= stylesheet_link_tag 'global' %>
</head>
<body>
<%= yield %>
</body>
</html>
ERB
end
git :init
git :add => '.'
git :commit => "-a -m 'Initial commit'"
run 'bundle install vendor'
run 'vendor/bin/rake db:create'
run 'vendor/bin/rails generate scaffold Person name:string'
run 'vendor/bin/rake db:automigrate'
say ''
say '--------------------------------------------------------------------------'
say 'After the sever booted, point your browser at http://localhost:3000/people'
say '--------------------------------------------------------------------------'
say ''
run 'vendor/bin/rails server'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment