Sha256: 95d14572cfb8159b1344d75564ff985fb0f88af0a1e455df2643d6b6bc8231ab

Contents?: true

Size: 603 Bytes

Versions: 6

Compression:

Stored size: 603 Bytes

Contents

require 'pathname'

module Spontaneous::Asset
  class Source
    def initialize(source_dir)
      @source_dir = ::File.expand_path(source_dir)
    end

    def source_path
      @source_path ||= Pathname.new(@source_dir)
    end

    def source_files
      source_paths.map(&:to_s)
    end

    def source_paths
      @source_files ||= find_source_paths
    end

    def find_source_paths
      absolute_paths = Dir[@source_dir / "**/*.*"].map { |path| Pathname.new(path) }
      source_path = self.source_path
      absolute_paths.map { |path| path.relative_path_from(source_path) }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta1 lib/spontaneous/asset/source.rb
spontaneous-0.2.0.alpha7 lib/spontaneous/asset/source.rb
spontaneous-0.2.0.alpha6 lib/spontaneous/asset/source.rb
spontaneous-0.2.0.alpha5 lib/spontaneous/asset/source.rb
spontaneous-0.2.0.alpha4 lib/spontaneous/asset/source.rb
spontaneous-0.2.0.alpha3 lib/spontaneous/asset/source.rb