Class: Bizflow::BuildCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/bizflow/command/build_command.rb

Class Method Summary collapse

Class Method Details

.run(config, args = []) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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