serialport-server 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/History.txt +3 -0
- data/Manifest.txt +19 -0
- data/README.rdoc +46 -0
- data/Rakefile +32 -0
- data/bin/serialport-server +140 -0
- data/lib/serialport-server.rb +6 -0
- data/sample/README.md +13 -0
- data/sample/ajax/index.html +53 -0
- data/sample/ajax/jquery.js +9404 -0
- data/sample/ajax/main.js +18 -0
- data/sample/arduino/arduino.ino +26 -0
- data/sample/websocket/index.html +54 -0
- data/sample/websocket/jquery.js +9404 -0
- data/sample/websocket/main.js +35 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/test/test_helper.rb +3 -0
- data/test/test_serialport-server.rb +11 -0
- metadata +220 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
var ws;
|
3
|
+
|
4
|
+
$(function(){
|
5
|
+
$('.websocket .btn').click(function(){
|
6
|
+
if(ws == null || ws.readyState != 1){
|
7
|
+
ws = new WebSocket($('#addr').val());
|
8
|
+
$('#addr').attr('disabled','disabled');
|
9
|
+
$('.websocket .btn').val('close');
|
10
|
+
ws.onopen = function(){
|
11
|
+
alert('websocket open');
|
12
|
+
};
|
13
|
+
ws.onclose = function(){
|
14
|
+
alert('websocket closed')
|
15
|
+
$('.websocket .btn').val('open');
|
16
|
+
$('#addr').attr('disabled',null);
|
17
|
+
};
|
18
|
+
ws.onmessage = function(e){
|
19
|
+
$('.cds input').val(e.data);
|
20
|
+
};
|
21
|
+
}
|
22
|
+
else{
|
23
|
+
ws.close();
|
24
|
+
$('.websocket .btn').val('open');
|
25
|
+
$('#addr').attr('disabled',null);
|
26
|
+
}
|
27
|
+
});
|
28
|
+
|
29
|
+
$('.led .on').click(function(){
|
30
|
+
ws.send('o');
|
31
|
+
});
|
32
|
+
$('.led .off').click(function(){
|
33
|
+
ws.send('x');
|
34
|
+
});
|
35
|
+
});
|
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/serialport-server.rb'}"
|
9
|
+
puts "Loading serialport-server gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,220 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: serialport-server
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Sho Hashimoto
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-05-17 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: serialport
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 31
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 0
|
32
|
+
- 4
|
33
|
+
version: 1.0.4
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: eventmachine
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: eventmachine_httpserver
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
type: :runtime
|
63
|
+
version_requirements: *id003
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: em-websocket
|
66
|
+
prerelease: false
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
type: :runtime
|
77
|
+
version_requirements: *id004
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: args_parser
|
80
|
+
prerelease: false
|
81
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
87
|
+
segments:
|
88
|
+
- 0
|
89
|
+
version: "0"
|
90
|
+
type: :runtime
|
91
|
+
version_requirements: *id005
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: json
|
94
|
+
prerelease: false
|
95
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
type: :runtime
|
105
|
+
version_requirements: *id006
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
name: rdoc
|
108
|
+
prerelease: false
|
109
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ~>
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
hash: 19
|
115
|
+
segments:
|
116
|
+
- 3
|
117
|
+
- 10
|
118
|
+
version: "3.10"
|
119
|
+
type: :development
|
120
|
+
version_requirements: *id007
|
121
|
+
- !ruby/object:Gem::Dependency
|
122
|
+
name: newgem
|
123
|
+
prerelease: false
|
124
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
hash: 5
|
130
|
+
segments:
|
131
|
+
- 1
|
132
|
+
- 5
|
133
|
+
- 3
|
134
|
+
version: 1.5.3
|
135
|
+
type: :development
|
136
|
+
version_requirements: *id008
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: hoe
|
139
|
+
prerelease: false
|
140
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
hash: 29
|
146
|
+
segments:
|
147
|
+
- 2
|
148
|
+
- 15
|
149
|
+
version: "2.15"
|
150
|
+
type: :development
|
151
|
+
version_requirements: *id009
|
152
|
+
description: access SerialPort via HTTP, WebSocket and TCP Socket.
|
153
|
+
email:
|
154
|
+
- hashimoto@shokai.org
|
155
|
+
executables:
|
156
|
+
- serialport-server
|
157
|
+
extensions: []
|
158
|
+
|
159
|
+
extra_rdoc_files:
|
160
|
+
- History.txt
|
161
|
+
- Manifest.txt
|
162
|
+
- README.rdoc
|
163
|
+
files:
|
164
|
+
- History.txt
|
165
|
+
- Manifest.txt
|
166
|
+
- README.rdoc
|
167
|
+
- Rakefile
|
168
|
+
- script/console
|
169
|
+
- script/destroy
|
170
|
+
- script/generate
|
171
|
+
- test/test_helper.rb
|
172
|
+
- test/test_serialport-server.rb
|
173
|
+
- bin/serialport-server
|
174
|
+
- lib/serialport-server.rb
|
175
|
+
- sample/README.md
|
176
|
+
- sample/ajax/index.html
|
177
|
+
- sample/ajax/jquery.js
|
178
|
+
- sample/ajax/main.js
|
179
|
+
- sample/arduino/arduino.ino
|
180
|
+
- sample/websocket/index.html
|
181
|
+
- sample/websocket/jquery.js
|
182
|
+
- sample/websocket/main.js
|
183
|
+
- .gemtest
|
184
|
+
homepage: http://shokai.github.com/serialport-server
|
185
|
+
licenses: []
|
186
|
+
|
187
|
+
post_install_message: "!! For more information on serialport-server, see http://shokai.github.com/serialport-server"
|
188
|
+
rdoc_options:
|
189
|
+
- --main
|
190
|
+
- README.rdoc
|
191
|
+
require_paths:
|
192
|
+
- lib
|
193
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
194
|
+
none: false
|
195
|
+
requirements:
|
196
|
+
- - ">="
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
hash: 3
|
199
|
+
segments:
|
200
|
+
- 0
|
201
|
+
version: "0"
|
202
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
|
+
none: false
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
hash: 3
|
208
|
+
segments:
|
209
|
+
- 0
|
210
|
+
version: "0"
|
211
|
+
requirements: []
|
212
|
+
|
213
|
+
rubyforge_project: serialport-server
|
214
|
+
rubygems_version: 1.8.17
|
215
|
+
signing_key:
|
216
|
+
specification_version: 3
|
217
|
+
summary: access SerialPort via HTTP, WebSocket and TCP Socket.
|
218
|
+
test_files:
|
219
|
+
- test/test_helper.rb
|
220
|
+
- test/test_serialport-server.rb
|