Module: Nrb

Defined in:
lib/nrb.rb,
lib/nrb/cli.rb,
lib/nrb/utils.rb,
lib/nrb/errors.rb,
lib/nrb/version.rb,
lib/nrb/commands/script.rb,
lib/nrb/commands/console.rb,
lib/nrb/commands/destroy.rb,
lib/nrb/commands/starter.rb,
lib/nrb/commands/generate.rb,
lib/nrb/commands/base/base.rb,
lib/nrb/commands/base/inside.rb,
lib/nrb/commands/base/resource.rb,
lib/nrb/commands/concerns/script_generator.rb,
lib/nrb/commands/concerns/resource_generator.rb

Overview

The main namespace for this gem’s logic.

Defined Under Namespace

Modules: Commands, Utils Classes: CLI, Configuration, InvalidResourceError, OutsideRootError

Constant Summary collapse

RESOURCES =
%w(models services).freeze
VERSION =
'1.2.0'.freeze

Class Method Summary collapse

Class Method Details

.config {|@config| ... } ⇒ Object Also known as: configure

Yields:



31
32
33
34
35
# File 'lib/nrb.rb', line 31

def config
  @config ||= Configuration.new
  yield @config if block_given?
  @config
end

.inside?Boolean

Returns:

  • (Boolean)


42
43
44
45
46
47
# File 'lib/nrb.rb', line 42

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

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

.resourcesObject



49
50
51
# File 'lib/nrb.rb', line 49

def resources
  RESOURCES
end

.rootObject



38
39
40
# File 'lib/nrb.rb', line 38

def root
  config.root || Dir.pwd
end