Skip to content

Commit

Permalink
Fix requires at least 0 argument error in Thor
Browse files Browse the repository at this point in the history
  • Loading branch information
schof committed Jul 27, 2012
1 parent 47891a7 commit 979ca94
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 30 deletions.
5 changes: 1 addition & 4 deletions cmd/bin/spree
@@ -1,5 +1,2 @@
#!/usr/bin/env ruby

require 'spree_cmd'

SpreeCmd::Command.start
require 'spree_cmd'
5 changes: 1 addition & 4 deletions cmd/bin/spree_cmd
@@ -1,6 +1,3 @@
#!/usr/bin/env ruby

require 'spree_cmd'

SpreeCmd::Command.start

require 'spree_cmd'
34 changes: 12 additions & 22 deletions cmd/lib/spree_cmd.rb
@@ -1,29 +1,19 @@
require 'thor'
require 'thor/group'

require 'spree_cmd/installer'
require 'spree_cmd/extension'
require 'spree_cmd/version'

module SpreeCmd
class Command < Thor

desc 'install', 'adds spree to an existing rails app'
method_option :app_path, :type => :string, :desc => 'path to rails application'
def install(app_path = '.')
invoke Installer
end
class Command

desc 'extension', 'builds a spree extension'
method_option :app_path, :type => :string, :desc => 'path to new extension'
def extension(app_path)
invoke Extension
if ARGV.first == 'version'
puts Gem.loaded_specs['spree_cmd'].version
elsif ARGV.first == 'extension'
ARGV.shift
require 'spree_cmd/extension'
SpreeCmd::Extension.start
else
ARGV.shift
require 'spree_cmd/installer'
SpreeCmd::Installer.start
end

desc 'version', 'display spree_cmd version'
def version
invoke Version
end

end
end
end

0 comments on commit 979ca94

Please sign in to comment.