Class: NetLinx::Rake::Workspace::GenerateAPW
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- NetLinx::Rake::Workspace::GenerateAPW
- Defined in:
- lib/netlinx/rake/workspace/generate_apw.rb
Overview
Generate .apw workspace file from yaml config.
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name = :generate_apw) {|_self| ... } ⇒ GenerateAPW
constructor
A new instance of GenerateAPW.
Constructor Details
#initialize(name = :generate_apw) {|_self| ... } ⇒ GenerateAPW
Returns a new instance of GenerateAPW
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# 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 |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
11 12 13 |
# File 'lib/netlinx/rake/workspace/generate_apw.rb', line 11 def name @name end |