netlinx-workspace 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +206 -6
  3. data/bin/netlinx-workspace +27 -0
  4. data/doc/NetLinx.html +18 -7
  5. data/doc/NetLinx/Compile.html +15 -4
  6. data/doc/NetLinx/Compile/Extension.html +15 -4
  7. data/doc/NetLinx/Compile/Extension/APW.html +8 -8
  8. data/doc/NetLinx/Project.html +334 -90
  9. data/doc/NetLinx/Rake.html +128 -0
  10. data/doc/NetLinx/Rake/Workspace.html +128 -0
  11. data/doc/NetLinx/Rake/Workspace/CreateWorkspaceConfig.html +387 -0
  12. data/doc/NetLinx/Rake/Workspace/GenerateAPW.html +371 -0
  13. data/doc/NetLinx/System.html +1341 -217
  14. data/doc/NetLinx/SystemFile.html +454 -51
  15. data/doc/NetLinx/Workspace.html +434 -69
  16. data/doc/NetLinx/Workspace/YAML.html +398 -0
  17. data/doc/_index.html +66 -4
  18. data/doc/class_list.html +6 -2
  19. data/doc/file.README.html +218 -10
  20. data/doc/file.license.html +4 -4
  21. data/doc/file_list.html +5 -1
  22. data/doc/frames.html +1 -1
  23. data/doc/index.html +218 -10
  24. data/doc/js/full_list.js +4 -1
  25. data/doc/method_list.html +171 -23
  26. data/doc/top-level-namespace.html +3 -3
  27. data/lib/netlinx/compile/extension/apw.rb +3 -0
  28. data/lib/netlinx/rake/workspace.rb +14 -0
  29. data/lib/netlinx/rake/workspace/create_workspace_config.rb +49 -0
  30. data/lib/netlinx/rake/workspace/generate_apw.rb +41 -0
  31. data/lib/netlinx/workspace.rb +58 -14
  32. data/lib/netlinx/workspace/project.rb +107 -0
  33. data/lib/netlinx/workspace/system.rb +226 -0
  34. data/lib/netlinx/workspace/system_file.rb +98 -0
  35. data/lib/netlinx/workspace/yaml.rb +217 -0
  36. data/license.txt +1 -1
  37. metadata +53 -28
  38. data/lib/netlinx-workspace.rb +0 -1
  39. data/lib/netlinx/project.rb +0 -83
  40. data/lib/netlinx/system.rb +0 -122
  41. data/lib/netlinx/system_file.rb +0 -36
@@ -1 +0,0 @@
1
- require 'netlinx/workspace'
@@ -1,83 +0,0 @@
1
- require 'netlinx/system'
2
-
3
- module NetLinx
4
- # A collection of NeTLinx systems.
5
- # Workspace -> Project -> System
6
- class Project
7
- attr_accessor :name
8
- attr_accessor :description
9
- attr_accessor :dealer
10
- attr_accessor :designer
11
- attr_accessor :sales_order
12
- attr_accessor :purchase_order
13
- attr_accessor :workspace # A reference to the project's parent workspace.
14
- attr_accessor :systems
15
-
16
- def initialize(**kvargs)
17
- @name = kvargs.fetch :name, ''
18
- @description = kvargs.fetch :description, ''
19
- @dealer = kvargs.fetch :dealer, ''
20
- @designer = kvargs.fetch :designer, ''
21
- @sales_order = kvargs.fetch :sales_order, ''
22
- @purchase_order = kvargs.fetch :purchase_order, ''
23
- @workspace = kvargs.fetch :workspace, nil
24
-
25
- @systems = []
26
-
27
- project_element = kvargs.fetch :element, nil
28
- parse_xml_element project_element if project_element
29
- end
30
-
31
- # Alias to add a system.
32
- def <<(system)
33
- @systems << system
34
- system.project = self
35
- end
36
-
37
- # Returns the project name.
38
- def to_s
39
- @name
40
- end
41
-
42
- # Returns true if the project contains the specified file.
43
- def include?(file)
44
- included = false
45
-
46
- systems.each do |system|
47
- included = system.include? file
48
- break if included
49
- end
50
-
51
- included
52
- end
53
-
54
- # Compile all systems in this project.
55
- def compile
56
- compiler_results = []
57
- @systems.each {|system| compiler_results << (system.compile).first}
58
- compiler_results
59
- end
60
-
61
- private
62
-
63
- def parse_xml_element(project)
64
- # Load project params.
65
- @name = project.elements['Identifier'].text.strip
66
- @designer = project.elements['Designer'].text
67
- @dealer = project.elements['DealerID'].text
68
- @sales_order = project.elements['SalesOrder'].text
69
- @purchase_order = project.elements['PurchaseOrder'].text
70
- @description = project.elements['Comments'].text
71
-
72
- # Load systems.
73
- project.each_element 'System' do |e|
74
- system = NetLinx::System.new \
75
- element: e,
76
- project: self
77
-
78
- @systems << system
79
- end
80
- end
81
-
82
- end
83
- end
@@ -1,122 +0,0 @@
1
- require 'netlinx/system_file'
2
-
3
- module NetLinx
4
- # A collection of resources loaded onto a NetLinx master.
5
- # Workspace -> Project -> System
6
- class System
7
- attr_accessor :name
8
- attr_accessor :id
9
- attr_accessor :description
10
- attr_accessor :project # A reference to the system's parent project.
11
- attr_accessor :files
12
-
13
- def initialize(**kvargs)
14
- @name = kvargs.fetch :name, ''
15
- @id = kvargs.fetch :id, ''
16
- @description = kvargs.fetch :description, ''
17
- @project = kvargs.fetch :project, nil
18
-
19
- @files = []
20
-
21
- @compiler_target_files = []
22
- @compiler_include_paths = []
23
- @compiler_module_paths = []
24
- @compiler_library_paths = []
25
-
26
- system_element = kvargs.fetch :element, nil
27
- parse_xml_element system_element if system_element
28
- end
29
-
30
- # Alias to add a file.
31
- def <<(file)
32
- @files << file
33
- file.system = self
34
- end
35
-
36
- # Returns the system name.
37
- def to_s
38
- @name
39
- end
40
-
41
- # See Test::NetLinx::Compilable.
42
- def compiler_target_files
43
- @files
44
- .select {|f| f.type == 'MasterSrc'}
45
- .map {|f| File.expand_path \
46
- f.path.gsub('\\', '/'),
47
- f.system.project.workspace.path
48
- }.uniq
49
- end
50
-
51
- # See Test::NetLinx::Compilable.
52
- def compiler_include_paths
53
- @files
54
- .select {|f| f.type == 'Include'}
55
- .map {|f| File.expand_path \
56
- File.dirname(f.path.gsub('\\', '/')),
57
- f.system.project.workspace.path
58
- }.uniq
59
- end
60
-
61
- # See Test::NetLinx::Compilable.
62
- def compiler_module_paths
63
- @files
64
- .select {|f| f.type == 'Module' || f.type == 'TKO' || f.type == 'DUET'}
65
- .map {|f| File.expand_path \
66
- File.dirname(f.path.gsub('\\', '/')),
67
- f.system.project.workspace.path
68
- }.uniq
69
- end
70
-
71
- # See Test::NetLinx::Compilable.
72
- def compiler_library_paths
73
- []
74
- end
75
-
76
- # Returns true if the project contains the specified file.
77
- def include?(file)
78
- included = false
79
-
80
- @files.each do |f|
81
- name_included = f.name.downcase.eql? file.downcase
82
-
83
- # TODO: This should probably be relative to the workspace path,
84
- # which can be found by traversing @project, @workspace.
85
- path_included = file.gsub(/\\/, '/').include? f.path.gsub(/\\/, '/')
86
-
87
- included = name_included || path_included
88
- break if included
89
- end
90
-
91
- included
92
- end
93
-
94
- # Compile this system.
95
- def compile
96
- # The compiler dependency is only needed if this method is called.
97
- require 'netlinx/compiler'
98
-
99
- compiler = NetLinx::Compiler.new
100
- compiler.compile self
101
- end
102
-
103
- private
104
-
105
- def parse_xml_element(system)
106
- # Load system params.
107
- @name = system.elements['Identifier'].text.strip
108
- @id = system.elements['SysID'].text.strip.to_i
109
- @description = system.elements['Comments'].text
110
-
111
- # Create system files.
112
- system.each_element 'File' do |e|
113
- system_file = NetLinx::SystemFile.new \
114
- element: e,
115
- system: self
116
-
117
- @files << system_file
118
- end
119
- end
120
-
121
- end
122
- end
@@ -1,36 +0,0 @@
1
- module NetLinx
2
- class SystemFile
3
- attr_accessor :name
4
- attr_accessor :type
5
- attr_accessor :path
6
- attr_accessor :description
7
- attr_accessor :system
8
-
9
- def initialize(**kvargs)
10
- @name = kvargs.fetch :name, ''
11
- @type = kvargs.fetch :type, ''
12
- @path = kvargs.fetch :path, ''
13
- @description = kvargs.fetch :description, ''
14
- @system = kvargs.fetch :system, nil
15
-
16
- system_file_element = kvargs.fetch :element, nil
17
- parse_xml_element system_file_element if system_file_element
18
- end
19
-
20
- # Print the SystemFile's name.
21
- def to_s
22
- @name
23
- end
24
-
25
- private
26
-
27
- def parse_xml_element(system_file)
28
- # Load system file params.
29
- @name = system_file.elements['Identifier'].text.strip
30
- @type = system_file.attributes['Type']
31
- @path = system_file.elements['FilePathName'].text.strip
32
- @description = system_file.elements['Comments'].text
33
- end
34
-
35
- end
36
- end