Skip to content

Commit 494c0b9

Browse files
committed
Updated spec
2 parents e6fd4f7 + 2515984 commit 494c0b9

File tree

9 files changed

+112
-31
lines changed

9 files changed

+112
-31
lines changed

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
# Specify your gem's dependencies in rinruby.gemspec
4+
gemspec

Gemfile.lock

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
PATH
2+
remote: .
3+
specs:
4+
rinruby (2.0.3)
5+
6+
GEM
7+
remote: https://rubygems.org/
8+
specs:
9+
diff-lcs (1.2.5)
10+
hoe (3.12.0)
11+
rake (>= 0.8, < 11.0)
12+
rake (10.3.2)
13+
rspec (3.0.0)
14+
rspec-core (~> 3.0.0)
15+
rspec-expectations (~> 3.0.0)
16+
rspec-mocks (~> 3.0.0)
17+
rspec-core (3.0.2)
18+
rspec-support (~> 3.0.0)
19+
rspec-expectations (3.0.2)
20+
diff-lcs (>= 1.2.0, < 2.0)
21+
rspec-support (~> 3.0.0)
22+
rspec-mocks (3.0.2)
23+
rspec-support (~> 3.0.0)
24+
rspec-support (3.0.2)
25+
26+
PLATFORMS
27+
ruby
28+
29+
DEPENDENCIES
30+
hoe
31+
rake
32+
rinruby!
33+
rspec

History.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
=== 2.0.3 / 2012-07-31
2-
* 64-bit version is in x64
3-
* Adapt to different Rterm.exe locations. On Windows at least, Rterm.exe has moved under an i386/ folder
4-
* Update README.txt
5-
* Updated spec to rspec 2.0
2+
* Update README.txt
3+
4+
=== 2.0.2 / 2011-02-03
5+
6+
* Updated RSpec to 2.0. Should work on Windows [clbustos]
7+
* 64-bit version is in x64 [Rob Heittman]
8+
* Adapt to different Rterm.exe locations [Rob Heittman]
69

710
=== 2.0.1 / 2010-05-01
811
* Reimplemented Rinruby.new with ordered parameters, for complete backwards compatibility

README.txt renamed to README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
= rinruby
2-
1+
# rinruby
32
* http://rinruby.ddahl.org/
43

5-
== DESCRIPTION:
4+
### DESCRIPTION
65

76
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.
87

@@ -15,15 +14,16 @@ Homepage: http://rinruby.ddahl.org
1514

1615
Contributors: Claudio Bustos
1716

18-
== FEATURES/PROBLEMS:
17+
### FEATURES/PROBLEMS
1918

2019
* Pure Ruby. Works on Ruby 1.8.7, 1.9 and JRuby 1.4
2120
* Slower than RSRuby, but more robust
2221

23-
== SYNOPSIS:
22+
### SYNOPSIS
23+
2424
Below is a simple example of RinRuby usage for simple linear regression. The simulation parameters are defined in Ruby, computations are performed in R, and Ruby reports the results. In a more elaborate application, the simulation parameter might come from input from a graphical user interface, the statistical analysis might be more involved, and the results might be an HTML page or PDF report.
2525

26-
<b>Code</b>:
26+
#### Code
2727

2828
require "rinruby"
2929
n = 10
@@ -33,34 +33,34 @@ Below is a simple example of RinRuby usage for simple linear regression. The sim
3333
seed = 23423
3434
R.x = (1..n).entries
3535
R.eval <<EOF
36-
set.seed({seed})
37-
y <- {beta_0} + {beta_1}*x + rnorm({n})
36+
set.seed(#{seed})
37+
y <- #{beta_0} + #{beta_1}*x + rnorm(#{n})
3838
fit <- lm( y ~ x )
3939
est <- round(coef(fit),3)
4040
pvalue <- summary(fit)$coefficients[2,4]
4141
EOF
42-
puts "E(y|x) ~= {R.est[0]} + {R.est[1]} * x"
42+
puts "E(y|x) ~= #{R.est[0]} + #{R.est[1]} * x"
4343
if R.pvalue < alpha
4444
puts "Reject the null hypothesis and conclude that x and y are related."
4545
else
4646
puts "There is insufficient evidence to conclude that x and y are related."
4747
end
4848

49-
<b>Output</b>:
49+
#### Output
5050

5151
E(y|x) ~= 1.264 + 0.273 * x
5252
Reject the null hypothesis and conclude that x and y are related.
5353

54-
== REQUIREMENTS:
54+
### REQUIREMENTS
5555

5656
* R
5757

58-
== INSTALL:
58+
### INSTALL
5959

6060
* sudo gem install rinruby
6161

6262

63-
== LICENSE:
63+
### LICENSE
6464

6565
GPL-3. See LICENSE.txt for more information.
6666

Rakefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ Hoe.spec 'rinruby' do
1414
# self.rubyforge_name = 'rinruby' # if different than 'rinruby2'
1515
self.developer('David Dahl', 'rinruby_AT_ddahl.org')
1616
self.developer('Claudio Bustos', 'clbustos_AT_gmail.com')
17-
self.url = "http://rinruby.ddahl.org/"
18-
17+
self.urls = ["http://rinruby.ddahl.org/"]
1918
end
2019

2120
# vim: syntax=ruby

lib/version.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Rinruby
2+
VERSION = "2.0.3"
3+
end

rinruby.gemspec

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# coding: utf-8
2+
lib = File.expand_path('../lib', __FILE__)
3+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4+
require 'version'
5+
6+
Gem::Specification.new do |spec|
7+
spec.name = "rinruby"
8+
spec.version = Rinruby::VERSION
9+
spec.authors = ["David Dahl", "Scott Crawford", "Claudio Bustos"]
10+
11+
spec.summary = %q{RinRuby is a Ruby library that integrates the R interpreter in Ruby}
12+
spec.description = %q{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.}
13+
spec.homepage = "http://rinruby.ddahl.org"
14+
spec.license = "Copyright 2005-2008 David B. Dahl"
15+
16+
spec.files = `git ls-files`.split($/)
17+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19+
spec.require_paths = ["lib"]
20+
21+
spec.add_development_dependency "rake"
22+
spec.add_development_dependency "rspec"
23+
spec.add_development_dependency "hoe"
24+
end

spec/rinruby_spec.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,22 @@
1313
"other"
1414
end
1515
if platform=='windows'
16-
pending("Difficult to test without specific location of R executable on Windows")
16+
skip("Difficult to test without specific location of R executable on Windows")
1717
else
1818

1919
r=RinRuby.new(false, false, "R", 38500, 1)
20-
r.echo_enabled.should_not be_true
21-
r.interactive.should_not be_true
20+
21+
expect(r.echo_enabled).to be false
22+
r.interactive.should be false
2223
r.executable.should=="R"
2324
r.port_number.should==38500
2425
r.port_width.should==1
2526
end
2627
end
2728
it "should accept :echo and :interactive parameters" do
2829
r=RinRuby.new(:echo=>false, :interactive=>false)
29-
r.echo_enabled.should_not be_true
30-
r.interactive.should_not be_true
30+
r.echo_enabled.should be false
31+
r.interactive.should be false
3132

3233
end
3334
it "should accept :port_number" do
@@ -56,13 +57,13 @@
5657
it {should respond_to :quit}
5758
it {should respond_to :echo}
5859
it "return correct values for complete?" do
59-
R.eval("x<-1").should be_true
60+
R.eval("x<-1").should be true
6061
end
6162
it "return false for complete? for incorrect expressions" do
62-
R.complete?("x<-").should be_false
63+
R.complete?("x<-").should be false
6364
end
6465
it "correct eval should return true" do
65-
R.complete?("x<-1").should be_true
66+
R.complete?("x<-1").should be true
6667
end
6768
it "incorrect eval should raise an ParseError" do
6869
lambda {R.eval("x<-")}.should raise_error(RinRuby::ParseError)
@@ -136,7 +137,7 @@
136137
@r=RinRuby.new(:echo=>false)
137138
end
138139
it "return true" do
139-
@r.quit.should be_true
140+
@r.quit.should be true
140141
end
141142
it "returns an error if used again" do
142143
@r.quit

spec/spec_helper.rb

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
22
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
3-
require 'rinruby'
43
require 'rspec'
4+
require 'rinruby'
55

66
require 'matrix'
77

88
RSpec.configure do |config|
9-
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
1021
end
1122

23+
1224
class String
1325
def deindent
14-
gsub /^[ \t]*/, ''
26+
gsub /^[ \t]*/, ''
1527
end
1628
end
29+
30+

0 commit comments

Comments
 (0)