rserve-client 0.3.1 → 0.3.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4c3a03347161784ff8220b9e7a8ef33620643fa5
4
+ data.tar.gz: 46b6892b3f439202a362f3c1db6f9f75c26eb828
5
+ SHA512:
6
+ metadata.gz: 884b4e27bd68a01679bf774f21ee5f4b022ca591fef8f27cd1058ed27259da612cd6632e3206a570274399af195f137ec837c0ab5040535e895416ab688417f1
7
+ data.tar.gz: 0909cebb7571cadda549e0c5965a01e58b4e1a46d3b48e750653a347b158afa8c483440ccc40c557fb8d5d96c3a3451ec440722a4e3699d02affc20be0713cd6
@@ -0,0 +1,6 @@
1
+ *.rbc
2
+ coverage.info
3
+ *~
4
+ doc
5
+ pkg
6
+ coverage
data/.rspec CHANGED
@@ -1,3 +1,2 @@
1
- --color
2
- -f s
1
+ --color
3
2
  -b
@@ -0,0 +1,16 @@
1
+ language:
2
+ ruby
3
+
4
+ rvm:
5
+ - '1.8.7'
6
+ - '1.9.3'
7
+ - '2.0.0'
8
+ - '2.1.1'
9
+
10
+ script:
11
+ bundle exec rake spec
12
+
13
+ before_install:
14
+ - sudo apt-get update -qq
15
+ - sudo apt-get install -y r-base r-base-dev
16
+ - sudo Rscript -e "install.packages(c('Rserve','icc'),,'http://cran.us.r-project.org')"
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ gem 'hoe'
3
+ gem 'rspec'
4
+ gem 'rake'
@@ -0,0 +1,31 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.3)
5
+ hoe (3.16.0)
6
+ rake (>= 0.8, < 13.0)
7
+ rake (12.0.0)
8
+ rspec (3.6.0)
9
+ rspec-core (~> 3.6.0)
10
+ rspec-expectations (~> 3.6.0)
11
+ rspec-mocks (~> 3.6.0)
12
+ rspec-core (3.6.0)
13
+ rspec-support (~> 3.6.0)
14
+ rspec-expectations (3.6.0)
15
+ diff-lcs (>= 1.2.0, < 2.0)
16
+ rspec-support (~> 3.6.0)
17
+ rspec-mocks (3.6.0)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.6.0)
20
+ rspec-support (3.6.0)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ hoe
27
+ rake
28
+ rspec
29
+
30
+ BUNDLED WITH
31
+ 1.14.6
@@ -1,3 +1,8 @@
1
+ === 0.3.2 / 2017-05-17
2
+
3
+ * Updated Gemfile
4
+ * Fixed bug 26: Error handling NA values on integer matrix
5
+
1
6
  === 0.3.1 / 2013-07-26
2
7
 
3
8
  * 2D Names functionality for Arrays and Matrices
@@ -48,6 +48,8 @@ lib/rserve/with2dnames.rb
48
48
  lib/rserve/with2dsizes.rb
49
49
  lib/rserve/withattributes.rb
50
50
  lib/rserve/withnames.rb
51
+ spec/rserve_bug_1_spec.rb
52
+ spec/rserve_bug_26_spec.rb
51
53
  spec/rserve_connection_on_unix_spec.rb
52
54
  spec/rserve_connection_spec.rb
53
55
  spec/rserve_double_spec.rb
@@ -1,15 +1,16 @@
1
- = rserve-client
1
+ # rserve-client
2
2
 
3
3
  * http://github.com/clbustos/Rserve-Ruby-client
4
4
 
5
+ [![Build Status](https://travis-ci.org/clbustos/Rserve-Ruby-client.svg?branch=master)](https://travis-ci.org/clbustos/Rserve-Ruby-client)
5
6
 
6
- == DESCRIPTION:
7
+ ## DESCRIPTION:
7
8
 
8
9
  Ruby client for Rserve, a Binary R server (http://www.rforge.net/Rserve/).
9
10
 
10
11
  Follows closely the new Java client API, but maintains all Ruby conventions when possible.
11
12
 
12
- == FEATURES / LIMITATIONS
13
+ ## FEATURES / LIMITATIONS
13
14
 
14
15
  * 100% ruby
15
16
  * Uses TCP/IP sockets to interchange data and commands
@@ -28,7 +29,7 @@ Cons:
28
29
  * Requires Rserve
29
30
  * Limited features on Windows, caused by limitations on Rserve on this platform: single concurrent connection allowed, server crash on parse errors and can't spawn sessions.
30
31
 
31
- == RELATED LIBRARIES (Ruby / R)
32
+ ## RELATED LIBRARIES (Ruby / R)
32
33
 
33
34
  * Rinruby [http://rinruby.ddahl.org/]
34
35
  * 100% ruby
@@ -54,7 +55,7 @@ Cons:
54
55
  * Not available for alternative implementations of Ruby (JRuby, IronRuby and Rubinius)
55
56
 
56
57
 
57
- == TODO
58
+ ## TODO
58
59
 
59
60
  Implements
60
61
 
@@ -67,7 +68,7 @@ Spec
67
68
  * First tutorial on R
68
69
 
69
70
 
70
- == SYNOPSIS:
71
+ ## SYNOPSIS:
71
72
 
72
73
  require 'rserve'
73
74
  con=Rserve::Connection.new
@@ -105,16 +106,16 @@ Spec
105
106
 
106
107
  => #<Rserve::REXP::GenericVector:0x000000010c81d0 @attr=nil, @payload=#<Rserve::Rlist:0x000000010c8278 @names=nil, @data=[#<Rserve::REXP::String:0x000000010c86d8 @payload=["a"], @attr=nil>, #<Rserve::REXP::String:0x000000010c85c0 @payload=["b"], @attr=nil>, #<Rserve::REXP::String:0x000000010c82e8 @payload=["c", "d"], @attr=nil>]>>
107
108
 
108
- == REQUIREMENTS:
109
+ ## REQUIREMENTS:
109
110
 
110
111
  * R
111
112
  * Rserve
112
113
 
113
- == INSTALL:
114
+ ## INSTALL:
114
115
 
115
116
  sudo gem install rserve-client
116
117
 
117
- == LICENSE:
118
+ ## LICENSE:
118
119
 
119
120
  REngine - Java interface to R
120
121
  Copyright (C) 2004,5,6,7 Simon Urbanek
data/Rakefile CHANGED
@@ -1,24 +1,14 @@
1
1
  # -*- ruby -*-
2
2
  $:.unshift(File.dirname(__FILE__)+"/lib")
3
3
  require 'rubygems'
4
- require 'hoe'
5
4
  require 'rserve'
6
- require 'rubyforge'
7
- Hoe.plugin :git
8
- Hoe.plugin :rubyforge
9
-
10
5
  require 'rspec'
11
6
  require 'rspec/core/rake_task'
12
7
 
8
+ require 'bundler'
9
+ Bundler::GemHelper.install_tasks
13
10
 
14
- Hoe.spec 'rserve-client' do
15
- self.testlib=:rspec
16
- self.test_globs="spec/*_spec.rb"
17
- self.version=Rserve::VERSION
18
- self.rubyforge_name = 'ruby-statsample' # if different than 'rserve'
19
- self.remote_rdoc_dir = "rserve-client"
20
- self.developer('Claudio Bustos', 'clbustos_AT_gmail.com')
21
- self.extra_dev_deps << ["rspec","~>2.0"]
22
- end
23
11
 
24
12
  # vim: syntax=ruby
13
+
14
+
@@ -1,7 +1,7 @@
1
1
  require 'socket'
2
2
  require 'rbconfig'
3
3
  module Rserve
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  ON_WINDOWS=RbConfig::CONFIG['arch']=~/mswin|mingw/
6
6
  end
7
7
 
@@ -4,7 +4,9 @@ module Rserve
4
4
  class Double < REXP::Vector
5
5
  attr_reader :payload
6
6
  # NA is arch dependent
7
+
7
8
  case RbConfig::CONFIG['arch']
9
+
8
10
  when /i686-linux|mswin|mingw/
9
11
  NA = 269653970229425383598692395468593241088322026492507901905402939417320933254485890939796955099302180188971623023005661539310855695935759376615857567599472873400528811349204333736152257830107446553333670133666606746438802800063353690283455789426038632208916715592554825644961573453826957827246636338344317943808
10
12
  else
@@ -47,18 +49,19 @@ module Rserve
47
49
  @payload.map {|v| v.to_f.to_s}
48
50
  end
49
51
 
50
- def na?(value=nil)
52
+ def na?(value=:nil)
51
53
  #if value.nil?
52
54
  # @payload.map {|v| v.respond_to? :nan and v.nan?}
53
55
  #else
54
56
  # value.respond_to? :nan? and value.nan?
55
57
  #end
56
- return _na?(value) unless value.nil?
58
+ #p @payload
59
+ return _na?(value) unless value==:nil
57
60
  @payload.map {|v| _na?(v) }
58
61
  end
59
62
 
60
63
  def self.infinite?(value)
61
- value.respond_to?(:infinite?) and value.infinite?
64
+ value.respond_to?(:infinite?) and !value.infinite?.nil?
62
65
  end
63
66
 
64
67
 
@@ -81,6 +84,7 @@ module Rserve
81
84
  protected
82
85
 
83
86
  def _na?(value)
87
+ return true if value.nil?
84
88
  if value.is_a? Float
85
89
  return true if value.nan?
86
90
  return false if value.infinite?
@@ -3,7 +3,7 @@ module Rserve
3
3
  class Integer < REXP::Vector
4
4
  public_class_method :new
5
5
  attr_reader :payload
6
- NA = -2147483648;
6
+ NA = -2147483648
7
7
  def initialize(data, attrs=nil)
8
8
  @payload=case data
9
9
  when Integer
@@ -11,7 +11,7 @@ module Rserve
11
11
  when Numeric
12
12
  [data.to_i]
13
13
  when Array
14
- data
14
+ data.map {|v| v.to_i}
15
15
  else
16
16
  raise ArgumentError, "Should be Numeric or Array"
17
17
  end
@@ -30,7 +30,7 @@ module Rserve
30
30
  @payload
31
31
  end
32
32
  def as_doubles
33
- @payload.map(&:to_f)
33
+ @payload.map {|v| na?(v) ? nil : v.to_f}
34
34
  end
35
35
  def as_strings
36
36
  @payload.map(&:to_s)
@@ -22,11 +22,14 @@ module Rserve
22
22
  @payload
23
23
  end
24
24
 
25
- def na?(value=nil)
26
- if value.nil?
27
- @payload.map {|v| NA.include? v}
25
+ def na?(value=:nil)
26
+
27
+ if value==:nil
28
+ @payload.map {|v|
29
+ v.unpack("C")==[255] or v=="NA" # Ugly hack
30
+ }
28
31
  else
29
- NA.include? value
32
+ value.unpack("C")==[255] or value=="NA"
30
33
  end
31
34
  end
32
35
  def to_debug_string
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.unshift(File.expand_path(File.dirname(__FILE__)+"/lib"))
3
+
4
+ require File.expand_path("../lib/rserve", __FILE__)
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "rserve-client"
8
+ s.version = Rserve::VERSION
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ['Claudio Bustos']
11
+ s.email = []
12
+ s.homepage = "http://rubygems.org/gems/rserve-client"
13
+ s.summary = "Rserve client for ruby"
14
+ s.description = "Rserve client for ruby"
15
+
16
+ s.required_rubygems_version = ">= 1.3.6"
17
+ s.add_development_dependency "bundler", ">= 1.0.0"
18
+ s.add_development_dependency "rspec"
19
+ s.files = `git ls-files`.split("\n")
20
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
21
+ s.require_path = 'lib'
22
+ end
@@ -0,0 +1,27 @@
1
+ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
+ describe "Bug #1 on statsample" do
3
+ before do
4
+ @r=Rserve::Connection.new()
5
+ end
6
+ after do
7
+ @r.close if @r.connected?
8
+ end
9
+ it "should return a correct irr object" do
10
+
11
+ @r.void_eval("
12
+ install.packages('irr');
13
+ library(irr);
14
+ ds<-data.frame(a=rnorm(100),b=rnorm(100),c=rnorm(100),d=rnorm(100));
15
+ iccs=list(
16
+ icc_1=icc(ds,'o','c','s'),
17
+ icc_k=icc(ds,'o','c','a'),
18
+ icc_c_1=icc(ds,'t','c','s'),
19
+ icc_c_k=icc(ds,'t','c','a'),
20
+ icc_a_1=icc(ds,'t','a','s'),
21
+ icc_a_k=icc(ds,'t','a','a'))
22
+ ")
23
+
24
+ @iccs=@r.eval('iccs').to_ruby
25
+ @iccs.should be_instance_of(Array)
26
+ end
27
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
+ describe "Bug Error handling NA values on integer matrix #26" do
3
+ before do
4
+ @r=Rserve::Connection.new()
5
+ end
6
+ after do
7
+ @r.close if @r.connected?
8
+ end
9
+ it "should return a correct Matrix" do
10
+
11
+ @r.eval("m<-matrix(as.integer(c(1, NA, NA, 4)), ncol=2)")
12
+
13
+ @m=@r.eval('m').to_ruby
14
+ @m.should be_instance_of(Matrix)
15
+ expect(@m).to eq(Matrix[[1,nil],[nil,4]])
16
+ end
17
+ end
@@ -15,9 +15,9 @@ describe Rserve::Connection do
15
15
  end
16
16
  it "should quit correctly" do
17
17
  @r.should be_connected
18
- @r.close.should be_true
18
+ @r.close.should be true
19
19
  @r.should_not be_connected
20
- @r.close.should be_true
20
+ @r.close.should be true
21
21
  end
22
22
  it "raise an error if eval is clased after closed" do
23
23
  @r.close
@@ -33,7 +33,7 @@ describe Rserve::Connection do
33
33
  @r=Rserve::Connection.new
34
34
  end
35
35
  it "method eval_void should return true with correct expression" do
36
- @r.void_eval("x<-1").should be_true
36
+ @r.void_eval("x<-1").should be true
37
37
  end
38
38
 
39
39
  it "method eval should return a simple object" do
@@ -44,7 +44,7 @@ describe Rserve::Connection do
44
44
 
45
45
 
46
46
  it "should eval_void and eval correctly" do
47
- @r.void_eval("x<-c(TRUE,FALSE)").should be_true
47
+ @r.void_eval("x<-c(TRUE,FALSE)").should be true
48
48
  la=@r.eval("x")
49
49
  la.should be_instance_of(Rserve::REXP::Logical)
50
50
  la.true?.should==[true,false]
@@ -20,9 +20,9 @@ describe Rserve::REXP::Double do
20
20
  end
21
21
 
22
22
  it "method na? should return coherent answer" do
23
- @a.na?(@a.as_integers[0]).should be_false
24
- @a.na?(@a.as_integers[2]).should be_true
25
- @a.na?.should==[false,false,true,false,false, false]
23
+ expect(@a.na?(@a.as_integers[0])).to be false
24
+ expect(@a.na?(@a.as_integers[2])).to be true
25
+ expect(@a.na?).to eq([false,false,true,false,false, false])
26
26
  end
27
27
  it "to_a should return correct values with NA" do
28
28
  @a.to_a.should==[3,5, nil, 10, 20, Float::INFINITY]
@@ -36,16 +36,16 @@ describe Rserve::REXP::Double do
36
36
  describe "infinite?" do
37
37
 
38
38
  it "should return false for non Float objects" do
39
- Rserve::REXP::Double.infinite?(1).should be_false
39
+ expect(Rserve::REXP::Double.infinite?(1)).to be false
40
40
  end
41
41
 
42
42
  it "should return false for non infinite floats" do
43
- Rserve::REXP::Double.infinite?(Math::PI).should be_false
43
+ Rserve::REXP::Double.infinite?(Math::PI).should be false
44
44
  end
45
45
 
46
46
  it "should return true for infinite floats" do
47
- Rserve::REXP::Double.infinite?(-Float::INFINITY).should be_true
48
- Rserve::REXP::Double.infinite?(Float::INFINITY).should be_true
47
+ Rserve::REXP::Double.infinite?(-Float::INFINITY).should be true
48
+ Rserve::REXP::Double.infinite?(Float::INFINITY).should be true
49
49
  end
50
50
 
51
51
  end
@@ -20,11 +20,10 @@ describe Rserve::REXP::Integer do
20
20
  before do
21
21
  @payload=[3,5,Rserve::REXP::Integer::NA, 10,20]
22
22
  @a=Rserve::REXP::Integer.new(@payload)
23
-
24
23
  end
25
24
  it "method is_NA should return coherent answer" do
26
- @a.na?(@a.as_integers[0]).should be_false
27
- @a.na?(@a.as_integers[2]).should be_true
25
+ @a.na?(@a.as_integers[0]).should be false
26
+ @a.na?(@a.as_integers[2]).should be true
28
27
  @a.na?.should==[false,false,true,false,false]
29
28
  end
30
29
  it "to_a should return correct values with NA" do
@@ -21,8 +21,8 @@ describe Rserve::REXP::Integer do
21
21
  end
22
22
  it "method is_NA should return coherent answer" do
23
23
  @a.na?.should==[false,true,false]
24
- @a.na?(@a.as_bytes[0]).should be_false
25
- @a.na?(@a.as_bytes[1]).should be_true
24
+ @a.na?(@a.as_bytes[0]).should be false
25
+ @a.na?(@a.as_bytes[1]).should be true
26
26
  end
27
27
  it "method to_a should return correct answer" do
28
28
  @a.to_a.should==[true,nil,false]
@@ -43,13 +43,13 @@ describe Rserve::REXP do
43
43
  @v.as_string.should=="1.5"
44
44
  end
45
45
  it "method has_attribute? should return false for non-lists" do
46
- @v.has_attribute?('randomattribute').should be_false
46
+ @v.has_attribute?('randomattribute').should be false
47
47
  end
48
48
  it "method has_attribute? should return true for existing value" do
49
- @l.has_attribute?('names').should be_true
49
+ @l.has_attribute?('names').should be true
50
50
  end
51
51
  it "method has_attribute? should return false for non existing value" do
52
- @l.has_attribute?('at2').should be_false
52
+ @l.has_attribute?('at2').should be false
53
53
  end
54
54
  it "method get_attribute should return correct value for attribute" do
55
55
  @l.get_attribute('names').as_strings.should==['at']
@@ -44,6 +44,10 @@ describe "Rserve::REXP#to_ruby" do
44
44
  it "should return a Ruby Matrix with R matrix with NA values" do
45
45
  @r.eval("matrix(c(NA,2,3,4),2,2,byrow=TRUE)").to_ruby.should==Matrix[[nil,2],[3,4]]
46
46
  end
47
+ it "should return a Ruby Matrix with R matrix with floats with NA values" do
48
+ @r.eval("matrix(c(NA,2.5,3.5,NA),2,2,byrow=TRUE)").to_ruby.should==Matrix[[nil,2.5],[3.5,nil]]
49
+ end
50
+
47
51
  it "should return a nested array of Ruby Matrixes with vector with more than tree dimensions" do
48
52
  @r.void_eval("a<-1:16; attr(a,'dim')<-c(2,2,2,2)")
49
53
  @r.eval("a").to_ruby.should==[[[[1.0, 3.0], [2.0, 4.0]], [[5.0, 7.0], [6.0, 8.0]]],
@@ -55,7 +59,7 @@ describe "Rserve::REXP#to_ruby" do
55
59
 
56
60
  end
57
61
  it "should return a boolean with a logical with one element" do
58
- @r.eval("TRUE").to_ruby.should be_true
62
+ @r.eval("TRUE").to_ruby.should be true
59
63
  end
60
64
  it "should return an array extended with Rserve::WithNames if vector is named" do
61
65
  @r.void_eval("a<-c(1,2,3);names(a)<-c('a','b','c')")
@@ -73,7 +77,9 @@ describe "Rserve::REXP#to_ruby" do
73
77
  @r.eval("'a'").to_ruby.should=='a'
74
78
  end
75
79
  it "should return an array of strings with a vector with two or more strings" do
76
- @r.eval("c('a','b',NA)").to_ruby.should==['a','b',nil]
80
+ obj=@r.eval("c('a','b',NA)").to_ruby
81
+ p @r.eval("c('a','b',NA)")
82
+ obj.should==['a','b',nil]
77
83
  end
78
84
  it "should handle named floats" do
79
85
  @r.void_eval('y <- sample(1:100, 10)')
@@ -77,6 +77,7 @@ describe Rserve::Protocol::REXPFactory do
77
77
  la.should be_instance_of(Rserve::REXP::String)
78
78
  la.as_strings.should==['abc','def','ghi']
79
79
  end
80
+
80
81
  it "should process string vector with NA" do
81
82
  la=@r.eval("c('abc','def',NA)")
82
83
  la.should be_instance_of(Rserve::REXP::String)
@@ -95,8 +96,8 @@ describe Rserve::Protocol::REXPFactory do
95
96
  la.should be_factor
96
97
  la.as_factor.levels.sort.should==%w{act nsw nt qld sa tas vic wa}.sort
97
98
 
98
- la.as_factor.contains?("tas").should be_true
99
- la.as_factor.contains?("nn").should be_false
99
+ la.as_factor.contains?("tas").should be true
100
+ la.as_factor.contains?("nn").should be false
100
101
  @r.void_eval("rm(state, statef)")
101
102
  end
102
103
  it "should process factors with NA" do
@@ -121,14 +122,14 @@ describe Rserve::Protocol::REXPFactory do
121
122
 
122
123
  it "should process list with booleans and NA" do
123
124
  la=@r.eval("list(TRUE)")
124
- la.should be_true
125
+ la.should be_truthy
125
126
  la=@r.eval("list(2,NA)")
126
- la.should be_true
127
+ la.should be_truthy
127
128
  end
128
129
 
129
130
  it "should process data.frame" do
130
131
  la=@r.eval("data.frame(a=1:10,b=1:10)")
131
- la.should be_true
132
+ la.should be_truthy
132
133
  la.attr.as_list['names'].to_ruby.should==%w{a b}
133
134
  la.attr.as_list['class'].to_ruby.should=="data.frame"
134
135
  la.attr.as_list['row.names'].to_ruby.should==[nil,-10]
@@ -137,7 +138,7 @@ describe Rserve::Protocol::REXPFactory do
137
138
  @r.void_eval("df<-data.frame(a=1:10,b=1:10);
138
139
  attr(df,'row.names')<-c('a','b','c',4,5,6,7,8,9,10);")
139
140
  la=@r.eval("df")
140
- la.should be_true
141
+ la.should be_truthy
141
142
  la.attr.as_list['names'].to_ruby.should==%w{a b}
142
143
  la.attr.as_list['class'].to_ruby.should=="data.frame"
143
144
  la.attr.as_list['row.names'].to_ruby.should==%w{a b c 4 5 6 7 8 9 10}
@@ -20,10 +20,10 @@ describe Rserve::RFactor do
20
20
  }
21
21
  end
22
22
  it "methods contains? should work with integers and strings" do
23
- @factor.contains?(1).should be_true
24
- @factor.contains?(5).should be_false
25
- @factor.contains?('a').should be_true
26
- @factor.contains?('z').should be_false
23
+ @factor.contains?(1).should be true
24
+ @factor.contains?(5).should be false
25
+ @factor.contains?('a').should be true
26
+ @factor.contains?('z').should be false
27
27
  end
28
28
  it "methods count should work with integers and strings" do
29
29
  @factor.count(2).should==2
@@ -14,13 +14,13 @@ describe Rserve::Rlist do
14
14
  it "method == should return true for rlist with equal data and names" do
15
15
  a=Rserve::Rlist.new([1,2,3],%w{a b c})
16
16
  b=Rserve::Rlist.new([1,2,3],%w{a b c})
17
- (a==b).should be_true
17
+ (a==b).should be true
18
18
  a=Rserve::Rlist.new([1,2,3],%w{a b c})
19
19
  b=Rserve::Rlist.new([1,2,3])
20
- (a==b).should be_false
20
+ (a==b).should be false
21
21
  a=Rserve::Rlist.new([1,2,3],%w{a b c})
22
22
  b=Rserve::Rlist.new([4,5,6],%w{c d e})
23
- (a==b).should be_false
23
+ (a==b).should be false
24
24
 
25
25
  end
26
26
  it "method [] return correct values for strings" do
@@ -16,11 +16,11 @@ logit<-glm(y~a+b, family=binomial(link="logit"), na.action=na.pass)
16
16
  EOF
17
17
  @r.void_eval(script)
18
18
  @r.eval('logit').should be_instance_of(Rserve::REXP::GenericVector)
19
- @r.eval('logit$family$variance').should be_true
20
- @r.eval('logit').should be_true
21
- @r.eval('logit').to_ruby.should be_true
22
- @r.eval('summary(logit)').should be_true
23
- @r.eval('summary(logit)').to_ruby.should be_true
19
+ @r.eval('logit$family$variance').should be_truthy
20
+ @r.eval('logit').should be_truthy
21
+ @r.eval('logit').to_ruby.should be_truthy
22
+ @r.eval('summary(logit)').should be_truthy
23
+ @r.eval('summary(logit)').to_ruby.should be_truthy
24
24
  end
25
25
 
26
26
  it "should calcule lr without problem" do
@@ -41,9 +41,9 @@ severity.lm <- lm(diseasesev~temperature,data=severity)
41
41
  @r.void_eval(script)
42
42
  temp = @r.eval('severity.lm')
43
43
  @r.eval('severity.lm').should be_instance_of(Rserve::REXP::GenericVector)
44
- @r.eval('severity.lm').to_ruby.should be_true
45
- @r.eval('summary(severity.lm)').should be_true
46
- @r.eval('summary(severity.lm)').to_ruby.should be_true
44
+ @r.eval('severity.lm').to_ruby.should be_truthy
45
+ @r.eval('summary(severity.lm)').should be_truthy
46
+ @r.eval('summary(severity.lm)').to_ruby.should be_truthy
47
47
  end
48
48
 
49
49
  end
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
2
 
3
3
  describe Rserve::Talk do
4
4
  before do
5
- @iomock=mock('IO Mock')
5
+ @iomock=double('IO Mock')
6
6
  @talk=Rserve::Talk.new(@iomock)
7
7
  end
8
8
  it "method request_string should return a valid string" do
@@ -10,10 +10,10 @@ describe Rserve::WithNames do
10
10
  end
11
11
  describe "with incorrect naming" do
12
12
  it "should raise an error with names array of another size" do
13
- lambda {@a.names=["1","2"]}.should raise_exception
13
+ lambda {@a.names=["1","2"]}.should raise_exception(ArgumentError)
14
14
  end
15
15
  it "should raise an error with names array !(String or nil) " do
16
- lambda {@a.names=[1,"a","b","c"]}.should raise_exception
16
+ lambda {@a.names=[1,"a","b","c"]}.should raise_exception(ArgumentError)
17
17
  lambda {@a.names=[nil,"a","b","c"]}.should_not raise_exception
18
18
  end
19
19
  end
@@ -3,3 +3,19 @@ require 'rspec'
3
3
  require 'rserve'
4
4
  require 'matrix'
5
5
  require 'pp'
6
+
7
+
8
+ RSpec.configure do |config|
9
+ config.expect_with :rspec do |c|
10
+ c.syntax = [:should, :expect]
11
+ end
12
+
13
+ # Use color in STDOUT
14
+ config.color = true
15
+
16
+ # Use color not only in STDOUT but also in pagers and files
17
+ config.tty = true
18
+
19
+ # Use the specified formatter
20
+ config.formatter = :documentation # :progress, :html, :textmate
21
+ end
metadata CHANGED
@@ -1,101 +1,59 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rserve-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
5
- prerelease:
4
+ version: 0.3.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Claudio Bustos
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-26 00:00:00.000000000 Z
11
+ date: 2017-05-17 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: rubyforge
14
+ name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: 2.0.4
19
+ version: 1.0.0
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: 2.0.4
30
- - !ruby/object:Gem::Dependency
31
- name: rdoc
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: '4.0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: '4.0'
26
+ version: 1.0.0
46
27
  - !ruby/object:Gem::Dependency
47
28
  name: rspec
48
29
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
30
  requirements:
51
- - - ~>
31
+ - - ">="
52
32
  - !ruby/object:Gem::Version
53
- version: '2.0'
33
+ version: '0'
54
34
  type: :development
55
35
  prerelease: false
56
36
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
37
  requirements:
59
- - - ~>
38
+ - - ">="
60
39
  - !ruby/object:Gem::Version
61
- version: '2.0'
62
- - !ruby/object:Gem::Dependency
63
- name: hoe
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ~>
68
- - !ruby/object:Gem::Version
69
- version: '3.7'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: '3.7'
78
- description: ! 'Ruby client for Rserve, a Binary R server (http://www.rforge.net/Rserve/).
79
-
80
-
81
- Follows closely the new Java client API, but maintains all Ruby conventions when
82
- possible.'
83
- email:
84
- - clbustos_AT_gmail.com
40
+ version: '0'
41
+ description: Rserve client for ruby
42
+ email: []
85
43
  executables: []
86
44
  extensions: []
87
- extra_rdoc_files:
88
- - History.txt
89
- - Introduction.txt
90
- - Manifest.txt
91
- - README.txt
45
+ extra_rdoc_files: []
92
46
  files:
93
- - .autotest
94
- - .rspec
47
+ - ".autotest"
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - ".travis.yml"
51
+ - Gemfile
52
+ - Gemfile.lock
95
53
  - History.txt
96
54
  - Introduction.txt
97
55
  - Manifest.txt
98
- - README.txt
56
+ - README.md
99
57
  - Rakefile
100
58
  - benchmark/benchmark.rb
101
59
  - benchmark/comparison_2010_06_07.xls
@@ -140,6 +98,9 @@ files:
140
98
  - lib/rserve/with2dsizes.rb
141
99
  - lib/rserve/withattributes.rb
142
100
  - lib/rserve/withnames.rb
101
+ - rserve-client.gemspec
102
+ - spec/rserve_bug_1_spec.rb
103
+ - spec/rserve_bug_26_spec.rb
143
104
  - spec/rserve_connection_on_unix_spec.rb
144
105
  - spec/rserve_connection_spec.rb
145
106
  - spec/rserve_double_spec.rb
@@ -161,52 +122,27 @@ files:
161
122
  - spec/rserve_with2dsizes_spec.rb
162
123
  - spec/rserve_withnames_spec.rb
163
124
  - spec/spec_helper.rb
164
- - .gemtest
165
- homepage: http://github.com/clbustos/Rserve-Ruby-client
166
- licenses:
167
- - MIT
125
+ homepage: http://rubygems.org/gems/rserve-client
126
+ licenses: []
127
+ metadata: {}
168
128
  post_install_message:
169
- rdoc_options:
170
- - --main
171
- - README.txt
129
+ rdoc_options: []
172
130
  require_paths:
173
131
  - lib
174
132
  required_ruby_version: !ruby/object:Gem::Requirement
175
- none: false
176
133
  requirements:
177
- - - ! '>='
134
+ - - ">="
178
135
  - !ruby/object:Gem::Version
179
136
  version: '0'
180
137
  required_rubygems_version: !ruby/object:Gem::Requirement
181
- none: false
182
138
  requirements:
183
- - - ! '>='
139
+ - - ">="
184
140
  - !ruby/object:Gem::Version
185
- version: '0'
141
+ version: 1.3.6
186
142
  requirements: []
187
- rubyforge_project: ruby-statsample
188
- rubygems_version: 1.8.25
143
+ rubyforge_project:
144
+ rubygems_version: 2.6.10
189
145
  signing_key:
190
- specification_version: 3
191
- summary: Ruby client for Rserve, a Binary R server (http://www.rforge.net/Rserve/)
192
- test_files:
193
- - spec/rserve_with2dnames_spec.rb
194
- - spec/rserve_connection_spec.rb
195
- - spec/rserve_rfactor_spec.rb
196
- - spec/rserve_double_spec.rb
197
- - spec/rserve_rexp_to_ruby_spec.rb
198
- - spec/rserve_logical_spec.rb
199
- - spec/rserve_session_spec.rb
200
- - spec/rserve_talk_spec.rb
201
- - spec/rserve_rlist_spec.rb
202
- - spec/rserve_genericvector_spec.rb
203
- - spec/rserve_with2dsizes_spec.rb
204
- - spec/rserve_packet_spec.rb
205
- - spec/rserve_integer_spec.rb
206
- - spec/rserve_rexpfactory_spec.rb
207
- - spec/rserve_withnames_spec.rb
208
- - spec/rserve_protocol_spec.rb
209
- - spec/rserve_rexp_spec.rb
210
- - spec/rserve_spec.rb
211
- - spec/rserve_rexp_wrapper_spec.rb
212
- - spec/rserve_connection_on_unix_spec.rb
146
+ specification_version: 4
147
+ summary: Rserve client for ruby
148
+ test_files: []
data/.gemtest DELETED
File without changes