rinruby 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +6 -0
- data/lib/rinruby.rb +10 -3
- data/spec/rinruby_spec.rb +16 -5
- data/spec/spec_helper.rb +3 -8
- metadata +24 -20
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
=== 2.0.2 / 2011-02-03
|
2
|
+
|
3
|
+
* Updated RSpec to 2.0. Should work on Windows [clbustos]
|
4
|
+
* 64-bit version is in x64 [Rob Heittman]
|
5
|
+
* Adapt to different Rterm.exe locations [Rob Heittman]
|
6
|
+
|
1
7
|
=== 2.0.1 / 2010-05-01
|
2
8
|
* Reimplemented Rinruby.new with ordered parameters, for complete backwards compatibility
|
3
9
|
|
data/lib/rinruby.rb
CHANGED
@@ -62,7 +62,7 @@ class RinRuby
|
|
62
62
|
require 'socket'
|
63
63
|
|
64
64
|
|
65
|
-
VERSION = '2.0.
|
65
|
+
VERSION = '2.0.2'
|
66
66
|
|
67
67
|
|
68
68
|
attr_reader :interactive
|
@@ -93,7 +93,7 @@ class RinRuby
|
|
93
93
|
#* :port_number: This is the smallest port number on the local host that could be used to pass data between Ruby and R. The actual port number used depends on port_width.
|
94
94
|
#* :port_width: RinRuby will randomly select a uniform number between port_number and port_number + port_width - 1 (inclusive) to pass data between Ruby and R. If the randomly selected port is not available, RinRuby will continue selecting random ports until it finds one that is available. By setting port_width to 1, RinRuby will wait until port_number is available. The default port_width is 1000.
|
95
95
|
#
|
96
|
-
#It may be desirable to change the parameters to the instance of R, but still call it by the name of R. In that case the old instance of R which was created with the 'require "rinruby"' statement should be closed first using the quit method which is explained below. Unless the previous instance is killed, it will continue to use system resources until exiting Ruby. The following shows an example by changing the parameter echo:
|
96
|
+
# It may be desirable to change the parameters to the instance of R, but still call it by the name of R. In that case the old instance of R which was created with the 'require "rinruby"' statement should be closed first using the quit method which is explained below. Unless the previous instance is killed, it will continue to use system resources until exiting Ruby. The following shows an example by changing the parameter echo:
|
97
97
|
#
|
98
98
|
# >> require "rinruby"
|
99
99
|
# >> R.quit
|
@@ -189,6 +189,7 @@ def initialize(*args)
|
|
189
189
|
def quit
|
190
190
|
begin
|
191
191
|
@writer.puts "q(save='no')"
|
192
|
+
# TODO: Verify if read is needed
|
192
193
|
@socket.read()
|
193
194
|
#@socket.close
|
194
195
|
@engine.close
|
@@ -771,7 +772,13 @@ def initialize(*args)
|
|
771
772
|
else
|
772
773
|
path.gsub!('\\','/')
|
773
774
|
end
|
774
|
-
|
775
|
+
for hierarchy in [ 'bin', 'bin/i386', 'bin/x64' ]
|
776
|
+
target = "#{path}/#{hierarchy}/Rterm.exe"
|
777
|
+
if File.exists? target
|
778
|
+
return %Q<"#{target}">
|
779
|
+
end
|
780
|
+
end
|
781
|
+
raise "Cannot locate R executable"
|
775
782
|
end
|
776
783
|
|
777
784
|
end
|
data/spec/rinruby_spec.rb
CHANGED
@@ -4,14 +4,25 @@ puts "RinRuby #{RinRuby::VERSION} specification"
|
|
4
4
|
describe RinRuby do
|
5
5
|
describe "on init" do
|
6
6
|
it "should accept parameters as specified on Dahl & Crawford(2009)" do
|
7
|
+
|
8
|
+
platform = case RUBY_PLATFORM
|
9
|
+
when /mswin/ then 'windows'
|
10
|
+
when /mingw/ then 'windows'
|
11
|
+
when /bccwin/ then 'windows'
|
12
|
+
else
|
13
|
+
"other"
|
14
|
+
end
|
15
|
+
if platform=='windows'
|
16
|
+
pending("Difficult to test without specific location of R executable on Windows")
|
17
|
+
else
|
18
|
+
|
7
19
|
r=RinRuby.new(false, false, "R", 38500, 1)
|
8
20
|
r.echo_enabled.should_not be_true
|
9
21
|
r.interactive.should_not be_true
|
10
|
-
r.executable.should==
|
22
|
+
r.executable.should=="R"
|
11
23
|
r.port_number.should==38500
|
12
|
-
r.port_width.should==1
|
13
|
-
|
14
|
-
|
24
|
+
r.port_width.should==1
|
25
|
+
end
|
15
26
|
end
|
16
27
|
it "should accept :echo and :interactive parameters" do
|
17
28
|
r=RinRuby.new(:echo=>false, :interactive=>false)
|
@@ -113,7 +124,7 @@ describe RinRuby do
|
|
113
124
|
rx=R.x
|
114
125
|
matrix.row_size.times {|i|
|
115
126
|
matrix.column_size.times {|j|
|
116
|
-
matrix[i,j].should
|
127
|
+
matrix[i,j].should be_within(1e-10).of(rx[i,j])
|
117
128
|
}
|
118
129
|
}
|
119
130
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
1
|
+
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
|
2
|
+
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
|
3
3
|
require 'rinruby'
|
4
|
-
require '
|
5
|
-
require 'spec/autorun'
|
4
|
+
require 'rspec'
|
6
5
|
|
7
6
|
require 'matrix'
|
8
7
|
|
9
|
-
Spec::Runner.configure do |config|
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
8
|
class String
|
14
9
|
def deindent
|
15
10
|
gsub /^[ \t]*/, ''
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rinruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 2
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
version: 2.0.2
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- David Dahl
|
@@ -31,29 +36,24 @@ cert_chain:
|
|
31
36
|
rpP0jjs0
|
32
37
|
-----END CERTIFICATE-----
|
33
38
|
|
34
|
-
date:
|
39
|
+
date: 2011-02-03 00:00:00 -03:00
|
35
40
|
default_executable:
|
36
41
|
dependencies:
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: rubyforge
|
39
|
-
type: :development
|
40
|
-
version_requirement:
|
41
|
-
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
requirements:
|
43
|
-
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 2.0.4
|
46
|
-
version:
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: hoe
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
prerelease: false
|
45
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
52
47
|
requirements:
|
53
48
|
- - ">="
|
54
49
|
- !ruby/object:Gem::Version
|
55
|
-
|
56
|
-
|
50
|
+
segments:
|
51
|
+
- 2
|
52
|
+
- 8
|
53
|
+
- 0
|
54
|
+
version: 2.8.0
|
55
|
+
type: :development
|
56
|
+
version_requirements: *id001
|
57
57
|
description: |-
|
58
58
|
RinRuby is a Ruby library that integrates the R interpreter in Ruby, making R's statistical routines and graphics available within Ruby. The library consists of a single Ruby script that is simple to install and does not require any special compilation or installation of R. Since the library is 100% pure Ruby, it works on a variety of operating systems, Ruby implementations, and versions of R. RinRuby's methods are simple, making for readable code. The {website [rinruby.ddahl.org]}[http://rinruby.ddahl.org] describes RinRuby usage, provides comprehensive documentation, gives several examples, and discusses RinRuby's implementation.
|
59
59
|
|
@@ -98,21 +98,25 @@ rdoc_options:
|
|
98
98
|
require_paths:
|
99
99
|
- lib
|
100
100
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
101
102
|
requirements:
|
102
103
|
- - ">="
|
103
104
|
- !ruby/object:Gem::Version
|
105
|
+
segments:
|
106
|
+
- 0
|
104
107
|
version: "0"
|
105
|
-
version:
|
106
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
107
110
|
requirements:
|
108
111
|
- - ">="
|
109
112
|
- !ruby/object:Gem::Version
|
113
|
+
segments:
|
114
|
+
- 0
|
110
115
|
version: "0"
|
111
|
-
version:
|
112
116
|
requirements: []
|
113
117
|
|
114
118
|
rubyforge_project: rinruby
|
115
|
-
rubygems_version: 1.3.
|
119
|
+
rubygems_version: 1.3.7
|
116
120
|
signing_key:
|
117
121
|
specification_version: 3
|
118
122
|
summary: RinRuby is a Ruby library that integrates the R interpreter in Ruby, making R's statistical routines and graphics available within Ruby
|
metadata.gz.sig
CHANGED
Binary file
|