module PublicanCreatorsPrepare

The module Prepare contains some methods for preparing the directories. They will be used in the make directory function

Public Class Methods

targetdir(environment, type, report, reports_dir_business, articles_dir_bus, books_dir_business, homework, articles_dir_private, homework_dir_private, books_dir_private) click to toggle source

This method sets the needed targetdir depending on the environment @param [String] environment Work or Private @param [String] type represents the Document-Type like Article or Book. @param [String] reports_dir_business contains the directory to your reports @param [String] articles_dir_bus represents the directory for your articles @param [String] report contains a true or false. There you can set if the

new Publication is a Report or not.

@param [String] books_dir_business contains the directory for your business

books

@param [String] homework contains true or false. If your present Publication

is a homework you can set it there.

@param [String] articles_dir_private contains the path to your private

articles_dir

@param [String] homework_dir_private contains the path to your homework dir. @param [String] books_dir_private contains the path to your private

books_dir

@return [String] targetdir

# File lib/publican_creators/prepare.rb, line 38
def self.targetdir(environment, type, report, reports_dir_business,
                   articles_dir_bus, books_dir_business, homework,
                   articles_dir_private, homework_dir_private, books_dir_private)
  home = Dir.home
  # TODO: Try to fix this in future
  # rubocop:disable Style/IfInsideElse
  if environment == 'Work'
    if type == 'Article'
      targetdir_work(report, reports_dir_business, articles_dir_bus)
    else
      books_dir = "#{home}/#{books_dir_business}"
      return books_dir
    end
  else
    if type == 'Article'
      targetdir_private(homework, articles_dir_private, homework_dir_private)
    else
      books_dir = "#{home}/#{books_dir_private}"
      return books_dir
    end
  end
end
targetdir_private(homework, articles_dir_private, homework_dir_private) click to toggle source

Prepares the articles_dir for home environment @param [String] homework contains true or false. If your present Publication

is a homework you can set it there.

@param [String] articles_dir_private contains the path to your private

articles_dir

@param [String] homework_dir_private contains the path to your homework dir.

# File lib/publican_creators/prepare.rb, line 82
def self.targetdir_private(homework, articles_dir_private, homework_dir_private)
  home = Dir.home
  articles_dir = if homework == 'FALSE'
                   "#{home}/#{articles_dir_private}"
                 else
                   "#{home}/#{homework_dir_private}"
                 end
  return articles_dir
end
targetdir_work(report, reports_dir_business, articles_dir_bus) click to toggle source

Prepares the articles_dir for work environment @param [String] report contains a true or false. There you can set if the

new Publication is a Report or not.

@param [String] reports_dir_business contains the directory to your reports @param [String] articles_dir_bus represents the directory for your articles

# File lib/publican_creators/prepare.rb, line 66
def self.targetdir_work(report, reports_dir_business, articles_dir_bus)
  home = Dir.home
  articles_dir = if report == 'TRUE'
                   "#{home}/#{reports_dir_business}"
                 else
                   "#{home}/#{articles_dir_bus}"
                 end
  return articles_dir
end