Class: Travis::CLI::Setup::S3

Inherits:
Service
  • Object
show all
Defined in:
lib/travis/cli/setup/s3.rb

Instance Attribute Summary

Attributes inherited from Service

#command

Instance Method Summary collapse

Methods inherited from Service

description, #initialize, known_as?, #method_missing, normalized_name, service_name

Constructor Details

This class inherits a constructor from Travis::CLI::Setup::Service

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Travis::CLI::Setup::Service

Instance Method Details

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/travis/cli/setup/s3.rb', line 9

def run
  deploy 's3', 'push' do |config|
    config['access_key_id'] = ask("Access key ID: ").to_s
    config['secret_access_key'] = ask("Secret access key: ") { |q| q.echo = "*" }.to_s
    config['bucket'] = ask("Bucket: ").to_s
    local_dir = ask("Local project directory to upload (Optional): ").to_s
    config['local-dir'] = local_dir unless local_dir.empty?
    upload_dir = ask("S3 upload directory (Optional): ").to_s
    config['upload-dir'] = upload_dir unless upload_dir.empty?
    config['acl'] = ask("S3 ACL Settings (private, public_read, public_read_write, authenticated_read, bucket_owner_read, bucket_owner_full_control): ").to_s { |q| q.default = 'private'}
    encrypt(config, 'secret_access_key') if agree("Encrypt secret access key? ") { |q| q.default = 'yes' }
  end
end