nabaztag_hack_kit 0.1.0.alpha3 → 0.1.0.alpha4
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/record/Gemfile +5 -0
- data/examples/record/server.rb +1 -1
- data/lib/nabaztag_hack_kit/server.rb +17 -6
- data/lib/nabaztag_hack_kit/version.rb +1 -1
- data/spec/integration/server_spec.rb +1 -1
- metadata +10 -10
data/examples/record/Gemfile
CHANGED
data/examples/record/server.rb
CHANGED
@@ -11,12 +11,15 @@ module NabaztagHackKit
|
|
11
11
|
enable :logging
|
12
12
|
end
|
13
13
|
|
14
|
+
# set :public_folder, File.dirname(__FILE__) + '../public'
|
15
|
+
|
14
16
|
REC_FILE = "rec.wav"
|
15
17
|
PREFIX = "/api/:bunnyid"
|
16
18
|
|
17
|
-
def initialize(
|
19
|
+
def initialize(opts = {})
|
18
20
|
super
|
19
|
-
@
|
21
|
+
@base_file = opts.fetch(:base_file, __FILE__)
|
22
|
+
@bytecode_file = opts.fetch(:bytecode_file, public_file('bytecode.bin'))
|
20
23
|
end
|
21
24
|
|
22
25
|
class << self
|
@@ -60,8 +63,12 @@ module NabaztagHackKit
|
|
60
63
|
end
|
61
64
|
|
62
65
|
get "/bc.jsp" do
|
63
|
-
|
64
|
-
|
66
|
+
if File.exists?(@bytecode_file)
|
67
|
+
logger.info "Serving Bytecode from #{@bytecode_file}"
|
68
|
+
send_file @bytecode_file
|
69
|
+
else
|
70
|
+
status 404
|
71
|
+
end
|
65
72
|
end
|
66
73
|
|
67
74
|
post "#{PREFIX}/log.jsp" do
|
@@ -90,7 +97,11 @@ module NabaztagHackKit
|
|
90
97
|
end
|
91
98
|
|
92
99
|
get "/streams/:file.mp3" do
|
93
|
-
|
100
|
+
if (file = public_file("#{params[:file]}.mp3")) && File.exists?(file)
|
101
|
+
File.read file
|
102
|
+
else
|
103
|
+
status 404
|
104
|
+
end
|
94
105
|
end
|
95
106
|
|
96
107
|
# generic callback
|
@@ -108,7 +119,7 @@ module NabaztagHackKit
|
|
108
119
|
|
109
120
|
protected
|
110
121
|
def public_file(name)
|
111
|
-
File.expand_path(File.join('..', 'public', name),
|
122
|
+
File.expand_path(File.join('..', 'public', name), @base_file)
|
112
123
|
end
|
113
124
|
end
|
114
125
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nabaztag_hack_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.alpha4
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bytecode/bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-21 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
16
|
-
requirement: &
|
16
|
+
requirement: &70133294055600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70133294055600
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70133294055060 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70133294055060
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70133294054600 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70133294054600
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rack-test
|
49
|
-
requirement: &
|
49
|
+
requirement: &70133294054140 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70133294054140
|
58
58
|
description: Sinatra server api framework to run custom bytecode on Nabaztag v1/v2.
|
59
59
|
Sources + Compiler included (linux only)
|
60
60
|
email:
|