superbot-cloud 0.2.4 → 0.2.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 584d399136285f0079c9c3843e1e6cae1f5f41dd50750ccedc48fb6cea087450
4
- data.tar.gz: 2b572c467d093d83edd7017a6f56a185fc7f1746ef460ffca230d97c643b2f41
3
+ metadata.gz: ce8cd0ea8e957d1230ff3b9eb7e7afc6f46242ab2594dc28e33a2ae529abf580
4
+ data.tar.gz: e16d490de4b68a548623af3a73805dedf3482b1906a50d64975dea579481bd20
5
5
  SHA512:
6
- metadata.gz: 92f058cc4e12a8fed5b065c96137e8f562b7b9a0ac4851ed4a88b621c3a2c32b917d4a7c25d1bc2200142dc202394499efa5903addd912c11c38dd24fbd7cd08
7
- data.tar.gz: d50a5f321b79aec5f0186ed1808d55cef7d802bfe787875f8f306d647901c65c8e6d20fb53c22151fcb296113cc8cb797efb7f1f42c3627fac441158cf5fc224
6
+ metadata.gz: cbb070d510196297ef7ca9b1ade929db260b2cda17f411dfd49f80b8874f2aeaf2bc3a281b272e496e64b97b2c4882c3d44d40ad9f4274969a471e335ee7ec89
7
+ data.tar.gz: 39a9203c7580e93f0ec883f12d335e0edceed2d54f604f61bb33622ed313bdefa04dbb78c52041d494a4e7253e40b02d212823344a9c31ab526de54e00aa5528
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superbot-cloud (0.2.4)
4
+ superbot-cloud (0.2.5)
5
5
  marcel (= 0.3.3)
6
6
  multipart-post (= 2.0.0)
7
7
 
@@ -10,7 +10,11 @@ module Superbot
10
10
  module CLI
11
11
  module Test
12
12
  class UploadCommand < BaseCommand
13
- parameter "PATH", "the path to folder containing tests to upload"
13
+ include Superbot::Validations
14
+
15
+ parameter "PATH", "the path to folder containing tests to upload" do |path|
16
+ validates_project_path(path)
17
+ end
14
18
 
15
19
  def execute
16
20
  upload_tests
@@ -18,24 +22,26 @@ module Superbot
18
22
 
19
23
  def upload_tests
20
24
  puts "Uploading files from #{path}..."
21
- Dir.glob(File.join(path, '*')) do |test_file|
25
+ files = Dir.glob(File.join(path, '*')).map do |test_file|
22
26
  filename = File.basename(test_file)
23
27
  content_type = Marcel::MimeType.for(Pathname.new(test_file), name: filename)
28
+ UploadIO.new(File.open(test_file), content_type, filename)
29
+ end
30
+ test_name = Zaru.sanitize!(File.basename(path))
24
31
 
25
- File.open(test_file) do |file|
26
- api_response = Superbot::Cloud::Api.request(
27
- :test_upload,
28
- params: {
29
- name: Zaru.sanitize!(File.basename(path)),
30
- organization_name: organization,
31
- file: UploadIO.new(file, content_type, filename)
32
- }
33
- )
32
+ api_response = Superbot::Cloud::Api.request(
33
+ :test_upload,
34
+ params: {
35
+ name: test_name,
36
+ organization_name: organization,
37
+ 'files[]': files
38
+ }
39
+ )
34
40
 
35
- print filename, ' - ', api_response[:error] || 'Success'
36
- puts
37
- end
38
- end
41
+ puts "Successfully uploaded!"
42
+ puts "Organization: #{api_response[:organization]}"
43
+ puts "Test name: #{api_response[:name]}"
44
+ puts("Files:", api_response[:files].map { |f| f[:filename].prepend(' ') })
39
45
  end
40
46
  end
41
47
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Superbot
4
4
  module Cloud
5
- VERSION = "0.2.4"
5
+ VERSION = "0.2.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superbot-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Superbots
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-14 00:00:00.000000000 Z
11
+ date: 2019-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post