Class: TRMNLP::Paths
- Inherits:
-
Object
- Object
- TRMNLP::Paths
- Defined in:
- lib/trmnlp/paths.rb
Instance Attribute Summary collapse
-
#root_dir ⇒ Object
readonly
Returns the value of attribute root_dir.
Instance Method Summary collapse
- #app_config ⇒ Object
- #app_config_dir ⇒ Object
- #build_dir ⇒ Object
- #cache_dir ⇒ Object
- #create_build_dir ⇒ Object
- #create_cache_dir ⇒ Object
-
#expand(path) ⇒ Object
— utilities —.
-
#gem_dir ⇒ Object
— trmnlp library —.
-
#initialize(root_dir) ⇒ Paths
constructor
A new instance of Paths.
- #plugin_config ⇒ Object
- #render_template ⇒ Object
- #shared_template ⇒ Object
-
#src_dir ⇒ Object
— directories —.
- #src_files ⇒ Object
- #template(view) ⇒ Object
- #templates_dir ⇒ Object
-
#trmnlp_config ⇒ Object
— files —.
- #user_data ⇒ Object
- #valid? ⇒ Boolean
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_dir ⇒ Object (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_config ⇒ Object
42 |
# File 'lib/trmnlp/paths.rb', line 42 def app_config = app_config_dir.join('config.yml') |
#app_config_dir ⇒ Object
25 |
# File 'lib/trmnlp/paths.rb', line 25 def app_config_dir = xdg.config_home.join('trmnlp') |
#build_dir ⇒ Object
22 |
# File 'lib/trmnlp/paths.rb', line 22 def build_dir = root_dir.join('_build') |
#cache_dir ⇒ Object
27 |
# File 'lib/trmnlp/paths.rb', line 27 def cache_dir = xdg.cache_home.join('trmnl') |
#create_build_dir ⇒ Object
23 |
# File 'lib/trmnlp/paths.rb', line 23 def create_build_dir = build_dir.mkpath |
#create_cache_dir ⇒ Object
28 |
# File 'lib/trmnlp/paths.rb', line 28 def create_cache_dir = cache_dir.mkpath |
#expand(path) ⇒ Object
— utilities —
52 |
# File 'lib/trmnlp/paths.rb', line 52 def (path) = Pathname.new(path).(root_dir) |
#gem_dir ⇒ Object
— trmnlp library —
14 |
# File 'lib/trmnlp/paths.rb', line 14 def gem_dir = Pathname.new(__dir__).join('..', '..'). |
#plugin_config ⇒ Object
36 |
# File 'lib/trmnlp/paths.rb', line 36 def plugin_config = src_dir.join('settings.yml') |
#render_template ⇒ Object
46 |
# File 'lib/trmnlp/paths.rb', line 46 def render_template = Pathname.new(__dir__).join('..', '..', 'web', 'views', 'render_html.erb') |
#shared_template ⇒ Object
40 |
# File 'lib/trmnlp/paths.rb', line 40 def shared_template = template('shared') |
#src_dir ⇒ Object
— directories —
20 |
# File 'lib/trmnlp/paths.rb', line 20 def src_dir = root_dir.join('src') |
#src_files ⇒ Object
48 |
# File 'lib/trmnlp/paths.rb', line 48 def src_files = src_dir.glob('*').select(&:file?) |
#template(view) ⇒ Object
38 |
# File 'lib/trmnlp/paths.rb', line 38 def template(view) = src_dir.join("#{view}.liquid") |
#templates_dir ⇒ Object
16 |
# File 'lib/trmnlp/paths.rb', line 16 def templates_dir = gem_dir.join('templates') |
#trmnlp_config ⇒ Object
— files —
34 |
# File 'lib/trmnlp/paths.rb', line 34 def trmnlp_config = root_dir.join('.trmnlp.yml') |
#user_data ⇒ Object
44 |
# File 'lib/trmnlp/paths.rb', line 44 def user_data = cache_dir.join('data.json') |
#valid? ⇒ Boolean
30 |
# File 'lib/trmnlp/paths.rb', line 30 def valid? = trmnlp_config.exist? |