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 +4 -4
 - data/Gemfile.lock +1 -1
 - data/lib/superbot/cloud/cli/test/upload_command.rb +21 -15
 - data/lib/superbot/cloud/version.rb +1 -1
 - 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: ce8cd0ea8e957d1230ff3b9eb7e7afc6f46242ab2594dc28e33a2ae529abf580
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e16d490de4b68a548623af3a73805dedf3482b1906a50d64975dea579481bd20
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: cbb070d510196297ef7ca9b1ade929db260b2cda17f411dfd49f80b8874f2aeaf2bc3a281b272e496e64b97b2c4882c3d44d40ad9f4274969a471e335ee7ec89
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 39a9203c7580e93f0ec883f12d335e0edceed2d54f604f61bb33622ed313bdefa04dbb78c52041d494a4e7253e40b02d212823344a9c31ab526de54e00aa5528
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
| 
         @@ -10,7 +10,11 @@ module Superbot 
     | 
|
| 
       10 
10 
     | 
    
         
             
                module CLI
         
     | 
| 
       11 
11 
     | 
    
         
             
                  module Test
         
     | 
| 
       12 
12 
     | 
    
         
             
                    class UploadCommand < BaseCommand
         
     | 
| 
       13 
     | 
    
         
            -
                       
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       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 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                         
     | 
| 
      
 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
         
     | 
    
        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 
     | 
    
         
            +
              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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-01-15 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: multipart-post
         
     |