Created
May 2, 2009 21:54
-
-
Save thisivan/105723 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
# = Base Template | |
# Base application template for Innetra | |
# == Requirements | |
# Requires innetra-easy_generators (http://github.com/innetra/easy_generators/tree/master) and | |
# gem to work | |
root_controller_name = 'home' | |
if yes?('Install haml and innetra-easy_generators gems (both required)?') | |
run 'gem sources -a http://gems.github.com' | |
run 'sudo gem install innetra-easy_generators' | |
run 'sudo gem install haml --no-ri' | |
end | |
# Install common used plugins | |
gem "innetra-easy_navigation", :lib => "easy_navigation", :source => "http://gems.github.com" | |
gem "mislav-will_paginate", :lib => "will_paginate", :source => "http://gems.github.com" | |
gem "innetra-flow_pagination", :lib => "flow_pagination", :source => "http://gems.github.com" | |
# Install Haml plugin | |
run "haml --rails ." | |
# Install testing gems | |
gem "rspec", :lib => false, :env => :test | |
gem "rspec-rails", :lib => false, :env => :test | |
gem "webrat", :lib => false, :env => :test | |
gem "cucumber", :lib => false, :env => :test | |
# Install New Relic's RPM on test, staging and production environments | |
gem "newrelic_rpm", :env => :test | |
gem "newrelic_rpm", :env => :staging | |
gem "newrelic_rpm", :env => :production | |
rake "gems:install" | |
# Home page | |
run "rm public/index.html" | |
generate :controller, "#{root_controller_name.capitalize} index" | |
route "map.root :controller => '#{root_controller_name}'" | |
# Replace basic root index view | |
run "rm app/views/#{root_controller_name}/index.html.erb" | |
file "app/views/#{root_controller_name}/index.html.haml", <<-EOF | |
- title 'Welcome' | |
#sidebar | |
- shadowbox "sample_sidebar_section", :class => "sidebar_section" do | |
This is a sample sidebar section | |
#page.sidebar | |
- shadowbox 'page_content' do | |
= user_feedback | |
%p This is your (root) welcome page | |
EOF | |
# Easy Layout | |
generate :easy_layout | |
# Easy Navigation | |
generate :easy_navigation | |
# Install EasyContacts | |
plugin "easy_contacts", :git => "git://github.com/innetra/easy_contacts.git" | |
generate :easy_contacts | |
rake "db:migrate" | |
rake "easy_contacts:init" | |
# Install EasyAuthentication | |
plugin "easy_authentication", :git => "git://github.com/innetra/easy_authentication.git" | |
generate :easy_authentication | |
rake "db:migrate" | |
rake "easy_authentication:init" | |
# Remove Prototype.js and install jQuery | |
run 'rm public/javascripts/application.js' | |
run 'rm public/javascripts/controls.js' | |
run 'rm public/javascripts/dragdrop.js' | |
run 'rm public/javascripts/effects.js' | |
run 'rm public/javascripts/prototype.js' | |
plugin "jrails", :svn => "http://ennerchi.googlecode.com/svn/trunk/plugins/jrails" | |
easy_navigation_configuration = <<-EOF | |
EasyNavigation::Builder.config do |map| | |
map.navigation :default do |navigation| | |
# Root Page | |
navigation.tab :home, :url => { :controller => "home", :action => "index" } | |
# Easy Contacts | |
navigation.tab :contacts, :url => { :controller => "contacts", :action => "index" } do |tab| | |
tab.menu :contacts, :url => { :controller => "contacts", :action => "index" } do |menu| | |
menu.connect | |
menu.connect :controller => "companies", :except => "new" | |
menu.connect :controller => "people", :except => "new" | |
end | |
tab.menu :new_person, :url => { :controller => "people", :action => "new" } | |
tab.menu :new_company, :url => { :controller => "companies", :action => "new" } | |
end | |
# Easy Authentication | |
navigation.tab :security, :url => { :controller => "users", :action => "index" } do |tab| | |
tab.menu :users, :url => { :controller => "users", :action => "index" } do |menu| | |
menu.connect | |
end | |
tab.menu :user_roles, :url => { :controller => "roles", :action => "index" } do |menu| | |
menu.connect | |
end | |
end | |
end | |
end | |
EOF | |
File.open('config/initializers/easy_navigation.rb', 'w') { |f| f.write(easy_navigation_configuration)} | |
# Setup testing | |
generate :rspec | |
generate :cucumber | |
rake "db:test:clone" | |
# Create staging environment | |
run "cp config/environments/development.rb config/environments/staging.rb" | |
staging_database_configuration = <<-EOF | |
staging: | |
adapter: sqlite3 | |
database: db/staging.sqlite3 | |
pool: 5 | |
timeout: 5000 | |
EOF | |
File.open('config/database.yml', 'a+') { |f| f.write(staging_database_configuration) } | |
run "cp config/database.yml config/example_database.yml" | |
# Git configuration | |
git :init | |
git_ignore_file = <<-END | |
.DS_Store | |
log/*.log | |
tmp/**/* | |
config/database.yml | |
db/*.sqlite3 | |
db/schema.rb | |
public/stylesheets/*.css | |
END | |
File.open('.gitignore', 'w') { |f| f.write(git_ignore_file)} | |
run "touch tmp/.gitignore log/.gitignore vendor/.gitignore" | |
# Initial commit | |
git :add => '.' | |
git :commit => "-m 'initial commit'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment