class S3AssetsDeployer::Deployer

Public Class Methods

new(storage:, root_path:, prefix_paths:) click to toggle source
# File lib/s3_assets_deployer/deployer.rb, line 5
def initialize(storage:, root_path:, prefix_paths:)
  @storage = storage
  @root_path = root_path
  @prefix_paths = prefix_paths
end

Public Instance Methods

run() click to toggle source
# File lib/s3_assets_deployer/deployer.rb, line 11
def run
  @storage.upload(files)
end

Private Instance Methods

files() click to toggle source
# File lib/s3_assets_deployer/deployer.rb, line 17
def files
  @files ||= @prefix_paths.flat_map do |prefix|
    Dir.chdir(@root_path) do
      Dir.glob(Pathname.new(prefix).join('**', '**')).map do |path|
        AssetFile.new(path, File.realpath(path)) if Pathname.new(path).file?
      end
    end
  end.compact
end