rspreadsheet 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +37 -0
- data/GUIDE.md +33 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +68 -0
- data/Rakefile +1 -0
- data/lib/rspreadsheet/version.rb +3 -0
- data/lib/rspreadsheet.rb +5 -0
- data/rspreadsheet.gemspec +23 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 53c030cab7792551f4a5de197ddc29a178819779
|
4
|
+
data.tar.gz: 9507d3da602fedeb5663ef3cd18cb90a59fe3bb7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9769f9526719bf73f62de799941729200d097966ff3b8b27885f96afb1b63af9437d61346ed1d7f7af4c56e00c3b3bed8853080bf525b220a4d7a596fa0826ba
|
7
|
+
data.tar.gz: 623d8226585fb2d345f113564cd5c94ee6d3d0bd8b408a14cdcaf17b681546dea0ecc38e19f98142f153aae5b77dd466e7c756c0105230b3c0a818803c864d1f
|
data/.gitignore
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
/.config
|
5
|
+
/coverage/
|
6
|
+
/InstalledFiles
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
lib/bundler/man
|
13
|
+
|
14
|
+
## Specific to RubyMotion:
|
15
|
+
.dat*
|
16
|
+
.repl_history
|
17
|
+
build/
|
18
|
+
|
19
|
+
## Documentation cache and generated files:
|
20
|
+
/.yardoc/
|
21
|
+
/_yardoc/
|
22
|
+
/doc/
|
23
|
+
/rdoc/
|
24
|
+
|
25
|
+
## Environment normalisation:
|
26
|
+
/.bundle/
|
27
|
+
/lib/bundler/man/
|
28
|
+
|
29
|
+
# for a library or gem, you might want to ignore these files since the code is
|
30
|
+
# intended to run in multiple environments; otherwise, check them in:
|
31
|
+
Gemfile.lock
|
32
|
+
# .ruby-version
|
33
|
+
# .ruby-gemset
|
34
|
+
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
|
+
.rvmrc
|
37
|
+
|
data/GUIDE.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Examplex of more advanced syntax follows:
|
2
|
+
|
3
|
+
```ruby
|
4
|
+
require 'rspreadsheet'
|
5
|
+
|
6
|
+
book = Rspreadsheet::Workbook.new
|
7
|
+
sheet book.create_worksheet 'Top icecreams'
|
8
|
+
|
9
|
+
sheet[0,0] = 'My top 5'
|
10
|
+
sheet[0,0].format.size = 15
|
11
|
+
sheet[0,0].format.weight = bold
|
12
|
+
p sheet[0,0].format.bold # => true
|
13
|
+
|
14
|
+
# These are all the same cells
|
15
|
+
p sheet.A1
|
16
|
+
p sheet.row(0).cell(0)
|
17
|
+
p sheet.rows[0][0]
|
18
|
+
p sheet.rows[0].cells[0]
|
19
|
+
p sheet.cells[0,0]
|
20
|
+
p sheet.cell(0,0)
|
21
|
+
|
22
|
+
p sheet.A1.class # => Rspreadsheet::Cell
|
23
|
+
|
24
|
+
# build the top ten list
|
25
|
+
(1..5).each { |i| sheet[i,0] = i }
|
26
|
+
sheet.columns[0].format.bold = true
|
27
|
+
sheet.cells[1,1..5] = ['Vanilla', 'Pistacia', 'Chocolate', 'Annanas', 'Strawbery']
|
28
|
+
|
29
|
+
sheet.columns[1][1..3].format.color = :red
|
30
|
+
|
31
|
+
book.save
|
32
|
+
|
33
|
+
```
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Jakub Tesinsky
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# rspreadsheet
|
2
|
+
|
3
|
+
rspreadsheet - manipulating spreadsheets with Ruby. Read, modify, write or create new OpenDocument Spreadsheet files from ruby code.
|
4
|
+
|
5
|
+
## Status
|
6
|
+
|
7
|
+
*This project is in its brainstorming phase.* Nothing is implemented yet, the documentation now serves as a list of intentions. Please submit issues and/or fork the repository if you have more ideas, wishes, etc ... once the coding begins, it will be much more difficult to change syntax.
|
8
|
+
|
9
|
+
## Examples of usage
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'rspreadsheet'
|
13
|
+
|
14
|
+
book = Rspreadsheet.open('./existing_file.ods')
|
15
|
+
sheet = book.worksheets 'Icecream list'
|
16
|
+
total = 0
|
17
|
+
|
18
|
+
sheet.rows[3..20].each do |row|
|
19
|
+
puts 'Icecream name: ' + row[2]
|
20
|
+
puts 'Icecream ingredients: ' + row[3]
|
21
|
+
puts "I ate this " + row[4] + ' times'
|
22
|
+
total += row[4]
|
23
|
+
end
|
24
|
+
|
25
|
+
sheet[21,3] = 'Total:'
|
26
|
+
sheet[21,4] = total
|
27
|
+
|
28
|
+
sheet.rows[21].format.bold = true
|
29
|
+
|
30
|
+
book.save
|
31
|
+
|
32
|
+
```
|
33
|
+
|
34
|
+
This is the basic functionality. However rspreadsheet should allows lots of alternative syntax, like described in [GUIDE.md](GUIDE.md)
|
35
|
+
|
36
|
+
## Installation
|
37
|
+
|
38
|
+
Add this line to your application's Gemfile:
|
39
|
+
|
40
|
+
gem 'rspreadsheet'
|
41
|
+
|
42
|
+
And then execute:
|
43
|
+
|
44
|
+
$ bundle
|
45
|
+
|
46
|
+
Or install it yourself as:
|
47
|
+
|
48
|
+
$ gem install rspreadsheet
|
49
|
+
|
50
|
+
## Motivation
|
51
|
+
|
52
|
+
This project arised from the necessity. Alhought it is not true that there are no ruby gems allowing to acess OpenDOcument spreadsheet, I did not find another decent one which would suit my needs. Most of them also look abandoned and inactive. I have investigated these options:
|
53
|
+
|
54
|
+
* [ruby-ods](https://github.com/yalab/ruby-ods) - this one seems as if it never really started
|
55
|
+
* [rodf](https://github.com/thiagoarrais/rodf)- this only server as builder, it can not read existing files
|
56
|
+
* [rods](http://www.drbreinlinger.de/ruby/rods/) - this is pretty ok, but it has terrible syntax. I first thought of writing wrapper around it, but it turned to be not so easy. Also last commit is 2 years old.
|
57
|
+
* [rubiod](https://github.com/netoctone/rubiod) - this one is quite ok, the syntax is definitely better that in rods, but it seems also very abandoned. This is a closest match.
|
58
|
+
* [spreadsheet](https://github.com/zdavatz/spreadsheet) - this does not work with OpenDocument and even with Excel has issues in modyfying document. However since it is supposedly used, and has quite good syntax it might be inspirative.
|
59
|
+
|
60
|
+
|
61
|
+
## Contributing
|
62
|
+
|
63
|
+
1. [Fork it](http://github.com/gorn/rspreadsheet/fork)
|
64
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
65
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
66
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
67
|
+
5. Create new Pull Request
|
68
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/rspreadsheet.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rspreadsheet/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rspreadsheet"
|
8
|
+
spec.version = Rspreadsheet::VERSION
|
9
|
+
spec.authors = ["Jakub A.Těšínský"]
|
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{TODO: Write a longer description. Optional.}
|
13
|
+
spec.homepage = "https://github.com/gorn/rspreadsheet"
|
14
|
+
# spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
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 "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspreadsheet
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jakub A.Těšínský
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- jAkub.cz (A is at)
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- GUIDE.md
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/rspreadsheet.rb
|
55
|
+
- lib/rspreadsheet/version.rb
|
56
|
+
- rspreadsheet.gemspec
|
57
|
+
homepage: https://github.com/gorn/rspreadsheet
|
58
|
+
licenses: []
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.0.14
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Manipulating spreadsheets with Ruby (read / create / modify OpenDocument
|
80
|
+
Spreadsheet).
|
81
|
+
test_files: []
|