# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Version by Jastix
# Link to local copy of edge rails
#inside('vendor') { run 'ln -s ~/projects/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm public/robots.txt"
run "rm -f public/javascripts/*"
# Download JQuery
run "curl -L http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js > public/javascripts/jquery.js"
run "curl -L http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js > public/javascripts/jquery.form.js"
# Set up git repository
git :init
git :add => '.'
# Rails as submodule
#run "git submodule add git://github.com/rails/rails.git vendor/rails"
# Copy database.yml for distribution use
#run "cp config/database.yml config/database.yml.example"
# Set up .gitignore files
run "touch tmp/.gitignore log/.gitignore vendor/.gitignore"
run %{find . -type d -empty | grep -v "vendor" | grep -v ".git" | grep -v "tmp" | xargs -I xxx touch xxx/.gitignore}
file '.gitignore', <<-END
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
public/system/**/*
END
file 'config/environment.rb',
%q{# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
# RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )
# Specify gems that this application depends on and have them installed with rake gems:install
# config.gem "bj"
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
# config.gem "sqlite3-ruby", :lib => "sqlite3"
# config.gem "aws-s3", :lib => "aws/s3"
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Skip frameworks you're not going to use. To use Rails without a database,
# you must remove the Active Record framework.
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names.
config.time_zone = 'UTC'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
# config.i18n.default_locale = :de
end
}
# Install submoduled plugins
#plugin 'cucumber', :git => 'git://github.com/aslakhellesoy/cucumber.git', :submodule => true
#plugin 'jrails', :git => 'git://github.com/kpitn/jrails.git', :submodule => true
plugin 'asset_packager', :git => 'git://github.com/sbecker/asset_packager.git', :submodule => true
plugin 'thinking_sphinx', :git => 'git://github.com/freelancing-god/thinking-sphinx.git', :submodule => true
plugin 'acl9', :git => 'git://github.com/be9/acl9.git', :submodule => true
#plugin 'acts_as_taggable_redux', :git => 'git://github.com/monki/acts_as_taggable_redux.git', :submodule => true
# Install all gems
gem 'thoughtbot-factory_girl', :lib => 'factory_girl', :source => 'http://gems.github.com'
gem 'thoughtbot-clearance', :lib => 'clearance', :source => 'http://gems.github.com'
gem 'thoughtbot-paperclip', :lib => 'paperclip', :source => 'http://gems.github.com'
gem 'thoughtbot-shoulda', :lib => 'shoulda', :source => 'http://gems.github.com' # install separately
gem 'why-hpricot', :lib => 'hpricot', :source => 'http://gems.github.com'
gem 'mislav-will_paginate', :lib => 'will_paginate', :source => 'http://gems.github.com'
#gem 'jastix-scribd_fu', :lib => 'scribd_fu', :source => 'http://gems.github.com'
gem 'mdarby-scribd_fu', :lib => 'scribd_fu', :source => 'http://gems.github.com'
gem 'aslakhellesoy-cucumber', :lib => 'cucumber', :source => 'http://gems.github.com'
rake('gems:install', :sudo => true)
rake('gems:unpack:dependencies')
# Set up sessions
#rake('db:sessions:create')
#generate("authenticated", "user session")
#generate("roles", "Role User")
#generate("rspec")
#rake('acts_as_taggable:db:create')
#rake('db:migrate')
# Set up session store initializer
initializer 'session_store.rb', <<-END
ActionController::Base.session = { :session_key => '_#{(1..6).map { |x| (65 + rand(26)).chr }.join}_session', :secret => '#{(1..40).map { |x| (65 + rand(26)).chr }.join}' }
ActionController::Base.session_store = :active_record_store
END
run "sudo gem install capistrano"
capify!
file 'Capfile', <<-FILE
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
FILE
# Initialize submodules
git :submodule => "init"
# Commit all work so far to the repository
git :add => '.'
git :commit => "-a -m 'Initial commit'"
# Success!
puts "SUCCESS!"