Class: ArcWeld::WeldCli

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/arc_weld/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



12
13
14
15
# File 'lib/arc_weld/cli.rb', line 12

def self.source_root
  @source_root ||= File.join( File.dirname( File.expand_path(__FILE__) ),
                              'templates')
end

Instance Method Details

#generate(filename = 'model.xml') ⇒ Object



38
39
40
41
42
43
44
# File 'lib/arc_weld/cli.rb', line 38

def generate(filename='model.xml')
  config = JSON.parse(File.read(options[:config]))
  project = ArcWeld::Cli::Project.new(config)
  outfile = File.join(project.output_dir, filename)
  archive = project.generate_archive
  File.open(outfile,'w') {|f| f.puts archive.xml.to_s }
end

#new(name) ⇒ Object



31
32
33
34
35
# File 'lib/arc_weld/cli.rb', line 31

def new(name)
  self.destination_root = options[:dir]
  @config = options.merge(name: name)
  directory(format('project-%s',options[:driver]),name)
end