class NetLinx::Rake::Workspace::GenerateAPW
Generate .apw workspace file from yaml config.
Attributes
name[RW]
Public Class Methods
new(name = :generate_apw) { |self| ... }
click to toggle source
# File lib/netlinx/rake/workspace/generate_apw.rb, line 13 def initialize name = :generate_apw @name = name yield self if block_given? desc "Generate .apw workspace file from yaml config." task(name) do require 'netlinx/workspace' workspace_file = 'workspace.config.yaml' unless File.exists? workspace_file puts "File not found: #{workspace_file}" next end NetLinx::Workspace::YAML.parse_file(workspace_file).tap do |workspace| return unless workspace.name File.open("#{workspace.name.strip}.apw", 'w') do |f| f.write workspace.to_xml end end end end