Class: PublicanCreatorsCreate

Inherits:
Object
  • Object
show all
Defined in:
lib/publican_creators/create.rb

Overview

Class for creating stuff

Class Method Summary collapse

Class Method Details

.create_docu(string, title) ⇒ String

This method uses the input of init_docu methods to create the documentation



125
126
127
128
129
130
# File 'lib/publican_creators/create.rb', line 125

def self.create_docu(string, title)
  system("publican create #{string}")
  # @param [String] title comes from the get method. This param represents
  # the name or title of your work. It is used in all important code places.
  Checker.check_result(title)
end

.init_docu_private(title, type, homework, language, brand_homework, brand_private, db5) ⇒ String

Note:

That method returns just a success or a fail. After the main part of

Method for creating initial documentation for private. It asks for title, type, language, homework, brand_homework, brand_private and db5 variable, creates a launch-string from them and launches publican. the method it starts another method “PublicanCreatorsChange.check_result”. This method checks if the directory with the content of the parameter title is available.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/publican_creators/create.rb', line 76

def self.init_docu_private(title, type, homework, language, brand_homework, brand_private, db5)
  puts 'Creating initial documentation ...'

  if type == 'Article'
    string = private_article(language, title, brand_private,
                             brand_homework, homework)
  else
    # @note Initial creation of documentation with publican
    string = "--lang #{language} --name #{title}"
    string << " --brand #{brand_private}" if brand_private != ''
  end
  # @note Check if DocBook 5 wished as default, if yes it adds the parameter
  # dtdver 5.0 to string
  string << ' --dtdver 5.0' if db5 == 'true'
  create_docu(string, title)
end

.init_docu_work(title, type, language, brand, db5) ⇒ String

Note:

That method returns just a success or a fail. After the main part of

Method for creating initial documentation for work. It asks for title, type, language, brand and db5 variable, creates a launch-string from them and launches publican. the method it starts another method “PublicanCreatorsChange.check_result”. This method checks if the directory with the content of the parameter title is available.



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/publican_creators/create.rb', line 40

def self.init_docu_work(title, type, language, brand, db5)
  puts 'Creating initial documentation ...'
  # Set standard string
  string = "--lang #{language} --name #{title}"
  # Add Article if type is Article
  string << ' --type Article' if type == 'Article'
  # Set business brand if given
  string << " --brand #{brand}" if brand != ''
  # @note Check if DocBook 5 wished as default, if yes it adds the parameter
  # dtdver 5.0 to string
  string << ' --dtdver 5.0' if db5 == 'true'
  create_docu(string, title)
end

.private_article(language, title, brand_private, brand_homework, homework) ⇒ Object

Method for preparing the string for private articles



105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/publican_creators/create.rb', line 105

def self.private_article(language, title, brand_private, brand_homework, homework)
  # @note Initial creation of documentation with publican
  string = "--type Article --lang #{language} --name #{title}"
  # Use brand_private if brand_private is set
  if brand_private != '' && homework == 'FALSE'
    string << " --brand #{brand_private}"
  end
  # Use brand_homework if its set
  if brand_homework != '' && homework == 'TRUE'
    string << " --brand #{brand_homework}"
  end
  return string
end