Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove ruby compact function. Fix tests and cleanup the generator scr…

…ipt. Move sass require.
  • Loading branch information...
commit 7a359c257010f00289ffcb0893982db92e1aa2c8 1 parent c9dfa51
Phil LaPier authored
View
6 Gemfile.lock
@@ -1,8 +1,8 @@
PATH
remote: .
specs:
- bourbon (2.1.2)
- sass (>= 3.2)
+ bourbon (2.2.0)
+ sass (>= 3.2.1)
thor
GEM
@@ -36,7 +36,7 @@ GEM
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
- sass (3.2.2)
+ sass (3.2.3)
term-ansicolor (1.0.7)
thor (0.16.0)
View
4 features/install.feature
@@ -6,9 +6,7 @@ Feature: Install bourbon files
Then the sass directories should have been generated
And the following directories should exist:
| bourbon |
- | bourbon/lib |
And the master bourbon partial should have been generated
- And the lib files should have been generated
And the output should contain "Bourbon files installed to bourbon/"
Scenario: Generating does not overwrite an existing bourbon directory
@@ -21,9 +19,7 @@ Feature: Install bourbon files
Then the sass directories with "custom_path" prefix should have been generated
And the following directories should exist:
| custom_path/bourbon |
- | custom_path/bourbon/lib |
And the master bourbon partial should have been generated within "custom_path" directory
- And the lib files should have been generated within "custom_path" directory
And the output should contain "Bourbon files installed to custom_path/bourbon/"
Scenario: Forcing install of bourbon
View
7 features/step_definitions/bourbon_steps.rb
@@ -15,13 +15,6 @@
check_file_presence([bourbon_path(prefix, '_bourbon.scss')], true)
end
-Then /^the lib files should have been generated(?: within "([^"]+)" directory)?$/ do |prefix|
- check_file_presence([bourbon_path(prefix, 'lib/bourbon.rb')], true)
- check_directory_presence([bourbon_path(prefix, 'lib/bourbon')], true)
- check_file_presence([bourbon_path(prefix, 'lib/bourbon/sass_extensions.rb')], true)
- check_directory_presence([bourbon_path(prefix, 'lib/bourbon/sass_extensions')], true)
-end
-
Then /^bourbon should not have been generated$/ do
check_directory_presence(['bourbon'], false)
end
View
4 lib/bourbon.rb
@@ -20,4 +20,6 @@ class Railtie < ::Rails::Railtie
end
end
-require File.join(File.dirname(__FILE__), "/bourbon/sass_extensions")
+unless defined?(Sass)
+ require 'sass'
+end
View
17 lib/bourbon/generator.rb
@@ -50,7 +50,6 @@ def install_path
def install_files
make_lib_directory
- copy_in_sass_extensions
copy_in_scss_files
end
@@ -59,13 +58,7 @@ def remove_bourbon_directory
end
def make_lib_directory
- FileUtils.mkdir_p(install_path.join('lib', 'bourbon'))
- end
-
- def copy_in_sass_extensions
- FileUtils.cp(File.join(lib_directory, 'bourbon.rb'), install_path.join('lib'))
- FileUtils.cp(File.join(lib_bourbon_directory, 'sass_extensions.rb'), install_path.join('lib', 'bourbon'))
- FileUtils.cp_r(File.join(lib_bourbon_directory, 'sass_extensions'), install_path.join('lib', 'bourbon'))
+ FileUtils.mkdir_p(install_path)
end
def copy_in_scss_files
@@ -80,14 +73,6 @@ def stylesheets_directory
File.join(top_level_directory, "app", "assets", "stylesheets")
end
- def lib_directory
- File.join(top_level_directory, "lib")
- end
-
- def lib_bourbon_directory
- File.join(top_level_directory, "lib", "bourbon")
- end
-
def top_level_directory
File.dirname(File.dirname(File.dirname(__FILE__)))
end
View
8 lib/bourbon/sass_extensions.rb
@@ -1,8 +0,0 @@
-module Bourbon::SassExtensions
-end
-
-unless defined?(Sass)
- require 'sass'
-end
-
-require File.join(File.dirname(__FILE__), '/sass_extensions/functions')
View
13 lib/bourbon/sass_extensions/functions.rb
@@ -1,13 +0,0 @@
-module Bourbon::SassExtensions::Functions
-end
-
-require File.join(File.dirname(__FILE__), "/functions/compact")
-
-module Sass::Script::Functions
- include Bourbon::SassExtensions::Functions::Compact
-end
-
-# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
-class Sass::Script::Functions::EvaluationContext
- include Sass::Script::Functions
-end
View
14 lib/bourbon/sass_extensions/functions/compact.rb
@@ -1,14 +0,0 @@
-# Compact function pulled from compass
-module Bourbon::SassExtensions::Functions::Compact
-
- def compact(*args)
- sep = :comma
- if args.size == 1 && args.first.is_a?(Sass::Script::List)
- list = args.first
- args = list.value
- sep = list.separator
- end
- Sass::Script::List.new(args.reject{|a| !a.to_bool}, sep)
- end
-
-end
Please sign in to comment.
Something went wrong with that request. Please try again.