Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use Thor for command parsing

  • Loading branch information...
commit ac3b3181d42a7808c4c00aa16c66ce2eb509132e 1 parent c59153f
@mike-burns mike-burns authored
View
6 Gemfile.lock
@@ -1,8 +1,9 @@
PATH
remote: .
specs:
- bourbon (1.4.0)
+ bourbon (2.1.1)
sass (>= 3.1)
+ thor
GEM
remote: http://rubygems.org/
@@ -35,8 +36,9 @@ GEM
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
- sass (3.1.15)
+ sass (3.2.1)
term-ansicolor (1.0.7)
+ thor (0.15.4)
PLATFORMS
ruby
View
2  bin/bourbon
@@ -2,4 +2,4 @@
require "bourbon"
-Bourbon::Generator.new(ARGV).run
+Bourbon::Generator.start
View
1  bourbon.gemspec
@@ -27,6 +27,7 @@ that support only CSS3 prefixed properties.
s.require_paths = ["lib"]
s.add_dependency('sass', '>= 3.1')
+ s.add_dependency('thor')
s.add_development_dependency('aruba', '~> 0.4')
s.add_development_dependency('rake')
View
29 lib/bourbon/generator.rb
@@ -1,19 +1,19 @@
require "fileutils"
+require 'thor'
module Bourbon
- class Generator
- def initialize(arguments)
- @subcommand = arguments.first
- end
-
- def run
- if @subcommand == "install"
- install
- elsif @subcommand == "update"
- update
+ class Generator < Thor
+ desc 'install', 'Install Bourbon into your project'
+ def install
+ if bourbon_files_already_exist?
+ puts "Bourbon files already installed, doing nothing."
+ else
+ install_files
+ puts "Bourbon files installed to bourbon/"
end
end
+ desc 'update', 'Update Bourbon'
def update
if bourbon_files_already_exist?
remove_bourbon_directory
@@ -24,15 +24,6 @@ def update
end
end
- def install
- if bourbon_files_already_exist?
- puts "Bourbon files already installed, doing nothing."
- else
- install_files
- puts "Bourbon files installed to bourbon/"
- end
- end
-
private
def bourbon_files_already_exist?
Please sign in to comment.
Something went wrong with that request. Please try again.