class DrJekyll::NewCommand

Public Class Methods

new( catalog, opts ) click to toggle source
# File lib/drjekyll/cli/new.rb, line 8
def initialize( catalog, opts )
  @catalog = catalog
  @opts    = opts
end

Public Instance Methods

download_and_unzip( key, theme ) click to toggle source
# File lib/drjekyll/cli/new.rb, line 27
def download_and_unzip( key, theme )
  pak = Package.new( key, theme )
 
  ## todo/fix:
  ##   add puts "GET URL" w/ color (bright/bold green)
 
  pak.download
  pak.unzip( "./#{key}" )
end
run( args ) click to toggle source
# File lib/drjekyll/cli/new.rb, line 13
def run( args )
  ## note: required template name (defaults to starter for now)
  key = args[0] || 'starter'

  theme = @catalog.find( key )

  if theme
    download_and_unzip( key, theme )
  else
    ## todo: issue warning - why, why not??
    puts "*** theme '#{key}' not found; sorry"
  end
end