PublicanCreatorsGet.title()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
c 2
b 0
f 0
dl 0
loc 18
rs 9.4285
1
# PublicanCreatorsGet
2
# @author Sascha Manns
3
# @abstract Class for gathering information from config file and user input
4
#
5
# Copyright (C) 2015-2017  Sascha Manns <[email protected]>
6
# License: MIT
7
8
# Dependencies
9
10
require 'parseconfig'
11
12
# This method provides methods for user inputs
13
module PublicanCreatorsGet
14
  # This method ask for the title, environment, type and optional settings.
15
  # It returns the title variable.
16
  # @return [String] environment, type, opt, title
17
  def self.title
18
    # @note Put the yad input as variable titlein
19
    titlein = `yad --title="Create documentation" --center --on-top --form \
20
--item-separator=, --separator="|"  --field="Environment:CBE" \
21
--field="Type:CBE" --field="Optional:CBE" --field="Enter a title name \
22
(with underscores instead of blanks and without umlauts):TEXT" \
23
--field="Please file bugs or feature requests \
24
on http://saigkill-bugs.myjetbrains.com/youtrack/:LBL" --button="Go!" "Work,Private" \
25
"Article,Book" "Normal,Report,Homework"`
26
    # @note Format: Work/Private Article/Book title!Normal Report Homework
27
    # @note Cleanup the array
28
    environment, type, opt, titlefix = titlein.chomp.split('|')
29
30
    # @note replace blanks with underscores
31
    title = titlefix.gsub(/ /, '_')
32
33
    [environment, type, opt, title]
34
  end
35
36
  # This method ask for revision information
37
  # Description:
38
  # @return [String] revision
39
  def self.revision
40
    # @note Put the yad input as variable revhistin
41
    revhistin = `yad --title="Create Revision" --center --on-top --form \
42
--item-separator=, --separator="|" --field="Choose the directory where your \
43
project publican.cfg is:LBL" --field="Projectdir:DIR" --field="Enter your \
44
first revision text:TEXT" --field="Enter your second revision text:TEXT" \
45
--field="Enter your third revision text:TEXT" --field="Enter your fourth \
46
revision text:TEXT" --field="Enter your fifth revision text:TEXT" \
47
--field="Enter Revision number:TEXT" --field="You can use backslashes for \
48
entering Revision textes with blanks.:LBL" --button="Go!"`
49
    # @note Format: Directory|One|Two|Three|Four|Five|Revision
50
    # @note Cleanup the array
51
    revision = revhistin.chomp.split('|')
52
    # @note Split the variable to array revision[*]
53
    puts revision
54
  end
55
56
  # This method gets the language from the config file for using in
57
  # RevisionCreator
58
  # @return [String] language
59
  def self.config_revision
60
    include ParseConfig
61
    home = Dir.home
62
    config = ParseConfig.new("#{home}/.publican_creators/publicancreators.cfg")
63
    language = config['language']
64
    puts language
65
  end
66
end
67