Created
February 27, 2010 05:51
-
-
Save scottharvey/316508 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
run "rm public/index.html" | |
generate(:rspec) | |
generate(:cucumber) | |
plugin 'resource_controller', :git => 'git://github.com/jamesgolick/resource_controller.git' | |
plugin 'flash-message-conductor', :git => 'git://github.com/planetargon/flash-message-conductor.git' | |
gem "formtastic" | |
gem "pickle" | |
gem "machinist" | |
file 'spec/blueprint.rb', <<-CODE | |
require 'machinist/active_record' | |
require 'sham' | |
CODE | |
# ================================================================= | |
# Compass Ruby on Rails Installer (template) v.1.0 | |
# written by Derek Perez ([email protected]) | |
# ----------------------------------------------------------------- | |
# NOTE: This installer is designed to work as a Rails template, | |
# and can only be used with Rails 2.3+. | |
# ----------------------------------------------------------------- | |
# Copyright (c) 2009 Derek Perez | |
# | |
# Permission is hereby granted, free of charge, to any person | |
# obtaining a copy of this software and associated documentation | |
# files (the "Software"), to deal in the Software without | |
# restriction, including without limitation the rights to use, | |
# copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the | |
# Software is furnished to do so, subject to the following | |
# conditions: | |
# | |
# The above copyright notice and this permission notice shall be | |
# included in all copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | |
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
# OTHER DEALINGS IN THE SOFTWARE. | |
# ================================================================= | |
# Determine if we use sudo, defaults to true unless we are | |
# on win32, cygwin, or mingw32 or they ask us not to | |
def sudo_is_an_option? | |
return false if RUBY_PLATFORM =~ /(win|w)32$/ # true if win32, cygwin or mingw32 | |
return false if ENV['NO_SUDO'] =~ /true/i | |
return true | |
end | |
puts "===================================================" | |
puts "Welcome to the Compass Installer for Ruby on Rails!" | |
puts "===================================================" | |
puts | |
# css framework prompt | |
css_framework = ask("What CSS Framework do you want to use with Compass? (default: 'blueprint')") | |
css_framework = "blueprint" if css_framework.blank? | |
# sass storage prompt | |
sass_dir = ask("Where would you like to keep your sass files within your project? (default: 'app/stylesheets')") | |
sass_dir = "app/stylesheets" if sass_dir.blank? | |
# compiled css storage prompt | |
css_dir = ask("Where would you like Compass to store your compiled css files? (default: 'public/stylesheets/compiled')") | |
css_dir = "public/stylesheets/compiled" if css_dir.blank? | |
# use sudo for gem commands? | |
use_sudo = sudo_is_an_option? | |
if sudo_is_an_option? # dont give them the option if they are on a system that can't use sudo (aka windows) | |
use_sudo = yes?("Use sudo for the gem commands? (the default for your system is #{sudo_is_an_option? ? 'yes' : 'no'})") | |
end | |
# define dependencies | |
gem "haml", :version => ">=2.2.16" | |
gem "compass", :version => ">= 0.8.17" | |
# install and unpack | |
rake "gems:install GEM=haml", :sudo => use_sudo | |
rake "gems:install GEM=compass", :sudo => use_sudo | |
rake "gems:unpack GEM=compass" | |
# load any compass framework plugins | |
if css_framework =~ /960/ | |
gem "compass-960-plugin", :lib => "ninesixty" | |
rake "gems:install GEM=compass-960-plugin", :sudo => use_sudo | |
css_framework = "960" # rename for command | |
plugin_require = "-r ninesixty" | |
end | |
# build out compass command | |
compass_command = "compass --rails -f #{css_framework} . --css-dir=#{css_dir} --sass-dir=#{sass_dir} " | |
compass_command << plugin_require if plugin_require | |
# Require compass during plugin loading | |
file 'vendor/plugins/compass/init.rb', <<-CODE | |
# This is here to make sure that the right version of sass gets loaded (haml 2.2) by the compass requires. | |
require 'compass' | |
CODE | |
# integrate it! | |
run "haml --rails ." | |
run compass_command | |
puts "Compass (with #{css_framework}) is all setup, have fun!" | |
rake gems:unpack | |
rake "db:migrate" | |
git :init | |
git :add => "." | |
git :commit => "-a -m 'Initial commit'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment