tac-cli 0.0.9 → 0.1.0
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.
- data/lib/cli/client_collector.rb +14 -11
 - data/lib/cli/consts.rb +1 -1
 - data/lib/cli/version.rb +1 -1
 - metadata +2 -2
 
    
        data/lib/cli/client_collector.rb
    CHANGED
    
    | 
         @@ -17,18 +17,18 @@ module CTT::Cli 
     | 
|
| 
       17 
17 
     | 
    
         
             
                  collect
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
                  payload = @info.dup
         
     | 
| 
       20 
     | 
    
         
            -
                  payload[: 
     | 
| 
       21 
     | 
    
         
            -
                  payload[:multipart] 
     | 
| 
      
 20 
     | 
    
         
            +
                  payload[:file]        = File.open(@tar_file_path, "r")
         
     | 
| 
      
 21 
     | 
    
         
            +
                  payload[:multipart]   = true
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
                  #retry 3 times
         
     | 
| 
       24 
24 
     | 
    
         
             
                  3.times do
         
     | 
| 
       25 
25 
     | 
    
         
             
                    begin
         
     | 
| 
       26 
26 
     | 
    
         
             
                      response = RestClient.post("#{RESULTS_SERVER_URL}/tac/upload", payload)
         
     | 
| 
      
 27 
     | 
    
         
            +
                      break if response.code == 200
         
     | 
| 
       27 
28 
     | 
    
         
             
                    rescue
         
     | 
| 
       28 
29 
     | 
    
         
             
                    end
         
     | 
| 
       29 
     | 
    
         
            -
                    break if (response.nil? || response.code == 200)
         
     | 
| 
       30 
30 
     | 
    
         
             
                  end
         
     | 
| 
       31 
     | 
    
         
            -
                   
     | 
| 
      
 31 
     | 
    
         
            +
                  FileUtils.rm(payload[:file].path)
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
                def collect
         
     | 
| 
         @@ -87,20 +87,23 @@ module CTT::Cli 
     | 
|
| 
       87 
87 
     | 
    
         
             
                    say("report path did not exists. abort!", :red)
         
     | 
| 
       88 
88 
     | 
    
         
             
                    exit(1)
         
     | 
| 
       89 
89 
     | 
    
         
             
                  end
         
     | 
| 
       90 
     | 
    
         
            -
                  @ 
     | 
| 
      
 90 
     | 
    
         
            +
                  @tar_file_path = zip_test_reports(report_path)
         
     | 
| 
       91 
91 
     | 
    
         
             
                end
         
     | 
| 
       92 
92 
     | 
    
         | 
| 
       93 
93 
     | 
    
         
             
                def zip_test_reports(reports_path)
         
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
                   
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                  temp_file_path = File.join(Dir.tmpdir, "reports-#{@uuid}.tgz")
         
     | 
| 
      
 96 
     | 
    
         
            +
                  pwd = Dir.pwd
         
     | 
| 
      
 97 
     | 
    
         
            +
                  Dir.chdir(File.dirname(reports_path))
         
     | 
| 
      
 98 
     | 
    
         
            +
                  `tar czf #{temp_file_path} #{File.basename(reports_path)} 2>&1`
         
     | 
| 
       96 
99 
     | 
    
         
             
                  unless $?.exitstatus == 0
         
     | 
| 
       97 
100 
     | 
    
         
             
                    say("fail to tarball test reports. abort!", :red)
         
     | 
| 
       98 
     | 
    
         
            -
                     
     | 
| 
      
 101 
     | 
    
         
            +
                    FileUtils.rm(temp_file_path)
         
     | 
| 
       99 
102 
     | 
    
         
             
                    exit(1)
         
     | 
| 
       100 
103 
     | 
    
         
             
                  end
         
     | 
| 
       101 
     | 
    
         
            -
                   
     | 
| 
       102 
     | 
    
         
            -
                end
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
      
 104 
     | 
    
         
            +
                  Dir.chdir(pwd)
         
     | 
| 
       104 
105 
     | 
    
         | 
| 
      
 106 
     | 
    
         
            +
                  temp_file_path
         
     | 
| 
      
 107 
     | 
    
         
            +
                end
         
     | 
| 
       105 
108 
     | 
    
         
             
              end
         
     | 
| 
       106 
109 
     | 
    
         
             
            end
         
     | 
    
        data/lib/cli/consts.rb
    CHANGED
    
    
    
        data/lib/cli/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: tac-cli
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2012-12- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2012-12-12 00:00:00.000000000Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: json_pure
         
     |