Permalink
Browse files

updating to most recent version

  • Loading branch information...
2 parents 872de22 + ed5062b commit 21a132f9e581cc47835b2935ff2fe29421c647b5 @polymetis committed Nov 14, 2012
View
@@ -1,2 +1,9 @@
+# encoding: utf-8
+require 'rubygems'
require 'bundler'
+require 'cucumber/rake/task'
+
Bundler::GemHelper.install_tasks
+Cucumber::Rake::Task.new
+
+task :default => :cucumber
@@ -21,10 +21,11 @@
@import "css3/box-sizing";
@import "css3/columns";
@import "css3/flex-box";
+@import "css3/font-face";
+@import "css3/hidpi-media-query";
@import "css3/image-rendering";
@import "css3/inline-block";
@import "css3/linear-gradient";
-@import "css3/prefixer";
@import "css3/radial-gradient";
@import "css3/transform";
@import "css3/transition";
@@ -33,9 +34,9 @@
// Addons & other mixins
@import "addons/button";
@import "addons/clearfix";
-@import "addons/font-face";
@import "addons/font-family";
@import "addons/hide-text";
@import "addons/html5-input-types";
@import "addons/position";
+@import "addons/prefixer";
@import "addons/timing-functions";
@@ -1,12 +0,0 @@
-@mixin font-face($font-family, $file-path, $weight: normal, $style: normal ) {
- @font-face {
- font-family: $font-family;
- src: url('#{$file-path}.eot');
- src: url('#{$file-path}.eot?#iefix') format('embedded-opentype'),
- url('#{$file-path}.woff') format('woff'),
- url('#{$file-path}.ttf') format('truetype'),
- url('#{$file-path}.svg##{$font-family}') format('svg');
- font-weight: $weight;
- font-style: $style;
- }
-}
@@ -0,0 +1,21 @@
+@mixin font-face($font-family, $file-path, $weight: normal, $style: normal, $asset-pipeline: false ) {
+ @font-face {
+ font-family: $font-family;
+ font-weight: $weight;
+ font-style: $style;
+
+ @if $asset-pipeline == true {
+ src: font-url('#{$file-path}.eot');
+ src: font-url('#{$file-path}.eot?#iefix') format('embedded-opentype'),
+ font-url('#{$file-path}.woff') format('woff'),
+ font-url('#{$file-path}.ttf') format('truetype'),
+ font-url('#{$file-path}.svg##{$font-family}') format('svg');
+ } @else {
+ src: url('#{$file-path}.eot');
+ src: url('#{$file-path}.eot?#iefix') format('embedded-opentype'),
+ url('#{$file-path}.woff') format('woff'),
+ url('#{$file-path}.ttf') format('truetype'),
+ url('#{$file-path}.svg##{$font-family}') format('svg');
+ }
+ }
+}
@@ -0,0 +1,10 @@
+// HiDPI mixin. Default value set to 1.3 to target Google Nexus 7 (http://bjango.com/articles/min-device-pixel-ratio/)
+@mixin hidpi($ratio: 1.3) {
+ @media only screen and (-webkit-min-device-pixel-ratio: $ratio),
+ only screen and (min--moz-device-pixel-ratio: $ratio),
+ only screen and (-o-min-device-pixel-ratio: #{$ratio}/1),
+ only screen and (min-resolution: #{round($ratio*96)}dpi),
+ only screen and (min-resolution: #{$ratio}dppx) {
+ @content;
+ }
+}
View
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
s.name = "bourbon"
s.version = Bourbon::VERSION
s.platform = Gem::Platform::RUBY
- s.authors = ["Phil LaPier", "Chad Mazzola", "Matt Jankowski", "Nick Quaranto", "Jeremy Raines", "Mike Burns", "Andres Mejia", "Travis Haynes", "Chris Lloyd", "Gabe Berke-Williams", "J. Edward Dewyea"]
+ s.authors = ["Phil LaPier", "Chad Mazzola", "Matt Jankowski", "Nick Quaranto", "Jeremy Raines", "Mike Burns", "Andres Mejia", "Travis Haynes", "Chris Lloyd", "Gabe Berke-Williams", "J. Edward Dewyea", "Reda Lemeden"]
s.email = ["support@thoughtbot.com"]
s.homepage = "https://github.com/thoughtbot/bourbon"
s.summary = "Bourbon Sass Mixins using SCSS syntax."
@@ -26,7 +26,7 @@ that support only CSS3 prefixed properties.
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- s.add_dependency('sass', '>= 3.1')
+ s.add_dependency('sass', '>= 3.2')
s.add_dependency('thor')
s.add_development_dependency('aruba', '~> 0.4')
View
@@ -2,16 +2,32 @@
Feature: Install bourbon files
Scenario: Bourbon generates a new bourbon installation
- When I install bourbon files
+ When I run `bundle exec bourbon install`
Then the sass directories should have been generated
And the following directories should exist:
- | bourbon |
- | bourbon/lib |
+ | 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
Given bourbon is already installed
- When I install bourbon files
+ When I run `bundle exec bourbon install`
Then the output should contain "Bourbon files already installed, doing nothing."
+
+ Scenario: Install Bourbon into a custom path
+ When I run `bundle exec bourbon install --path=custom_path`
+ 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
+ Given bourbon is already installed
+ When I run `bundle exec bourbon install --force`
+ Then the output from "bundle exec bourbon install --force" should contain "Bourbon files installed to bourbon/"
+ And the output should not contain "Bourbon files already installed, doing nothing."
@@ -1,33 +1,31 @@
Given /^bourbon is already installed$/ do
- set_up_bourbon_directory
install_bourbon
end
-When /^I install bourbon files$/ do
- set_up_bourbon_directory
- install_bourbon
-end
-
-When /^I update bourbon files$/ do
- update_bourbon
+Given /^I install bourbon to "([^"]*)"$/ do |path|
end
-Then /^the sass directories should have been generated$/ do
- sass_directories = ["bourbon/addons", "bourbon/css3", "bourbon/functions"]
+Then /^the sass directories(?: with "([^"]+)" prefix)? should have been generated$/ do |prefix|
+ sass_directories = ["addons", "css3", "functions"]
+ sass_directories.map!{ |directory| bourbon_path(prefix, directory) }
check_directory_presence(sass_directories, true)
end
-Then /^the master bourbon partial should have been generated$/ do
- check_file_presence(["bourbon/_bourbon.scss"], true)
+Then /^the master bourbon partial should have been generated(?: within "([^"]+)" directory)?$/ do |prefix|
+ check_file_presence([bourbon_path(prefix, '_bourbon.scss')], true)
end
-Then /^the lib files should have been generated$/ do
- check_file_presence(["bourbon/lib/bourbon.rb"], true)
- check_directory_presence(["bourbon/lib/bourbon"], true)
- check_file_presence(["bourbon/lib/bourbon/sass_extensions.rb"], true)
- check_directory_presence(["bourbon/lib/bourbon/sass_extensions"], true)
+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)
+ check_directory_presence(['bourbon'], false)
+end
+
+Then /^the output should contain the current version of Bourbon$/ do
+ step %(the output should contain exactly "Bourbon #{Bourbon::VERSION}\n")
end
@@ -1,15 +1,18 @@
module BourbonSupport
- def set_up_bourbon_directory
- write_file("Gemfile", "gem 'bourbon', :path => '../../..'")
- run_simple("bundle install")
+ def install_bourbon(path = nil)
+ if path
+ run_simple("bundle exec bourbon install --path '#{path}'")
+ else
+ run_simple("bundle exec bourbon install")
+ end
end
- def install_bourbon
- run_simple("bundle exec bourbon install")
- end
-
- def update_bourbon
- run_simple("bundle exec bourbon update")
+ def bourbon_path(prefix, path)
+ if prefix
+ File.join(prefix, 'bourbon', path)
+ else
+ File.join('bourbon', path)
+ end
end
end
View
@@ -2,16 +2,29 @@
Feature: Update bourbon files
Scenario: Updating updates an existing bourbon install
- When I install bourbon files
- And I write to "bourbon/_bourbon.scss" with:
+ Given bourbon is already installed
+ When I write to "bourbon/_bourbon.scss" with:
"""
foobar
"""
- And I update bourbon files
+ And I run `bundle exec bourbon update`
Then the output should contain "Bourbon files updated."
And the file "bourbon/_bourbon.scss" should not contain "foobar"
+ Scenario: Updating with a --path option
+ Given I install bourbon to "custom_path"
+ When I write to "custom_path/bourbon/_bourbon.scss" with:
+ """
+ foobar
+ """
+ And I run `bundle exec bourbon update`
+ Then the output should contain "No existing bourbon installation. Doing nothing."
+
+ When I run `bundle exec bourbon update --path custom_path`
+ Then the output should contain "Bourbon files updated."
+ And the file "custom_path/bourbon/_bourbon.scss" should not contain "foobar"
+
Scenario: Updating does not generate a new bourbon install
- When I update bourbon files
+ And I run `bundle exec bourbon update`
Then bourbon should not have been generated
And the output should contain "No existing bourbon installation. Doing nothing."
View
@@ -0,0 +1,6 @@
+@disable-bundler
+Feature: Show version
+ Scenario: Viewing version
+ When I successfully run `bundle exec bourbon --version`
+ Then the output should contain the current version of Bourbon
+
View
@@ -1,19 +1,24 @@
+require 'bourbon/version'
require "fileutils"
require 'thor'
module Bourbon
class Generator < Thor
+ map ['-v', '--version'] => :version
+
desc 'install', 'Install Bourbon into your project'
+ method_options :path => :string, :force => :boolean
def install
- if bourbon_files_already_exist?
+ if bourbon_files_already_exist? && !options[:force]
puts "Bourbon files already installed, doing nothing."
else
install_files
- puts "Bourbon files installed to bourbon/"
+ puts "Bourbon files installed to #{install_path}/"
end
end
desc 'update', 'Update Bourbon'
+ method_options :path => :string
def update
if bourbon_files_already_exist?
remove_bourbon_directory
@@ -24,10 +29,23 @@ def update
end
end
+ desc 'version', 'Show Bourbon version'
+ def version
+ say "Bourbon #{Bourbon::VERSION}"
+ end
+
private
def bourbon_files_already_exist?
- File.directory?("bourbon")
+ install_path.exist?
+ end
+
+ def install_path
+ @install_path ||= if options[:path]
+ Pathname.new(File.join(options[:path], 'bourbon'))
+ else
+ Pathname.new('bourbon')
+ end
end
def install_files
@@ -41,17 +59,17 @@ def remove_bourbon_directory
end
def make_lib_directory
- FileUtils.mkdir_p("bourbon/lib/bourbon")
+ FileUtils.mkdir_p(install_path.join('lib', 'bourbon'))
end
def copy_in_sass_extensions
- FileUtils.cp(File.join(lib_directory, "bourbon.rb"), "bourbon/lib/")
- FileUtils.cp(File.join(lib_bourbon_directory, "sass_extensions.rb"), "bourbon/lib/bourbon/")
- FileUtils.cp_r(File.join(lib_bourbon_directory, "sass_extensions"), "bourbon/lib/bourbon/")
+ 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'))
end
def copy_in_scss_files
- FileUtils.cp_r(all_stylesheets, "bourbon/")
+ FileUtils.cp_r(all_stylesheets, install_path)
end
def all_stylesheets
@@ -1,6 +1,8 @@
module Bourbon::SassExtensions
end
-require "sass"
+unless defined?(Sass)
+ require 'sass'
+end
-require File.join(File.dirname(__FILE__), "/sass_extensions/functions")
+require File.join(File.dirname(__FILE__), '/sass_extensions/functions')
View
@@ -1,3 +1,3 @@
module Bourbon
- VERSION = "2.1.1"
+ VERSION = "2.1.2"
end
Oops, something went wrong.

0 comments on commit 21a132f

Please sign in to comment.