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

Instance Method Summary collapse

Instance Method Details

#write_org_lisp_configInteger

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.

Returns:

  • (Integer)

    the length written (as returned by the underlying ~File.write~ method call)



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fronde/config/lisp.rb', line 22

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.expand_path('./data/org-config.el', __dir__)),
    'version' => Fronde::VERSION,
    'work_dir' => workdir,
    'fronde_data_dir' => File.expand_path('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