Class: TRMNLP::Paths

Inherits:
Object
  • Object
show all
Defined in:
lib/trmnlp/paths.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_dir) ⇒ Paths

Returns a new instance of Paths.



7
8
9
10
# File 'lib/trmnlp/paths.rb', line 7

def initialize(root_dir)
  @root_dir = Pathname.new(root_dir)
  @xdg = XDG.new
end

Instance Attribute Details

#root_dirObject (readonly)

Returns the value of attribute root_dir.



5
6
7
# File 'lib/trmnlp/paths.rb', line 5

def root_dir
  @root_dir
end

Instance Method Details

#app_configObject



34
# File 'lib/trmnlp/paths.rb', line 34

def app_config = app_config_dir.join('config.yml')

#app_config_dirObject



19
# File 'lib/trmnlp/paths.rb', line 19

def app_config_dir = xdg.config_home.join('trmnlp')

#build_dirObject



16
# File 'lib/trmnlp/paths.rb', line 16

def build_dir = root_dir.join('_build')

#cache_dirObject



21
# File 'lib/trmnlp/paths.rb', line 21

def cache_dir = xdg.cache_home.join('trmnl')

#create_build_dirObject



17
# File 'lib/trmnlp/paths.rb', line 17

def create_build_dir = build_dir.mkpath

#create_cache_dirObject



22
# File 'lib/trmnlp/paths.rb', line 22

def create_cache_dir = cache_dir.mkpath

#expand(path) ⇒ Object

— utilities —



44
# File 'lib/trmnlp/paths.rb', line 44

def expand(path) = Pathname.new(path).expand_path(root_dir)

#plugin_configObject



30
# File 'lib/trmnlp/paths.rb', line 30

def plugin_config = src_dir.join('settings.yml')

#render_templateObject



38
# File 'lib/trmnlp/paths.rb', line 38

def render_template = Pathname.new(__dir__).join('..', '..', 'web', 'views', 'render_html.erb')

#src_dirObject

— directories —



14
# File 'lib/trmnlp/paths.rb', line 14

def src_dir = root_dir.join('src')

#src_filesObject



40
# File 'lib/trmnlp/paths.rb', line 40

def src_files = src_dir.glob('*').select(&:file?)

#template(view) ⇒ Object



32
# File 'lib/trmnlp/paths.rb', line 32

def template(view) = src_dir.join("#{view}.liquid")

#trmnlp_configObject

— files —



28
# File 'lib/trmnlp/paths.rb', line 28

def trmnlp_config = root_dir.join('.trmnlp.yml')

#user_dataObject



36
# File 'lib/trmnlp/paths.rb', line 36

def user_data = cache_dir.join('data.json')

#valid?Boolean

Returns:

  • (Boolean)


24
# File 'lib/trmnlp/paths.rb', line 24

def valid? = trmnlp_config.exist?