class Dpl::Providers::Gcs
Constants
- BOTO
- URL
Public Instance Methods
Source
# File lib/dpl/providers/gcs.rb, line 67 def deploy Dir.chdir(local_dir) do files.each { |file| copy(file) } end end
Source
# File lib/dpl/providers/gcs.rb, line 63 def login key_file? ? login_key : login_creds end
Private Instance Methods
Source
# File lib/dpl/providers/gcs.rb, line 92 def copy(source) to = [target.sub(%r{/$}, ''), source].join('/') shell :copy, gs_opts: gs_opts(source), source:, target: to end
Source
# File lib/dpl/providers/gcs.rb, line 110 def copy_opts opts = [] opts << %(-a "#{acl}") if acl? "#{opts.join(' ')} " if opts.any? end
Source
# File lib/dpl/providers/gcs.rb, line 97 def dirname(path) dir = File.dirname(path) dir unless dir.empty? || dir == '.' end
Source
# File lib/dpl/providers/gcs.rb, line 88 def files Dir.glob(*glob_args).select { |path| File.file?(path) } end
Source
# File lib/dpl/providers/gcs.rb, line 125 def glob_args args = [glob] args << File::FNM_DOTMATCH if dot_match? args end
Source
# File lib/dpl/providers/gcs.rb, line 102 def gs_opts(path) opts = [] opts << %(-h "Cache-Control:#{cache_control}") if cache_control? opts << %(-h "Content-Encoding:#{encoding(path)}") if detect_encoding? opts << %(-h "Content-type:#{mime_type(path)}") if mime_type(path) "#{opts.join(' ')} " if opts.any? end
Source
# File lib/dpl/providers/gcs.rb, line 79 def login_creds info :login_creds write_boto end
Source
# File lib/dpl/providers/gcs.rb, line 120 def mime_type(path) type = MIME::Types.type_for(path).first type&.to_s end
Source
# File lib/dpl/providers/gcs.rb, line 116 def target "gs://#{bucket}/#{upload_dir}" end
Source
# File lib/dpl/providers/gcs.rb, line 84 def write_boto write_file '~/.boto', interpolate(BOTO, opts, secure: true), 0600 end