Skip to content

Commit 5f5ca3f

Browse files
committed
Send test coverage to coveralls. Allow fail jruby on travis
1 parent 21d8630 commit 5f5ca3f

13 files changed

+107
-112
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ rvm:
88
matrix:
99
allow_failures:
1010
- rvm: ruby-head
11+
- rvm: jruby-19mode
1112
bundler_args: --without local_development

Gemfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ group :test do
88
gem 'shoulda'
99
gem 'rspec', '>= 3.0.0'
1010
gem 'vcr'
11-
gem 'simplecov', '>= 0.9.0', :require => false
12-
gem 'coveralls', :require => false
11+
gem 'simplecov', '>= 0.9.0', require: false
12+
gem 'coveralls', require: false
1313
end
1414

1515
group :local_development do
1616
gem 'terminal-notifier-guard', require: false if RUBY_PLATFORM.downcase.include?('darwin')
17-
gem 'guard-rspec', '>= 4.3.1' ,require: false
17+
gem 'guard-rspec', '>= 4.3.1', require: false
1818
gem 'guard-bundler', require: false
1919
gem 'guard-preek', require: false
2020
gem 'guard-rubocop', require: false

Rakefile

+23-22
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
require "bundler/gem_tasks"
2-
3-
require 'rake/testtask'
4-
require 'rspec/core/rake_task'
5-
require 'coveralls/rake/task'
6-
7-
# Test unit
8-
Rake::TestTask.new do |t|
9-
t.libs << 'test'
10-
t.test_files = FileList['test/test*.rb']
11-
t.verbose = true
12-
end
13-
14-
# RSpec
15-
RSpec::Core::RakeTask.new(:spec)
16-
17-
# Coveralls
18-
Coveralls::RakeTask.new
19-
20-
task test_with_coveralls: [:test, :spec, 'coveralls:push']
21-
22-
task default: [:test, :spec]
1+
require 'bundler/gem_tasks'
2+
3+
require 'rake/testtask'
4+
require 'rspec/core/rake_task'
5+
require 'coveralls/rake/task'
6+
7+
# Test unit
8+
Rake::TestTask.new do |t|
9+
t.libs << 'test'
10+
t.test_files = FileList['test/test*.rb']
11+
t.verbose = true
12+
end
13+
14+
# RSpec
15+
RSpec::Core::RakeTask.new(:spec)
16+
17+
# Coveralls
18+
Coveralls::RakeTask.new
19+
20+
default_task = [:test, :spec]
21+
default_task << 'coveralls:push' if ENV['TRAVIS']
22+
23+
task default: default_task

examples/roo_soap_client.rb

+28-31
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
require 'soap/rpc/driver'
22

3-
def ferien_fuer_region(proxy, region, year=nil)
4-
proxy.first_row.upto(proxy.last_row) { |row|
5-
if proxy.cell(row, 2) == region
6-
jahr = proxy.cell(row,1).to_i
7-
if year == nil || jahr == year
8-
bis_datum = proxy.cell(row,5)
9-
if DateTime.now > bis_datum
10-
print '('
11-
end
12-
print jahr.to_s+" "
13-
print proxy.cell(row,2)+" "
14-
print proxy.cell(row,3)+" "
15-
print proxy.cell(row,4).to_s+" "
16-
print bis_datum.to_s+" "
17-
print (proxy.cell(row,6) || '')+" "
18-
if DateTime.now > bis_datum
19-
print ')'
20-
end
21-
puts
3+
def ferien_fuer_region(proxy, region, year = nil)
4+
proxy.first_row.upto(proxy.last_row) do |row|
5+
if proxy.cell(row, 2) == region
6+
jahr = proxy.cell(row, 1).to_i
7+
if year.nil? || jahr == year
8+
bis_datum = proxy.cell(row, 5)
9+
if DateTime.now > bis_datum
10+
print '('
2211
end
23-
end
24-
}
12+
print jahr.to_s + ' '
13+
print proxy.cell(row, 2) + ' '
14+
print proxy.cell(row, 3) + ' '
15+
print proxy.cell(row, 4).to_s + ' '
16+
print bis_datum.to_s + ' '
17+
print (proxy.cell(row, 6) || '') + ' '
18+
if DateTime.now > bis_datum
19+
print ')'
20+
end
21+
puts
22+
end
23+
end
2524
end
25+
end
2626

27-
proxy = SOAP::RPC::Driver.new("http://localhost:12321","spreadsheetserver")
28-
proxy.add_method('cell','row','col')
27+
proxy = SOAP::RPC::Driver.new('http://localhost:12321', 'spreadsheetserver')
28+
proxy.add_method('cell', 'row', 'col')
2929
proxy.add_method('officeversion')
3030
proxy.add_method('last_row')
3131
proxy.add_method('last_column')
3232
proxy.add_method('first_row')
3333
proxy.add_method('first_column')
3434
proxy.add_method('sheets')
35-
proxy.add_method('set_default_sheet','s')
35+
proxy.add_method('set_default_sheet', 's')
3636
proxy.add_method('ferien_fuer_region', 'region')
3737

3838
sheets = proxy.sheets
@@ -42,12 +42,9 @@ def ferien_fuer_region(proxy, region, year=nil)
4242
puts "first column: #{proxy.first_column}"
4343
puts "last row: #{proxy.last_row}"
4444
puts "last column: #{proxy.last_column}"
45-
puts "cell: #{proxy.cell('C',8)}"
46-
puts "cell: #{proxy.cell('F',12)}"
45+
puts "cell: #{proxy.cell('C', 8)}"
46+
puts "cell: #{proxy.cell('F', 12)}"
4747
puts "officeversion: #{proxy.officeversion}"
48-
puts "Berlin:"
49-
50-
ferien_fuer_region(proxy, "Berlin")
51-
52-
48+
puts 'Berlin:'
5349

50+
ferien_fuer_region(proxy, 'Berlin')

examples/roo_soap_server.rb

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
require 'roo'
22
require 'soap/rpc/standaloneServer'
33

4-
NS = "spreadsheetserver" # name of your service = namespace
4+
NS = 'spreadsheetserver' # name of your service = namespace
55
class Server2 < SOAP::RPC::StandaloneServer
6-
76
def on_init
8-
spreadsheet = OpenOffice.new("./Ferien-de.ods")
7+
spreadsheet = OpenOffice.new('./Ferien-de.ods')
98
add_method(spreadsheet, 'cell', 'row', 'col')
109
add_method(spreadsheet, 'officeversion')
1110
add_method(spreadsheet, 'first_row')
1211
add_method(spreadsheet, 'last_row')
1312
add_method(spreadsheet, 'first_column')
1413
add_method(spreadsheet, 'last_column')
1514
add_method(spreadsheet, 'sheets')
16-
#add_method(spreadsheet, 'default_sheet=', 's')
15+
# add_method(spreadsheet, 'default_sheet=', 's')
1716
# method with '...=' did not work? alias method 'set_default_sheet' created
1817
add_method(spreadsheet, 'set_default_sheet', 's')
1918
end
20-
2119
end
2220

23-
PORT = 12321
21+
PORT = 12_321
2422
puts "serving at port #{PORT}"
2523
svr = Server2.new('Roo', NS, '0.0.0.0', PORT)
2624

examples/write_me.rb

+9-10
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,27 @@
55
MAXTRIES = 1000
66
print "what's your name? "
77
my_name = gets.chomp
8-
print "where do you live? "
8+
print 'where do you live? '
99
my_location = gets.chomp
10-
print "your message? (if left blank, only your name and location will be inserted) "
10+
print 'your message? (if left blank, only your name and location will be inserted) '
1111
my_message = gets.chomp
1212
spreadsheet = Google.new('ptu6bbahNZpY0N0RrxQbWdw')
1313
spreadsheet.default_sheet = 'Sheet1'
1414
success = false
1515
MAXTRIES.times do
16-
col = rand(10)+1
17-
row = rand(10)+1
18-
if spreadsheet.empty?(row,col)
16+
col = rand(10) + 1
17+
row = rand(10) + 1
18+
if spreadsheet.empty?(row, col)
1919
if my_message.empty?
20-
text = Time.now.to_s+" "+"Greetings from #{my_name} (#{my_location})"
20+
text = Time.now.to_s + ' ' + "Greetings from #{my_name} (#{my_location})"
2121
else
22-
text = Time.now.to_s+" "+"#{my_message} from #{my_name} (#{my_location})"
22+
text = Time.now.to_s + ' ' + "#{my_message} from #{my_name} (#{my_location})"
2323
end
24-
spreadsheet.set_value(row,col,text)
24+
spreadsheet.set_value(row, col, text)
2525
puts "message written to row #{row}, column #{col}"
2626
success = true
2727
break
2828
end
2929
puts "Row #{row}, column #{col} already occupied, trying again..."
3030
end
31-
puts "no empty cell found within #{MAXTRIES} tries" if !success
32-
31+
puts "no empty cell found within #{MAXTRIES} tries" unless success

roo.gemspec

+11-11
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
44
require 'roo/version'
55

66
Gem::Specification.new do |spec|
7-
spec.name = "roo"
7+
spec.name = 'roo'
88
spec.version = Roo::VERSION
9-
spec.authors = ["Thomas Preymesser", "Hugh McGowan", "Ben Woosley"]
10-
spec.email = ["[email protected]"]
11-
spec.summary = "Roo can access the contents of various spreadsheet files."
9+
spec.authors = ['Thomas Preymesser', 'Hugh McGowan', 'Ben Woosley']
10+
spec.email = ['[email protected]']
11+
spec.summary = 'Roo can access the contents of various spreadsheet files.'
1212
spec.description = "Roo can access the contents of various spreadsheet files. It can handle\n* OpenOffice\n* Excel\n* Google spreadsheets\n* Excelx\n* LibreOffice\n* CSV"
13-
spec.homepage = "http://github.com/Empact/roo"
14-
spec.license = "MIT"
13+
spec.homepage = 'http://github.com/Empact/roo'
14+
spec.license = 'MIT'
1515

1616
spec.files = `git ls-files -z`.split("\x0")
1717
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
1818
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19-
spec.require_paths = ["lib"]
19+
spec.require_paths = ['lib']
2020

21-
spec.add_dependency "nokogiri"
22-
spec.add_dependency "rubyzip"
21+
spec.add_dependency 'nokogiri'
22+
spec.add_dependency 'rubyzip'
2323

24-
spec.add_development_dependency "bundler", ">= 1.7"
25-
spec.add_development_dependency "rake", ">= 10.0"
24+
spec.add_development_dependency 'bundler', '>= 1.7'
25+
spec.add_development_dependency 'rake', '>= 10.0'
2626
spec.add_development_dependency 'minitest', '>= 5.4.3'
2727
end

spec/lib/roo/csv_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
end
1212

1313
describe '#parse' do
14-
subject {
14+
subject do
1515
csv.parse(options)
16-
}
16+
end
1717
context 'with headers: true' do
18-
let(:options) { {headers: true} }
18+
let(:options) { { headers: true } }
1919

2020
it "doesn't blow up" do
2121
expect { subject }.to_not raise_error
@@ -25,12 +25,12 @@
2525

2626
describe '#csv_options' do
2727
context 'when created with the csv_options option' do
28-
let(:options) {
28+
let(:options) do
2929
{
3030
col_sep: '\t',
3131
quote_char: "'"
3232
}
33-
}
33+
end
3434

3535
it 'returns the csv options' do
3636
csv = Roo::CSV.new(path, csv_options: options)

spec/lib/roo/excelx/format_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
'0%' => :percentage,
1212
'0.00%' => :percentage,
1313
'0.00E+00' => :float,
14-
'# ?/?' => :float, #??? TODO:
15-
'# ??/??' => :float, #??? TODO:
14+
'# ?/?' => :float, # ??? TODO:
15+
'# ??/??' => :float, # ??? TODO:
1616
'mm-dd-yy' => :date,
1717
'd-mmm-yy' => :date,
1818
'd-mmm' => :date,
@@ -33,10 +33,10 @@
3333
'##0.0E+0' => :float,
3434
'@' => :float,
3535
#-- zusaetzliche Formate, die nicht standardmaessig definiert sind:
36-
"yyyy\\-mm\\-dd" => :date,
36+
'yyyy\\-mm\\-dd' => :date,
3737
'dd/mm/yy' => :date,
3838
'hh:mm:ss' => :time,
39-
"dd/mm/yy\\ hh:mm" => :datetime,
39+
'dd/mm/yy\\ hh:mm' => :datetime,
4040
'dd/mmm/yy\\ hh:mm' => :datetime,
4141
'dd/mmm/yy' => :date, # 2011-05-21
4242
'yyyy-mm-dd' => :date, # 2011-09-16

spec/lib/roo/excelx_spec.rb

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
require 'spec_helper'
22

33
describe Roo::Excelx do
4-
subject(:xlsx) {
4+
subject(:xlsx) do
55
Roo::Excelx.new(path)
6-
}
7-
6+
end
87

98
describe '.new' do
109
let(:path) { 'test/files/numeric-link.xlsx' }
@@ -27,13 +26,13 @@
2726
context 'with numeric contents' do
2827
let(:path) { 'test/files/numeric-link.xlsx' }
2928

30-
subject {
29+
subject do
3130
xlsx.cell('A', 1)
32-
}
31+
end
3332

3433
it 'returns a link with the number as a string value' do
3534
expect(subject).to be_a(Roo::Link)
36-
expect(subject).to eq("8675309.0")
35+
expect(subject).to eq('8675309.0')
3736
end
3837
end
3938
end
@@ -45,12 +44,12 @@
4544
context 'with a columns hash' do
4645
context 'when not present in the sheet' do
4746
it 'does not raise' do
48-
expect {
47+
expect do
4948
xlsx.sheet(0).parse(
50-
this: "This",
51-
that: "That"
49+
this: 'This',
50+
that: 'That'
5251
)
53-
}.to raise_error("Couldn't find header row.")
52+
end.to raise_error("Couldn't find header row.")
5453
end
5554
end
5655
end

spec/lib/roo/libreoffice_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
describe Roo::LibreOffice do
44
describe '.new' do
5-
subject {
5+
subject do
66
Roo::LibreOffice.new('test/files/numbers1.ods')
7-
}
7+
end
88

99
it 'creates an instance' do
1010
expect(subject).to be_a(Roo::LibreOffice)

spec/lib/roo/openoffice_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
describe Roo::OpenOffice do
44
describe '.new' do
5-
subject {
5+
subject do
66
Roo::OpenOffice.new('test/files/numbers1.ods')
7-
}
7+
end
88

99
it 'creates an instance' do
1010
expect(subject).to be_a(Roo::OpenOffice)

0 commit comments

Comments
 (0)