Sha256: c3572c16cadc64cd2b2b7fabda61e9278344cb4fc305b83b13f701cfa812d57c

Contents?: true

Size: 860 Bytes

Versions: 1

Compression:

Stored size: 860 Bytes

Contents

require_relative 'installer'
require_relative 'errors'

module Arli
  class Library
    attr_accessor :lib, :config, :canonical_dir

    def initialize(lib, config: Arli.config)
      self.lib           = lib
      self.config        = config
    end

    def install
      Arli::Installer.new(self).install
    end

    def rm_rf!
      FileUtils.rm_rf(dir)
    end

    def libraries_home
      config.libraries.path
    end

    def dir
      lib.name.gsub(/ /, '_')
    end

    def path
      libraries_home + '/' + dir
    end

    def canonical_path
      libraries_home + '/' + canonical_dir
    end

    def exists?
      Dir.exist?(path)
    end

    def method_missing(method, *args, &block)
      if lib && lib.respond_to?(method)
        lib.send(method, *args, &block)
      else
        super(method, *args, &block)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arli-0.7.0 lib/arli/library.rb