Sha256: 28a0985a360c5fc64d7459924efada68b04089d30044d71198f5ff5f1a090db2

Contents?: true

Size: 554 Bytes

Versions: 5

Compression:

Stored size: 554 Bytes

Contents

module Rip
  class DirPackage < Package
    handles do |source|
      File.directory? source
    end

    def initialize(source, *args)
      super
      @source = File.expand_path(source)
    end

    def exists?
      File.directory? source
    end

    memoize :name
    def name
      File.basename(source)
    end

    def version
      if name.match(/-((?:\d+\.?)+\d+)$/)
        $1
      else
        "unversioned"
      end
    end

    def fetch!
      FileUtils.rm_rf cache_path
      FileUtils.cp_r "#{source}/.", cache_path
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rip-0.0.4 lib/rip/packages/dir_package.rb
rip-0.0.5 lib/rip/packages/dir_package.rb
rip-0.0.3 lib/rip/packages/dir_package.rb
rip-0.0.2 lib/rip/packages/dir_package.rb
rip-0.0.1 lib/rip/packages/dir_package.rb