Skip to content

Commit

Permalink
Don't extend core classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseppstein committed Mar 25, 2011
1 parent e475637 commit cca6474
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lib/compass.rb
@@ -1,7 +1,7 @@
module Compass
end

%w(dependencies util browser_support sass_extensions core_ext version errors quick_cache).each do |lib|
%w(dependencies util browser_support sass_extensions version errors quick_cache).each do |lib|
require "compass/#{lib}"
end

Expand Down
Expand Up @@ -47,18 +47,18 @@ def sudo_is_an_option?

# 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?
sass_dir = "app/stylesheets" if Compass::Util.blank?(sass_dir)

# 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?
css_dir = "public/stylesheets/compiled" if Compass::Util.blank?(css_dir)

# use sudo for gem commands?
use_sudo = nil
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
use_sudo = sudo_is_an_option? if use_sudo.blank?
use_sudo = sudo_is_an_option? if Compass::Util.blank?(use_sudo)

# define dependencies
gem "haml", :version => ">=3.0.0"
Expand All @@ -71,7 +71,7 @@ def sudo_is_an_option?

# build out compass command
compass_command = "compass init rails . --css-dir=#{css_dir} --sass-dir=#{sass_dir} "
compass_command << "--using #{css_framework} " unless css_framework.blank?
compass_command << "--using #{css_framework} " unless Compass::Util.blank?(css_framework)

# integrate it!
run "haml --rails ."
Expand Down
14 changes: 0 additions & 14 deletions lib/compass/core_ext.rb

This file was deleted.

11 changes: 11 additions & 0 deletions lib/compass/util.rb
Expand Up @@ -15,4 +15,15 @@ def compass_warn(*args)
send(WARN_METHOD, *args)
end

def blank?(value)
case value
when NilClass, FalseClass
true
when String, Array
value.length.zero?
else
false
end
end

end
2 changes: 1 addition & 1 deletion test/test_case_helper.rb
@@ -1,7 +1,7 @@
module Compass
module TestCaseHelper
def absolutize(path)
if path.blank?
if Compass::Util.blank?(path)
File.dirname(__FILE__)
elsif path[0] == ?/
"#{File.dirname(__FILE__)}#{path}"
Expand Down

0 comments on commit cca6474

Please sign in to comment.