Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module ::Rails
- class TemplateRunner
- def run_with_windows(command, log_action = true)
- command = command.sub(/^(?:sudo\s+)?(rake|capify)\b/, '\1.bat')
- run_without_windows(command, log_action)
- end
- alias_method_chain :run, :windows if RUBY_PLATFORM =~ /mswin32/
- end
- end
- git :init
- plugin 'exception_notifier', :git => 'git://github.com/rails/exception_notification.git', :submodule => true
- plugin 'will_paginate', :git => 'git://github.com/mislav/will_paginate.git', :submodule => true
- plugin 'asset_packager', :git => 'git://github.com/sbecker/asset_packager.git', :submodule => true
- plugin 'aasm', :git => 'git://github.com/rubyist/aasm.git', :submodule => true
- plugin 'acts_as_list', :git => 'git://github.com/rails/acts_as_list.git', :submodule => true
- plugin 'awesome_nested_set', :git => 'git://github.com/collectiveidea/awesome_nested_set.git', :submodule => true
- plugin 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git', :submodule => true
- plugin 'shoulda', :git => 'git://github.com/thoughtbot/shoulda.git', :submodule => true
- plugin 'mocha', :git => 'git://github.com/floehopper/mocha.git', :submodule => true
- plugin 'authlogic', :git => 'git://github.com/binarylogic/authlogic.git', :submodule => true
- plugin 'searchlogic', :git => 'git://github.com/binarylogic/searchlogic.git', :submodule => true
- run 'cp config/database.yml config/database.example.yml'
- run 'rm public/index.html'
- run 'rm public/favicon.ico'
- run 'rm public/robots.txt'
- run 'rm public/images/rails.png'
- rake 'asset:packager:create_yml'
- generate 'session', 'UserSession'
- generate 'controller', 'index index'
- generate 'controller', 'admin/index index'
- route <<-END
- map.root :controller => 'index'
- map.namespace :admin do |admin|
- admin.root :controller => 'index'
- end
- END
- capify!
- file '.gitignore', <<-END
- log/*.log
- db/*.db
- db/*.sqlite3
- tmp/**/*
- doc/api
- doc/app
- config/database.yml
- nbproject
- END
- file 'public/.htaccess', <<-END
- <IfModule mod_deflate.c>
- SetOutputFilter DEFLATE
- <IfModule mod_headers.c>
- Header append Vary User-Agent
- </IfModule>
- </IfModule>
- <IfModule mod_expires.c>
- ExpiresActive On
- ExpiresDefault A9030400
- </IfModule>
- <IfModule !mod_expires.c>
- <IfModule mod_headers.c>
- Header set Cache-Control "max-age=29030400, public"
- </IfModule>
- </IfModule>
- END
- file 'config/deploy.rb', <<-END
- set :application, 'helloworld'
- set :domain, 'helloworld.com'
- set :user, 'deploy'
- set :admin_runner, 'deploy'
- set :runner, 'root'
- set :use_sudo, true
- default_run_options[:pty] = true
- role :app, domain
- role :web, domain
- role :db, domain, :primary => true
- set :scm, :git
- set :repository, "git@\#{domain}:\#{application}.git"
- set :branch, 'master'
- set :deploy_to, "/home/\#{user}/sites/\#{domain}"
- set :deploy_via, :remote_cache
- set :git_shallow_clone, 1
- set :git_enable_submodules, 1
- set :db_name, proc{Capistrano::CLI.password_prompt('Database name:' )}
- set :db_user, proc{Capistrano::CLI.password_prompt('Database user:' )}
- set :db_password, proc{Capistrano::CLI.password_prompt('Database password:' )}
- namespace :deploy do
- desc 'Restart'
- task :restart, :roles => :app do
- run "touch \#{current_path}/tmp/restart.txt"
- end
- desc 'Create database.yml in shared/config'
- task :after_setup do
- require 'erb'
- db_config = ERB.new <<-EOF
- production:
- adapter: mysql
- encoding: utf8
- reconnect: false
- database: <%= db_name %>
- pool: 5
- username: <%= db_user %>
- password: <%= db_password %>
- socket: /var/run/mysqld/mysqld.sock
- EOF
- run "mkdir -p \#{shared_path}/config"
- put db_config.result(binding), "\#{shared_path}/config/database.yml"
- end
- desc "Make configuration symlinks"
- task :after_update_code do
- run "ln -nfs \#{deploy_to}/\#{shared_dir}/config/database.yml \#{release_path}/config/database.yml"
- end
- end
- END
- git :submodule => "init"
- git :add => '.'
- git :commit => '-a -m "Initial commit"'
Add Comment
Please, Sign In to add comment