Class: OpenStudio::Extension::Extension

Inherits:
Object
  • Object
show all
Defined in:
lib/openstudio/extension.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_dir = nil) ⇒ Extension

Typically one does not pass in the root path and it is defaulted as the root path of the project that is inheriting the extension. The root path can be overriden as needed on initialization only. This is mainly used for testing purposes.

Parameters:

  • root_dir:

    string, fully qualified path of the root directory of the extension gem.



19
20
21
# File 'lib/openstudio/extension.rb', line 19

def initialize(root_dir = nil)
  @root_dir = root_dir || File.absolute_path(File.join(File.dirname(__FILE__), '..', '..'))
end

Instance Attribute Details

#root_dirObject

Returns the value of attribute root_dir.



13
14
15
# File 'lib/openstudio/extension.rb', line 13

def root_dir
  @root_dir
end

Instance Method Details

#core_dirObject

Do not override Files in the core directory are copied into measure resource folders to build standalone measures Files will be copied into the resources folder of measures which have files of the same name Return the absolute path of the core dir or nil if there is none



45
46
47
# File 'lib/openstudio/extension.rb', line 45

def core_dir
  return File.absolute_path(File.join(@root_dir, 'lib', 'openstudio', 'extension', 'core'))
end

#doc_templates_dirObject

Doc templates are common files like copyright files which are used to update measures and other code Doc templates will only be applied to measures in the current repository Return the absolute path of the doc templates dir or nil if there is none



37
38
39
# File 'lib/openstudio/extension.rb', line 37

def doc_templates_dir
  return File.absolute_path(File.join(@root_dir, 'doc_templates'))
end

#files_dirObject

Relevant files such as weather data, design days, etc. Return the absolute path of the files or nil if there is none, used when configuring OSWs



30
31
32
# File 'lib/openstudio/extension.rb', line 30

def files_dir
  return File.absolute_path(File.join(@root_dir, 'lib', 'files'))
end

#measures_dirObject

Return the absolute path of the measures or nil if there is none, used when configuring OSWs



24
25
26
# File 'lib/openstudio/extension.rb', line 24

def measures_dir
  return File.absolute_path(File.join(@root_dir, 'lib', 'measures'))
end