tmm1-erlectricity 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. data/CONTRIBUTORS +2 -0
  2. data/History.txt +1 -0
  3. data/Manifest.txt +45 -0
  4. data/README.txt +51 -0
  5. data/Rakefile +71 -0
  6. data/examples/gruff/gruff.erl +62 -0
  7. data/examples/gruff/gruff_provider.rb +36 -0
  8. data/examples/gruff/gruff_run.erl +17 -0
  9. data/examples/gruff/stat_run.erl +18 -0
  10. data/examples/gruff/stat_writer.erl +40 -0
  11. data/examples/tinderl/tinderl.erl +45 -0
  12. data/examples/tinderl/tinderl.rb +27 -0
  13. data/ext/decoder.c +391 -0
  14. data/ext/extconf.rb +11 -0
  15. data/lib/erlectricity.rb +37 -0
  16. data/lib/erlectricity/condition.rb +51 -0
  17. data/lib/erlectricity/conditions/hash.rb +14 -0
  18. data/lib/erlectricity/conditions/static.rb +13 -0
  19. data/lib/erlectricity/conditions/type.rb +17 -0
  20. data/lib/erlectricity/constants.rb +37 -0
  21. data/lib/erlectricity/decoder.rb +204 -0
  22. data/lib/erlectricity/encoder.rb +127 -0
  23. data/lib/erlectricity/errors/decode_error.rb +3 -0
  24. data/lib/erlectricity/errors/encode_error.rb +3 -0
  25. data/lib/erlectricity/errors/erlectricity_error.rb +3 -0
  26. data/lib/erlectricity/matcher.rb +38 -0
  27. data/lib/erlectricity/port.rb +46 -0
  28. data/lib/erlectricity/receiver.rb +78 -0
  29. data/lib/erlectricity/types/function.rb +3 -0
  30. data/lib/erlectricity/types/list.rb +1 -0
  31. data/lib/erlectricity/types/new_function.rb +3 -0
  32. data/lib/erlectricity/types/new_reference.rb +3 -0
  33. data/lib/erlectricity/types/pid.rb +3 -0
  34. data/lib/erlectricity/types/reference.rb +3 -0
  35. data/lib/erlectricity/version.rb +9 -0
  36. data/setup.rb +1585 -0
  37. data/test/condition_spec.rb +73 -0
  38. data/test/decode_spec.rb +129 -0
  39. data/test/encode_spec.rb +132 -0
  40. data/test/matcher_spec.rb +69 -0
  41. data/test/port_spec.rb +35 -0
  42. data/test/receiver_spec.rb +105 -0
  43. data/test/spec_suite.rb +2 -0
  44. data/test/test_erlectricity.rb +2 -0
  45. data/test/test_helper.rb +42 -0
  46. metadata +102 -0
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+ Dir[File.dirname(__FILE__) + '/*_spec.rb'].each{ |f| require f}
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
@@ -0,0 +1,42 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
2
+ require 'erlectricity'
3
+ require 'rubygems'
4
+ require 'test/unit'
5
+ require 'test/spec'
6
+
7
+ class Test::Unit::TestCase
8
+
9
+ def run_erl(code)
10
+ cmd = %Q{erl -noshell -eval "A = #{code.split.join(' ')}, io:put_chars(A)." -s erlang halt}
11
+ `#{cmd}`
12
+ end
13
+
14
+ def encode_packet(code)
15
+ bin = run_erl("term_to_binary(#{code})")
16
+ [bin.length, bin].pack("Na#{bin.length}")
17
+ end
18
+
19
+ def word_length
20
+ (1.size * 8) - 2
21
+ end
22
+ end
23
+
24
+ class FakePort < Erlectricity::Port
25
+ attr_reader :sent
26
+ attr_reader :terms
27
+
28
+ def initialize(*terms)
29
+ @terms = terms
30
+ @sent = []
31
+ super(StringIO.new(""), StringIO.new(""))
32
+ end
33
+
34
+ def send(term)
35
+ sent << term
36
+ end
37
+
38
+ private
39
+ def read_from_input
40
+ @terms.shift
41
+ end
42
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tmm1-erlectricity
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Scott Fleckenstein
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-06-04 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: A library to interface erlang and ruby through the erlang port system
17
+ email: nullstyle@gmail.com
18
+ executables: []
19
+
20
+ extensions:
21
+ - ext/extconf.rb
22
+ extra_rdoc_files:
23
+ - History.txt
24
+ - Manifest.txt
25
+ - README.txt
26
+ files:
27
+ - CONTRIBUTORS
28
+ - History.txt
29
+ - Manifest.txt
30
+ - README.txt
31
+ - Rakefile
32
+ - examples/gruff/gruff.erl
33
+ - examples/gruff/gruff_provider.rb
34
+ - examples/gruff/gruff_run.erl
35
+ - examples/gruff/stat_run.erl
36
+ - examples/gruff/stat_writer.erl
37
+ - examples/tinderl/tinderl.erl
38
+ - examples/tinderl/tinderl.rb
39
+ - ext/decoder.c
40
+ - ext/extconf.rb
41
+ - lib/erlectricity.rb
42
+ - lib/erlectricity/condition.rb
43
+ - lib/erlectricity/conditions/hash.rb
44
+ - lib/erlectricity/conditions/static.rb
45
+ - lib/erlectricity/conditions/type.rb
46
+ - lib/erlectricity/constants.rb
47
+ - lib/erlectricity/decoder.rb
48
+ - lib/erlectricity/encoder.rb
49
+ - lib/erlectricity/errors/decode_error.rb
50
+ - lib/erlectricity/errors/encode_error.rb
51
+ - lib/erlectricity/errors/erlectricity_error.rb
52
+ - lib/erlectricity/matcher.rb
53
+ - lib/erlectricity/port.rb
54
+ - lib/erlectricity/receiver.rb
55
+ - lib/erlectricity/types/function.rb
56
+ - lib/erlectricity/types/list.rb
57
+ - lib/erlectricity/types/new_function.rb
58
+ - lib/erlectricity/types/new_reference.rb
59
+ - lib/erlectricity/types/pid.rb
60
+ - lib/erlectricity/types/reference.rb
61
+ - lib/erlectricity/version.rb
62
+ - setup.rb
63
+ - test/condition_spec.rb
64
+ - test/decode_spec.rb
65
+ - test/encode_spec.rb
66
+ - test/matcher_spec.rb
67
+ - test/port_spec.rb
68
+ - test/receiver_spec.rb
69
+ - test/spec_suite.rb
70
+ - test/test_erlectricity.rb
71
+ - test/test_helper.rb
72
+ has_rdoc: true
73
+ homepage: http://erlectricity.rubyforge.org
74
+ post_install_message:
75
+ rdoc_options:
76
+ - --main
77
+ - README.txt
78
+ require_paths:
79
+ - lib
80
+ - ext
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: "0"
86
+ version:
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: "0"
92
+ version:
93
+ requirements: []
94
+
95
+ rubyforge_project: erlectricity
96
+ rubygems_version: 1.0.1
97
+ signing_key:
98
+ specification_version: 2
99
+ summary: A library to interface erlang and ruby through the erlang port system
100
+ test_files:
101
+ - test/test_erlectricity.rb
102
+ - test/test_helper.rb