Class: AssetsDeployer::StorageBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/assets_deployer/storage_builder.rb

Defined Under Namespace

Classes: InvalidStorageError

Instance Method Summary collapse

Constructor Details

#initialize(name:, credentials:, options:) ⇒ StorageBuilder

Returns a new instance of StorageBuilder.



9
10
11
12
13
# File 'lib/assets_deployer/storage_builder.rb', line 9

def initialize(name:, credentials:, options:)
  @name = name
  @credentials = credentials
  @options = options
end

Instance Method Details

#buildObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/assets_deployer/storage_builder.rb', line 15

def build
  case @name
  when 'S3'
    Storage::AwsS3.new(
      credentials: @credentials,
      bucket: @options[:bucket],
      prefix_key: @options[:prefix_key],
      region: @options[:region]
    )
  else
    raise InvalidStorageError
  end
end