Sha256: 3df8a41b913da248fd4441dcde9e9300f0b2d3e95be3224b74494cdd60106a8b
Contents?: true
Size: 1.8 KB
Versions: 3
Compression:
Stored size: 1.8 KB
Contents
require 'forwardable' require 'arli' require 'arli/actions' require_relative 'single_version' module Arli module Library class Installer include ::Arli::Helpers::Output extend Forwardable def_delegators :@library, :exists? attr_accessor :library, :config, :temp_dir def initialize(library, config: Arli.config) self.config = config self.library = library self.temp_dir = Arli.config.libraries.temp_dir end def install ___ "#{library.name.blue.bold} " if library.nil? && library.library.nil? ___ ' (no library) ' fuck elsif library.url.nil? ___ ' (no url) ' fuck else ___ "(#{library.version.yellow.bold}) " if library.version indent_cursor actions(library).each do |action| run_action(action) end end ___ "\n" end def run_action(action_name) klass = Arli::Actions.action(action_name) if klass action = klass.new(library, config: config) if action.supported? print_action_starting(action_name.to_s) do action.run! end puts if verbose? else print_action_failure('unsupported', "missing pre-requisites: #{klass.command_name.bold.yellow} did not succeed") end else print_action_failure("#{action_name.red} not found") end end def verbose? config.verbose end def actions(library) actions = [] # First, how do we get the library? actions << ((library.url =~ /\.zip$/i) ? :unzip_file : :git_repo) actions << :dir_name actions << :move_to_library_path actions.flatten end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
arli-1.4.0 | lib/arli/library/installer.rb |
arli-1.3.0 | lib/arli/library/installer.rb |
arli-1.2.1 | lib/arli/library/installer.rb |