Module: PublicanCreatorsPrepare
- Defined in:
- lib/publican_creators/prepare.rb
Overview
The module Prepare contains some methods for preparing the directories. They will be used in the make directory function
Class Method Summary collapse
-
.targetdir(environment, type, report, reports_dir_business, articles_dir_bus, books_dir_business, homework, articles_dir_private, homework_dir_private, books_dir_private) ⇒ String
This method sets the needed targetdir depending on the environment.
-
.targetdir_private(homework, articles_dir_private, homework_dir_private) ⇒ Object
Prepares the articles_dir for home environment.
-
.targetdir_work(report, reports_dir_business, articles_dir_bus) ⇒ Object
Prepares the articles_dir for work environment.
Class Method Details
.targetdir(environment, type, report, reports_dir_business, articles_dir_bus, books_dir_business, homework, articles_dir_private, homework_dir_private, books_dir_private) ⇒ String
This method sets the needed targetdir depending on the environment
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# 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) ⇒ Object
Prepares the articles_dir for home environment
82 83 84 85 86 87 88 89 90 |
# 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) ⇒ Object
Prepares the articles_dir for work environment
66 67 68 69 70 71 72 73 74 |
# 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 |