sink3 0.0.6 → 0.0.7
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/lib/sink3.rb +2 -0
 - data/lib/sink3/main.rb +15 -1
 - data/lib/sink3/path_crawler.rb +2 -2
 - data/lib/sink3/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c38fc1886885c4b540758bfe360fbb3b104e42a58cf09089665e070aa748c116
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: df4199bae369d7186ba4337d0789e33a332c6ac925dcd3ae2d85ae9c4aa5df3c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 61e0348ecb5cf342f3de7e69ff208fa6dc82f65a62572180cd157bc5a7cf910b9b176b66034e44815c0bc0574e9510484f9bd3a08c070d4fd3fb8f1b9d76c19f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 435085e039823346909ae1494acc924024a525d4a2a99c3c02f3bb1bd198e75fb90e8128a6a1da4343983eed571adc9f533559623fb2b847037ab9acbcf34f8d
         
     | 
    
        data/lib/sink3.rb
    CHANGED
    
    | 
         @@ -16,7 +16,9 @@ module Sink3 
     | 
|
| 
       16 
16 
     | 
    
         
             
              class Configuration 
         
     | 
| 
       17 
17 
     | 
    
         
             
                attr_accessor :delete_after_upload
         
     | 
| 
       18 
18 
     | 
    
         
             
                attr_accessor :skip_overwrite
         
     | 
| 
      
 19 
     | 
    
         
            +
                attr_accessor :skip_date_partition
         
     | 
| 
       19 
20 
     | 
    
         
             
                attr_accessor :verbose
         
     | 
| 
      
 21 
     | 
    
         
            +
                attr_accessor :skip_full_path
         
     | 
| 
       20 
22 
     | 
    
         | 
| 
       21 
23 
     | 
    
         
             
                def delete_after_upload
         
     | 
| 
       22 
24 
     | 
    
         
             
                  !!@delete_after_upload
         
     | 
    
        data/lib/sink3/main.rb
    CHANGED
    
    | 
         @@ -16,6 +16,8 @@ module Sink3 
     | 
|
| 
       16 
16 
     | 
    
         
             
                option :delete, type: :boolean, desc: "delete origin file on succesful send"
         
     | 
| 
       17 
17 
     | 
    
         
             
                option :skip_overwrite, type: :boolean, desc: "skip sending file if exists" 
         
     | 
| 
       18 
18 
     | 
    
         
             
                option :verbose, type: :boolean, desc: "verbose" 
         
     | 
| 
      
 19 
     | 
    
         
            +
                option :skip_date_partition, type: :boolean, desc: "remove YYYY-MM-DD remote prefix" 
         
     | 
| 
      
 20 
     | 
    
         
            +
                option :skip_full_path, type: :boolean, desc: "don't archive file with full path prefix" 
         
     | 
| 
       19 
21 
     | 
    
         | 
| 
       20 
22 
     | 
    
         
             
                def send(*paths) 
         
     | 
| 
       21 
23 
     | 
    
         
             
                  configure
         
     | 
| 
         @@ -24,10 +26,20 @@ module Sink3 
     | 
|
| 
       24 
26 
     | 
    
         | 
| 
       25 
27 
     | 
    
         
             
                  validate_env
         
     | 
| 
       26 
28 
     | 
    
         | 
| 
      
 29 
     | 
    
         
            +
                  prefix = nil 
         
     | 
| 
       27 
30 
     | 
    
         
             
                  [paths].flatten.each do |path|
         
     | 
| 
       28 
31 
     | 
    
         
             
                    path = Pathname.new(path)
         
     | 
| 
      
 32 
     | 
    
         
            +
            	
         
     | 
| 
       29 
33 
     | 
    
         
             
                    raise "specified path does not exist" unless path.exist?
         
     | 
| 
       30 
     | 
    
         
            -
                     
     | 
| 
      
 34 
     | 
    
         
            +
                    unless Sink3.config.skip_full_path
         
     | 
| 
      
 35 
     | 
    
         
            +
                       if (path.file?) 
         
     | 
| 
      
 36 
     | 
    
         
            +
                         prefix = path.realdirpath.parent 
         
     | 
| 
      
 37 
     | 
    
         
            +
                         puts "prefix is #{prefix}" if Sink3.config.verbose
         
     | 
| 
      
 38 
     | 
    
         
            +
                       else 
         
     | 
| 
      
 39 
     | 
    
         
            +
                         prefix = path.realdirpath.parent.parent 
         
     | 
| 
      
 40 
     | 
    
         
            +
                         puts "prefix is not set" if Sink3.config.verbose
         
     | 
| 
      
 41 
     | 
    
         
            +
                       end
         
     | 
| 
      
 42 
     | 
    
         
            +
                   end
         
     | 
| 
       31 
43 
     | 
    
         | 
| 
       32 
44 
     | 
    
         
             
                    Sink3::PathCrawler.new(path, prefix).start
         
     | 
| 
       33 
45 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -42,6 +54,8 @@ module Sink3 
     | 
|
| 
       42 
54 
     | 
    
         
             
                    config.delete_after_upload = options[:delete]
         
     | 
| 
       43 
55 
     | 
    
         
             
                    config.skip_overwrite = options[:skip_overwrite]
         
     | 
| 
       44 
56 
     | 
    
         
             
                    config.verbose = options[:verbose]
         
     | 
| 
      
 57 
     | 
    
         
            +
                    config.skip_date_partition = options[:skip_date_partition]
         
     | 
| 
      
 58 
     | 
    
         
            +
                    config.skip_full_path = options[:skip_full_path]
         
     | 
| 
       45 
59 
     | 
    
         
             
                  end
         
     | 
| 
       46 
60 
     | 
    
         
             
                end
         
     | 
| 
       47 
61 
     | 
    
         | 
    
        data/lib/sink3/path_crawler.rb
    CHANGED
    
    | 
         @@ -57,7 +57,7 @@ module Sink3 
     | 
|
| 
       57 
57 
     | 
    
         
             
                  remote_file = bucket.objects[remote_path]
         
     | 
| 
       58 
58 
     | 
    
         
             
                  if Sink3.config.skip_overwrite 
         
     | 
| 
       59 
59 
     | 
    
         
             
            	if ! check_exists(remote_file)
         
     | 
| 
       60 
     | 
    
         
            -
            	  puts "remote file does not exist"  if Sink3.config.verbose
         
     | 
| 
      
 60 
     | 
    
         
            +
            	  puts "remote file does not exist #{remote_path}"  if Sink3.config.verbose
         
     | 
| 
       61 
61 
     | 
    
         
             
            	  remote_file.write(@path)
         
     | 
| 
       62 
62 
     | 
    
         
             
            	else
         
     | 
| 
       63 
63 
     | 
    
         
             
                      puts "skpping overwrite of #{remote_path}"  if Sink3.config.verbose
         
     | 
| 
         @@ -72,7 +72,7 @@ module Sink3 
     | 
|
| 
       72 
72 
     | 
    
         
             
                end
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
74 
     | 
    
         
             
                def formatted_date
         
     | 
| 
       75 
     | 
    
         
            -
                  if ! 
     | 
| 
      
 75 
     | 
    
         
            +
                  if !Sink3.config.skip_date_partition
         
     | 
| 
       76 
76 
     | 
    
         
             
                    return "#{Time.now.strftime "%Y-%m-%d"}/"
         
     | 
| 
       77 
77 
     | 
    
         
             
                  else
         
     | 
| 
       78 
78 
     | 
    
         
             
                    return ""
         
     | 
    
        data/lib/sink3/version.rb
    CHANGED