rainforest-cli 1.10.1 → 1.10.2
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/rainforest_cli/csv_importer.rb +14 -3
- data/lib/rainforest_cli/version.rb +1 -1
- data/spec/rainforest_cli/csv_importer_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e31fc0fb7e685c2de8fd444e7d5f2a074d19875
|
4
|
+
data.tar.gz: ad40b1b738892368b8597e779a23c25f621dc5a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ea8b9dc6ad22b570efae9b6f379631130062653a92f982b02660fe9dfc8b60f61a2f7678732a0837faf4fb94f613e5c5bd5d8fdfc03e8ecc250fd299ec46c1f
|
7
|
+
data.tar.gz: 644af9ed6b8064c8cfcfd17fe7aaeed20d992d073d968bcb73e66e13533c665c3010bcfea52957444a03dde6488622d9691e74fcf6660b229e881463ba217afc
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Rainforest CLI Changelog
|
2
2
|
|
3
|
+
## 1.10.2 - 11th October 2016
|
4
|
+
- Limit CSV batch upload size to chunks of 20 at a time for more reliability.
|
5
|
+
(abfed07df5635eb88029ee0b6cf8eea3a538fff6, @epaulet)
|
6
|
+
|
3
7
|
## 1.10.1 - 10th October 2016
|
4
8
|
- Add documentation for commands to `--help` text. (fe3fddbe7086a6b914ffe74f65ae128a14277f82, @epaulet)
|
5
9
|
- Use more efficient CSV upload method. (e716e76b7627b334c4f8b50fd0afdad6fadd162e, @epaulet)
|
@@ -4,6 +4,8 @@ require 'csv'
|
|
4
4
|
|
5
5
|
module RainforestCli
|
6
6
|
class CSVImporter
|
7
|
+
BATCH_SIZE = 50
|
8
|
+
|
7
9
|
def initialize(options)
|
8
10
|
@generator_name = options.import_name
|
9
11
|
@file = options.import_file_name
|
@@ -48,9 +50,18 @@ module RainforestCli
|
|
48
50
|
data = rows.map { |row| row_data(columns, row) }
|
49
51
|
|
50
52
|
puts 'Uploading data...'
|
51
|
-
|
52
|
-
|
53
|
-
|
53
|
+
row_count = (1.0 * data.count / BATCH_SIZE).ceil
|
54
|
+
p = ProgressBar.create(title: 'Rows', total: row_count, format: '%a %B %p%% %t')
|
55
|
+
|
56
|
+
data.each_slice(BATCH_SIZE) do |data_slice|
|
57
|
+
response = http_client.post(
|
58
|
+
"/generators/#{generator_id}/rows/batch",
|
59
|
+
{ data: data_slice },
|
60
|
+
retries_on_failures: true)
|
61
|
+
# NOTE: Response for this endpoint will usually be an array representing all the rows created
|
62
|
+
raise response['error'] if response.is_a?(Hash) && response['error']
|
63
|
+
p.increment
|
64
|
+
end
|
54
65
|
puts 'Upload complete.'
|
55
66
|
end
|
56
67
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rainforest-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Russell Smith
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-10-
|
12
|
+
date: 2016-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|