bin/railsthemes in railsthemes-1.1.pre vs bin/railsthemes in railsthemes-1.1.pre.2

- old
+ new

@@ -2,13 +2,31 @@ require "rubygems" require "thor" require "railsthemes" class Installer < Thor - desc "install CODE", "Install from RailsThemes.com using your download code" + desc "default", "The default task to run when no command is given" + method_option :version, + :desc => "See what version you have installed", + :aliases => ['-v', '--version'], + :type => :boolean + def default + if options[:version] + puts Railsthemes::VERSION + else + puts <<-EOS +railsthemes -v # Print the version of the installer gem you are using +railsthemes install your@email:code # Install from RailsThemes.com using your download code +railsthemes help [TASK] # Describe available tasks or one specific task +EOS + end + end + default_task :default + + desc "install your@email:code", "Install from RailsThemes.com using your download code" method_option :file, - :desc => "Use local filename instead of downloading.", + :desc => "Use local relative pathname instead of a code, and install from there.", :type => :boolean method_option :no_doc_popup, :desc => "Do not pop up documentation on successful install.", :type => :boolean method_option :verbose, @@ -16,32 +34,29 @@ :type => :boolean # do not rename to :debug, conflicts with Thor built-in functionality method_option :debugging, :desc => "Print gratuitous output on installation (for debugging).", :type => :boolean - def install code_or_file # might be better to pass in the options directly if we get more options installer = Railsthemes::Installer.new + + if options[:email] + end + installer.doc_popup = !options[:no_doc_popup] - installer.verbose if options[:verbose] - installer.debug if options[:debugging] + Railsthemes::Logging.verbose if options[:verbose] + Railsthemes::Logging.debug if options[:debugging] if options[:file] file = code_or_file abort 'Please specify a file to install from' unless file - puts "Installing from file: #{file}." installer.install_from_file_system file else code = code_or_file abort 'Please specify a code to install from' unless code - installer.download_from_code code + installer.install_from_code code end - end - - desc "version", "See what version you have installed" - def version - puts Railsthemes::VERSION end # AP: other options could include list, remove, help, etc. end