Class: NetLinx::Rake::Workspace::CreateWorkspaceConfig

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/netlinx/rake/workspace/create_workspace_config.rb

Overview

Create a workspace config.yaml file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :create_workspace_config) {|_self| ... } ⇒ CreateWorkspaceConfig

Returns a new instance of CreateWorkspaceConfig.

Yields:

  • (_self)

Yield Parameters:



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
39
40
41
42
43
44
# File 'lib/netlinx/rake/workspace/create_workspace_config.rb', line 13

def initialize name = :create_workspace_config
  @name = name
  yield self if block_given?
  
  desc "Create a workspace config.yaml file."
  
  task(name) do
    config_file = 'workspace.config.yaml'
    
    if File.exists? config_file
      puts "Aborted: #{config_file} already exists."
      next
    end
    
    File.open config_file, 'w' do |f|
      f.write <<EOS
systems:
  -
    name: Client - Room
    connection: 192.168.1.2
    touch_panels:
      -
path: Touch Panel.TP4
dps: 10001:1:0
    ir:
      -
path: IR.irl
dps: 5001:1:0
EOS
    end
  end
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/netlinx/rake/workspace/create_workspace_config.rb', line 11

def name
  @name
end