Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.version = "0.9.0"
gem.name = "erlectricity"
gem.rubyforge_project = "erlectricity"
gem.summary = "A library to interface erlang and ruby through the erlang port system"
Expand Down Expand Up @@ -34,6 +35,7 @@ task :test do
end

puts "\nRunning `make` to build extensions and rerunning decoder specs..."
Dir.chdir('ext') { `ruby extconf.rb` }
Dir.chdir('ext') { `make` }
Open3.popen3("ruby test/decode_spec.rb") do |stdin, stdout, stderr|
while !stdout.eof?
Expand All @@ -59,6 +61,7 @@ end
task :default => :test

require 'rake/rdoctask'
require 'yaml'
Rake::RDocTask.new do |rdoc|
if File.exist?('VERSION.yml')
config = YAML.load(File.read('VERSION.yml'))
Expand All @@ -71,4 +74,4 @@ Rake::RDocTask.new do |rdoc|
rdoc.title = "erlectricity #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
end
4 changes: 0 additions & 4 deletions VERSION.yml

This file was deleted.

142 changes: 75 additions & 67 deletions erlectricity.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
Expand All @@ -6,92 +9,97 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Scott Fleckenstein", "Tom Preston-Werner"]
s.date = %q{2009-04-24}
s.date = %q{2010-10-08}
s.email = %q{tom@mojombo.com}
s.extensions = ["ext/extconf.rb"]
s.extensions = ["ext/extconf.rb", "ext/extconf.rb"]
s.extra_rdoc_files = [
"README.md"
"LICENSE",
"README.md"
]
s.files = [
"History.txt",
"README.md",
"Rakefile",
"VERSION.yml",
"examples/echo/echo.beam",
"examples/echo/echo.erl",
"examples/echo/echo.rb",
"examples/gruff/gruff.erl",
"examples/gruff/gruff_provider.rb",
"examples/gruff/gruff_run.erl",
"examples/gruff/stat_run.erl",
"examples/gruff/stat_writer.erl",
"examples/simple/rerl.rb",
"examples/simple/rerl.sh",
"examples/tinderl/tinderl.erl",
"examples/tinderl/tinderl.rb",
"ext/decoder.c",
"ext/extconf.rb",
"lib/erlectricity.rb",
"lib/erlectricity/condition.rb",
"lib/erlectricity/conditions/hash.rb",
"lib/erlectricity/conditions/static.rb",
"lib/erlectricity/conditions/type.rb",
"lib/erlectricity/constants.rb",
"lib/erlectricity/decoder.rb",
"lib/erlectricity/encoder.rb",
"lib/erlectricity/errors/decode_error.rb",
"lib/erlectricity/errors/encode_error.rb",
"lib/erlectricity/errors/erlectricity_error.rb",
"lib/erlectricity/matcher.rb",
"lib/erlectricity/port.rb",
"lib/erlectricity/receiver.rb",
"lib/erlectricity/types/function.rb",
"lib/erlectricity/types/list.rb",
"lib/erlectricity/types/new_function.rb",
"lib/erlectricity/types/new_reference.rb",
"lib/erlectricity/types/pid.rb",
"lib/erlectricity/types/reference.rb",
"lib/erlectricity/version.rb",
"test/condition_spec.rb",
"test/decode_spec.rb",
"test/encode_spec.rb",
"test/matcher_spec.rb",
"test/port_spec.rb",
"test/receiver_spec.rb",
"test/spec_suite.rb",
"test/test_erlectricity.rb",
"test/test_helper.rb"
".gitignore",
"History.txt",
"LICENSE",
"README.md",
"Rakefile",
"benchmarks/bench.rb",
"erlectricity.gemspec",
"examples/echo/README.md",
"examples/echo/echo.erl",
"examples/echo/echo.rb",
"examples/gruff/gruff.erl",
"examples/gruff/gruff_provider.rb",
"examples/gruff/gruff_run.sh",
"examples/gruff/stat_run.sh",
"examples/gruff/stat_writer.erl",
"examples/simple/README.md",
"examples/simple/rerl.rb",
"examples/simple/rerl.sh",
"examples/tinderl/README.md",
"examples/tinderl/tinderl.erl",
"examples/tinderl/tinderl.rb",
"ext/decoder.c",
"ext/extconf.rb",
"lib/erlectricity.rb",
"lib/erlectricity/condition.rb",
"lib/erlectricity/conditions/boolean.rb",
"lib/erlectricity/conditions/hash.rb",
"lib/erlectricity/conditions/static.rb",
"lib/erlectricity/conditions/type.rb",
"lib/erlectricity/constants.rb",
"lib/erlectricity/decoder.rb",
"lib/erlectricity/encoder.rb",
"lib/erlectricity/errors/decode_error.rb",
"lib/erlectricity/errors/encode_error.rb",
"lib/erlectricity/errors/erlectricity_error.rb",
"lib/erlectricity/matcher.rb",
"lib/erlectricity/port.rb",
"lib/erlectricity/receiver.rb",
"lib/erlectricity/types/function.rb",
"lib/erlectricity/types/list.rb",
"lib/erlectricity/types/new_function.rb",
"lib/erlectricity/types/new_reference.rb",
"lib/erlectricity/types/pid.rb",
"lib/erlectricity/types/reference.rb",
"lib/erlectricity/version.rb",
"test/condition_spec.rb",
"test/decode_spec.rb",
"test/encode_spec.rb",
"test/matcher_spec.rb",
"test/port_spec.rb",
"test/receiver_spec.rb",
"test/spec_suite.rb",
"test/test_helper.rb"
]
s.has_rdoc = true
s.homepage = %q{http://github.com/mojombo/erlectricity}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib", "ext"]
s.rubyforge_project = %q{erlectricity}
s.rubygems_version = %q{1.3.0}
s.rubygems_version = %q{1.3.7}
s.summary = %q{A library to interface erlang and ruby through the erlang port system}
s.test_files = [
"test/condition_spec.rb",
"test/decode_spec.rb",
"test/encode_spec.rb",
"test/matcher_spec.rb",
"test/port_spec.rb",
"test/receiver_spec.rb",
"test/spec_suite.rb",
"test/test_erlectricity.rb",
"test/test_helper.rb",
"examples/echo/echo.rb",
"examples/gruff/gruff_provider.rb",
"examples/simple/rerl.rb",
"examples/tinderl/tinderl.rb"
"test/matcher_spec.rb",
"test/condition_spec.rb",
"test/decode_spec.rb",
"test/receiver_spec.rb",
"test/spec_suite.rb",
"test/encode_spec.rb",
"test/port_spec.rb",
"examples/simple/rerl.rb",
"examples/echo/echo.rb",
"examples/gruff/gruff_provider.rb",
"examples/tinderl/tinderl.rb"
]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2
s.specification_version = 3

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
else
end
else
end
end

4 changes: 2 additions & 2 deletions ext/decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ VALUE read_small_bignum(unsigned char **pData) {
unsigned char buf[size + 1];
read_string_raw(buf, pData, size);

int i;
unsigned int i;
for(i = 0; i < size; ++i) {
tmp = INT2FIX(*(buf + i));
tmp = rb_funcall(tmp, rb_intern("<<"), 1, INT2NUM(i * 8));
Expand Down Expand Up @@ -257,7 +257,7 @@ VALUE read_large_bignum(unsigned char **pData) {
unsigned char buf[size + 1];
read_string_raw(buf, pData, size);

int i;
unsigned int i;
for(i = 0; i < size; ++i) {
tmp = INT2FIX(*(buf + i));
tmp = rb_funcall(tmp, rb_intern("<<"), 1, INT2NUM(i * 8));
Expand Down
4 changes: 3 additions & 1 deletion lib/erlectricity/port.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ def initialize(input=STDIN, output=STDOUT)
input.sync = true
output.sync = true

output.set_encoding("ASCII-8BIT")

@encoder = Erlectricity::Encoder.new(nil)
@skipped = []
@queue = []
Expand Down Expand Up @@ -43,4 +45,4 @@ def read_from_input
Erlectricity::Decoder.decode(data)
end
end
end
end
4 changes: 2 additions & 2 deletions test/condition_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.dirname(__FILE__) + '/test_helper.rb'
load File.dirname(__FILE__) + '/test_helper.rb'

context "Erlectricity::StaticConditions" do
specify "should satisfy on the same value" do
Expand Down Expand Up @@ -69,4 +69,4 @@
s = Erlectricity::HashCondition.new()
s.binding_for([[:foo, 3], [:bar, [3,4,5]]]).should == {:foo => 3, :bar => [3,4,5] }
end
end
end
8 changes: 4 additions & 4 deletions test/decode_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.dirname(__FILE__) + '/test_helper.rb'
load File.dirname(__FILE__) + '/test_helper.rb'

context "When unpacking from a binary stream" do
setup do
Expand Down Expand Up @@ -94,8 +94,8 @@
end

specify "an erlang list encoded as a string should decode to an array of bytes (less than ideal, but consistent)" do
get("\"asdasd\"").should == "asdasd".split('').map{|c| c[0]}
get("\"#{'a' * 65534}\"").should == ['a'[0]] * 65534
get("\"asdasd\"").should == "asdasd".split('').map{|c| c[0].ord}
get("\"#{'a' * 65534}\"").should == ['a'[0].ord] * 65534
end

specify "an erlang list encoded as a list should decode to a array" do
Expand Down Expand Up @@ -125,4 +125,4 @@ def get(str)
bin = run_erl(x)
Erlectricity::Decoder.decode(bin)
end
end
end
Loading