Created
November 9, 2009 20:52
-
-
Save textgoeshere/230269 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Kapoq Rails template | |
# TODO: | |
# timeformats | |
# concerns | |
# core extensions | |
# lowpro | |
# mysql/sqlite users and db config | |
# FIXME: | |
# unpacking Blueprint | |
# gems | |
gem 'binarylogic-authlogic', :lib => 'authlogic', :source => 'http://gems.github.com' | |
gem 'mislav-will_paginate', :lib => 'will_paginate', :source => 'http://gems.github.com' | |
gem 'fastercsv' | |
gem 'haml' | |
# gems for testing environment | |
gem 'rspec', :env => :test | |
gem 'rspec-rails', :env => :test | |
gem 'webrat', :env => :test | |
gem 'cucumber', :env => :test | |
gem 'thoughtbot-factory_girl', :env => :test, :lib => 'factory_girl' | |
gem 'spork', :env => :test | |
gem 'blueridge', :env => :test | |
rake "gems:install" | |
generate :rspec | |
generate :cucumber | |
generate :spork | |
# Separate directories for mailers, observers, and sweepers | |
%w(app/mailers app/mailers/views app/observers app/sweepers).each do |dir| | |
run "mkdir #{dir}" | |
end | |
environment %q( | |
%w(observers sweepers mailers).each do |dir| | |
config.load_paths << "#{RAILS_ROOT}/app/#{dir}" | |
end | |
) | |
file("app/mailers/application_mailer.rb", %q(class ApplicationMailer < ActionMailer::Base | |
self.template_root = File.join(RAILS_ROOT, 'app', 'mailers', 'views') | |
end | |
)) | |
# 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 | |
# Configuration data initializer | |
initializer 'configurations.rb', <<END | |
%w(config).each { |c| self.class.const_set(c.upcase, YAML::load(ERB.new((IO.read(File.join(RAILS_ROOT, 'config', "\#{c}.yml")))).result)) } | |
END | |
# Layouts, CSS | |
run "wget http://github.com/joshuaclayton/blueprint-css/tarball/master | tar xvf - -C #{public/stylesheets}" | |
file 'app/views/layouts/application.haml', <<END | |
!!! Strict | |
%html{ :xmlns => "http://www.w3.org/1999/xhtml", 'xml:lang' => 'en-UK', :lang => 'en-UK' } | |
%head | |
%title YOUR APP NAME | |
%meta{'http-equiv' => 'Content-Type', :content => 'text/html;charset=utf-8'} | |
=stylesheet_link_tag 'blueprint/screen', :media => 'screen, projection' | |
=stylesheet_link_tag 'blueprint/print', :media => 'print' | |
=stylesheet_link_tag 'main', :media => 'screen, projection' | |
/[if lt IE 8] | |
=stylesheet_link_tag 'blueprint/ie', :media => 'screen, projection' | |
=javascript_include_tag :defaults | |
=render 'shared/js_config' | |
%body{:class => body_class} | |
=render 'shared/flashes' | |
#container | |
=render 'shared/header' | |
=yield | |
=render 'shared/footer' | |
=render 'shared/js_init' | |
END | |
file 'app/views/shared/_js_config', <<END | |
-content_for :js, "var authenticityToken = encodeURIComponent('#{form_authenticity_token}');\n" | |
-content_for :js, "base_url = '#{BASE_URL}';" | |
=javascript_tag(yield(:js)) | |
END | |
file 'app/views/shared/_flashes.haml', <<END | |
-flash.each_pair do |k, v| | |
=content_tag(:p, v, :class => k) | |
END | |
file 'app/views/shared/_header.haml' | |
file 'app/views/shared/_footer.haml' | |
file 'app/views/shared/_js_init', <<END | |
END | |
# DB initialization | |
# Setup seed data | |
rakefile("seed.rake") do | |
<<-TASK | |
namespace :db do | |
task :reset => ["db:drop", "db:setup"] | |
Stask :setup => ["db:create", "db:schema:load", "db:seed"] | |
task :seed do | |
seed_file = File.join(Rails.root, "db", "seeds.rb") | |
load(seed_file) if File.exist?(seed_file) | |
end | |
end | |
TASK | |
end | |
rake "db:drop db:create db:sessions:create db:migrate" | |
rake "db:drop db:create db:sessions:create db:migrate", :env => "test" | |
# Set up sessions, RSpec, user model, OpenID, etc, and run migrations | |
rake('db:sessions:create') | |
generate("authlogic", "user session") | |
# Deployment | |
capify! | |
# git | |
git :init | |
file ".gitignore", <<-END | |
.DS_Store | |
.idea/* | |
log/*.log | |
tmp/**/* | |
config/database.yml | |
db/*.sqlite3 | |
END | |
run "touch tmp/.gitignore log/.gitignore vendor/.gitignore" | |
run "cp config/database.yml config/example_database.yml" | |
# Remove unnecessary files | |
%w(README public/index.html public/favicon.ico public/robots.txt).each do |file| | |
run "rm #{file}" | |
end | |
run "rm -rf doc/" | |
run "rm -rf test/" | |
git :add => ".", :commit => "-m 'initial commit'" | |
puts "Success!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment