publican_creators 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.2
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'publican_creators'
4
+ require 'bundler/setup'
5
+
6
+ IRB.start
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # @author Sascha Manns
3
+ # @abstract Class RevisionCreator for PublicanCreator
4
+ # Copyright (C) 2015 Sascha Manns <samannsml@directbox.com>
5
+ # License: GPL-3
6
+
7
+ require File.expand_path(File.join(File.dirname(__FILE__),
8
+ '../lib/publican_creators', 'revision.rb'))
9
+ RevisionCreator.new
data/config.reek ADDED
@@ -0,0 +1,111 @@
1
+ ---
2
+ Attribute:
3
+ enabled: false
4
+ exclude: []
5
+ BooleanParameter:
6
+ enabled: true
7
+ exclude: []
8
+ ClassVariable:
9
+ enabled: true
10
+ exclude: []
11
+ ControlParameter:
12
+ enabled: true
13
+ exclude: []
14
+ DataClump:
15
+ enabled: true
16
+ exclude: []
17
+ max_copies: 2
18
+ min_clump_size: 2
19
+ DuplicateMethodCall:
20
+ enabled: true
21
+ exclude: []
22
+ max_calls: 3
23
+ allow_calls: []
24
+ FeatureEnvy:
25
+ enabled: true
26
+ exclude: []
27
+ IrresponsibleModule:
28
+ enabled: true
29
+ exclude: []
30
+ LongParameterList:
31
+ enabled: true
32
+ exclude: []
33
+ max_params: 3
34
+ overrides:
35
+ initialize:
36
+ max_params: 5
37
+ LongYieldList:
38
+ enabled: true
39
+ exclude: []
40
+ max_params: 3
41
+ ModuleInitialize:
42
+ enabled: true
43
+ exclude: []
44
+ NestedIterators:
45
+ enabled: true
46
+ exclude: []
47
+ max_allowed_nesting: 1
48
+ ignore_iterators: []
49
+ NilCheck:
50
+ enabled: true
51
+ exclude: []
52
+ PrimaDonnaMethod:
53
+ enabled: true
54
+ exclude: []
55
+ RepeatedConditional:
56
+ enabled: true
57
+ exclude: []
58
+ max_ifs: 2
59
+ TooManyInstanceVariables:
60
+ enabled: true
61
+ exclude: []
62
+ max_instance_variables: 9
63
+ TooManyMethods:
64
+ enabled: true
65
+ exclude: []
66
+ max_methods: 25
67
+ TooManyStatements:
68
+ enabled: true
69
+ exclude:
70
+ - initialize
71
+ max_statements: 15
72
+ UncommunicativeMethodName:
73
+ enabled: true
74
+ exclude: []
75
+ reject:
76
+ - !ruby/regexp /^[a-z]$/
77
+ - !ruby/regexp /[0-9]$/
78
+ - !ruby/regexp /[A-Z]/
79
+ accept: []
80
+ UncommunicativeModuleName:
81
+ enabled: true
82
+ exclude: []
83
+ reject:
84
+ - !ruby/regexp /^.$/
85
+ - !ruby/regexp /[0-9]$/
86
+ accept:
87
+ - Inline::C
88
+ UncommunicativeParameterName:
89
+ enabled: true
90
+ exclude: []
91
+ reject:
92
+ - !ruby/regexp /^.$/
93
+ - !ruby/regexp /[0-9]$/
94
+ - !ruby/regexp /[A-Z]/
95
+ - !ruby/regexp /^_/
96
+ accept: []
97
+ UncommunicativeVariableName:
98
+ enabled: true
99
+ exclude: []
100
+ reject:
101
+ - !ruby/regexp /^.$/
102
+ - !ruby/regexp /[0-9]$/
103
+ - !ruby/regexp /[A-Z]/
104
+ accept:
105
+ - _
106
+ UnusedParameters:
107
+ enabled: true
108
+ exclude: []
109
+ UtilityFunction:
110
+ enabled: true
111
+ exclude: []
Binary file
@@ -0,0 +1,85 @@
1
+ # Configuration file for PublicanCreators
2
+ # Change this file to pacify your needs
3
+ conf_ver = '1'
4
+
5
+ # Global
6
+ name = 'Sascha Manns'
7
+ email_private = 'samannsml@directbox.com'
8
+
9
+ # Specify your language like de-DE
10
+ language = 'de-DE'
11
+
12
+ # If you want to use DocBook5 as default so set it there
13
+ db5 = 'true'
14
+
15
+ # Choose if you like to use a special brand or use the publicacn default
16
+ use_brand = 'true'
17
+
18
+ # If you write anything do you would like to use the default titlelogo
19
+ # Hint: Another way can be to write own XSL-FO Stylesheets and use an own brand
20
+ title_logo = 'false'
21
+
22
+ # Would you like to remove the XI-Include from articles?
23
+ # Hint: Maybe you use it in another way.
24
+ legal = 'true'
25
+
26
+ # If you have an own xfc brand (xfc is a fo processor for docx, odt and so on)
27
+ # you can place your path there
28
+ xfc_brand_dir = "/opt/XMLmind/xfc-xcom-stylesheet/xsl/fo/docbook.xsl"
29
+
30
+ # Set your prefered PDF-Viewer e.g. evince
31
+ pdfview = "/opt/cxoffice/bin/wine --bottle "PDF-XChange Viewer 2.x" --cx-app PDFXCview.exe"
32
+
33
+ # Private
34
+
35
+ # If you are using different brands for your homework and private you can place it there
36
+ # If you would like to use the publican brand just set brand_private = '' and brand_homework = ''
37
+ brand_private = 'manns'
38
+ brand_homework = 'ils'
39
+
40
+ # Define your standard directory for articles if you writing private
41
+ # Please set the directory without leading "/home/username"
42
+ articles_dir_priv = "Dokumente/Textdokumente/publican-manns/articles"
43
+
44
+ # If the option homework is given in the dialog the program
45
+ # uses this directory.
46
+ # Please set the directory without leading "/home/username"
47
+ homework_dir = "Dokumente/Textdokumente/publican-manns/articles/homework"
48
+
49
+ # Define there your books directory
50
+ # Please set the directory without leading "/home/username"
51
+ books_dir_priv = "Dokumente/Textdokumente/publican-manns/books"
52
+
53
+ # Work
54
+
55
+ # If choosen yes please tell the name as shown in /usr/share/publican/Common_Content
56
+ # Like XCOM for /usr/share/publican/Common_Content/XCOM or
57
+ # manns for /usr/share/publican/Common_Content/manns
58
+ # If you would like to use the publican brand just set brand = ''
59
+ brand = 'XCOM'
60
+ company_name = 'XCOM AG'
61
+ company_division = 'SWE7 (Sascha Bochartz)'
62
+ email_business = 'Sascha.Manns@xcom.de'
63
+
64
+ # System Variables
65
+ # If you are using a publican brand you can place there
66
+ # the full path to them
67
+ brand_dir = '/usr/share/publican/Common_Content/XCOM'
68
+
69
+ # If the brand has a global entities file you can place
70
+ # the path there. Please leave the #{brand_dir} because
71
+ # it will be handled by ruby later.
72
+ globalentities = "de-DE/entitiesxcom.ent"
73
+
74
+ # Define your standard directory for articles
75
+ # Please set the directory without leading "/home/username"
76
+ articles_dir = "Dokumente/Textdokumente/publican-documentation/articles/Projekte/GSBUHA/Dokumentation/"
77
+
78
+ # If the option Reports is given in the dialog the program
79
+ # uses this directory.
80
+ # Please set the directory without leading "/home/username"
81
+ reports_dir = "Dokumente/Textdokumente/publican-documentation/articles/Projekte/GSBUHA/Dokumentation/Reports"
82
+
83
+ # Define there your books directory
84
+ # Please set the directory without leading "/home/username"
85
+ books_dir = "Dokumente/Textdokumente/publican-documentation/books"
@@ -0,0 +1,233 @@
1
+ #!/usr/bin/env ruby
2
+ # @author Sascha Manns
3
+ # @abstract Main Class for PublicanCreators
4
+ #
5
+ # Copyright (C) 2015 Sascha Manns <samannsml@directbox.com>
6
+ # License: MIT
7
+
8
+ # Dependencies
9
+ require 'publican_creators/checker'
10
+ require 'publican_creators/get'
11
+ require 'publican_creators/change'
12
+ require 'publican_creators/export'
13
+ require 'publican_creators/prepare'
14
+ require 'publican_creators/notifier'
15
+ require 'fileutils'
16
+ require 'nokogiri'
17
+ require 'rainbow/ext/string'
18
+ require 'bundler/setup'
19
+ require 'manns_shared'
20
+
21
+ # Main Class of PublicanCreators
22
+ # @return [String] true or false
23
+ class PublicanCreators
24
+ # Versionizing
25
+ VERSION = '1.0.2'
26
+
27
+ my_name = File.basename($PROGRAM_NAME)
28
+
29
+ puts "Script: #{my_name}"
30
+ puts "Version: #{VERSION}"
31
+ puts
32
+ puts 'Copyright (C) 2015 Sascha Manns <samannsml@directbox.com>'
33
+ puts 'Description: This script creates a article or book set with'
34
+ puts 'Publican. Then it modifies it for your needs.'
35
+ puts 'License: GPL-3'
36
+ puts 'Bugs: Please file bugs on https://gitlab.com/saigkill/publican_creators/issues'
37
+
38
+ puts 'Reading the config file in publicancreators.cfg'
39
+ # @note Run config method who reads in the config file and puts the variables
40
+ # in an array
41
+ # name, email, language, use_brand, title_logo, legal, brand, company_name,
42
+ # company_division, email_business, brand_dir, glob_entities,
43
+ # articles_dir_business, reports_dir_business, books_dir_business,
44
+ # articles_dir_private, homework_dir_private, books_dir_private,
45
+ # brand_private, brand_homework, db5, conf_ver, xfc_brand_dir,
46
+ # pdfview = PublicanCreatorsGet.config
47
+
48
+ home = Dir.home
49
+ config = ParseConfig.new("#{home}/.publican_creators/publicancreators.cfg")
50
+ conf_ver = config['conf_ver']
51
+ name = config['name']
52
+ email = config['email_private']
53
+ language = config['language']
54
+ use_brand = config['use_brand']
55
+ title_logo = config['title_logo']
56
+ legal = config['legal']
57
+ brand = config['brand']
58
+ company_name = config['company_name']
59
+ company_division = config['company_division']
60
+ email_business = config['email_business']
61
+ brand_dir = config['brand_dir']
62
+ glob_entities = config['globalentities']
63
+ articles_dir_business = config['articles_dir']
64
+ reports_dir_business = config['reports_dir']
65
+ books_dir_business = config['books_dir']
66
+ articles_dir_private = config['articles_dir_priv']
67
+ homework_dir_private = config['homework_dir']
68
+ books_dir_private = config['books_dir_priv']
69
+ brand_private = config['brand_private']
70
+ brand_homework = config['brand_homework']
71
+ db5 = config['db5']
72
+ xfc_brand_dir = config['xfc_brand_dir']
73
+ pdfview = config['pdfview']
74
+
75
+ puts 'Your configuration is:'
76
+ puts "Your Name: #{name}"
77
+ puts "Your private emailaddress: #{email}"
78
+ puts "Your choosen language: #{language}"
79
+ puts "Using an own brand: #{use_brand}"
80
+ puts "Leave title_logo: #{title_logo}"
81
+ puts "Leave legalnotice in article: #{legal}"
82
+ puts "Choosen brand: #{brand}"
83
+ puts "Your company name: #{company_name}"
84
+ puts "Your company division: #{company_division}"
85
+ puts "Your business email address: #{email_business}"
86
+ puts "Your brand dir: #{brand_dir}"
87
+ puts "Your global entities: #{glob_entities}"
88
+ puts "Your business articles dir: #{articles_dir_business}"
89
+ puts "Your business reports dir: #{reports_dir_business}"
90
+ puts "Your business books dir: #{books_dir_business}"
91
+ puts "Your private articles dir: #{articles_dir_private}"
92
+ puts "Your homework dir: #{homework_dir_private}"
93
+ puts "Your private books dir: #{books_dir_private}"
94
+ puts "Your private brand: #{brand_private}"
95
+ puts "Your homework brand: #{brand_homework}"
96
+ puts "DocBook5 as default: #{db5}"
97
+ puts "Config version: #{conf_ver}"
98
+ puts "XFC brand dir: #{xfc_brand_dir}"
99
+ puts "Your prefered PDF-Viewer: #{pdfview}"
100
+
101
+ global_entities = "#{brand_dir}/#{glob_entities}"
102
+ puts "Your global entities file is there: #{global_entities}"
103
+
104
+ # @note Ask for the title and other settings via yad and put them into a array
105
+ environment, type, opt, title = PublicanCreatorsGet.title
106
+
107
+ puts "Environment: #{environment}"
108
+ puts "Type: #{type}"
109
+ puts "Optional: #{opt}"
110
+ puts "Title: #{title}"
111
+
112
+ # This method sets the default value for report
113
+ # @param [String] opt Can be Report or Homework or Normal
114
+ # @return [String] report
115
+
116
+ report = 'FALSE'
117
+ homework = 'FALSE'
118
+ report = 'TRUE' if opt == 'Report'
119
+ homework = 'TRUE' if opt == 'Homework'
120
+
121
+ # @note Hardcoded variables
122
+ artinfo = "#{title}/#{language}/Article_Info.xml"
123
+ bookinfo = "#{title}/#{language}/Book_Info.xml"
124
+ revhist = "#{title}/#{language}/Revision_History.xml"
125
+ agroup = "#{title}/#{language}/Author_Group.xml"
126
+ ent = "#{title}/#{language}/#{title}.ent"
127
+ builds = "#{title}/#{language}/Rakefile"
128
+
129
+ # @note Run one of the both methods to get the variable targetdir
130
+ # @param [String] type Book or Article
131
+ # @param [String] reports_dir_business path to that dir where you store your
132
+ # reports
133
+ # @param [String] articles_dir_business path to that dir where you store
134
+ # business articles
135
+ # @param [String] report true or false
136
+ # @param [String] books_dir_business path to that dir where you store your
137
+ # business books
138
+ # @param [String] true or false
139
+ # @param [String] articles_dir_private path to your private articles directory
140
+ # @param [String] homework path to your homework directory
141
+ # @param [String] books_dir_private path to your private books directory
142
+ targetdir = PublicanCreatorsPrepare.targetdir(environment, type, report,
143
+ reports_dir_business,
144
+ articles_dir_business,
145
+ books_dir_business, homework,
146
+ articles_dir_private,
147
+ homework_dir_private,
148
+ books_dir_private)
149
+
150
+ # @note Checks if the needed directory targetdir is available. Otherwise it
151
+ # creates one.
152
+ puts "Creating directory #{targetdir}"
153
+ # @param [String] targetdir comes from PublicanCreatorsPrepare.prepare_work or
154
+ # .prepare_private
155
+ MannsShared.check_dir(targetdir)
156
+
157
+ # @note Change to target directory
158
+ puts 'Change to this directory'
159
+ # @param [String] targetdir comes from PublicanCreatorsPrepare.prepare_work or
160
+ # .prepare_private
161
+ FileUtils.cd(targetdir) do
162
+ # @param [String] title comes from titleget[3]
163
+ # @param [String] type Book or Article
164
+ # @param [String] language comes from config file in format de-DE
165
+ # @param [String] brand e.g. Debian or nothing for using publicans default
166
+ # brand (config file)
167
+ # @param [String] db5 DocBook5 as default? (config file)
168
+ # @param [String] homework true or false
169
+ # @param [String] brand_homework e.g. ils (config file)
170
+ # @param [String] brand_private e.g. manns (config file)
171
+ PublicanCreatorsChange.check_environment(environment, title, type, language,
172
+ brand, db5, homework,
173
+ brand_homework, brand_private)
174
+
175
+ # @param [String] title comes from titleget[3]
176
+ # @param [String] environment Work or Private
177
+ # @param [String] global_entities path to a global entities file
178
+ # (config file)
179
+ # @param [String] brand e.g. Debian or nothing for using publicans default
180
+ # brand (config file)
181
+ PublicanCreatorsChange.add_entity(environment, global_entities, ent)
182
+
183
+ # @param [String] title comes from titleget[3]
184
+ # @param [String] environment Work or Private
185
+ # @param [String] name your name (config file)
186
+ # @param [String] company_name (config file)
187
+ PublicanCreatorsChange.change_holder(title, environment, name, company_name,
188
+ ent)
189
+
190
+ # @param [String] title comes from titleget[3]
191
+ # @param [String] environment Work or Private
192
+ # @param [String] type Book or Article
193
+ # @param [String] legal remove legalnotice from article? (config file)
194
+ PublicanCreatorsChange.remove_legal(environment, type, legal, artinfo)
195
+
196
+ # @param [String] artinfo path to Article_Info (hardcoded)
197
+ # @param [String] bookinfo path to Book_Info (hardcoded)
198
+ # @param [String] title_logo remove titlelogo from articlepage (config file)
199
+ # @param [String] type Book or Article
200
+ PublicanCreatorsChange.remove_orgname_prepare(bookinfo, artinfo, title_logo,
201
+ type)
202
+
203
+ # @param [String] environment Work or Private
204
+ # @param [String] name your name (config file)
205
+ # @param [String] email_business business email address (config file)
206
+ # @param [String] title comes from titleget[3]
207
+ PublicanCreatorsChange.fix_revhist(environment, name, email_business, email,
208
+ revhist)
209
+
210
+ # @param [String] title comes from titleget[3]
211
+ # @param [String] name your name (config file)
212
+ # @param [String] email_business business email address (config file)
213
+ # @param [String] company_name your company's name (config file)
214
+ # @param [String] company_division your companiy's division
215
+ # @param [String] email your private email address
216
+ PublicanCreatorsChange.fix_authorgroup(name, email_business, company_name,
217
+ company_division, email, environment,
218
+ agroup)
219
+
220
+ # @param [String] title comes from titleget[3]
221
+ # @param [String] builds path to buildscript (hardcoded)
222
+ # @param [String] language comes from config file in format de-DE
223
+ # @param [String] xfc_brand_dir if present the path to your branded xfc
224
+ # stylesheets (config file)
225
+ # @param [String] pdfview your prefered PDF-Viewer (config file)
226
+ PublicanCreatorsExport.export_buildscript(title, builds, language,
227
+ xfc_brand_dir, pdfview)
228
+
229
+ puts "Now you can find your documentation there: #{targetdir}/#{title}"
230
+ Notifier.run
231
+ puts "Thanks for using: #{my_name} #{version}"
232
+ end
233
+ end