Sha256: 45a751d584ee2a70f283585295701e1e8dc48991102f9b8f7c9e16e778fc00a8

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

#!/usr/bin/env ruby

$: << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))

begin
  require 'rubikon'
  require 'ninjs'
rescue LoadError
  require 'rubygems'
  require 'rubikon'
  require 'ninjs'
end

class NinjsConsole < Rubikon::Application::Base
  def initialize
    @directory = '/'
  end
  
  flag :v => :version
  option :version
  default do
    if version.given?
      time = Time.now
      Ninjs::Notification.notice 'ninjs ' + Ninjs::VERSION
      Ninjs::Notification.notice "Copyright (c) #{time.year} Dayton Nolan"
      Ninjs::Notification.notice "Released under the MIT License"
    else
      Ninjs::Command.help
    end
  end
  
  command :compile do
    Ninjs::Command.compile
  end
  
  command :watch do
    Ninjs::Command.watch
  end
  
  command :import do
    Ninjs::Command.import
  end
  
  command :create, :app_name, :dir => :optional do
    dir.nil? ? Ninjs::Command.create(app_name) : Ninjs::Command.create(app_name, dir)
  end

  option :elements
  option :model
  flag :e => :elements
  flag :m => :model
  command :generate, :object, :obj_name do
    with = {
        :model => model.given?,
        :elements => elements.given?
    }
    
    Ninjs::Command.generate(object, obj_name, with)
  end
  
  command :upgrade do
    Ninjs::Command.upgrade
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ninjs-0.13.1 bin/ninjs