Sha256: bf108c1eecd0ba10f78f394be70832bf2cbc9cc5442340e49bf3f072327eb680

Contents?: true

Size: 803 Bytes

Versions: 3

Compression:

Stored size: 803 Bytes

Contents

require 'json'
require 'fileutils'
require 'open3'
require 'arli'
require 'arli/version'
require 'arli/errors'
require 'arli/output'

module Arli
  module Commands
    class Base
      include Arli::Output

      attr_accessor :config, :name

      def initialize(config: Arli.config)
        self.config = config
        FileUtils.mkdir_p(library_path) unless Dir.exist?(library_path)
        setup
      end

      def run(*args)
        raise ArgumentError, 'This method must be implemented in subclasses'
      end

      def runtime
        config.runtime
      end

      def name
        @name ||= self.class.name.gsub(/.*::/, '').downcase.to_sym
      end

      def library_path
        config.libraries.path
      end

      def setup

      end

      def params

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arli-0.7.0 lib/arli/commands/base.rb
arli-0.6.2 lib/arli/commands/base.rb
arli-0.6.1 lib/arli/commands/base.rb