excel-esv 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +26 -0
- data/.rubocop.yml +5 -0
- data/Gemfile +10 -2
- data/Rakefile +1 -1
- data/excel-esv.gemspec +6 -10
- data/lib/esv/version.rb +1 -1
- data/spec/esv_spec.rb +28 -44
- data/spec/spec_helper.rb +2 -26
- metadata +8 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 61b9d8716af48b7a32382ba6e9558a5f9f2afc71cb6ec0e6a380686dd91ea308
|
4
|
+
data.tar.gz: 8d737947eb7b20510cd234a5c23a033c5eaec2a8f90d22152c8c6892de99e271
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e72fa2c2685e9833c15d4ea0c6278b41ca0b8f45fe296ff81f6691652cd0b477f68e69365b9bc42b3d70024738361cd8805ab0d21885de875b028febab293d0d
|
7
|
+
data.tar.gz: 2dacf749dcc74944f9ad3cf2ef671e123a16f8665ecfab299541cd22c702663b9e168218675cfd75cc56ef1bac455b3d90f6f554f0d3549f71928931074808ea
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby-version: ["3.0", "2.7", "2.6", "2.5"]
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
25
|
+
- name: Run tests
|
26
|
+
run: bundle exec rake
|
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
# Specify your gem's dependencies in esv.gemspec
|
3
|
+
# Specify your gem's dependencies in excel-esv.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem "barsoom_utils", github: "barsoom/barsoom_utils"
|
8
|
+
gem "bundler"
|
9
|
+
gem "rake"
|
10
|
+
gem "rspec"
|
11
|
+
gem "rubocop"
|
12
|
+
end
|
data/Rakefile
CHANGED
data/excel-esv.gemspec
CHANGED
@@ -1,24 +1,20 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "esv/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "excel-esv"
|
8
8
|
spec.version = ESV::VERSION
|
9
|
-
spec.authors = ["Henrik Nyh"]
|
10
|
-
spec.email = ["henrik@nyh.se"]
|
9
|
+
spec.authors = [ "Henrik Nyh" ]
|
10
|
+
spec.email = [ "henrik@nyh.se" ]
|
11
11
|
spec.summary = %q{Excel parsing and generation with the ease of CSV.}
|
12
12
|
spec.homepage = "https://github.com/barsoom/excel-esv"
|
13
13
|
spec.license = "MIT"
|
14
|
+
spec.metadata = { "rubygems_mfa_required" => "true" }
|
14
15
|
|
15
16
|
spec.files = `git ls-files -z`.split("\x0")
|
16
|
-
spec.
|
17
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
-
spec.require_paths = ["lib"]
|
17
|
+
spec.require_paths = [ "lib" ]
|
19
18
|
|
20
19
|
spec.add_dependency "spreadsheet"
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
-
spec.add_development_dependency "rspec"
|
24
20
|
end
|
data/lib/esv/version.rb
CHANGED
data/spec/esv_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "esv"
|
2
2
|
|
3
|
-
describe ESV, ".generate and .parse" do
|
3
|
+
RSpec.describe ESV, ".generate and .parse" do
|
4
4
|
it "works" do
|
5
5
|
data = ESV.generate do |esv|
|
6
6
|
esv << [ "Dogs", "Cats" ]
|
@@ -16,44 +16,56 @@ describe ESV, ".generate and .parse" do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
describe ESV, ".parse" do
|
19
|
+
RSpec.describe ESV, ".parse" do
|
20
20
|
it "raises if there's more than one worksheet" do
|
21
|
+
excel_file_with_two_worksheets = generate_excel_file do |sheet, book|
|
22
|
+
book.create_worksheet
|
23
|
+
end
|
24
|
+
|
21
25
|
expect {
|
22
26
|
ESV.parse(excel_file_with_two_worksheets)
|
23
27
|
}.to raise_error(/Expected 1 worksheet, found 2/)
|
24
28
|
end
|
25
29
|
|
26
30
|
it "ignores formatting, always returning a plain array of data" do
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
+
excel_file_with_formatting = generate_excel_file do |sheet|
|
32
|
+
sheet.row(0).replace([ 1, 2 ])
|
33
|
+
sheet.row(0).default_format = Spreadsheet::Format.new(color: :blue)
|
34
|
+
end
|
31
35
|
|
32
|
-
|
33
|
-
end
|
36
|
+
output = ESV.parse(excel_file_with_formatting)
|
34
37
|
|
35
|
-
it "returns the last value of a formula cell" do
|
36
|
-
output = ESV.parse(excel_file_with_formula)
|
37
38
|
expect(output).to eq [
|
38
|
-
[
|
39
|
+
[ 1, 2 ],
|
39
40
|
]
|
40
41
|
|
41
42
|
expect(output[0].class).to eq Array
|
42
43
|
end
|
43
44
|
|
44
45
|
it "returns the last value of a formula cell" do
|
46
|
+
excel_file_with_formula = generate_excel_file do |sheet|
|
47
|
+
formula = Spreadsheet::Formula.new
|
48
|
+
formula.value = "two"
|
49
|
+
sheet.row(0).replace([ "one", formula ])
|
50
|
+
end
|
51
|
+
|
45
52
|
output = ESV.parse(excel_file_with_formula)
|
53
|
+
|
46
54
|
expect(output).to eq [
|
47
55
|
[ "one", "two" ],
|
48
56
|
]
|
49
|
-
|
50
57
|
expect(output[0].class).to eq Array
|
51
58
|
end
|
52
59
|
|
60
|
+
|
53
61
|
it "returns the URL of a link cell" do
|
54
|
-
|
62
|
+
excel_file_with_link = generate_excel_file do |sheet|
|
63
|
+
link = Spreadsheet::Link.new("https://example.com", "desc", "foo")
|
64
|
+
sheet.row(0).replace([ "one", link ])
|
65
|
+
end
|
66
|
+
output = ESV.parse(excel_file_with_link)
|
55
67
|
expect(output).to eq [
|
56
|
-
[ "one", "https://example.com" ],
|
68
|
+
[ "one", "https://example.com#foo" ],
|
57
69
|
]
|
58
70
|
|
59
71
|
expect(output[0][1].class).to eq String
|
@@ -61,35 +73,7 @@ describe ESV, ".parse" do
|
|
61
73
|
|
62
74
|
private
|
63
75
|
|
64
|
-
def
|
65
|
-
excel_file do |sheet, book|
|
66
|
-
book.create_worksheet
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def excel_file_with_formatting(data)
|
71
|
-
excel_file do |sheet|
|
72
|
-
sheet.row(0).replace(data)
|
73
|
-
sheet.row(0).default_format = Spreadsheet::Format.new(color: :blue)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def excel_file_with_formula
|
78
|
-
excel_file do |sheet|
|
79
|
-
formula = Spreadsheet::Formula.new
|
80
|
-
formula.value = "two"
|
81
|
-
sheet.row(0).replace([ "one", formula ])
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def excel_file_with_link(url)
|
86
|
-
excel_file do |sheet|
|
87
|
-
link = Spreadsheet::Link.new(url)
|
88
|
-
sheet.row(0).replace([ "one", link ])
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
def excel_file(&block)
|
76
|
+
def generate_excel_file(&block)
|
93
77
|
book = Spreadsheet::Workbook.new
|
94
78
|
sheet = book.create_worksheet
|
95
79
|
|
@@ -102,7 +86,7 @@ describe ESV, ".parse" do
|
|
102
86
|
end
|
103
87
|
end
|
104
88
|
|
105
|
-
describe ESV, ".generate_file and .parse_file" do
|
89
|
+
RSpec.describe ESV, ".generate_file and .parse_file" do
|
106
90
|
before do
|
107
91
|
@file = Tempfile.new("esv")
|
108
92
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,23 +1,4 @@
|
|
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 this
|
4
|
-
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
-
#
|
6
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
-
# individual file that may not need all of that loaded. Instead, make a
|
10
|
-
# separate helper file that requires this one and then use it only in the specs
|
11
|
-
# that actually need it.
|
12
|
-
#
|
13
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
-
# users commonly want.
|
15
|
-
#
|
16
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
1
|
RSpec.configure do |config|
|
18
|
-
# The settings below are suggested to provide a good initial experience
|
19
|
-
# with RSpec, but feel free to customize to your heart's content.
|
20
|
-
=begin
|
21
2
|
# These two settings work together to allow you to limit a spec run
|
22
3
|
# to individual examples or groups you care about by tagging them with
|
23
4
|
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
@@ -32,7 +13,7 @@ RSpec.configure do |config|
|
|
32
13
|
# Use the documentation formatter for detailed output,
|
33
14
|
# unless a formatter has already been configured
|
34
15
|
# (e.g. via a command-line flag).
|
35
|
-
config.default_formatter =
|
16
|
+
config.default_formatter = "doc"
|
36
17
|
end
|
37
18
|
|
38
19
|
# Print the 10 slowest examples and example groups at the
|
@@ -45,6 +26,7 @@ RSpec.configure do |config|
|
|
45
26
|
# the seed, which is printed after each run.
|
46
27
|
# --seed 1234
|
47
28
|
config.order = :random
|
29
|
+
config.disable_monkey_patching!
|
48
30
|
|
49
31
|
# Seed global randomization in this process using the `--seed` CLI option.
|
50
32
|
# Setting this allows you to use `--seed` to deterministically reproduce
|
@@ -62,17 +44,11 @@ RSpec.configure do |config|
|
|
62
44
|
expectations.syntax = :expect
|
63
45
|
end
|
64
46
|
|
65
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
66
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
67
47
|
config.mock_with :rspec do |mocks|
|
68
|
-
# Enable only the newer, non-monkey-patching expect syntax.
|
69
|
-
# For more details, see:
|
70
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
71
48
|
mocks.syntax = :expect
|
72
49
|
|
73
50
|
# Prevents you from mocking or stubbing a method that does not exist on
|
74
51
|
# a real object. This is generally recommended.
|
75
52
|
mocks.verify_partial_doubles = true
|
76
53
|
end
|
77
|
-
=end
|
78
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excel-esv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Nyh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spreadsheet
|
@@ -24,48 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.7'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.7'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '10.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '10.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
27
|
description:
|
70
28
|
email:
|
71
29
|
- henrik@nyh.se
|
@@ -73,8 +31,10 @@ executables: []
|
|
73
31
|
extensions: []
|
74
32
|
extra_rdoc_files: []
|
75
33
|
files:
|
34
|
+
- ".github/workflows/ci.yml"
|
76
35
|
- ".gitignore"
|
77
36
|
- ".rspec"
|
37
|
+
- ".rubocop.yml"
|
78
38
|
- CHANGELOG.md
|
79
39
|
- Gemfile
|
80
40
|
- LICENSE.txt
|
@@ -91,7 +51,8 @@ files:
|
|
91
51
|
homepage: https://github.com/barsoom/excel-esv
|
92
52
|
licenses:
|
93
53
|
- MIT
|
94
|
-
metadata:
|
54
|
+
metadata:
|
55
|
+
rubygems_mfa_required: 'true'
|
95
56
|
post_install_message:
|
96
57
|
rdoc_options: []
|
97
58
|
require_paths:
|
@@ -107,11 +68,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
68
|
- !ruby/object:Gem::Version
|
108
69
|
version: '0'
|
109
70
|
requirements: []
|
110
|
-
|
111
|
-
rubygems_version: 2.6.11
|
71
|
+
rubygems_version: 3.2.28
|
112
72
|
signing_key:
|
113
73
|
specification_version: 4
|
114
74
|
summary: Excel parsing and generation with the ease of CSV.
|
115
|
-
test_files:
|
116
|
-
- spec/esv_spec.rb
|
117
|
-
- spec/spec_helper.rb
|
75
|
+
test_files: []
|