#!/usr/bin/env ruby require 'spinebox' Spinebox::Command.dispatch do # Version on "--version, -v", "Show the version", :if => proc { ['--version', '-v'].include?(ARGV.first) } 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? } do puts Spinebox::Command.help exit(0) end # New application on "new APP", "Create a new APP", :if => proc { ['new', 'n'].include?(ARGV.first) } do ARGV.shift Spinebox::Generator.new(ARGV.first) puts ">> Created new spinebox in './#{ARGV.first}'. Let's go!" exit(0) end # Run server on "s, server", "Run the development server", :if => proc { ['server', 's'].include?(ARGV.first) } do Rack::Handler::Thin.run(Spinebox.app, :Port => 3000) end end