publican_creators 1.2.3 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +237 -228
- data/CONTRIBUTING.md +21 -24
- data/LICENSE.md +635 -635
- data/MAINTENANCE.md +18 -18
- data/README.md +94 -94
- data/bin/publican_creators.rb +22 -22
- data/bin/revision_creator.rb +20 -20
- data/etc/publicancreators.cfg +84 -84
- data/lib/publican_creators.rb +210 -209
- data/lib/publican_creators/change.rb +287 -287
- data/lib/publican_creators/checker.rb +58 -58
- data/lib/publican_creators/create.rb +131 -131
- data/lib/publican_creators/export.rb +236 -236
- data/lib/publican_creators/get.rb +76 -75
- data/lib/publican_creators/notifier.rb +33 -32
- data/lib/publican_creators/prepare.rb +91 -91
- data/lib/publican_creators/revision.rb +56 -56
- data/lib/publican_creators/testlib.rb +37 -37
- data/lib/publican_creators/version.rb +35 -35
- metadata +17 -20
- data/data/publican_creators/publican-revision.png +0 -0
- data/data/publican_creators/publican.png +0 -0
@@ -1,75 +1,76 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
#
|
3
|
-
# This program is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This program is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
# Dependencies
|
17
|
-
|
18
|
-
require 'parseconfig'
|
19
|
-
require 'xdg'
|
20
|
-
|
21
|
-
# This method provides methods for user inputs
|
22
|
-
module PublicanCreatorsGet
|
23
|
-
# This method ask for the title, environment, type and optional settings.
|
24
|
-
# It returns the title variable.
|
25
|
-
# @return [String] environment, type, opt, title
|
26
|
-
def self.title
|
27
|
-
# @note Put the yad input as variable titlein
|
28
|
-
titlein = `yad --title="Create documentation" --center --on-top --form \
|
29
|
-
--item-separator=, --separator="|" --field="Environment:CBE" \
|
30
|
-
--field="Type:CBE" --field="Optional:CBE" --field="Enter a title name \
|
31
|
-
(with underscores instead of blanks and without umlauts):TEXT" \
|
32
|
-
--field="Please file bugs or feature requests \
|
33
|
-
on https://bugs.launchpad.net/publicancreators:LBL" --button="Go!" "Work,Private" \
|
34
|
-
"Article,Book" "Normal,Report,Homework"`
|
35
|
-
# @note Format: Work/Private Article/Book title!Normal Report Homework
|
36
|
-
# @note Cleanup the array
|
37
|
-
environment, type, opt, titlefix = titlein.chomp.split('|')
|
38
|
-
|
39
|
-
# @note replace blanks with underscores
|
40
|
-
title = titlefix.tr(' ', '_')
|
41
|
-
|
42
|
-
[environment, type, opt, title]
|
43
|
-
end
|
44
|
-
|
45
|
-
# This method ask for revision information
|
46
|
-
# Description:
|
47
|
-
# @return [String] revision
|
48
|
-
def self.revision
|
49
|
-
# @note Put the yad input as variable revhistin
|
50
|
-
revhistin = `yad --title="Create Revision" --center --on-top --form \
|
51
|
-
--item-separator=, --separator="|" --field="Choose the directory where your \
|
52
|
-
project publican.cfg is:LBL" --field="Projectdir:DIR" --field="Enter your \
|
53
|
-
first revision text:TEXT" --field="Enter your second revision text:TEXT" \
|
54
|
-
--field="Enter your third revision text:TEXT" --field="Enter your fourth \
|
55
|
-
revision text:TEXT" --field="Enter your fifth revision text:TEXT" \
|
56
|
-
--field="Enter Revision number:TEXT" --field="You can use backslashes for \
|
57
|
-
entering Revision textes with blanks.:LBL" --button="Go!"`
|
58
|
-
# @note Format: Directory|One|Two|Three|Four|Five|Revision
|
59
|
-
# @note Cleanup the array
|
60
|
-
revision = revhistin.chomp.split('|')
|
61
|
-
# @note Split the variable to array revision[*]
|
62
|
-
puts revision
|
63
|
-
end
|
64
|
-
|
65
|
-
# This method gets the language from the config file for using in
|
66
|
-
# RevisionCreator
|
67
|
-
# @return [String] language
|
68
|
-
def self.config_revision
|
69
|
-
include ParseConfig
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
1
|
+
# Copyright (C) 2013-2020 Sascha Manns <Sascha.Manns@outlook.de>
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
# Dependencies
|
17
|
+
|
18
|
+
require 'parseconfig'
|
19
|
+
require 'xdg'
|
20
|
+
|
21
|
+
# This method provides methods for user inputs
|
22
|
+
module PublicanCreatorsGet
|
23
|
+
# This method ask for the title, environment, type and optional settings.
|
24
|
+
# It returns the title variable.
|
25
|
+
# @return [String] environment, type, opt, title
|
26
|
+
def self.title
|
27
|
+
# @note Put the yad input as variable titlein
|
28
|
+
titlein = `yad --title="Create documentation" --center --on-top --form \
|
29
|
+
--item-separator=, --separator="|" --field="Environment:CBE" \
|
30
|
+
--field="Type:CBE" --field="Optional:CBE" --field="Enter a title name \
|
31
|
+
(with underscores instead of blanks and without umlauts):TEXT" \
|
32
|
+
--field="Please file bugs or feature requests \
|
33
|
+
on https://bugs.launchpad.net/publicancreators:LBL" --button="Go!" "Work,Private" \
|
34
|
+
"Article,Book" "Normal,Report,Homework"`
|
35
|
+
# @note Format: Work/Private Article/Book title!Normal Report Homework
|
36
|
+
# @note Cleanup the array
|
37
|
+
environment, type, opt, titlefix = titlein.chomp.split('|')
|
38
|
+
|
39
|
+
# @note replace blanks with underscores
|
40
|
+
title = titlefix.tr(' ', '_')
|
41
|
+
|
42
|
+
[environment, type, opt, title]
|
43
|
+
end
|
44
|
+
|
45
|
+
# This method ask for revision information
|
46
|
+
# Description:
|
47
|
+
# @return [String] revision
|
48
|
+
def self.revision
|
49
|
+
# @note Put the yad input as variable revhistin
|
50
|
+
revhistin = `yad --title="Create Revision" --center --on-top --form \
|
51
|
+
--item-separator=, --separator="|" --field="Choose the directory where your \
|
52
|
+
project publican.cfg is:LBL" --field="Projectdir:DIR" --field="Enter your \
|
53
|
+
first revision text:TEXT" --field="Enter your second revision text:TEXT" \
|
54
|
+
--field="Enter your third revision text:TEXT" --field="Enter your fourth \
|
55
|
+
revision text:TEXT" --field="Enter your fifth revision text:TEXT" \
|
56
|
+
--field="Enter Revision number:TEXT" --field="You can use backslashes for \
|
57
|
+
entering Revision textes with blanks.:LBL" --button="Go!"`
|
58
|
+
# @note Format: Directory|One|Two|Three|Four|Five|Revision
|
59
|
+
# @note Cleanup the array
|
60
|
+
revision = revhistin.chomp.split('|')
|
61
|
+
# @note Split the variable to array revision[*]
|
62
|
+
puts revision
|
63
|
+
end
|
64
|
+
|
65
|
+
# This method gets the language from the config file for using in
|
66
|
+
# RevisionCreator
|
67
|
+
# @return [String] language
|
68
|
+
def self.config_revision
|
69
|
+
include ParseConfig
|
70
|
+
xdg = XDG::Environment.new
|
71
|
+
sys_xdg = xdg.config_home
|
72
|
+
config = ParseConfig.new("#{sys_xdg}/publican_creators/publicancreators.cfg")
|
73
|
+
language = config['language']
|
74
|
+
puts language
|
75
|
+
end
|
76
|
+
end
|
@@ -1,32 +1,33 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
#
|
3
|
-
# This program is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This program is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
# Dependencies
|
17
|
-
require 'notifier'
|
18
|
-
require 'xdg'
|
19
|
-
|
20
|
-
# Module for notify the user
|
21
|
-
module Notifier
|
22
|
-
def self.run
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
1
|
+
# Copyright (C) 2013-2020 Sascha Manns <Sascha.Manns@outlook.de>
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
# Dependencies
|
17
|
+
require 'notifier'
|
18
|
+
require 'xdg'
|
19
|
+
|
20
|
+
# Module for notify the user
|
21
|
+
module Notifier
|
22
|
+
def self.run
|
23
|
+
xdg = XDG::Environment.new
|
24
|
+
data_xdg = xdg.data_home
|
25
|
+
install_path = "#{data_xdg}/icons/"
|
26
|
+
img = "#{install_path}/publican.png"
|
27
|
+
Notifier.notify(
|
28
|
+
image: img.to_s,
|
29
|
+
title: 'Your Documentation',
|
30
|
+
message: 'The preparation of your Documentation is finished.'
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
@@ -1,91 +1,91 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
#
|
3
|
-
# This program is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This program is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
# Dependencies
|
17
|
-
|
18
|
-
# The module Prepare contains some methods for preparing the directories. They
|
19
|
-
# will be used in the make directory function
|
20
|
-
module PublicanCreatorsPrepare
|
21
|
-
# This method sets the needed targetdir depending on the environment
|
22
|
-
# @param [String] environment Work or Private
|
23
|
-
# @param [String] type represents the Document-Type like Article or Book.
|
24
|
-
# @param [String] reports_dir_business contains the directory to your reports
|
25
|
-
# @param [String] articles_dir_bus represents the directory for your articles
|
26
|
-
# @param [String] report contains a true or false. There you can set if the
|
27
|
-
# new Publication is a Report or not.
|
28
|
-
# @param [String] books_dir_business contains the directory for your business
|
29
|
-
# books
|
30
|
-
# @param [String] homework contains true or false. If your present Publication
|
31
|
-
# is a homework you can set it there.
|
32
|
-
# @param [String] articles_dir_private contains the path to your private
|
33
|
-
# articles_dir
|
34
|
-
# @param [String] homework_dir_private contains the path to your homework dir.
|
35
|
-
# @param [String] books_dir_private contains the path to your private
|
36
|
-
# books_dir
|
37
|
-
# @return [String] targetdir
|
38
|
-
def self.targetdir(environment, type, report, reports_dir_business,
|
39
|
-
articles_dir_bus, books_dir_business, homework,
|
40
|
-
articles_dir_private, homework_dir_private, books_dir_private)
|
41
|
-
home = Dir.home
|
42
|
-
# TODO: Try to fix this in future
|
43
|
-
# rubocop:disable Style/IfInsideElse
|
44
|
-
if environment == 'Work'
|
45
|
-
if type == 'Article'
|
46
|
-
targetdir_work(report, reports_dir_business, articles_dir_bus)
|
47
|
-
else
|
48
|
-
books_dir = "#{home}/#{books_dir_business}"
|
49
|
-
return books_dir
|
50
|
-
end
|
51
|
-
else
|
52
|
-
if type == 'Article'
|
53
|
-
targetdir_private(homework, articles_dir_private, homework_dir_private)
|
54
|
-
else
|
55
|
-
books_dir = "#{home}/#{books_dir_private}"
|
56
|
-
return books_dir
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
# Prepares the articles_dir for work environment
|
62
|
-
# @param [String] report contains a true or false. There you can set if the
|
63
|
-
# new Publication is a Report or not.
|
64
|
-
# @param [String] reports_dir_business contains the directory to your reports
|
65
|
-
# @param [String] articles_dir_bus represents the directory for your articles
|
66
|
-
def self.targetdir_work(report, reports_dir_business, articles_dir_bus)
|
67
|
-
home = Dir.home
|
68
|
-
articles_dir = if report == 'TRUE'
|
69
|
-
"#{home}/#{reports_dir_business}"
|
70
|
-
else
|
71
|
-
"#{home}/#{articles_dir_bus}"
|
72
|
-
end
|
73
|
-
return articles_dir
|
74
|
-
end
|
75
|
-
|
76
|
-
# Prepares the articles_dir for home environment
|
77
|
-
# @param [String] homework contains true or false. If your present Publication
|
78
|
-
# is a homework you can set it there.
|
79
|
-
# @param [String] articles_dir_private contains the path to your private
|
80
|
-
# articles_dir
|
81
|
-
# @param [String] homework_dir_private contains the path to your homework dir.
|
82
|
-
def self.targetdir_private(homework, articles_dir_private, homework_dir_private)
|
83
|
-
home = Dir.home
|
84
|
-
articles_dir = if homework == 'FALSE'
|
85
|
-
"#{home}/#{articles_dir_private}"
|
86
|
-
else
|
87
|
-
"#{home}/#{homework_dir_private}"
|
88
|
-
end
|
89
|
-
return articles_dir
|
90
|
-
end
|
91
|
-
end
|
1
|
+
# Copyright (C) 2013-2020 Sascha Manns <Sascha.Manns@outlook.de>
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
# Dependencies
|
17
|
+
|
18
|
+
# The module Prepare contains some methods for preparing the directories. They
|
19
|
+
# will be used in the make directory function
|
20
|
+
module PublicanCreatorsPrepare
|
21
|
+
# This method sets the needed targetdir depending on the environment
|
22
|
+
# @param [String] environment Work or Private
|
23
|
+
# @param [String] type represents the Document-Type like Article or Book.
|
24
|
+
# @param [String] reports_dir_business contains the directory to your reports
|
25
|
+
# @param [String] articles_dir_bus represents the directory for your articles
|
26
|
+
# @param [String] report contains a true or false. There you can set if the
|
27
|
+
# new Publication is a Report or not.
|
28
|
+
# @param [String] books_dir_business contains the directory for your business
|
29
|
+
# books
|
30
|
+
# @param [String] homework contains true or false. If your present Publication
|
31
|
+
# is a homework you can set it there.
|
32
|
+
# @param [String] articles_dir_private contains the path to your private
|
33
|
+
# articles_dir
|
34
|
+
# @param [String] homework_dir_private contains the path to your homework dir.
|
35
|
+
# @param [String] books_dir_private contains the path to your private
|
36
|
+
# books_dir
|
37
|
+
# @return [String] targetdir
|
38
|
+
def self.targetdir(environment, type, report, reports_dir_business,
|
39
|
+
articles_dir_bus, books_dir_business, homework,
|
40
|
+
articles_dir_private, homework_dir_private, books_dir_private)
|
41
|
+
home = Dir.home
|
42
|
+
# TODO: Try to fix this in future
|
43
|
+
# rubocop:disable Style/IfInsideElse
|
44
|
+
if environment == 'Work'
|
45
|
+
if type == 'Article'
|
46
|
+
targetdir_work(report, reports_dir_business, articles_dir_bus)
|
47
|
+
else
|
48
|
+
books_dir = "#{home}/#{books_dir_business}"
|
49
|
+
return books_dir
|
50
|
+
end
|
51
|
+
else
|
52
|
+
if type == 'Article'
|
53
|
+
targetdir_private(homework, articles_dir_private, homework_dir_private)
|
54
|
+
else
|
55
|
+
books_dir = "#{home}/#{books_dir_private}"
|
56
|
+
return books_dir
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Prepares the articles_dir for work environment
|
62
|
+
# @param [String] report contains a true or false. There you can set if the
|
63
|
+
# new Publication is a Report or not.
|
64
|
+
# @param [String] reports_dir_business contains the directory to your reports
|
65
|
+
# @param [String] articles_dir_bus represents the directory for your articles
|
66
|
+
def self.targetdir_work(report, reports_dir_business, articles_dir_bus)
|
67
|
+
home = Dir.home
|
68
|
+
articles_dir = if report == 'TRUE'
|
69
|
+
"#{home}/#{reports_dir_business}"
|
70
|
+
else
|
71
|
+
"#{home}/#{articles_dir_bus}"
|
72
|
+
end
|
73
|
+
return articles_dir
|
74
|
+
end
|
75
|
+
|
76
|
+
# Prepares the articles_dir for home environment
|
77
|
+
# @param [String] homework contains true or false. If your present Publication
|
78
|
+
# is a homework you can set it there.
|
79
|
+
# @param [String] articles_dir_private contains the path to your private
|
80
|
+
# articles_dir
|
81
|
+
# @param [String] homework_dir_private contains the path to your homework dir.
|
82
|
+
def self.targetdir_private(homework, articles_dir_private, homework_dir_private)
|
83
|
+
home = Dir.home
|
84
|
+
articles_dir = if homework == 'FALSE'
|
85
|
+
"#{home}/#{articles_dir_private}"
|
86
|
+
else
|
87
|
+
"#{home}/#{homework_dir_private}"
|
88
|
+
end
|
89
|
+
return articles_dir
|
90
|
+
end
|
91
|
+
end
|
@@ -1,56 +1,56 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
#
|
3
|
-
# This program is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This program is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
# Dependencies
|
17
|
-
require 'fileutils'
|
18
|
-
require 'rainbow/ext/string'
|
19
|
-
require_relative 'change'
|
20
|
-
require_relative 'get'
|
21
|
-
|
22
|
-
# A class for creating a revison to a publican project
|
23
|
-
class RevisionCreator
|
24
|
-
# @note Ask for the revision information
|
25
|
-
# rubocop:disable Layout/UselessAssignment
|
26
|
-
null, directory, member1, member2, member3, member4, member5, revnumber = PublicanCreatorsGet.revision
|
27
|
-
language = PublicanCreatorsGet.config_revision
|
28
|
-
|
29
|
-
revision, edition = revnumber.split('-')
|
30
|
-
|
31
|
-
# This method prepares the string for adding a new revision
|
32
|
-
# @param [String] member1 is the first string into revdescription
|
33
|
-
# @param [String] member2 is the second string into revdescription
|
34
|
-
# @param [String] member3 is the third string into revdescription
|
35
|
-
# @param [String] member4 is the fourth string into revdescription
|
36
|
-
# @param [String] member5 is the fifth string into revdescription
|
37
|
-
# @param [String] revnumber is the revision number
|
38
|
-
# @param [String] language is the language. Comes from config file.
|
39
|
-
# @return [String] string is that string for creating the commit
|
40
|
-
def self.prepare_revision(member1, member2, member3, member4, member5, revnumber, language)
|
41
|
-
string = "--member \"#{member1}\""
|
42
|
-
string << " --member \"#{member2}\"" if member2 != ''
|
43
|
-
string << " --member \"#{member3}\"" if member3 != ''
|
44
|
-
string << " --member \"#{member4}\"" if member4 != ''
|
45
|
-
string << " --member \"#{member5}\"" if member5 != ''
|
46
|
-
string << " --revnumber \"#{revnumber}\""
|
47
|
-
string << " --lang \"#{language}\""
|
48
|
-
end
|
49
|
-
|
50
|
-
# This method changes to the target directory
|
51
|
-
FileUtils.cd(directory) do
|
52
|
-
string = prepare_revision(member1, member2, member3, member4, member5, revnumber, language)
|
53
|
-
PublicanCreatorsChange.replace_productnumber(revision, edition, language)
|
54
|
-
system("publican add_revision #{string}")
|
55
|
-
end
|
56
|
-
end
|
1
|
+
# Copyright (C) 2013-2020 Sascha Manns <Sascha.Manns@outlook.de>
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
# Dependencies
|
17
|
+
require 'fileutils'
|
18
|
+
require 'rainbow/ext/string'
|
19
|
+
require_relative 'change'
|
20
|
+
require_relative 'get'
|
21
|
+
|
22
|
+
# A class for creating a revison to a publican project
|
23
|
+
class RevisionCreator
|
24
|
+
# @note Ask for the revision information
|
25
|
+
# rubocop:disable Layout/UselessAssignment
|
26
|
+
null, directory, member1, member2, member3, member4, member5, revnumber = PublicanCreatorsGet.revision
|
27
|
+
language = PublicanCreatorsGet.config_revision
|
28
|
+
|
29
|
+
revision, edition = revnumber.split('-')
|
30
|
+
|
31
|
+
# This method prepares the string for adding a new revision
|
32
|
+
# @param [String] member1 is the first string into revdescription
|
33
|
+
# @param [String] member2 is the second string into revdescription
|
34
|
+
# @param [String] member3 is the third string into revdescription
|
35
|
+
# @param [String] member4 is the fourth string into revdescription
|
36
|
+
# @param [String] member5 is the fifth string into revdescription
|
37
|
+
# @param [String] revnumber is the revision number
|
38
|
+
# @param [String] language is the language. Comes from config file.
|
39
|
+
# @return [String] string is that string for creating the commit
|
40
|
+
def self.prepare_revision(member1, member2, member3, member4, member5, revnumber, language)
|
41
|
+
string = "--member \"#{member1}\""
|
42
|
+
string << " --member \"#{member2}\"" if member2 != ''
|
43
|
+
string << " --member \"#{member3}\"" if member3 != ''
|
44
|
+
string << " --member \"#{member4}\"" if member4 != ''
|
45
|
+
string << " --member \"#{member5}\"" if member5 != ''
|
46
|
+
string << " --revnumber \"#{revnumber}\""
|
47
|
+
string << " --lang \"#{language}\""
|
48
|
+
end
|
49
|
+
|
50
|
+
# This method changes to the target directory
|
51
|
+
FileUtils.cd(directory) do
|
52
|
+
string = prepare_revision(member1, member2, member3, member4, member5, revnumber, language)
|
53
|
+
PublicanCreatorsChange.replace_productnumber(revision, edition, language)
|
54
|
+
system("publican add_revision #{string}")
|
55
|
+
end
|
56
|
+
end
|