Sha256: 26d42e65e5793ddf736c71942a7b598c5fbe251e410b0f87a1fdf404ffc1f7c4

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

require_relative 'installer'

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

2 entries across 2 versions & 1 rubygems

Version Path
arli-0.6.2 lib/arli/library.rb
arli-0.6.1 lib/arli/library.rb