class Jekyll::Commands::DeployNarou

Constants

COMMAND_OPTIONS

Public Class Methods

init_with_program(prog) click to toggle source
# File lib/jekyll/commands/deploy_narou.rb, line 11
def init_with_program(prog)
  prog.command(:'deploy-narou') do |c|
    c.syntax 'deploy-narou [options]'
    c.description 'Deploy posts to Narou'
    c.alias :dn

    c.option 'config', '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
    c.option "future", "--future", "Publishes posts with a future date"
    c.option 'verbose', '-V', '--verbose', 'Print verbose output.'

    COMMAND_OPTIONS.each do |key, val|
      c.option key, *val
    end

    c.action do |_args, options|
      options['narou'] = {}
      COMMAND_OPTIONS.keys.each do |key|
        options['narou'][key] = options[key] unless options[key].nil?
      end

      process(options)
    end
  end
end
process(options, deployer: JekyllDeployShosetsu::Deployers::Narou.new) click to toggle source
# File lib/jekyll/commands/deploy_narou.rb, line 36
def process(options, deployer: JekyllDeployShosetsu::Deployers::Narou.new)
  Jekyll.logger.adjust_verbosity(options)

  site = Jekyll::Site.new(configure(options))
  site.reset
  site.read

  deployer.deploy(site)
end

Private Class Methods

configure(options) click to toggle source
# File lib/jekyll/commands/deploy_narou.rb, line 48
def configure(options)
  Jekyll::Hooks.register :posts, :pre_render do |post, _payload|
    post.merge_data!('layout' => 'none')
  end

  config = configuration_from_options(options)

  config['markdown']               = 'FujiMarkdown'
  config['FujiMarkdown']           ||= {}
  config['FujiMarkdown']['output'] = 'narou'

  config
end