Sha256: 2282ad6506048dea784ad748e94c9482847cb80912e93c43efcec6e7d2b22afb

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'rubigen'

require 'rubigen/scripts/generate'

BUILD_FILE= 'Buildfile'

def find_project_file(dir=nil)
  cwd= Dir.pwd
  dir ||= Dir.pwd
  while dir.length > 1
    build_file= File.join(dir, BUILD_FILE)
    return build_file if File.exists?(build_file)
    
    projects= Dir.glob(File.join(dir, "*.jsproj"))
    return from_file(projects.first) if 1==projects.size
    
    unless 0==projects.size
      puts "More than one candidate for Project:"
      projects.each { |e|
        puts "  #{e}"
      }
      exit 1
    end
    
    dir= File.dirname(dir)
  end
  
  nil
end


case ARGV[0]
when 'app'
  # pull off app "command"
  ARGV.shift
  
  source = RubiGen::PathSource.new(:application, 
    File.join(File.dirname(__FILE__), "../app_generators"))
  RubiGen::Base.reset_sources
  RubiGen::Base.append_sources source

  RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'coherent')

when 'demo'
  # pull off app "command"
  ARGV.shift
  
  source = RubiGen::PathSource.new(:application, 
    File.join(File.dirname(__FILE__), "../demo_generators"))
  RubiGen::Base.reset_sources
  RubiGen::Base.append_sources source

  generator= ARGV.shift
  RubiGen::Scripts::Generate.new.run(ARGV, :generator => generator)
  
when 'plugin'
  require File.join(File.dirname(__FILE__), "../lib/plugin")
  ARGV.shift
  Coherent::Commands::Plugin.parse!
else
  PROJECT_FILE= find_project_file
  if !PROJECT_FILE
    puts "Could not determine project root."
    exit 1
  end
  
  APP_ROOT= File.dirname(PROJECT_FILE)

  RubiGen::Base.use_component_sources! [:coherent, :test_unit]
  RubiGen::Scripts::Generate.new.run(ARGV)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coherent-0.6.11 bin/coherent