Skip to content

Instantly share code, notes, and snippets.

@jomz
Created March 26, 2009 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jomz/86081 to your computer and use it in GitHub Desktop.
Save jomz/86081 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
module Helpers
LINE = 80
def announcing(msg)
print msg
yield
print "." * (LINE - msg.size - 6)
puts "\e[32m[DONE]\e[0m"
end
def silent(command)
system "#{command} &> /dev/null"
end
def svn(command, *args)
silent "svn #{command} #{args.join(' ')}"
end
def git(command, *args)
silent "git #{command} #{args.join(' ')}"
end
def piston(repo)
silent "piston import #{repo}"
end
def rake(task, args={})
args = args.map {|name,value| "#{name.to_s.upcase}=#{value}"}.join(" ")
silent "rake #{task} #{args}"
end
def ray(task, args={})
args = args.map {|name,value| "#{name.to_s.upcase}=#{value}"}.join(" ")
system "rake ray:#{task} #{args}"
end
end
if __FILE__ == $0
include Helpers
app_name = ARGV.first || exit(1)
# Used for the Capfile.
admin_password = 'default_admin_pw'
db_template = 'roasters.yml'
repositories_root = 'kaizer@zuurstof.openminds.be:git'
repositories_password = 'your_scm_password'
app_server = ARGV[1] || 'pro-004.openminds.be'
db_host = 'kwik.openminds.be'
announcing "Creating new Radiant instance and initializing git repository" do
silent "radiant #{app_name}"
Dir.chdir(app_name)
git "init"
end
announcing "setting up development and test db" do
silent "mysqladmin -u root create #{app_name}_development"
silent "mysqladmin -u root create #{app_name}_test"
silent "rake ADMIN_NAME='Administrator' ADMIN_USERNAME='admin' ADMIN_PASSWORD='#{admin_password}' DATABASE_TEMPLATE=#{db_template} OVERWRITE=true db:bootstrap"
end
announcing "Installing plugins" do
git "submodule add git://github.com/technoweenie/attachment_fu.git vendor/plugins/attachment_fu" # requirement for gallery extension
end
announcing "Installing ray extension" do
git "submodule add git://github.com/johnmuhl/radiant-ray-extension.git vendor/extensions/ray"
git "submodule init"
git "submodule update"
silent "rake ray:setup:download"
silent "rake ray:setup:restart server=passenger"
end
announcing "Installing default extensions" do
bundle = %Q{---
- name: aggregation
- name: radiant-comments
hub: jomz
fullname: radiant-comments
- name: copy-move
hub: jomz
- name: enkodertags
hub: santry
- name: first-reorder
- name: gallery
hub: jomz
fullname: radiant-gallery
- name: gorillafy
hub: jomz
- name: gorilla-blog
- name: index-page
- name: mailer
hub: jomz
- name: navigation_tags
hub: jomz
- name: nested-layouts
- name: paperclipped
hub: jomz
- name: predefined-parts
hub: DefV
- name: search
- name: settings
hub: jomz
fullname: radiant-settings-extension
- name: share-layouts
hub: jomz
- name: tags
- name: trike-tags
- name: wym-editor-filter
}
system "touch config/extensions.yml"
system "echo \"#{bundle}\" > config/extensions.yml"
ray "extension:bundle"
end
announcing "Tweaking mailer ext." do
silent "cd vendor/extensions/mailer"
silent "git pull origin clientside-validation"
silent "git pull origin with_mailbuild_signups"
silent "cd ../../.."
silent "rake radiant:extensions:mailer:update"
end
announcing "capify'ing" do
system "touch Capfile"
capfile = %Q{load "deploy" if respond_to?(:namespace) # cap2 differentiator
set :application, "default"
set :user, "#{app_name}"
set :password, "updateme"
set :repository, "#{repositories_root}/\#{user}.git"
set :scm_password, "#{repositories_password}"
server "#{app_server}", :app, :web, :db, :primary => true
set :database_yml, %Q{# By capistrano
production:
adapter: mysql
database: #{app_name}
username: #{app_name}
password: updateme
host: #{db_host}
}
require "gorilla-capistrano-recipes/deploy"
require "gorilla-capistrano-recipes/mysql"
require "gorilla-capistrano-recipes/passenger"
require "gorilla-capistrano-recipes/radiant"
}
system "echo '#{capfile}' > Capfile"
end
announcing "setting ignore rules" do
system "touch .gitignore"
ignores = %Q{.DS_Store
log/*.log
db/schema.rb
db/*.sqlite3
config/database.yml
cache
tmp
}
system "echo \"#{ignores}\" > .gitignore"
end
announcing "committing kickstart" do
git "add ."
git "commit -m 'kickstarted'"
end
end
#!/usr/bin/ruby
module Helpers
LINE = 80
def announcing(msg)
print msg
yield
print "." * (LINE - msg.size - 6)
puts "\e[32m[DONE]\e[0m"
end
def silent(command)
system "#{command} &> /dev/null"
end
def svn(command, *args)
silent "svn #{command} #{args.join(' ')}"
end
def git(command, *args)
silent "git #{command} #{args.join(' ')}"
end
def piston(repo)
silent "piston import #{repo}"
end
def rake(task, args={})
args = args.map {|name,value| "#{name.to_s.upcase}=#{value}"}.join(" ")
silent "rake #{task} #{args}"
end
def ray(task, args={})
args = args.map {|name,value| "#{name.to_s.upcase}=#{value}"}.join(" ")
system "rake ray:#{task} #{args}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment