metacrunch-file 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -5
- data/Readme.md +6 -0
- data/lib/metacrunch/file/version.rb +1 -1
- data/lib/metacrunch/file/xlsx_destination.rb +11 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f48a935e53642f8c9ad1950a9ba8000d4e87b027c3e84cbcc83f88d337cb240
|
4
|
+
data.tar.gz: 67e654f8e28bebd82e25f91a8ea1e5bd31687bb9ff8462425e9fca7bd5d3c0a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d431451479609104391aaaf493665894f34f267beb635ce42073ec844a623a20763f259ff01721c63a0927608124fc4fe7e7413f1391babe159cdb7cdde8bf23
|
7
|
+
data.tar.gz: d3aac69ba1a203ba323afd8bfa0b108640e80c59ac2b8a7c6786f9538840e5b47526c0623e3d74099a4cb5869c89b0f202d9a78ebaeccaf0b13d63bc1a9e88a4
|
data/.circleci/config.yml
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
# Ruby CircleCI 2.0 configuration file
|
2
|
-
#
|
3
|
-
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
-
#
|
5
1
|
version: 2
|
6
2
|
jobs:
|
7
3
|
build:
|
8
4
|
docker:
|
9
|
-
- image: circleci/ruby:2.
|
5
|
+
- image: circleci/ruby:2.6-node-browsers
|
10
6
|
|
11
7
|
working_directory: ~/repo
|
12
8
|
|
data/Readme.md
CHANGED
@@ -84,6 +84,12 @@ destination Metacrunch::File::FileDestination.new("/tmp/my-data.txt" [, OPTIONS]
|
|
84
84
|
|
85
85
|
This class provides a metacrunch `source` for reading CSV files. It is a simple wrapper around [smarter_csv](https://github.com/tilo/smarter_csv) gem.
|
86
86
|
|
87
|
+
```ruby
|
88
|
+
# my_job.metacrunch
|
89
|
+
|
90
|
+
source Metacrunch::File::CSVSource.new("my.csv" [, OPTIONS])
|
91
|
+
```
|
92
|
+
|
87
93
|
**Options**
|
88
94
|
|
89
95
|
* `headers`: Whether or not the file contains headers as the first line. Important if the file does not contain headers, otherwise you would lose the first line of data. Defaults to `true`.
|
@@ -20,9 +20,17 @@ module Metacrunch
|
|
20
20
|
@sheet.add_row(columns, types: :string)
|
21
21
|
end
|
22
22
|
|
23
|
-
def write(
|
24
|
-
return if
|
25
|
-
|
23
|
+
def write(data)
|
24
|
+
return if data.blank?
|
25
|
+
raise ArgumentError, "Data must be an Array" unless data.is_a?(Array)
|
26
|
+
|
27
|
+
if data.first.is_a?(Array)
|
28
|
+
data.each do |d|
|
29
|
+
@sheet.add_row(d, types: :string)
|
30
|
+
end
|
31
|
+
else
|
32
|
+
@sheet.add_row(data, types: :string)
|
33
|
+
end
|
26
34
|
end
|
27
35
|
|
28
36
|
def close
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metacrunch-file
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- René Sprotte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|