Sha256: b5d8d74625e323dc2b66300bede5b81f1e0aa1996ddacc37f87dec01644e0616

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

#!/usr/bin/env ruby

require 'spinebox'

Spinebox::Command.dispatch do
  
  # Version
  on "--version, -v", "Show the version", :if => proc { ['--version', '-v'].include?(ARGV.first) }, :type => :option do
    puts "Spinebox #{Spinebox::VERSION}"
    exit(0)
  end
  
  # Help
  on "--help, -h", "Show this help", :if => proc { ['--help', '-h'].include?(ARGV.first) or ARGV.empty? }, :type => :option do
    Spinebox::Command.help
    exit(0)
  end
  
  # New application
  on "new APP", "Create a new APP", :if => proc { ['new', 'n'].include?(ARGV.first) }, :type => :action do
    ARGV.shift
    Spinebox::Generator.new(ARGV.first)
    puts "Successfully created '#{ARGV.first}'".green
    exit(0)
  end
  
  # Compile
  on "compile, precompile", "Compile files to the public dir", :if => proc { ['compile', 'precompile'].include?(ARGV.first) }, :type => :action do
    Spinebox.boot!
    Spinebox::Compiler.compile
    puts "Successfully compiled to 'public'".green
    exit(0)
  end
  
  # Run server
  on "server, s", "Run the development server", :if => proc { ['server', 's'].include?(ARGV.first) }, :type => :action do
    Rack::Handler::Thin.run(Spinebox.app, :Port => 3000)
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spinebox-0.0.5 bin/spinebox
spinebox-0.0.4 bin/spinebox