Sha256: fb7cccaf44fcbc0a9cbfd02a67d779c128a88d1c4bc1920cec14f7a5f26690c7

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

require 'trollop'

opts = Trollop::options do
  opt :verbose,"Verbose output"
  opt :debug,  "Enable debugging output"
  opt :quiet,  "No output"
  opt :create, "Create a gumdrop project", :type=>String
  opt :build,  "Build HTML output"
  opt :server, "Runs development server"
    opt :port, "Specifies port to run server on", :type=>:int
end

# Trollop::die :volume, "must be non-negative" if opts[:volume] < 0
# Trollop::die :file, "must exist" unless File.exist?(opts[:file]) if opts[:file]

unless opts[:create_given] or opts[:build_given] or opts[:server_given]
  Trollop::die "You must specify one of --create --build --server"
end


if opts[:create_given]
  require 'fileutils'
  here= File.dirname(__FILE__)
  there= File.expand_path(opts[:create])

  if File.file? there
    puts "You cannot specify a file as the target!" 
  elsif !File.directory? there
    FileUtils.mkdir_p there
  end
  
  FileUtils.cp_r Dir[File.join(here, "template", "*")], there

  puts "Done."
  
elsif opts[:build_given]
  Gumdrop.run(opts)

elsif opts[:server_given]
  Gumdrop.config.auto_run= true
  Gumdrop::Server

else
  require 'pp'
  puts "Unknown options"
  pp opts
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gumdrop-0.2.13 lib/gumdrop/cli.rb
gumdrop-0.2.12 lib/gumdrop/cli.rb
gumdrop-0.2.11 lib/gumdrop/cli.rb
gumdrop-0.2.10 lib/gumdrop/cli.rb
gumdrop-0.2.9 lib/gumdrop/cli.rb
gumdrop-0.2.8 lib/gumdrop/cli.rb
gumdrop-0.2.7 lib/gumdrop/cli.rb
gumdrop-0.2.4 lib/gumdrop/cli.rb