Permalink
Browse files

cleanup

  * files restructured, speration byte & ruby code
  * update server for generic structure, added callback
  * mtl binaires respect defaults from local `.mtlrc` file
  • Loading branch information...
1 parent fcd83aa commit 12bf5a4613edc2e7d6d866d21f537b5f82b77c4f Tobias Bielohlawek committed Sep 3, 2012
Showing with 70 additions and 24 deletions.
  1. +7 −1 CHANGELOG.md
  2. +1 −11 Rakefile
  3. +7 −0 bytecode/Rakefile
  4. +7 −3 { → bytecode}/bin/mtl_comp
  5. 0 { → bytecode}/bin/mtl_merge
  6. +7 −3 { → bytecode}/bin/mtl_simu
  7. 0 {ext → bytecode/src}/bytecode/Commands.md
  8. 0 {ext → bytecode/src}/bytecode/Docs.md
  9. 0 {ext → bytecode/src}/bytecode/README.md
  10. 0 {ext → bytecode/src}/bytecode/lib/arp.mtl
  11. 0 {ext → bytecode/src}/bytecode/lib/cfg.mtl
  12. 0 {ext → bytecode/src}/bytecode/lib/choreos.mtl
  13. 0 {ext → bytecode/src}/bytecode/lib/dhcp.mtl
  14. 0 {ext → bytecode/src}/bytecode/lib/dns.mtl
  15. 0 {ext → bytecode/src}/bytecode/lib/http.mtl
  16. 0 {ext → bytecode/src}/bytecode/lib/tcp.mtl
  17. 0 {ext → bytecode/src}/bytecode/lib/udp.mtl
  18. 0 {ext → bytecode/src}/bytecode/lib/util.mtl
  19. 0 {ext → bytecode/src}/bytecode/lib/var.mtl
  20. 0 {ext → bytecode/src}/bytecode/lib/wifi.mtl
  21. 0 {ext → bytecode/src}/bytecode/nominal-ping.mtl
  22. 0 {ext → bytecode/src}/mtl/Makefile
  23. 0 {ext → bytecode/src}/mtl/README.md
  24. 0 {ext → bytecode/src}/mtl/bc.cpp
  25. BIN {ext → bytecode/src}/mtl/conf.bin.sans_password
  26. 0 {ext → bytecode/src}/mtl/config.txt
  27. 0 {ext → bytecode/src}/mtl/dumpbc.c
  28. 0 {ext → bytecode/src}/mtl/extconf.rb
  29. 0 {ext → bytecode/src}/mtl/linux_simu.c
  30. 0 {ext → bytecode/src}/mtl/linux_simuaudio.c
  31. 0 {ext → bytecode/src}/mtl/linux_simuaudio.h
  32. 0 {ext → bytecode/src}/mtl/linux_simunet.c
  33. 0 {ext → bytecode/src}/mtl/linux_simunet.h
  34. 0 {ext → bytecode/src}/mtl/log.c
  35. 0 {ext → bytecode/src}/mtl/log.h
  36. 0 {ext → bytecode/src}/mtl/main_compiler.cpp
  37. 0 {ext → bytecode/src}/mtl/main_simu.cpp
  38. 0 {ext → bytecode/src}/mtl/mp3/GTKANAL.H
  39. 0 {ext → bytecode/src}/mtl/mp3/LAYER3.C
  40. 0 {ext → bytecode/src}/mtl/mp3/TABINIT.C
  41. 0 {ext → bytecode/src}/mtl/mp3/common.c
  42. 0 {ext → bytecode/src}/mtl/mp3/dct64_i386.c
  43. 0 {ext → bytecode/src}/mtl/mp3/decode_i386.c
  44. 0 {ext → bytecode/src}/mtl/mp3/huffman.h
  45. 0 {ext → bytecode/src}/mtl/mp3/interface.c
  46. 0 {ext → bytecode/src}/mtl/mp3/mpg123.h
  47. 0 {ext → bytecode/src}/mtl/mp3/mpglib.h
  48. 0 {ext → bytecode/src}/mtl/properties.c
  49. 0 {ext → bytecode/src}/mtl/properties.h
  50. 0 {ext → bytecode/src}/mtl/simu.c
  51. 0 {ext → bytecode/src}/mtl/simuaudio.c
  52. 0 {ext → bytecode/src}/mtl/simuaudio.h
  53. 0 {ext → bytecode/src}/mtl/simunet.c
  54. 0 {ext → bytecode/src}/mtl/simunet.h
  55. 0 {ext → bytecode/src}/mtl/utils/correct_const.sh
  56. 0 {ext → bytecode/src}/mtl/vaudio.c
  57. 0 {ext → bytecode/src}/mtl/vaudio.h
  58. 0 {ext → bytecode/src}/mtl/vbc.h
  59. 0 {ext → bytecode/src}/mtl/vbc_str.h
  60. 0 {ext → bytecode/src}/mtl/vcomp/Makefile
  61. 0 {ext → bytecode/src}/mtl/vcomp/bootstrap.cpp
  62. 0 {ext → bytecode/src}/mtl/vcomp/compiler.cpp
  63. 0 {ext → bytecode/src}/mtl/vcomp/compiler.h
  64. 0 {ext → bytecode/src}/mtl/vcomp/compiler_file.cpp
  65. 0 {ext → bytecode/src}/mtl/vcomp/compiler_prog.cpp
  66. 0 {ext → bytecode/src}/mtl/vcomp/compiler_term.cpp
  67. 0 {ext → bytecode/src}/mtl/vcomp/compiler_type.cpp
  68. 0 {ext → bytecode/src}/mtl/vcomp/compiler_var.cpp
  69. 0 {ext → bytecode/src}/mtl/vcomp/file.cpp
  70. 0 {ext → bytecode/src}/mtl/vcomp/file.h
  71. 0 {ext → bytecode/src}/mtl/vcomp/filesystem.h
  72. 0 {ext → bytecode/src}/mtl/vcomp/interpreter.cpp
  73. 0 {ext → bytecode/src}/mtl/vcomp/interpreter.h
  74. 0 {ext → bytecode/src}/mtl/vcomp/memory.cpp
  75. 0 {ext → bytecode/src}/mtl/vcomp/memory.h
  76. 0 {ext → bytecode/src}/mtl/vcomp/param.h
  77. 0 {ext → bytecode/src}/mtl/vcomp/parser.cpp
  78. 0 {ext → bytecode/src}/mtl/vcomp/parser.h
  79. 0 {ext → bytecode/src}/mtl/vcomp/parser_xml.cpp
  80. 0 {ext → bytecode/src}/mtl/vcomp/prodbuffer.cpp
  81. 0 {ext → bytecode/src}/mtl/vcomp/prodbuffer.h
  82. 0 {ext → bytecode/src}/mtl/vcomp/resource.h
  83. 0 {ext → bytecode/src}/mtl/vcomp/stdlib_core.cpp
  84. 0 {ext → bytecode/src}/mtl/vcomp/terminal.cpp
  85. 0 {ext → bytecode/src}/mtl/vcomp/terminal.h
  86. 0 {ext → bytecode/src}/mtl/vcomp/util.cpp
  87. 0 {ext → bytecode/src}/mtl/vcomp/util.h
  88. 0 {ext → bytecode/src}/mtl/vinterp.c
  89. 0 {ext → bytecode/src}/mtl/vinterp.h
  90. 0 {ext → bytecode/src}/mtl/vloader.c
  91. 0 {ext → bytecode/src}/mtl/vloader.h
  92. 0 {ext → bytecode/src}/mtl/vlog.c
  93. 0 {ext → bytecode/src}/mtl/vlog.h
  94. 0 {ext → bytecode/src}/mtl/vmem.c
  95. 0 {ext → bytecode/src}/mtl/vmem.h
  96. 0 {ext → bytecode/src}/mtl/vnet.c
  97. 0 {ext → bytecode/src}/mtl/vnet.h
  98. 0 {spec/bytecode → bytecode/test}/helper.mtl
  99. 0 {spec/bytecode → bytecode/test}/native.mtl
  100. 0 {spec/bytecode → bytecode/test}/test.mtl
  101. +1 −0 examples/monitor/.gitignore
  102. +6 −0 examples/monitor/Gemfile
  103. +8 −0 examples/monitor/config.ru
  104. +19 −0 examples/monitor/server.rb
  105. +2 −0 examples/record/server.rb
  106. +2 −3 lib/nabaztag_hack_kit/server.rb
  107. +1 −1 lib/nabaztag_hack_kit/version.rb
  108. +2 −2 nabaztag_hack_kit.gemspec
  109. 0 rec.wav
View
@@ -1,5 +1,11 @@
# Changes
+## v0.1.0 - xx-09-2012
+
+ * files restructured, speration byte & ruby code
+ * update server for generic structure, added callback
+ * mtl binaires respect defaults from local `.mtlrc` file
+
## v0.0.2 - 29-01-2012
* rename to NabaztagHackKit
@@ -8,4 +14,4 @@
## v0.0.1 - 28-01-2012
- * inital release
+ * inital release
View
@@ -1,16 +1,6 @@
require "bundler/gem_tasks"
-
require 'rspec/core/rake_task'
-RSpec::Core::RakeTask.new("unit") do |t|
- t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
-end
-namespace :test do
- desc "Test bytcode"
- task :bytecode do
- puts `bin/mtl_simu spec/bytecode/test.mtl`
- end
-end
+RSpec::Core::RakeTask.new(:spec)
-task :spec => [:unit]
task :default => :spec
View
@@ -0,0 +1,7 @@
+
+desc "Test bytcode"
+task :test do
+ puts `bin/mtl_simu test/test.mtl`
+end
+
+task :default => :test
@@ -1,8 +1,12 @@
#!/usr/bin/env ruby
-File.read(".mtlrc").split("\n").each do |line|
- var, *data = line.split("=")
- ENV[var] = data.join
+MTL_FILE = ".mtlrc"
+
+if File.exists?(MTL_FILE)
+ File.read(MTL_FILE).split("\n").each do |line|
+ var, *data = line.split("=")
+ ENV[var] = data.join
+ end
end
BIN_NAME = File.basename(__FILE__)
File renamed without changes.
@@ -1,8 +1,12 @@
#!/usr/bin/env ruby
-File.read(".mtlrc").split("\n").each do |line|
- var, *data = line.split("=")
- ENV[var] = data.join
+MTL_FILE = ".mtlrc"
+
+if File.exists?(MTL_FILE)
+ File.read(MTL_FILE).split("\n").each do |line|
+ var, *data = line.split("=")
+ ENV[var] = data.join
+ end
end
BIN_NAME = File.basename(__FILE__)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1 @@
+.rvmrc
View
@@ -0,0 +1,6 @@
+# A sample Gemfile
+source "http://rubygems.org"
+
+gem "nabaztag_hack_kit", {
+ :path => "/Users/tobi/Sites/ruby/NabaztagHackKit"
+}
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+
+#$LOAD_PATH.unshift ::File.expand_path(::File.dirname(__FILE__) + '/lib')
+require './server'
+
+use Rack::Reloader, 0
+
+run Server.new
View
@@ -0,0 +1,19 @@
+
+require "nabaztag_hack_kit/server"
+
+class Server < NabaztagHackKit::Server
+
+ def initialize
+ super('bytecode.bin')
+ end
+
+ on "button-pressed" do
+ send_nabaztag({
+ LED_L1 => [100,0,0,0],
+ LED_L2 => [0,100,0,100],
+ LED_L3 => [0,0,100,0]
+ })
+ end
+
+end
+
@@ -5,6 +5,8 @@
class Server < NabaztagHackKit::Server
+ REC_FILE = "rec.wav"
+
def initialize(echonest_cfg, soundcloud_cfg)
super('bytecode.bin')
@@echonest = Echonest(echonest_cfg[:key])
@@ -3,13 +3,11 @@
require 'nabaztag_hack_kit/message'
require 'nabaztag_hack_kit/message/api'
-
module NabaztagHackKit
class Server < Sinatra::Base
include Message::Api
- REC_FILE = "rec.wav"
- PREFIX = "/api"
+ PREFIX = "/api"
def initialize(bytecode_path = nil)
super
@@ -77,6 +75,7 @@ def callback(action, data, request)
callback('button-pressed', params[:duration], request)
end
+ # generic callback
%w(get post).each do |method|
send(method, "#{PREFIX}/:action.jsp") do
callback(params[:action], params, request)
@@ -1,3 +1,3 @@
module NabaztagHackKit
- VERSION = "0.0.3"
+ VERSION = "0.1.0"
end
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
- s.extensions = ['ext/mtl/extconf.rb']
+ s.executables = `git ls-files -- bytecode/bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.extensions = ['bytecode/src/mtl/extconf.rb']
s.executables = ['mtl_comp', 'mtl_simu', 'mtl_merge']
s.require_paths = ["lib"]
View
No changes.

0 comments on commit 12bf5a4

Please sign in to comment.