Sha256: 00d3cec8130356762c358c5cc225c4a4835a387990ea4aedf39b2be8d5e9d111

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

module Rip
  class RipfilePackage < Package
    handles '.rip'

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

    def exists?
      File.exists? source
    end

    def name
      source.split('/').last
    end

    def version
      nil
    end

    def meta_package?
      true
    end

    def cached?
      false
    end

    def dependency_installed(dependency, success = true)
      if !success
        ui.puts "rip: already installed #{dependency}"
      end
    end

    def fetch!
      FileUtils.rm_rf cache_path
      FileUtils.mkdir_p cache_path
      FileUtils.cp source, File.join(cache_path, name)
    end

    def unpack!
      fetch
    end

    def dependencies!
      if File.exists? deps = File.join(cache_path, name)
        File.readlines(deps).map do |line|
          package_source, version, *extra = line.split(' ')
          if package = Package.for(package_source, version)
            package
          else
            # Allows .rip file and dir packages to be listed as
            # relative paths.
            path = File.join(File.dirname(@source), package_source)
            Package.for(path, version)
          end
        end
      else
        []
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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