Skip to content

Instantly share code, notes, and snippets.

@aitor
Forked from molpe/tog_template.rb
Created June 10, 2009 23:45
Show Gist options
  • Save aitor/127604 to your computer and use it in GitHub Desktop.
Save aitor/127604 to your computer and use it in GitHub Desktop.
sentinel = 'Rails::Initializer.run do |config|'
gsub_file 'config/environment.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
"\nrequire 'desert'\n#{match}"
end
def gsub_file(path, regexp, *args, &block)
content = File.read(path).gsub(regexp, *args, &block)
File.open(path, 'wb') { |file| file.write(content) }
end
run "gem sources -a http://gems.github.com"
gem 'desert', :version => '0.5', :lib => 'desert'
gem 'mislav-will_paginate', :version => '~> 2.3.6', :lib => 'will_paginate', :source => 'http://gems.github.com'
gem 'tog-tog', :version => '0.5', :lib => 'tog'
gem 'mocha'
gem 'thoughtbot-factory_girl', :lib => 'factory_girl'
rake "gems:install", :sudo => true
plugin 'acts_as_commentable', :svn => "http://juixe.com/svn/acts_as_commentable"
file "db/migrate/" + Time.now.strftime("%Y%m%d%H%M%S") + "_acts_as_commentable.rb",
%q{class ActsAsCommentable < ActiveRecord::Migration
def self.up
create_table "comments", :force => true do |t|
t.column "title", :string, :limit => 50, :default => ""
t.column "comment", :text, :default => ""
t.column "created_at", :datetime, :null => false
t.column "commentable_id", :integer, :default => 0, :null => false
t.column "commentable_type", :string, :limit => 15, :default => "", :null => false
t.column "user_id", :integer, :default => 0, :null => false
end
add_index "comments", ["user_id"], :name => "fk_comments_user"
end
def self.down
drop_table :comments
end
end
}
plugin 'acts_as_state_machine', :svn => "http://elitists.textdriven.com/svn/plugins/acts_as_state_machine/trunk"
plugin 'acts_as_rateable', :git => "git://github.com/andry1/acts_as_rateable.git"
file "db/migrate/" + Time.now.strftime("%Y%m%d%H%M%S") + "_add_ratings.rb",
%q{class AddRatings < ActiveRecord::Migration
def self.up
create_table :ratings do |t|
t.column :rating, :integer # You can add a default value here if you wish
t.column :rateable_id, :integer, :null => false
t.column :rateable_type, :string, :null => false
end
add_index :ratings, [:rateable_id, :rating] # Not required, but should help more than it hurts
end
def self.down
drop_table :ratings
end
end
}
plugin 'seo_urls', :svn => "http://svn.redshiftmedia.com/svn/plugins/seo_urls"
plugin 'paperclip', :git => "git://github.com/thoughtbot/paperclip.git"
plugin 'acts_as_abusable', :git => "git://github.com/linkingpaths/acts_as_abusable.git"
generate "acts_as_abusable_migration"
plugin 'acts_as_taggable_on_steroids', :git => "git://github.com/jviney/acts_as_taggable_on_steroids.git"
generate "acts_as_taggable_migration"
plugin 'acts_as_scribe', :git => "git://github.com/linkingpaths/acts_as_scribe.git"
generate "acts_as_scribe_migration"
plugin 'viking', :git => "git://github.com/technoweenie/viking.git"
if yes?("Install tog_user?")
plugin 'tog_user', :git => "git://github.com/tog/tog_user.git"
route "map.routes_from_plugin 'tog_user'"
file "db/migrate/" + Time.now.strftime("%Y%m%d%H%M%S") + "_install_tog_user.rb",
%q{class InstallTogUser < ActiveRecord::Migration
def self.up
migrate_plugin "tog_user", 1
end
def self.down
migrate_plugin "tog_user", 0
end
end
}
if yes?("Create a default admin user?")
name = ask("username?")
pwd = ask("password?")
puts "nothing yet, sorry :("
end
end
plugin 'tog_core', :git => "git://github.com/tog/tog_core.git"
plugin 'tog_social', :git => "git://github.com/tog/tog_social.git"
plugin 'tog_mail', :git => "git://github.com/tog/tog_mail.git"
route "map.routes_from_plugin 'tog_core'"
route "map.routes_from_plugin 'tog_mail'"
route "map.routes_from_plugin 'tog_social'"
file "db/migrate/" + Time.now.strftime("%Y%m%d%H%M%S") + "_install_tog.rb",
%q{class InstallTog < ActiveRecord::Migration
def self.up
migrate_plugin "tog_core", 6
migrate_plugin "tog_social", 5
migrate_plugin "tog_mail", 2
end
def self.down
migrate_plugin "tog_mail", 0
migrate_plugin "tog_social", 0
migrate_plugin "tog_core", 0
end
end
}
run "echo \"require 'tasks/tog'\" >> Rakefile"
rake "tog:plugins:copy_resources"
rake "db:migrate"
run 'rm public/index.html'
if yes?("Run tog's tests?")
rake "db:test:prepare"
rake "tog:plugins:test"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment