class Bizflow::BuildCommand

Public Class Methods

run(config, args = []) click to toggle source
# File lib/bizflow/command/build_command.rb, line 7
def self.run(config, args = [])

  if(args[:args].empty?)
    raise "Setup command needs environment argument (production, development, test...)"
  end
  environment = args[:args].first

  puts "Building processes..."

  require 'bizflow/lib/semantic_builder'

  source_path = args[0] || config[:source_path]
  raise "dsl source path not specified" if source_path.nil?
  source_path = "#{Dir.pwd}/#{source_path}"
  domain_repo = Bizflow::Lib::SemanticBuilder.new(source_path).build

  raise "bizflow database path not specified" if config[:db_path].nil?
  
  db_path = "bizflow_db/bf-#{environment}.db"
  db_path = "#{Dir.pwd}/#{db_path}"

  db = Sequel.sqlite(db_path)

  Dir["#{File.dirname(__FILE__)}/../model/*.rb"].each { |path| require_relative path }

  require 'bizflow/lib/blueprint_builder'

  Bizflow::Lib::BlueprintBuilder.new.build(domain_repo)

  puts "Processes built"

end