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

Parameters:

  • string (String)

    This input comes from init_docu

  • title (String)

    comes from the get method. This param represents the name or title of your work. It is used in all important code places.

Returns:

  • (String)

    true or false



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.

Parameters:

  • title (String)

    comes from the get method. This parameter represents the name or title of your work. It is used in all important code places.

  • type (String)

    represents the Document-Type like Article or Book.

  • homework (String)

    can be true or false

  • brand_private (String)

    is used in all methods with a “private” in the name. If this brand is set it will be used instead of the original publican brand.

  • language (String)

    is just the ISO Code of your target language like: de-DE, en-GB or such things.

  • brand_homework (String)

    can be a special customized brand for distance learning schools.

  • db5 (String)

    just sets your preferences. If you like to have DocBook 5.x as default you can set it there.

Returns:

  • (String)

    true or false



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.

Parameters:

  • title (String)

    comes from the get method. This @param represents the name or title of your work. It is used in all important code places.

  • type (String)

    represents the Document-Type like Article or Book.

  • language (String)

    is just the ISO Code of your target language like: de-DE, en-GB or such things.

  • brand (String)

    can be a special customized brand for your company to fit the styleguide.

  • db5 (String)

    just sets your preferences. If you like to have DocBook 5.x as default you can set it there.

Returns:

  • (String)

    true or false



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

Parameters:

  • language (String)

    is just the ISO Code of your target language like: de-DE, en-GB or such things.

  • title (String)

    comes from the get method. This parameter represents the name or title of your work. It is used in all important code places.

  • brand_private (String)

    is used in all methods with a “private” in the name. If this brand is set it will be used instead of the original publican brand.

  • brand_homework (String)

    can be a special customized brand for distance learning schools.

  • homework (String)

    true if homework set



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