Module: Fronde::Config::Lisp
- Included in:
- Store
- Defined in:
- lib/fronde/config/lisp.rb
Overview
This module contains utilitary methods to ease ~org-config.el~ file generation
Class Method Summary collapse
Instance Method Summary collapse
-
#write_org_lisp_config ⇒ Integer
Generate emacs lisp configuration file for Org and write it.
Class Method Details
.theme_directory(theme) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fronde/config/lisp.rb', line 14 def theme_directory(theme) # User theme first to allow overwriting directory = File.("themes/#{theme}") return directory if Dir.exist? directory directory = File.("data/themes/#{theme}", __dir__) return directory if Dir.exist? directory raise Errno::ENOENT, "Theme #{theme} not found" end |
Instance Method Details
#write_org_lisp_config ⇒ Integer
Generate emacs lisp configuration file for Org and write it.
This method saves the generated configuration in the file ~org-config.el~ at the root of your project, overwriting it if it existed already.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fronde/config/lisp.rb', line 34 def write_org_lisp_config workdir = Dir.pwd all_projects = sources.map(&:org_config).flatten all_themes = org_generate_themes(all_projects) FileUtils.mkdir_p "#{workdir}/var/lib" content = Helpers.render_liquid_template( File.read(File.('./data/org-config.el', __dir__)), 'version' => Fronde::VERSION, 'work_dir' => workdir, 'fronde_data_dir' => File.('data', __dir__), 'org_version' => Fronde::Org.current_version, 'long_date_fmt' => I18n.t('time.formats.long'), 'author' => { 'email' => get('author_email', ''), 'name' => get('author') }, 'domain' => get('domain'), 'all_projects' => all_projects + all_themes ) File.write("#{workdir}/var/lib/org-config.el", content) end |