Module: DohApp

Extended by:
DohApp
Included in:
DohApp
Defined in:
lib/dohutil/app/name.rb,
lib/dohutil/app/util.rb

Instance Method Summary collapse

Instance Method Details

#init_from_file(filepath) ⇒ Object



12
13
14
15
# File 'lib/dohutil/app/util.rb', line 12

def init_from_file(filepath)
  Doh.find_root_from_file(filepath)
  DohApp.require_custom_config
end

#nameObject



4
5
6
# File 'lib/dohutil/app/name.rb', line 4

def name
  @name ||= File.basename($PROGRAM_NAME, '.rb')
end

#name=(appname) ⇒ Object



8
9
10
# File 'lib/dohutil/app/name.rb', line 8

def name=(appname)
  @name = appname
end

#require_custom_configObject

Raises:

  • (Doh::DohRootNotFoundException)


6
7
8
9
10
# File 'lib/dohutil/app/util.rb', line 6

def require_custom_config
  raise Doh::DohRootNotFoundException if !Doh.root
  path = File.expand_path(File.join(Doh.root, 'config/dohapp.rb'))
  require(path) if File.exist?(path)
end