Sha256: 896965d7308cb4f01570dfae23a1ecc1879a916b2fd402c6bb5c058e7bd69f22

Contents?: true

Size: 646 Bytes

Versions: 1

Compression:

Stored size: 646 Bytes

Contents

module AppBuilder
  class Base
    extend Forwardable

    attr_accessor :config
    ::AppBuilder::Config::VALID_OPTIONS.each do |name|
      def_delegator :config, name
    end

    def initialize(config = nil)
      @config = config || ::AppBuilder::Config.new
    end

    private

      def execute(cmd, options = {})
        log(:info, "Execute command [local]: #{cmd}")
        stdout, stderr, status = Open3.capture3(cmd, **options)
        log(:error, "Failed [#{status.exitstatus}]: #{stderr}") unless status.success?
        stdout.chomp
      end

      def log(level, message)
        logger&.send(level, message)
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
app_builder-0.1.0 lib/app_builder/base.rb