Class: Jektify::Engine
- Inherits:
-
Object
- Object
- Jektify::Engine
- Defined in:
- lib/jektify/engine.rb
Instance Method Summary collapse
-
#assets_path ⇒ Object
Caminho para os assets dentro da gem.
-
#configure_sass_for_jekyll(site) ⇒ Object
Adiciona o caminho Sass da gem ao Jekyll/Dart Sass.
-
#error_different_string(obj, opt_first, opt_secondy, msg) ⇒ Object
Erros de validação.
- #error_different_true_false(obj, msg) ⇒ Object
-
#gem_path ⇒ Object
Retorna o caminho raiz da gem.
-
#split_params(params) ⇒ Object
Divide parâmetros do tag Liquid.
-
#stylesheets_sass_path ⇒ Object
Caminho para os arquivos Sass da gem.
-
#yml_config(yml) ⇒ Object
Carrega um arquivo YAML.
-
#yml_verify(app_root_config) ⇒ Object
Verifica se a configuração existe.
Instance Method Details
#assets_path ⇒ Object
Caminho para os assets dentro da gem
12 13 14 |
# File 'lib/jektify/engine.rb', line 12 def assets_path File.join(gem_path, 'assets') end |
#configure_sass_for_jekyll(site) ⇒ Object
Adiciona o caminho Sass da gem ao Jekyll/Dart Sass
46 47 48 49 50 |
# File 'lib/jektify/engine.rb', line 46 def configure_sass_for_jekyll(site) site.config["sass"] ||= {} site.config["sass"]["load_paths"] ||= [] site.config["sass"]["load_paths"] << stylesheets_sass_path unless site.config["sass"]["load_paths"].include?(stylesheets_sass_path) end |
#error_different_string(obj, opt_first, opt_secondy, msg) ⇒ Object
Erros de validação
27 28 29 |
# File 'lib/jektify/engine.rb', line 27 def error_different_string(obj, opt_first, opt_secondy, msg) raise RuntimeError, msg if obj != opt_first && obj != opt_secondy end |
#error_different_true_false(obj, msg) ⇒ Object
31 32 33 |
# File 'lib/jektify/engine.rb', line 31 def error_different_true_false(obj, msg) raise RuntimeError, msg if obj != true && obj != false end |
#gem_path ⇒ Object
Retorna o caminho raiz da gem
7 8 9 |
# File 'lib/jektify/engine.rb', line 7 def gem_path @gem_path ||= File.('../..', __dir__) end |
#split_params(params) ⇒ Object
Divide parâmetros do tag Liquid
41 42 43 |
# File 'lib/jektify/engine.rb', line 41 def split_params(params) params.split("/") end |
#stylesheets_sass_path ⇒ Object
Caminho para os arquivos Sass da gem
17 18 19 |
# File 'lib/jektify/engine.rb', line 17 def stylesheets_sass_path File.join(assets_path, 'vendor/jektify/sass') end |
#yml_config(yml) ⇒ Object
Carrega um arquivo YAML
22 23 24 |
# File 'lib/jektify/engine.rb', line 22 def yml_config(yml) YAML.load_file(yml) end |
#yml_verify(app_root_config) ⇒ Object
Verifica se a configuração existe
36 37 38 |
# File 'lib/jektify/engine.rb', line 36 def yml_verify(app_root_config) raise RuntimeError, "[x] Error: Configuration Jektify not found in _config.yml. Aborted!" if app_root_config.nil? end |