rspreadsheet 0.4.5 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1baffe562cc732b33a3919529ebac6eee2a4e337
4
- data.tar.gz: 0405d76a41fecf70a3a131f0fcfdabd41877cb71
2
+ SHA256:
3
+ metadata.gz: fdaab0a6bad4e406aa6e180c1a0b5d21d7f1e01586d0275449e6a824852d07c6
4
+ data.tar.gz: 83f64bbd8b7c94c924ce0b75794995c4f90f2d14630f5a87b2f96d2fae80a6cc
5
5
  SHA512:
6
- metadata.gz: a60aa7bc6cbcd3af3d8de9b161b220d8f9f0db92279ee14715a107cd7bb0f902e27dfb87d4b3c42e86634f198c7163e18a01a8721b5a7501ade4d54246cd93a9
7
- data.tar.gz: 7f44c68924b04255565aaf06e0ac77ba6b3e719a748630122f8f7fd2bff5fe563033321a1e42db3c1070a9164627dd373fec7cba42901b2e9fe4536ac5f3c7b1
6
+ metadata.gz: 324d95798062e62cdb99a8039b48e46b80ddd33c31a6963e6c51af5da01f0858db51fd737937b1744b33d8b085a4b03e0ed81c92d4523e20a961ba7c437bda55
7
+ data.tar.gz: 60445dbdb2965e661db8e0b1213039aa89ad0b8a53ac61de4aa7e2005a9b4274bfd8bdad66cc6a494f4bc331e06c0f2012eab2150787859e018f977e6fd68214
data/.gitignore CHANGED
@@ -26,7 +26,7 @@ build/
26
26
  .*kate-swp
27
27
  .*kate-swp.bak
28
28
  .directory
29
- .rake-tasks~
29
+ .rake_tasks~
30
30
 
31
31
  ## Environment normalisation:
32
32
  /.bundle/
@@ -34,7 +34,6 @@ build/
34
34
 
35
35
  # for a library or gem, you might want to ignore these files since the code is
36
36
  # intended to run in multiple environments; otherwise, check them in:
37
-
38
37
  Gemfile.lock
39
38
  .ruby-version
40
39
  .ruby-gemset
@@ -47,4 +46,8 @@ Gemfile.lock
47
46
  /spec/testfile1/
48
47
 
49
48
  #temporary
50
- /w
49
+ /w
50
+ *~
51
+
52
+ # rspec failure tracking
53
+ .rspec_status
data/.travis.yml CHANGED
@@ -1,11 +1,19 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.0.0
5
- - 2.1.10
6
- - 2.2.6
7
- - 2.3.3
8
- - 2.4.0
4
+ - 2.0.0 # latest 2.0 by 2019-05
5
+ - 2.1.10 # latest 2.1 by 2019-05
6
+ - 2.2.10 # latest 2.2 by 2019-05
7
+ - 2.3.8 # latest 2.3 by 2019-05
8
+ - 2.4.6 # latest 2.4 by 2019-05
9
+ - 2.5.5 # latest 2.5 by 2019-05
10
+ - 2.6.3 # latest 2.6 by 2019-05
11
+ - 2.1.5 # ruby in debian 8 jessie
12
+ - 2.3.3 # ruby in debian 9 stretch
13
+ - 2.5.5 # ruby in debian 10 buster
14
+
15
+
16
+ # tesing versions with native libxml2 in debian
9
17
  script: 'bundle exec rake'
10
18
  matrix:
11
19
  include:
@@ -19,6 +27,6 @@ matrix:
19
27
  notifications:
20
28
  email:
21
29
  recipients:
22
- - jatesins@ncsu.edu
30
+ - travis@kub.cz
23
31
  on_failure: change
24
32
  on_success: never
data/DEVEL_BLOG.md CHANGED
@@ -66,7 +66,7 @@ RSpreadsheet.generate('pricelist.ods') do
66
66
  ## Guiding ideas
67
67
  * xml document is always synchronized with the data. So the save is trivial.
68
68
  * no duplication of data. Objects like RowArray should containg minimum information. This one exists solely to speed up cell search. Taken to extream it is questionable, whether we need such objects at all, it might be possible to always work with xml directly.
69
- * all cells and rows only server as proxy. they hold index and worksheet pointer and everytime read or write is done, the xml is newly searched. until there is a xmlnode caching we have no problem
69
+ * all cells and rows only serve as a proxy. They hold index and worksheet pointer and everytime read or write is done, the xml is newly searched. until there is a xmlnode caching we have no problem
70
70
  * all cells returned for particular coordinates are **always the same object**. This way we have no problem to synchronize changes.
71
71
 
72
72
  ## Known Issues
@@ -81,11 +81,11 @@ RSpreadsheet.generate('pricelist.ods') do
81
81
  ### Automated testing
82
82
 
83
83
  * ``bundle exec guard`` will get tested any changes as soon as they are summitted
84
- * ``rake spec`` runs all test manually
84
+ * ``bundle exec rake spec`` runs all test manually
85
85
 
86
86
  ### Automated utilities
87
87
 
88
- * [travis-ci](https://travis-ci.org/gorn/rspreadsheet) provides automated testing
88
+ * [travis-ci](https://travis-ci.org/gorn/rspreadsheet) provides automated testing - it tests every commit even in branches
89
89
  * [github](https://github.com/gorn/rspreadsheet) hosts the repository where you can get the code
90
90
  * [coverals](https://coveralls.io/r/gorn/rspreadsheet) checks how well source is covered by tests
91
91
 
@@ -94,13 +94,16 @@ RSpreadsheet.generate('pricelist.ods') do
94
94
  1. Make changes
95
95
  2. Test if all tests pass (run `bundle exec guard` to test automatically). If not go to 1.
96
96
  3. Build and install locally using script `./reinstall_local_gem.sh` (see [details](reinstall_local_gem.sh))
97
- 4. Now can locally and manually use/test the gem. This should not be replacement for automated testing. If you make some changes, go to 1.
98
- 5. When happy, increment the version number and `git add .; git commit -am'commit message'; git push`
99
- 6. ``rake release`` - creates a version tag in git and pushes the code to github + Rubygems. After this is succesfull the new version appears as release in Github and RubyGems.
97
+ 4. Now can locally and manually use/test the gem. This should not be replacement for automated testing. If you make any changes, go to 1.
98
+ 5. If you want to test in travis before the release, you can `git push` the changes and let [travis](https://travis-ci.org/gorn/rspreadsheet) test them.
99
+ If you want to be extra prudent you can do this in feature branch by `git checkout -b <feature-branch-name>; git push -u origin <feature-branch-name>`
100
+ 6. When happy, increment the version number and `git add .; git commit -am'commit message'; git push`
101
+ 7. ``rake release`` - creates a version tag in git and pushes the code to github + Rubygems. After this is succesfull the new version appears as release in Github and RubyGems.
102
+ 8. If you have used the feature branch, than delete it.
100
103
 
101
- gem alternative to points 3-6
104
+ gem alternative to step 3 and 7
102
105
 
103
- gem build rspreadsheet.gemspec -\ These two lines together are in install.sh
106
+ gem build rspreadsheet.gemspec -\ These two lines together are in reinstall_local_gem.sh
104
107
  sudo gem install rspreadsheet-x.y.z.gem -/ which should be invoked from parent directory
105
108
  gem push rspreadsheet-x.y.z.gem releases the gem, do not forgot to update version in rspreadsheet.gemspec before doing this
106
109
 
data/README.md CHANGED
@@ -9,19 +9,13 @@ The gem allows you to acces your file and modify any cell of it, **without** tou
9
9
  ## Examples of usage
10
10
 
11
11
  ```ruby
12
- require 'rspreadsheet'
13
- book = Rspreadsheet.open('./test.ods')
14
- sheet = book.worksheets(1)
12
+ sheet = Rspreadsheet.open('./test.ods').worksheets(1)
15
13
 
16
- # get value of a cell B5 (there are more ways to do this)
17
- sheet.B5 # => 'cell value'
18
- sheet[5,2] # => 'cell value'
19
- sheet.row(5).cell(2).value # => 'cell value'
20
-
21
- # set value of a cell B5
22
- sheet.F5 = 'text'
23
- sheet[5,2] = 7
24
- sheet.cell(5,2).value = 1.78
14
+ sheet.B5 = 'Cat'
15
+ sheet.B5 #=> 'Cat'
16
+ sheet['B', 5] #=> 'Cat'
17
+ sheet['B', 5] = 'Mouse'
18
+ sheet.row(5).cell(2).value #=> 'Mouse'
25
19
 
26
20
  # working with cell format
27
21
  sheet.cell(5,2).format.bold = true
@@ -55,32 +49,41 @@ book.save('different_filename.ods')
55
49
 
56
50
  ## Installation and Configuration
57
51
 
58
- Gem is on [Rubygems](https://rubygems.org/gems/rspreadsheet) so you can install it by
52
+ Add this line to your application's Gemfile:
53
+
54
+ ```ruby
55
+ gem 'rspreadsheet'
56
+ ```
57
+
58
+ And then execute:
59
+
60
+ $ bundle
61
+
62
+ Or install it yourself as:
59
63
 
60
64
  $ gem install rspreadsheet
61
65
 
62
- or add <code>gem 'rspreadsheet'</code> to your Gemfile and execute <code>bundle</code>.
66
+ If you get this error concering libxml, like
63
67
 
64
- If you get this error
68
+ checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
69
+ *** extconf.rb failed ***
70
+ or
65
71
 
66
72
  mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
67
-
73
+
68
74
  then you might not have installed libxml for ruby. I.e. in debian something like <code>sudo aptitude install ruby-libxml</code> or using equivalent command in other package managers.
69
75
 
70
76
  ## Contibutions, ideas and wishes welcomed
71
77
 
72
78
  ### Nonprogrammers
73
- If you need any help or find a bug please [submit an issue](https://github.com/gorn/rspreadsheet/issues) here. I appreciate any feedback and even if you can not help with code, it is interesting for me to hear from you. Different people have different needs and I want to hear about them. If you are a programmer and you have any ideas, wishes, etc you are welcomed to fork the repository and submit a pull request preferably including a failing test.
74
79
 
75
- Alhought this gem is still in beta stage I use in everyday and it works fine. Currently I am experimenting with syntax to get stabilized. **Any suggestions regarding the syntax is very welcomed**
80
+ File a [bug report](https://github.com/gorn/rspreadsheet/issues). I appreciate any feedback and even if you can not help with code, it is interesting for me to hear from you. Different people have different needs and I want to hear about them.
81
+
82
+ Alhought this gem is still in beta stage I use in everyday and it works fine. Any suggestions regarding the syntax is very welcomed.
76
83
 
77
84
  ### Programmers
78
85
 
79
- 1. [Fork it](http://github.com/gorn/rspreadsheet/fork) and clone it ([troubleshooting](https://github.com/gorn/rspreadsheet/blob/master/DEVEL_BLOG.md#installation-troubleshooting))
80
- 2. Create your feature branch (`git checkout -b my-new-feature`)
81
- 3. Commit your changes (`git commit -am 'Add some feature'`)
82
- 4. Push to the branch (`git push origin my-new-feature`)
83
- 5. Create new Pull Request
86
+ File a [bug report](https://github.com/gorn/rspreadsheet/issues) or [fork it](http://github.com/gorn/rspreadsheet/fork) and file a pull request. You do not have to contribute a code, failing tests are welcomed as well.
84
87
 
85
88
  ## Why another OpenDocument spreadsheet gem?
86
89
 
@@ -102,3 +105,7 @@ One of the main ideas is that the manipulation with OpenDOcument files should be
102
105
  * [Code documentation](http://www.rubydoc.info/github/gorn/rspreadsheet) is hosted on [rubydoc.info](http://www.rubydoc.info/)
103
106
  * [Changelog](CHANGELOG.md)
104
107
  * [Documentation for developers](DEVEL_BLOG.md) containing ideas for future development and documentation on testing tools
108
+
109
+ ## License
110
+
111
+ The gem is available as open source under the terms of the [GPL licence](LICENCE.md).
data/Rakefile CHANGED
@@ -1,10 +1,8 @@
1
- require 'rspec/core/rake_task'
2
- require 'bundler/gem_tasks'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
3
 
4
- # Default directory to look in is `/specs`
5
- # Run with `rake spec`
6
- RSpec::Core::RakeTask.new(:spec) do |task|
7
- task.rspec_opts = ['--color', '--format', 'nested']
4
+ RSpec::Core::RakeTask.new(:spec) do |task|
5
+ task.rspec_opts = ['--color', '--format', 'd'] # jak se ma formatova vystup
8
6
  end
9
7
 
10
- task :default => :spec
8
+ task :default => :spec
@@ -10,9 +10,6 @@ if RUBY_VERSION > '2.1'
10
10
  inject(0){ |sum, element| sum.to_f + element.to_f } || identity
11
11
  end
12
12
  end
13
- def self.marker
14
- 'yes'
15
- end
16
13
  end
17
14
 
18
15
  refine LibXML::XML::Node do
@@ -72,9 +69,6 @@ else # Monkeypatching
72
69
  inject(0){ |sum, element| sum.to_f + element.to_f } || identity
73
70
  end
74
71
  end
75
- def self.marker
76
- 'yes2'
77
- end
78
72
  end
79
73
 
80
74
  class LibXML::XML::Node
@@ -157,7 +157,7 @@ class Cell < XMLTiedItem
157
157
  when gt == :percentage then
158
158
  remove_all_value_attributes_and_content
159
159
  set_type_attribute('percentage')
160
- Tools.set_ns_attribute(xmlnode,'office','value', '%0.2d%' % avalue.to_f)
160
+ Tools.set_ns_attribute(xmlnode,'office','value', ('%0.2d' % avalue.to_f)+'%')
161
161
  xmlnode << Tools.prepare_ns_node('text','p', (avalue.to_f*100).round.to_s+'%')
162
162
  when gt == :currency then
163
163
  remove_all_value_attributes_and_content
@@ -67,7 +67,7 @@ class Image < XMLTiedItem
67
67
 
68
68
  def initialize_from_file(filename,mime)
69
69
  # ověřit, zda soubor na disku existuje TODO: tady by to chtělo zobecnit na IO
70
- raise 'File does not exist or it is not accessible' unless File.exists?(filename)
70
+ raise 'File does not exist or it is not accessible' unless File.exist?(filename)
71
71
  @original_filename = filename
72
72
  @mime = mime
73
73
  self
@@ -115,4 +115,4 @@ class Image < XMLTiedItem
115
115
  #
116
116
  end
117
117
 
118
- end
118
+ end
@@ -119,10 +119,10 @@ module Tools
119
119
  'css3t'=>"http://www.w3.org/TR/css3-text/",
120
120
  'manifest'=>"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"
121
121
  }
122
- if @pomnode.nil?
122
+ if !defined?(@pomnode) or @pomnode.nil?
123
123
  @pomnode = LibXML::XML::Node.new('xxx')
124
124
  end
125
- if @ns.nil? then @ns={} end
125
+ if !defined?(@ns) or @ns.nil? then @ns={} end
126
126
  if @ns[prefix].nil?
127
127
  @ns[prefix] = LibXML::XML::Namespace.new(@pomnode, prefix, ns_array[prefix])
128
128
  end
@@ -192,11 +192,3 @@ module Tools
192
192
  end
193
193
 
194
194
  end
195
-
196
- # @private
197
- class Range
198
- def size
199
- res = self.end-self.begin+1
200
- res>0 ? res : 0
201
- end
202
- end
@@ -1,3 +1,3 @@
1
1
  module Rspreadsheet
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.7"
3
3
  end
@@ -111,7 +111,7 @@ class Worksheet
111
111
  end
112
112
  alias :cell :cells
113
113
  def column(param)
114
- r,coli = Rspreadsheet::Tools.a2c(1,param)
114
+ _,coli = Rspreadsheet::Tools.a2c(1,param)
115
115
  Column.new(self,coli)
116
116
  end
117
117
  # Allows syntax like sheet.F15. TO catch errors easier, allows only up to three uppercase letters in colum part, althought it won't be necessarry to restrict.
@@ -92,6 +92,9 @@ class XMLTiedItem < XMLTied
92
92
  self.singleton_class.send(:define_method, method, raise_destroyed_cell_error)
93
93
  end
94
94
  self.singleton_class.send(:define_method, :inspect, -> { "#<%s:0x%x destroyed cell>" % [self.class,object_id] }) # define descriptive inspect
95
+ if self.singleton_class.respond_to? :remove_method # in ruby 2.5 and higher
96
+ self.singleton_class.remove_method :invalid_reference? if self.singleton_class.method_defined? :invalid_reference?
97
+ end
95
98
  self.singleton_class.send(:define_method, :invalid_reference?, -> { true }) # define invalid_reference? method
96
99
  # invalidate variables
97
100
  @xml_tied_parent=nil
@@ -18,13 +18,13 @@ module XMLTiedArray_WithRepeatableItems
18
18
  include XMLTiedArray
19
19
 
20
20
  def my_subnode_range(aindex)
21
- node, range = find_subnode_with_range(aindex)
21
+ _, range = find_subnode_with_range(aindex)
22
22
  return range
23
23
  end
24
24
 
25
25
  # vrátí xmlnode na souřadnici aindex
26
26
  def my_subnode(aindex)
27
- result1, result2 = find_subnode_with_range(aindex)
27
+ result1, _ = find_subnode_with_range(aindex)
28
28
  return result1
29
29
  end
30
30
 
@@ -112,7 +112,7 @@ module XMLTiedArray_WithRepeatableItems
112
112
  # clean up item from xml (handle possible detachments) and itemcache. leave the object invalidation on the object
113
113
  # this should not be called from nowhere but XMLTiedItem.delete
114
114
  def delete_subitem(aindex)
115
- options = subitem_xml_options
115
+ # options = subitem_xml_options
116
116
  delete_my_subnode_respect_repeated(aindex) # vymaž node z xml
117
117
  @itemcache.delete(aindex)
118
118
  @itemcache.keys.sort.select{|i| i>=aindex+1 }.each do |i|
@@ -148,4 +148,4 @@ module XMLTiedArray_WithRepeatableItems
148
148
  end
149
149
  end
150
150
 
151
- end
151
+ end
data/rspreadsheet.gemspec CHANGED
@@ -8,8 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Rspreadsheet::VERSION
9
9
  spec.authors = ["Jakub A.Těšínský"]
10
10
  spec.email = ["jAkub.cz (A is at)"]
11
- spec.summary = %q{Manipulating spreadsheets with Ruby (read / create / modify OpenDocument Spreadsheet).}
12
- spec.description = %q{Manipulating OpenDocument spreadsheets with Ruby. This gem can create new, read existing files abd modify them. When modyfying files, it tries to change as little as possible, making it as much forward compatifle as possible.}
11
+ spec.summary = 'Manipulating LibreOffice Calc (OpenDocument Spreadsheet) files from Ruby (read / create / modify).'
12
+ spec.description = 'Manipulating LibreOffice Calc (OpenDocument Spreadsheet) files with Ruby. This gem can create new, read existing files abd modify them. When modyfying files, it tries to change as little as possible, making it as much forward compatible as possible.'
13
+
13
14
  spec.homepage = "https://github.com/gorn/rspreadsheet"
14
15
  spec.license = "GPL"
15
16
 
@@ -33,17 +34,25 @@ Gem::Specification.new do |spec|
33
34
  spec.add_runtime_dependency 'andand', '~>1.3'
34
35
 
35
36
  # development dependencies
36
- spec.add_development_dependency "bundler", '~> 1.5'
37
- spec.add_development_dependency "rake", '~>0.9'
37
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.5')
38
+ # ruby 2.4.5 and up
39
+ spec.add_development_dependency "bundler", '>= 1.5', '<3' # some 2.5 rubyies contain already bundler 2 included
40
+ spec.add_development_dependency "rake", '~>10.0'
41
+ else
42
+ # ruby up to 2.4.5
43
+ spec.add_development_dependency "bundler", '~> 1.5'
44
+ spec.add_development_dependency "rake", '~>0.9'
45
+ end
38
46
  # testig - see http://bit.ly/1n5yM51
39
47
  spec.add_development_dependency "rspec", '~>2.0' # running tests
40
48
  spec.add_development_dependency 'pry-nav', '~>0.0' # enables pry 'next', 'step' commands
41
49
  spec.add_development_dependency "coveralls", '~>0.7' # inspecting coverage of tests
42
50
 
51
+
43
52
  # optional and testing
44
53
  if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.2.5')
45
- spec.add_development_dependency "guard", '~>2.13'
46
- spec.add_development_dependency "guard-rspec", '~>4.6'
54
+ # spec.add_development_dependency "guard", '~>2.13'
55
+ # spec.add_development_dependency "guard-rspec", '~>4.6'
47
56
  end
48
57
 
49
58
  # spec.add_development_dependency 'equivalent-xml' # implementing xml diff
data/spec/cell_spec.rb CHANGED
@@ -345,7 +345,7 @@ describe Rspreadsheet::Cell do
345
345
  @cell.formula='=1+5'
346
346
  @cell.formula.should eq '=1+5'
347
347
  end
348
- it 'unsets cell type when formula set - we can not guess it correctly', :focus do
348
+ it 'unsets cell type when formula set - we can not guess it correctly' do
349
349
  @cell = @sheet1.cell(1,1)
350
350
  @cell.value = 'ahoj'
351
351
  @cell.type.should eq :string
@@ -449,11 +449,11 @@ describe Rspreadsheet::Cell do
449
449
  @cell.border_top.should_not be_nil ## ?????
450
450
  end
451
451
 
452
- it 'automatically creates new style, if a style is automatic, some of its attributes changes and there are several cells pointing to it', :penting=>'' do
452
+ it 'automatically creates new style, if a style is automatic, some of its attributes changes and there are several cells pointing to it', :pending=>'' do
453
453
 
454
454
  end
455
455
 
456
- it 'gracedully accepts nil in assignement' do
456
+ it 'gracefully accepts nil in assignement' do
457
457
  expect {
458
458
  @sheet2.cell('B1').value = nil
459
459
  @sheet2.cell('B2').value = nil
@@ -21,7 +21,7 @@ if RUBY_VERSION > '2.1'
21
21
  @m2 = LibXML::XML::Node.new('a')
22
22
  end
23
23
  it 'can compare nodes' do
24
- @n.to_s.should == @m.to_s
24
+ @n.to_s.should be == @m.to_s
25
25
  @n.to_s.should_not == @m2.to_s
26
26
  end
27
27
  it 'has correct elements' do
data/spec/image_spec.rb CHANGED
@@ -4,7 +4,7 @@ describe Rspreadsheet::Image do
4
4
  before do
5
5
  @testfile_filename = $test_filename_images
6
6
  @tmp_testfile_filename = '/tmp/testfile2-image.ods'
7
- File.delete(@tmp_testfile_filename) if File.exists?(@tmp_testfile_filename) # delete temp file
7
+ File.delete(@tmp_testfile_filename) if File.exist?(@tmp_testfile_filename) # delete temp file
8
8
 
9
9
  @testimage_filename = './spec/test-image-blue.png'
10
10
  @testimage2_filename = './spec/test-image.png'
@@ -13,9 +13,9 @@ describe Rspreadsheet::Image do
13
13
  @sheet2 = @workbook.worksheets(2)
14
14
  end
15
15
  after do
16
- File.delete(@tmp_testfile_filename) if File.exists?(@tmp_testfile_filename) # delete temp file
16
+ File.delete(@tmp_testfile_filename) if File.exist?(@tmp_testfile_filename) # delete temp file
17
17
  end
18
- it 'is accesible when included in spreadsheet', :xpending do
18
+ it 'is accesible when included in spreadsheet' do
19
19
  @sheet.images_count.should == 1
20
20
  @image = @sheet.images(1)
21
21
 
@@ -80,7 +80,7 @@ describe Rspreadsheet::Image do
80
80
  @sheet2.images_count.should == 1
81
81
  @image = @sheet2.images(1)
82
82
 
83
- File.delete(tmp_test_image) if File.exists?(tmp_test_image)
83
+ File.delete(tmp_test_image) if File.exist?(tmp_test_image)
84
84
  Zip::File.open(@tmp_testfile_filename) do |zip| ## TODO: this is UGLY - it should not be extracting contents here
85
85
  zip.extract(@image.internal_filename,tmp_test_image)
86
86
  end
@@ -104,4 +104,4 @@ describe Rspreadsheet::Image do
104
104
  # it 'has dimensions defaulting to size of the image once it is inserted' do
105
105
  # end
106
106
 
107
- end
107
+ end
data/spec/io_spec.rb CHANGED
@@ -4,7 +4,7 @@ using ClassExtensions if RUBY_VERSION > '2.1'
4
4
  describe Rspreadsheet do
5
5
  before do
6
6
  @tmp_filename = '/tmp/testfile.ods'
7
- File.delete(@tmp_filename) if File.exists?(@tmp_filename) # delete temp file
7
+ File.delete(@tmp_filename) if File.exist?(@tmp_filename) # delete temp file
8
8
  end
9
9
 
10
10
 
data/spec/row_spec.rb CHANGED
@@ -255,7 +255,7 @@ describe Rspreadsheet::Row do
255
255
  @row.cells(1).value.should == 1
256
256
  @row.cells(3).blank?.should be_truthy
257
257
  end
258
- it 'can be mass assigned by sheet[]= method', :focus do
258
+ it 'can be mass assigned by sheet[]= method' do
259
259
  @sheet1[1] = ['foo','baz']
260
260
  end
261
261
  it 'cells can be wiped out by truncate method' do
@@ -4,10 +4,10 @@ using ClassExtensions if RUBY_VERSION > '2.1'
4
4
  describe Rspreadsheet do
5
5
  before do
6
6
  @tmp_filename = '/tmp/testfile.ods' # delete temp file before tests
7
- File.delete(@tmp_filename) if File.exists?(@tmp_filename)
7
+ File.delete(@tmp_filename) if File.exist?(@tmp_filename)
8
8
  end
9
9
  after do
10
- File.delete(@tmp_filename) if File.exists?(@tmp_filename) # delete temp file after tests
10
+ File.delete(@tmp_filename) if File.exist?(@tmp_filename) # delete temp file after tests
11
11
  end
12
12
 
13
13
  it 'can open ods testfile and reads its content correctly' do
@@ -119,7 +119,7 @@ describe Rspreadsheet do
119
119
  book.save
120
120
  book.save('/tmp/different_filename.ods')
121
121
  end.not_to raise_error
122
- File.delete('/tmp/different_filename.ods') if File.exists?('/tmp/different_filename.ods') # delete after tests
122
+ File.delete('/tmp/different_filename.ods') if File.exist?('/tmp/different_filename.ods') # delete after tests
123
123
  end
124
124
  it 'examples from advanced syntax GUIDE are working' do
125
125
  def p(*par); end # supress p in the example
data/spec/spec_helper.rb CHANGED
@@ -2,10 +2,26 @@
2
2
  require 'bundler/setup'
3
3
  Bundler.setup
4
4
 
5
- RSpec.configure do |c|
6
- c.fail_fast = true
7
- # c.warnings = true
8
- c.treat_symbols_as_metadata_keys_with_true_values = true # so i can run individual test just by appending :focus to them
5
+ RSpec.configure do |config|
6
+ config.fail_fast = true
7
+ # config.warnings = true
8
+
9
+ # so i can run individual test just by appending :focus to them
10
+ config.treat_symbols_as_metadata_keys_with_true_values = true if config.respond_to? :treat_symbols_as_metadata_keys_with_true_values= # older form
11
+ # config.filter_run_when_matching(:focus)
12
+
13
+ ## preparing for RSpec 4 (will be default in RSpec 4
14
+
15
+ if config.respond_to? :expect_with and config.respond_to? :include_chain_clauses_in_custom_matcher_descriptions
16
+ config.expect_with :rspec do |expectations|
17
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
18
+ end
19
+ end
20
+ config.mock_with :rspec do |mocks|
21
+ mocks.verify_partial_doubles = true if mocks.respond_to? :verify_partial_doubles
22
+ end
23
+ config.shared_context_metadata_behavior = :apply_to_host_groups if config.respond_to? :shared_context_metadata_behavior
24
+
9
25
  end
10
26
 
11
27
  # this enables Coveralls
@@ -18,3 +34,6 @@ $test_filename_images = './spec/testfile2-images.ods'
18
34
 
19
35
  # require my gem
20
36
  require 'rspreadsheet'
37
+
38
+
39
+
@@ -0,0 +1,100 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ # rspec-expectations config goes here. You can use an alternate
18
+ # assertion/expectation library such as wrong or the stdlib/minitest
19
+ # assertions if you prefer.
20
+ config.expect_with :rspec do |expectations|
21
+ # This option will default to `true` in RSpec 4. It makes the `description`
22
+ # and `failure_message` of custom matchers include text for helper methods
23
+ # defined using `chain`, e.g.:
24
+ # be_bigger_than(2).and_smaller_than(4).description
25
+ # # => "be bigger than 2 and smaller than 4"
26
+ # ...rather than:
27
+ # # => "be bigger than 2"
28
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
+ end
30
+
31
+ # rspec-mocks config goes here. You can use an alternate test double
32
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
33
+ config.mock_with :rspec do |mocks|
34
+ # Prevents you from mocking or stubbing a method that does not exist on
35
+ # a real object. This is generally recommended, and will default to
36
+ # `true` in RSpec 4.
37
+ mocks.verify_partial_doubles = true
38
+ end
39
+
40
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
+ # have no way to turn it off -- the option exists only for backwards
42
+ # compatibility in RSpec 3). It causes shared context metadata to be
43
+ # inherited by the metadata hash of host groups and examples, rather than
44
+ # triggering implicit auto-inclusion in groups with matching metadata.
45
+ config.shared_context_metadata_behavior = :apply_to_host_groups
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # This allows you to limit a spec run to individual examples or groups
51
+ # you care about by tagging them with `:focus` metadata. When nothing
52
+ # is tagged with `:focus`, all examples get run. RSpec also provides
53
+ # aliases for `it`, `describe`, and `context` that include `:focus`
54
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
55
+ config.filter_run_when_matching :focus
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = "spec/examples.txt"
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
65
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
67
+ config.disable_monkey_patching!
68
+
69
+ # This setting enables warnings. It's recommended, but in some cases may
70
+ # be too noisy due to issues in dependencies.
71
+ config.warnings = true
72
+
73
+ # Many RSpec users commonly either run the entire suite or an individual
74
+ # file, and it's useful to allow more verbose output when running an
75
+ # individual spec file.
76
+ if config.files_to_run.one?
77
+ # Use the documentation formatter for detailed output,
78
+ # unless a formatter has already been configured
79
+ # (e.g. via a command-line flag).
80
+ config.default_formatter = "doc"
81
+ end
82
+
83
+ # Print the 10 slowest examples and example groups at the
84
+ # end of the spec run, to help surface which specs are running
85
+ # particularly slow.
86
+ config.profile_examples = 10
87
+
88
+ # Run specs in random order to surface order dependencies. If you find an
89
+ # order dependency and want to debug it, you can fix the order by providing
90
+ # the seed, which is printed after each run.
91
+ # --seed 1234
92
+ config.order = :random
93
+
94
+ # Seed global randomization in this process using the `--seed` CLI option.
95
+ # Setting this allows you to use `--seed` to deterministically reproduce
96
+ # test failures related to randomization by passing the same `--seed` value
97
+ # as the one that triggered the failure.
98
+ Kernel.srand config.seed
99
+ =end
100
+ end
@@ -90,6 +90,8 @@ describe Rspreadsheet::Worksheet do
90
90
  @sheet[-2,-5].should be_nil
91
91
 
92
92
  Rspreadsheet.raise_on_negative_coordinates = pom # reset the setting back
93
+
94
+ Rspreadsheet.configuration { |config| config.raise_on_negative_coordinates.should be == pom }
93
95
  end
94
96
  it 'returns nil with negative index or raise if configured to do so' do
95
97
  pom = Rspreadsheet.raise_on_negative_coordinates
@@ -25,6 +25,6 @@ describe Rspreadsheet::XMLTiedArray do
25
25
 
26
26
  tx = TestXMLTiedArray.new
27
27
  expect {tx.insert_new_empty_subnode_before(0)}.to raise_error IndexError
28
- expect {tx.insert_new_empty_subnode_before(1)}.to raise_error /create empty xmlnode/
28
+ expect {tx.insert_new_empty_subnode_before(1)}.to raise_error(/create empty xmlnode/)
29
29
  end
30
- end
30
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspreadsheet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub A.Těšínský
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-04 00:00:00.000000000 Z
11
+ date: 2019-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -42,30 +42,36 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.5'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '3'
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
53
56
  - !ruby/object:Gem::Version
54
57
  version: '1.5'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '3'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rake
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '0.9'
67
+ version: '10.0'
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '0.9'
74
+ version: '10.0'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: rspec
71
77
  requirement: !ruby/object:Gem::Requirement
@@ -108,9 +114,10 @@ dependencies:
108
114
  - - "~>"
109
115
  - !ruby/object:Gem::Version
110
116
  version: '0.7'
111
- description: Manipulating OpenDocument spreadsheets with Ruby. This gem can create
112
- new, read existing files abd modify them. When modyfying files, it tries to change
113
- as little as possible, making it as much forward compatifle as possible.
117
+ description: Manipulating LibreOffice Calc (OpenDocument Spreadsheet) files with Ruby.
118
+ This gem can create new, read existing files abd modify them. When modyfying files,
119
+ it tries to change as little as possible, making it as much forward compatible as
120
+ possible.
114
121
  email:
115
122
  - jAkub.cz (A is at)
116
123
  executables: []
@@ -159,6 +166,7 @@ files:
159
166
  - spec/row_spec.rb
160
167
  - spec/rspreadsheet_spec.rb
161
168
  - spec/spec_helper.rb
169
+ - spec/spec_helper.rb.template
162
170
  - spec/test-image-blue.png
163
171
  - spec/test-image.png
164
172
  - spec/testfile1.ods
@@ -187,11 +195,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
195
  version: '0'
188
196
  requirements: []
189
197
  rubyforge_project:
190
- rubygems_version: 2.2.2
198
+ rubygems_version: 2.7.6.2
191
199
  signing_key:
192
200
  specification_version: 4
193
- summary: Manipulating spreadsheets with Ruby (read / create / modify OpenDocument
194
- Spreadsheet).
201
+ summary: Manipulating LibreOffice Calc (OpenDocument Spreadsheet) files from Ruby
202
+ (read / create / modify).
195
203
  test_files:
196
204
  - spec/cell_spec.rb
197
205
  - spec/class_extensions_spec.rb
@@ -202,6 +210,7 @@ test_files:
202
210
  - spec/row_spec.rb
203
211
  - spec/rspreadsheet_spec.rb
204
212
  - spec/spec_helper.rb
213
+ - spec/spec_helper.rb.template
205
214
  - spec/test-image-blue.png
206
215
  - spec/test-image.png
207
216
  - spec/testfile1.ods