Merge commit 'packetmonkey/optional_sudo'

* commit 'packetmonkey/optional_sudo':
  Allows turning off sudo usage with an ENV variable
  Move sudo checks into it's own function
This commit is contained in:
Chris Eppstein 2010-01-10 10:57:09 -08:00
commit fd2ab06f60

View File

@ -28,6 +28,15 @@
# 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 use_sudo?
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 "==================================================="
@ -50,24 +59,14 @@ gem "haml", :version => ">=2.2.16"
gem "compass", :version => ">= 0.8.17"
# install and unpack
unless RUBY_PLATFORM =~ /(win|w)32$/ # true if win32, cygwin or mingw32
rake "gems:install GEM=haml", :sudo => true
rake "gems:install GEM=compass", :sudo => true
else
rake "gems:install GEM=haml"
rake "gems:install GEM=compass"
end
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"
unless RUBY_PLATFORM =~ /(win|w)32$/
rake "gems:install GEM=compass-960-plugin", :sudo => true
else
rake "gems:install GEM=compass-960-plugin"
end
rake "gems:unpack GEM=compass-960-plugin"
rake "gems:install GEM=compass-960-plugin", :sudo => use_sudo?
css_framework = "960" # rename for command
plugin_require = "-r ninesixty"
end