Skip to content

Instantly share code, notes, and snippets.

@salicio
Created August 27, 2008 16:08
Show Gist options
  • Save salicio/7519 to your computer and use it in GitHub Desktop.
Save salicio/7519 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
G="\033[1;32m"
R="\033[1;31m"
B="\033[1;34m"
N="\033[0m"
if [ $# -ne 1 ]
then
echo "Usage: `basename $0` app_name"
exit 65
fi
exec(){
printf "$G$1$N\n"
$1
if [ $? -ne 0 ]
then
printf "$R>>> ERROR <<<$N\n"
exit 1
fi
}
section(){
printf "\n\n$B>>>>> $1 $N \n\n"
}
section "CREATE RAILS APP"
exec "rm -fr $1"
exec "rails -q $1"
exec "rm $1/public/index.html"
exec "cd $1"
section "INSTALL TOG"
exec "script/plugin install git://github.com/thoughtbot/shoulda.git" # for test
exec "script/plugin install http://juixe.com/svn/acts_as_commentable"
MIGRATION_FILE=`script/generate migration create_comments | grep "create db/migrate/" | sed -e 's/[ ]*create[ ]*//'`
MIGRATION='class CreateComments < 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'
echo "$MIGRATION" > $MIGRATION_FILE
exec "script/plugin install http://elitists.textdriven.com/svn/plugins/acts_as_state_machine/trunk"
#exec "script/plugin install http://svn.redshiftmedia.com/svn/plugins/seo_urls"
exec "cp -R /Users/roberto/softwork/larnaby.svn/instamat/trunk/vendor/plugins/seo_urls vendor/plugins"
exec "script/plugin install http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids"
exec "script/generate acts_as_taggable_migration"
exec "script/plugin install http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk"
exec "script/plugin install git://github.com/linkingpaths/acts_as_scribe.git"
exec "script/generate acts_as_scribe_migration"
exec "script/plugin install git://github.com/linkingpaths/acts_as_abusable.git"
exec "script/generate acts_as_abusable_migration"
exec "togify . --development"
exec "rake db:migrate"
section "INSTALL VAULT"
exec "script/plugin install git://github.com/salicio/fckeditor.git"
exec "script/plugin install acts_as_tree"
exec "git clone [email protected]:tog/tog_vault.git vendor/plugins/tog_vault"
#exec "script/plugin install [email protected]:tog/tog_vault.git"
MIGRATION_FILE=`script/generate migration integrate_vault | grep "create db/migrate/" | sed -e 's/[ ]*create[ ]*//'`
MIGRATION='class IntegrateVault < ActiveRecord::Migration
def self.up
migrate_plugin "tog_vault", 3
end
def self.down
migrate_plugin "tog_vault", 0
end
end'
echo "$MIGRATION" > $MIGRATION_FILE
exec "rake db:migrate"
printf "$G"
printf "cat config/routes.rb | awk '{ gsub(/# The priority/, \"map.routes_from_plugin \x27tog_vault\x27\ n # The priority\",$ 0); print }'$N\n"
ROUTES=`cat config/routes.rb | awk '{ gsub(/# The priority/, "map.routes_from_plugin \x27tog_vault\x27\n # The priority",$0); print }'`
echo "$ROUTES" > config/routes.rb
section "INSTALL CONVERSATIO"
exec "git clone [email protected]:tog/tog_conversatio.git vendor/plugins/tog_conversatio"
#exec "script/plugin install [email protected]:tog/tog_conversatio.git"
MIGRATION_FILE=`script/generate migration integrate_conversatio | grep "create db/migrate/" | sed -e 's/[ ]*create[ ]*//'`
MIGRATION='class IntegrateConversatio < ActiveRecord::Migration
def self.up
migrate_plugin "tog_conversatio", 4
end
def self.down
migrate_plugin "tog_conversatio", 0
end
end'
echo "$MIGRATION" > $MIGRATION_FILE
exec "rake db:migrate"
printf "$G"
printf "cat config/routes.rb | awk '{ gsub(/# The priority/, \"map.routes_from_plugin \x27tog_conversatio\x27\ n # The priority\",$ 0); print }'$N\n"
ROUTES=`cat config/routes.rb | awk '{ gsub(/# The priority/, "map.routes_from_plugin \x27tog_conversatio\x27\n # The priority",$0); print }'`
echo "$ROUTES" > config/routes.rb
section "INSTALL PICTO"
exec "script/plugin install git://github.com/rails/acts_as_list.git"
exec "script/plugin install git://github.com/andry1/acts_as_rateable.git"
MIGRATION_FILE=`script/generate migration add_ratings | grep "create db/migrate/" | sed -e 's/[ ]*create[ ]*//'`
MIGRATION='class AddRatings < ActiveRecord::Migration
def self.up
create_table :ratings do |t|
t.column :rating, :integer
t.column :rateable_id, :integer, :null => false
t.column :rateable_type, :string, :null => false
end
add_index :ratings, [:rateable_id, :rating]
end
def self.down
drop_table :ratings
end
end'
echo "$MIGRATION" > $MIGRATION_FILE
exec "rake db:migrate"
exec "git clone [email protected]:tog/tog_picto.git vendor/plugins/tog_picto"
#exec "script/plugin install [email protected]:tog/tog_picto.git"
MIGRATION_FILE=`script/generate migration integrate_picto | grep "create db/migrate/" | sed -e 's/[ ]*create[ ]*//'`
MIGRATION='class IntegratePicto < ActiveRecord::Migration
def self.up
migrate_plugin "tog_picto", 6
end
def self.down
migrate_plugin "tog_picto", 0
end
end'
echo "$MIGRATION" > $MIGRATION_FILE
exec "rake db:migrate"
printf "$G"
printf "cat config/routes.rb | awk '{ gsub(/# The priority/, \"map.routes_from_plugin \x27tog_picto\x27\ n # The priority\",$ 0); print }'$N\n"
ROUTES=`cat config/routes.rb | awk '{ gsub(/# The priority/, "map.routes_from_plugin \x27tog_picto\x27\n # The priority",$0); print }'`
echo "$ROUTES" > config/routes.rb
#section "INSTALL TAXONOMY"
#exec "script/plugin install git://github.com/funkensturm/acts_as_category.git"
#exec "script/plugin install git://github.com/pyrat/wee_lightbox.git"
#
#exec "git clone [email protected]:tog/tog_taxonomy.git vendor/plugins/tog_taxonomy"
##exec "script/plugin install [email protected]:tog/tog_taxonomy.git"
#MIGRATION_FILE=`script/generate migration integrate_taxonomy | grep "create db/migrate/" | sed -e 's/[ ]*create[ ]*//'`
#MIGRATION='class IntegrateTaxonomy < ActiveRecord::Migration
# def self.up
# migrate_plugin "tog_taxonomy", 1
# end
# def self.down
# migrate_plugin "tog_taxonomy", 0
# end
#end'
#echo "$MIGRATION" > $MIGRATION_FILE
#exec "rake db:migrate"
#
#printf "$G"
#printf "cat config/routes.rb | awk '{ gsub(/# The priority/, \"map.routes_from_plugin \x27tog_taxonomy\x27\ n # The priority\",$ 0); print }'$N\n"
#ROUTES=`cat config/routes.rb | awk '{ gsub(/# The priority/, "map.routes_from_plugin \x27tog_taxonomy\x27\n # The priority",$0); print }'`
#echo "$ROUTES" > config/routes.rb
#section "INSTALL BOOKMARKS"
#exec "git clone [email protected]:tog/tog_bookmarks.git vendor/plugins/tog_bookmarks"
##exec "script/plugin install [email protected]:tog/tog_bookmarks.git"
#MIGRATION_FILE=`script/generate migration integrate_bookmarks | grep "create db/migrate/" | sed -e 's/[ ]*create[ ]*//'`
#MIGRATION='class IntegrateBookmarks < ActiveRecord::Migration
# def self.up
# migrate_plugin "tog_bookmarks", 1
# end
# def self.down
# migrate_plugin "tog_bookmarks", 0
# end
#end'
#echo "$MIGRATION" > $MIGRATION_FILE
#exec "rake db:migrate"
#
#printf "$G"
#printf "cat config/routes.rb | awk '{ gsub(/# The priority/, \"map.routes_from_plugin \x27tog_bookmarks\x27\ n # The priority\",$ 0); print }'$N\n"
#ROUTES=`cat config/routes.rb | awk '{ gsub(/# The priority/, "map.routes_from_plugin \x27tog_bookmarks\x27\n # The priority",$0); print }'`
#echo "$ROUTES" > config/routes.rb
section "COPY RESOURCES"
exec "rake tog:plugins:copy_resources"
section "FAKE COMMUNITY"
exec "script/runner ../fake_community.rb"
section "START SERVER"
exec "script/server"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment