Sha256: 4ca97402e3354cae52faac03623620aa3c185d3c6004291b8a631206abb601c5

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'forwardable'
require 'arli'
require_relative 'actions'

module Arli
  class Installer
    include ::Arli::Output

    extend Forwardable
    def_delegators :@library, :exists?

    attr_accessor :library, :config

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

    def install
      ___ "#{library.name.blue} "

      if library.nil? && library.library.nil?
        ___ ' (no library) '
        fuck
      elsif library.url.nil?
        ___ ' (no url) '
        fuck
      else
        ___ "(#{library.version.green}) " if library.version
        ___ cursor.column(45) unless config.quiet
        actions(library).each do |action|
          run_action(action)
        end
      end
      ___ "\n"
    end

    def run_action(action)
      klass = Arli::Actions.action(action)
      klass.new(library, config: config).act if klass
    end

    def actions(library)
      actions = []
      # First, how do we get the library?
      actions << ((library.url =~ /\.zip$/i) ? :zip_file : :git_repo)
      actions << :dir_name
      actions
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arli-0.7.0 lib/arli/installer.rb
arli-0.6.2 lib/arli/installer.rb