class AssetsDeployer::Deployer

Public Class Methods

new(storage:, root_path:, prefix_paths:, ignore_paths:) click to toggle source
# File lib/assets_deployer/deployer.rb, line 5
def initialize(storage:, root_path:, prefix_paths:, ignore_paths:)
  @storage = storage
  @root_path = root_path
  @prefix_paths = prefix_paths
  @ignore_paths = ignore_paths.map { |path| File.join(root_path, path) }
end

Public Instance Methods

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

Private Instance Methods

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