Sha256: b91b38697de8b074bef2434d46a0b1013024b54f8fd195eca332253690f099dc

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

#!/usr/bin/env ruby
require "rubygems"
require "thor"
require "railsthemes"

class Installer < Thor
  desc "install CODE", "Install from RailsThemes.com using your download code"
  method_option :file,
    :desc => "Use local filename instead of downloading.",
    :type => :boolean
  method_option :no_doc_popup,
    :desc => "Do not pop up documentation on successful install.",
    :type => :boolean
  method_option :verbose,
    :desc => "Print more output on installation.",
    :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
    installer.doc_popup = !options[:no_doc_popup]
    installer.verbose if options[:verbose]
    installer.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
    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

Installer.start ARGV

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
railsthemes-1.1.pre bin/railsthemes