Sha256: fbb34e3793b922b82f394d761c88c7ab90e3da6f792d71e3ce40454f7376cfb4

Contents?: true

Size: 926 Bytes

Versions: 1

Compression:

Stored size: 926 Bytes

Contents

require 'ostruct'
require 'pry'
require 'binding_of_caller'
require 'pry-byebug'
require 'standalone_migrations'
require 'sqlite3'
require 'nrb/errors'
require 'nrb/version'

module Nrb
  class Configuration < OpenStruct
    def initialize(*args)
      super
      self.resources = %w(models services)
    end
  end

  class << self
    def config
      @config ||= Configuration.new
      yield @config if block_given?
      @config
    end
    alias_method :configure, :config

    def root
      config.root || Dir.pwd
    end

    def inside?
      gemfile = File.join(Dir.pwd, 'Gemfile')
      return false unless File.exist? gemfile

      !!(File.read(gemfile) =~ /gem\s+['"]nrb['"]/)
    end

    def silently(verbose: false)
      yield and return if verbose

      original_stdout = $stdout.clone
      $stdout.reopen '/dev/null'
      yield
      $stdout.reopen original_stdout
    end
  end
end

require 'nrb/cli'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nrb-1.1.0 lib/nrb.rb