rainforest-cli 1.10.1 → 1.10.2

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
2
  SHA1:
3
- metadata.gz: 2b75c82906788c8a2ee74b5d0ddb6311c7b644dd
4
- data.tar.gz: 3a80fd662427ed53bc4e850d85f13a0ad7e4ae96
3
+ metadata.gz: 0e31fc0fb7e685c2de8fd444e7d5f2a074d19875
4
+ data.tar.gz: ad40b1b738892368b8597e779a23c25f621dc5a3
5
5
  SHA512:
6
- metadata.gz: 837d61212b55d32434c933547c50224522e5c0da42d10ed5da14f8db6784242927861815fa724d1bf8eeade388f2feedc74b06ec70a0336224e93a490b32db1e
7
- data.tar.gz: 6dcf90bfca52ee02e8c1f72df2fd471bfef755c52cb374a8995b994e5d7605b159f63fd85b0947ba0a57904175d8a6e24b71a243fe9b97ca3e501c9e4b689d25
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
- response = http_client.post("/generators/#{generator_id}/rows/batch", data: data)
52
- # NOTE: Response for this endpoint will usually be an array representing all the rows created
53
- raise response['error'] if response.is_a?(Hash) && response['error']
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
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module RainforestCli
3
- VERSION = '1.10.1'
3
+ VERSION = '1.10.2'
4
4
  end
@@ -47,7 +47,7 @@ describe RainforestCli::CSVImporter do
47
47
  1 => 'hunter2',
48
48
  },
49
49
  ],
50
- }).and_return({})
50
+ }, retries_on_failures: true).and_return({})
51
51
  subject.import
52
52
  end
53
53
  end
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.1
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-10 00:00:00.000000000 Z
12
+ date: 2016-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty