From bf34e70a257151a0eacba23af0460986229abb69 Mon Sep 17 00:00:00 2001 From: Gabe Berke-Williams Date: Fri, 20 Jan 2012 14:42:44 -0500 Subject: [PATCH] Users can update their existing bourbon installation. --- .gitignore | 1 + bin/bourbon | 2 +- features/generate.feature | 3 +-- features/step_definitions/bourbon_steps.rb | 11 ++++++++--- features/support/bourbon_support.rb | 4 ++++ features/update.feature | 17 +++++++++++++++++ 6 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 features/update.feature diff --git a/.gitignore b/.gitignore index fb3c6c90d..e21d53877 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ bourbon/ demo/ tmp/ +tags diff --git a/bin/bourbon b/bin/bourbon index dbfc31644..d803514cc 100755 --- a/bin/bourbon +++ b/bin/bourbon @@ -2,4 +2,4 @@ require "bourbon" -Bourbon::Generator.new.generate +Bourbon::Generator.new(ARGV).run diff --git a/features/generate.feature b/features/generate.feature index f34c705a6..b37156257 100644 --- a/features/generate.feature +++ b/features/generate.feature @@ -1,8 +1,7 @@ @disable-bundler -Feature: Generate bourbon files via gem subcommand +Feature: Generate bourbon files Scenario: Run `bourbon generate` - Given I set up bourbon When I generate bourbon files Then the sass directories should have been generated And the following directories should exist: diff --git a/features/step_definitions/bourbon_steps.rb b/features/step_definitions/bourbon_steps.rb index 8b6cc2452..266eafdba 100644 --- a/features/step_definitions/bourbon_steps.rb +++ b/features/step_definitions/bourbon_steps.rb @@ -3,12 +3,13 @@ generate_bourbon end -When /^I set up bourbon$/ do +When /^I generate bourbon files$/ do set_up_bourbon_directory + generate_bourbon end -When /^I generate bourbon files$/ do - generate_bourbon +When /^I update bourbon files$/ do + update_bourbon end Then /^the sass directories should have been generated$/ do @@ -24,3 +25,7 @@ check_file_presence(["bourbon/lib/sass_extensions.rb"], true) check_directory_presence(["bourbon/lib/sass_extensions"], true) end + +Then /^bourbon should not have been generated$/ do + check_directory_presence(["bourbon"], false) +end diff --git a/features/support/bourbon_support.rb b/features/support/bourbon_support.rb index 2f18ddf45..01c4e7223 100644 --- a/features/support/bourbon_support.rb +++ b/features/support/bourbon_support.rb @@ -7,6 +7,10 @@ def set_up_bourbon_directory def generate_bourbon run_simple("bundle exec bourbon generate") end + + def update_bourbon + run_simple("bundle exec bourbon update") + end end World(BourbonSupport) diff --git a/features/update.feature b/features/update.feature new file mode 100644 index 000000000..cc8cb7f1e --- /dev/null +++ b/features/update.feature @@ -0,0 +1,17 @@ +@disable-bundler +Feature: Update bourbon files + + Scenario: `bourbon update` updates an existing bourbon install + When I generate bourbon files + And I write to "bourbon/_bourbon.scss" with: + """ + foobar + """ + And I update bourbon files + Then the output should contain "Bourbon files updated." + And the file "bourbon/_bourbon.scss" should not contain "foobar" + + Scenario: `bourbon update` does not generate a new bourbon install + When I update bourbon files + Then bourbon should not have been generated + And the output should contain "No existing bourbon installation. Doing nothing."