duet-bootstrap 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 27921562d72a16cdf929f5efcad5e7b699c2c4f9
4
+ data.tar.gz: c81e36b9600e49921d786c25171fc4a45a97f9ff
5
+ SHA512:
6
+ metadata.gz: 184c79bdb3376c64b86759818613618ad672255e60e406d08c6634eb90d0e6402cdef029e6cc4f1ed2312e5e5f3522a7381ba6f4c7f343b694b26f21b7f852f0
7
+ data.tar.gz: 16bbdc7ea060562aaa628375629301f2ddd4c69c5280feb968f1b548ea5653ac1aa59f6c9f9f9b8de6bd047595dd312258b9c9243e26c6148b8308ce507cf252
data/README.html ADDED
@@ -0,0 +1,7 @@
1
+ <h1>duet-bootstrap</h1>
2
+
3
+ <p>This gem generates a NetLinx workspace and source code to start up a Duet module. It is intended to be used when the entire AMX system has been programmed in Duet.</p>
4
+
5
+ <h2>Website</h2>
6
+
7
+ <p><a href="https://sourceforge.net/p/duet-bootstrap/wiki/Home/">https://sourceforge.net/p/duet-bootstrap/wiki/Home/</a></p>
@@ -0,0 +1,192 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ # Duet Bootstrap
4
+ # v1.0.0
5
+ #
6
+ # Website: https://sourceforge.net/projects/duet-bootstrap
7
+ #
8
+ #
9
+ # -- THIS IS A THIRD-PARTY TOOL AND IS NOT AFFILIATED WITH --
10
+ # -- THE AMX ORGANIZATION --
11
+ #
12
+ #
13
+ # This script was designed to run on Ruby v2.0.0-p0
14
+ # http://www.ruby-lang.org/en/downloads/
15
+ #
16
+ # OVERVIEW
17
+ #
18
+ # This script generates a NetLinx workspace and source code to start
19
+ # up a Duet module. It is intended to be used when the entire AMX
20
+ # system has been programmed in Duet.
21
+ #
22
+ # This script will generate a workspace and source file in the
23
+ # working directory. It will also compile the generated source
24
+ # code if the NetLinx compiler executable is found.
25
+ #
26
+ # CONFIGURATION
27
+ #
28
+ # It is recommended, although not required, to add this script to
29
+ # your operating system's PATH environment variable so that the
30
+ # script can be called from within the folder of a Duet project.
31
+ # There is plenty of information on the internet on how to do this.
32
+ #
33
+ # If you would like to change the default AMX master that will be
34
+ # used when generating workspaces, open the NetLinx Workspace file
35
+ # located at template/template.apw. Modify the communication
36
+ # settings, save the workspace, and close NetLinx Studio.
37
+ #
38
+ # EXECUTION
39
+ #
40
+ # This script will run on many different operating systems.
41
+ #
42
+ # On Windows, the fastest and easiest way to use this script is
43
+ # through the command line. Open Windows Explorer and browse
44
+ # to the folder of your compiled Duet .jar file. With no file
45
+ # selected, hold shift and right-click in the empty space of
46
+ # the file browser pane, then select "Open command window here"
47
+ # from the context menu.
48
+ #
49
+ # Run this script and pass the Duet module as a parameter in
50
+ # the file path. Pressing the tab key will auto-complete the
51
+ # file name.
52
+ #
53
+ # Example: >duet-bootstrap My_Duet_File_dr1_0_0.jar
54
+ #
55
+ #----------------------------------------------------------------------
56
+ # Copyright 2013 Alex McLain
57
+ #
58
+ # Licensed under the Apache License, Version 2.0 (the "License");
59
+ # you may not use this file except in compliance with the License.
60
+ # You may obtain a copy of the License at
61
+ #
62
+ # http://www.apache.org/licenses/LICENSE-2.0
63
+ #
64
+ # Unless required by applicable law or agreed to in writing, software
65
+ # distributed under the License is distributed on an "AS IS" BASIS,
66
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
67
+ # See the License for the specific language governing permissions and
68
+ # limitations under the License.
69
+ #----------------------------------------------------------------------
70
+
71
+ require 'rexml/document'
72
+
73
+ templatePath = File.expand_path '../../lib/duet-bootstrap/template', __FILE__
74
+
75
+ params = Hash.new
76
+
77
+ # Initialize parameters.
78
+ params[:projectName] = ''
79
+ params[:duetModuleName] = ''
80
+ params[:duetModulePath] = ''
81
+
82
+ # Make sure Duet module file was passed to the script.
83
+ if ARGV[0].nil?
84
+ puts 'No Duet module was specified.'
85
+ exit
86
+ end
87
+
88
+ params[:duetModulePath] = ARGV[0].strip
89
+
90
+ # Check Duet file extension.
91
+ unless File.extname(params[:duetModulePath]).downcase == '.jar'
92
+ puts 'Input file was not a Duet file.'
93
+ exit
94
+ end
95
+
96
+ # Parse Duet module name.
97
+ params[:duetModuleName] = File.basename(params[:duetModulePath], '.jar')
98
+ params[:projectName] = params[:duetModuleName][/(.*)_dr[0-9]+/, 1].gsub(/_/, ' ')
99
+
100
+ # Import existing AMX workspace template.
101
+ workspaceTemplate = File.open("#{templatePath}/template.apw", 'r')
102
+ xml = REXML::Document.new(workspaceTemplate)
103
+
104
+ # Rename the workspace.
105
+ xml.elements.each('/Workspace/Identifier') do |identifier|
106
+ identifier.text = params[:projectName]
107
+ break
108
+ end
109
+
110
+ # Rename the project.
111
+ xml.elements.each('/Workspace/Project/Identifier') do |identifier|
112
+ identifier.text = params[:projectName]
113
+ break
114
+ end
115
+
116
+ # Rename the system.
117
+ xml.elements.each('/Workspace/Project/System/Identifier') do |identifier|
118
+ identifier.text = params[:projectName]
119
+ end
120
+
121
+ # Delete all links to files in the workspace's system. The script
122
+ # will regenerate them.
123
+ xml.elements.delete_all('/Workspace/Project/System/File')
124
+
125
+ # Add file nodes.
126
+ xml.elements.each('/Workspace/Project/System') do |e|
127
+
128
+ # Add Duet file.
129
+ fileElement = e.add_element('File')
130
+ fileElement.add_attributes('CompileType' => 'None', 'Type' => 'DUET')
131
+
132
+ identifier = fileElement.add_element('Identifier')
133
+ identifier.text = params[:duetModuleName]
134
+
135
+ filePathName = fileElement.add_element('FilePathName')
136
+ filePathName.text = params[:duetModulePath]
137
+
138
+ # Add NetLinx file.
139
+ fileElement = e.add_element('File')
140
+ fileElement.add_attributes('CompileType' => 'Netlinx', 'Type' => 'MasterSrc')
141
+
142
+ identifier = fileElement.add_element('Identifier')
143
+ identifier.text = params[:projectName]
144
+
145
+ filePathName = fileElement.add_element('FilePathName')
146
+ filePathName.text = "#{params[:projectName]}.axs"
147
+
148
+ break
149
+ end
150
+
151
+
152
+ # Save workspace.
153
+ File.open("#{params[:projectName]}.apw", 'w') do |file|
154
+ file << xml
155
+ end
156
+
157
+
158
+ # Import NetLinx source code file template.
159
+ template = File.open("#{templatePath}/template.axs", 'r').read
160
+
161
+ template.gsub!(/%%_PROJECT_NAME_%%/, params[:projectName])
162
+ template.gsub!(/%%_MODULE_NAME_%%/, params[:duetModuleName])
163
+
164
+ # Save source code file.
165
+ File.open("#{params[:projectName]}.axs", 'w') do |file|
166
+ file << template
167
+ end
168
+
169
+ puts 'Generated project.'
170
+
171
+
172
+ # Check for NetLinx compiler.
173
+ compilerPath = 'C:\Program Files (x86)\Common Files\AMXShare\COM\nlrc.exe'
174
+
175
+ canCompile = File.exists?(compilerPath)
176
+ unless canCompile
177
+ # Use path for 32-bit O/S and try again.
178
+ compilerPath = 'C:\Program Files\Common Files\AMXShare\COM\nlrc.exe'
179
+
180
+ canCompile = File.exists?(compilerPath)
181
+ unless canCompile
182
+ puts 'NetLinx compiler not found. Can\'t auto-compile.'
183
+ end
184
+ end
185
+
186
+ # Execute NetLinx compiler.
187
+ if canCompile
188
+ system("\"#{compilerPath}\" \"#{File.absolute_path("#{params[:projectName]}.axs")}\"")
189
+ end
190
+
191
+ puts 'Done.'
192
+
data/doc/created.rid ADDED
@@ -0,0 +1,2 @@
1
+ Thu, 04 Jul 2013 10:00:32 -0700
2
+ lib/duet-bootstrap.rb Thu, 04 Jul 2013 09:36:35 -0700
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/doc/index.html ADDED
@@ -0,0 +1,69 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body>
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="project-metadata">
47
+
48
+ <nav id="classindex-section" class="section project-section">
49
+ <h3 class="section-header">Class and Module Index</h3>
50
+
51
+ <ul class="link-list">
52
+
53
+ </ul>
54
+ </nav>
55
+
56
+ </div>
57
+ </nav>
58
+
59
+ <div id="documentation" class="description">
60
+ <p>This is the API documentation for RDoc Documentation.
61
+ </div>
62
+
63
+
64
+ <footer id="validator-badges">
65
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
66
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.1.
67
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
68
+ </footer>
69
+
@@ -0,0 +1,155 @@
1
+ /**
2
+ *
3
+ * Darkfish Page Functions
4
+ * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
5
+ *
6
+ * Author: Michael Granger <mgranger@laika.com>
7
+ *
8
+ */
9
+
10
+ /* Provide console simulation for firebug-less environments */
11
+ if (!("console" in window) || !("firebug" in console)) {
12
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
13
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
14
+
15
+ window.console = {};
16
+ for (var i = 0; i < names.length; ++i)
17
+ window.console[names[i]] = function() {};
18
+ };
19
+
20
+
21
+ /**
22
+ * Unwrap the first element that matches the given @expr@ from the targets and return them.
23
+ */
24
+ $.fn.unwrap = function( expr ) {
25
+ return this.each( function() {
26
+ $(this).parents( expr ).eq( 0 ).after( this ).remove();
27
+ });
28
+ };
29
+
30
+
31
+ function showSource( e ) {
32
+ var target = e.target;
33
+ var codeSections = $(target).
34
+ parents('.method-detail').
35
+ find('.method-source-code');
36
+
37
+ $(target).
38
+ parents('.method-detail').
39
+ find('.method-source-code').
40
+ slideToggle();
41
+ };
42
+
43
+ function hookSourceViews() {
44
+ $('.method-heading').click( showSource );
45
+ };
46
+
47
+ function toggleDebuggingSection() {
48
+ $('.debugging-section').slideToggle();
49
+ };
50
+
51
+ function hookDebuggingToggle() {
52
+ $('#debugging-toggle img').click( toggleDebuggingSection );
53
+ };
54
+
55
+ function hookTableOfContentsToggle() {
56
+ $('.indexpage li .toc-toggle').each( function() {
57
+ $(this).click( function() {
58
+ $(this).toggleClass('open');
59
+ });
60
+
61
+ var section = $(this).next();
62
+
63
+ $(this).click( function() {
64
+ section.slideToggle();
65
+ });
66
+ });
67
+ }
68
+
69
+ function hookSearch() {
70
+ var input = $('#search-field').eq(0);
71
+ var result = $('#search-results').eq(0);
72
+ $(result).show();
73
+
74
+ var search_section = $('#search-section').get(0);
75
+ $(search_section).show();
76
+
77
+ var search = new Search(search_data, input, result);
78
+
79
+ search.renderItem = function(result) {
80
+ var li = document.createElement('li');
81
+ var html = '';
82
+
83
+ // TODO add relative path to <script> per-page
84
+ html += '<p class="search-match"><a href="' + rdoc_rel_prefix + result.path + '">' + this.hlt(result.title);
85
+ if (result.params)
86
+ html += '<span class="params">' + result.params + '</span>';
87
+ html += '</a>';
88
+
89
+
90
+ if (result.namespace)
91
+ html += '<p class="search-namespace">' + this.hlt(result.namespace);
92
+
93
+ if (result.snippet)
94
+ html += '<div class="search-snippet">' + result.snippet + '</div>';
95
+
96
+ li.innerHTML = html;
97
+
98
+ return li;
99
+ }
100
+
101
+ search.select = function(result) {
102
+ var result_element = result.get(0);
103
+ window.location.href = result_element.firstChild.firstChild.href;
104
+ }
105
+
106
+ search.scrollIntoView = search.scrollInWindow;
107
+ };
108
+
109
+ function highlightTarget( anchor ) {
110
+ console.debug( "Highlighting target '%s'.", anchor );
111
+
112
+ $("a[name]").each( function() {
113
+ if ( $(this).attr("name") == anchor ) {
114
+ if ( !$(this).parent().parent().hasClass('target-section') ) {
115
+ console.debug( "Wrapping the target-section" );
116
+ $('div.method-detail').unwrap( 'div.target-section' );
117
+ $(this).parent().wrap( '<div class="target-section"></div>' );
118
+ } else {
119
+ console.debug( "Already wrapped." );
120
+ }
121
+ }
122
+ });
123
+ };
124
+
125
+ function highlightLocationTarget() {
126
+ console.debug( "Location hash: %s", window.location.hash );
127
+ if ( ! window.location.hash || window.location.hash.length == 0 ) return;
128
+
129
+ var anchor = window.location.hash.substring(1);
130
+ console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
131
+
132
+ highlightTarget( anchor );
133
+ };
134
+
135
+ function highlightClickTarget( event ) {
136
+ console.debug( "Highlighting click target for event %o", event.target );
137
+ try {
138
+ var anchor = $(event.target).attr( 'href' ).substring(1);
139
+ console.debug( "Found target anchor: %s", anchor );
140
+ highlightTarget( anchor );
141
+ } catch ( err ) {
142
+ console.error( "Exception while highlighting: %o", err );
143
+ };
144
+ };
145
+
146
+
147
+ $(document).ready( function() {
148
+ hookSourceViews();
149
+ hookDebuggingToggle();
150
+ hookSearch();
151
+ highlightLocationTarget();
152
+ hookTableOfContentsToggle();
153
+
154
+ $('ul.link-list a').bind( "click", highlightClickTarget );
155
+ });