Skip to content

Commit

Permalink
Allow bourbon update to take --path argument
Browse files Browse the repository at this point in the history
  • Loading branch information
sikachu authored and Phil LaPier committed Nov 2, 2012
1 parent 05c85d7 commit 4486361
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
7 changes: 1 addition & 6 deletions features/step_definitions/bourbon_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
install_bourbon
end

When /^I install bourbon files$/ do
install_bourbon
end

When /^I update bourbon files$/ do
update_bourbon
Given /^I install bourbon to "([^"]*)"$/ do |path|
end

Then /^the sass directories(?: with "([^"]+)" prefix)? should have been generated$/ do |prefix|
Expand Down
12 changes: 6 additions & 6 deletions features/support/bourbon_support.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module BourbonSupport
def install_bourbon
run_simple("bundle exec bourbon install")
end

def update_bourbon
run_simple("bundle exec bourbon update")
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 bourbon_path(prefix, path)
Expand Down
21 changes: 17 additions & 4 deletions features/update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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."
1 change: 1 addition & 0 deletions lib/bourbon/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def install
end

desc 'update', 'Update Bourbon'
method_options :path => :string
def update
if bourbon_files_already_exist?
remove_bourbon_directory
Expand Down

0 comments on commit 4486361

Please sign in to comment.