asker-tool 2.1.6 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/{LICENSE.txt → LICENSE} +0 -0
  3. data/README.md +14 -15
  4. data/bin/asker +1 -1
  5. data/lib/asker/ai/ai.rb +6 -3
  6. data/lib/asker/ai/ai_calculate.rb +20 -6
  7. data/lib/asker/ai/concept_ai.rb +12 -3
  8. data/lib/asker/ai/question.rb +28 -6
  9. data/lib/asker/ai/stages/base_stage.rb +45 -6
  10. data/lib/asker/ai/stages/stage_b.rb +90 -49
  11. data/lib/asker/ai/stages/stage_d.rb +69 -90
  12. data/lib/asker/ai/stages/stage_f.rb +47 -38
  13. data/lib/asker/ai/stages/stage_i.rb +79 -92
  14. data/lib/asker/ai/stages/stage_s.rb +41 -36
  15. data/lib/asker/ai/stages/stage_t.rb +114 -73
  16. data/lib/asker/application.rb +7 -15
  17. data/lib/asker/check_input/input_data.rb +358 -0
  18. data/lib/asker/check_input.rb +51 -0
  19. data/lib/asker/cli.rb +28 -28
  20. data/lib/asker/data/code.rb +5 -16
  21. data/lib/asker/data/concept.rb +71 -24
  22. data/lib/asker/data/project_data.rb +63 -0
  23. data/lib/asker/data/table.rb +2 -0
  24. data/lib/asker/data/template.rb +3 -1
  25. data/lib/asker/data/world.rb +8 -16
  26. data/lib/asker/displayer/code_displayer.rb +7 -0
  27. data/lib/asker/displayer/concept_ai_displayer.erb +10 -0
  28. data/lib/asker/displayer/concept_ai_displayer.rb +24 -22
  29. data/lib/asker/displayer/concept_displayer.rb +9 -4
  30. data/lib/asker/displayer/stats_displayer.rb +8 -0
  31. data/lib/asker/exporter/concept_ai_gift_exporter.rb +16 -10
  32. data/lib/asker/exporter/concept_ai_moodle_exporter.rb +44 -0
  33. data/lib/asker/exporter/concept_ai_yaml_exporter.rb +6 -3
  34. data/lib/asker/exporter/concept_doc_exporter.rb +14 -1
  35. data/lib/asker/exporter/data_gift_exporter.rb +29 -0
  36. data/lib/asker/exporter/output_file_exporter.rb +9 -6
  37. data/lib/asker/files/{config.ini → asker.ini} +14 -4
  38. data/lib/asker/files/language/du/connectors.yaml +81 -0
  39. data/lib/asker/files/language/du/mistakes.yaml +82 -0
  40. data/lib/asker/files/language/du/templates.yaml +28 -49
  41. data/lib/asker/files/language/en/templates.yaml +19 -19
  42. data/lib/asker/files/language/es/mistakes.yaml +9 -7
  43. data/lib/asker/files/language/es/templates.yaml +19 -19
  44. data/lib/asker/files/language/fr/connectors.yaml +68 -84
  45. data/lib/asker/files/language/fr/templates.yaml +22 -22
  46. data/lib/asker/formatter/concept_doc_formatter.rb +0 -4
  47. data/lib/asker/formatter/concept_string_formatter.rb +7 -4
  48. data/lib/asker/formatter/moodle/matching.erb +38 -0
  49. data/lib/asker/formatter/moodle/multichoice.erb +49 -0
  50. data/lib/asker/formatter/moodle/shortanswer.erb +30 -0
  51. data/lib/asker/formatter/moodle/truefalse.erb +47 -0
  52. data/lib/asker/formatter/question_gift_formatter.rb +30 -20
  53. data/lib/asker/formatter/question_moodle_formatter.rb +27 -0
  54. data/lib/asker/lang/lang_factory.rb +7 -1
  55. data/lib/asker/loader/code_loader.rb +1 -1
  56. data/lib/asker/loader/content_loader.rb +12 -14
  57. data/lib/asker/loader/directory_loader.rb +1 -8
  58. data/lib/asker/loader/embedded_file.rb +42 -0
  59. data/lib/asker/loader/file_loader.rb +1 -3
  60. data/lib/asker/loader/image_url_loader.rb +8 -9
  61. data/lib/asker/loader/input_loader.rb +5 -6
  62. data/lib/asker/loader/project_loader.rb +18 -10
  63. data/lib/asker/logger.rb +35 -8
  64. data/lib/asker/skeleton.rb +3 -2
  65. data/lib/asker.rb +72 -43
  66. metadata +43 -17
  67. data/lib/asker/checker.rb +0 -455
  68. data/lib/asker/project.rb +0 -146
data/lib/asker/checker.rb DELETED
@@ -1,455 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rainbow'
4
-
5
- ##
6
- # Check HAML file syntax
7
- module Checker
8
- ##
9
- # Check:
10
- # * file exist
11
- # * filename extension
12
- # * and HAML syntax
13
- # @param filepath (String)
14
- def self.check(filepath)
15
- unless File.exist? filepath
16
- puts Rainbow('File not found!').red.bright
17
- return false
18
- end
19
- unless File.extname(filepath) == '.haml'
20
- puts Rainbow('Only check HAML files!').yellow.bright
21
- return false
22
- end
23
- check_filepath(filepath)
24
- end
25
-
26
- ##
27
- # Check HAML syntax
28
- # @param filepath (String)
29
- def self.check_filepath(filepath)
30
- data = Data.new(filepath)
31
- data.check
32
- data.show_errors
33
- data.ok?
34
- end
35
-
36
- ##
37
- # Internal class that revise syntax
38
- # rubocop:disable Metrics/ClassLength
39
- class Data
40
- attr_reader :inputs
41
- attr_reader :outputs
42
-
43
- # rubocop:disable Metrics/MethodLength
44
- def initialize(filepath)
45
- @inputs = File.read(filepath).split("\n")
46
- @outputs = []
47
- @inputs.each_with_index do |line, index|
48
- output = { id: index,
49
- level: 0,
50
- state: :none,
51
- type: :none,
52
- source: line,
53
- msg: '' }
54
- @outputs << output
55
- end
56
- @ok = false
57
- end
58
- # rubocop:enable Metrics/MethodLength
59
-
60
- def ok?
61
- @ok
62
- end
63
-
64
- def show
65
- @outputs.each do |i|
66
- puts "#{i[:id]}: #{i[:state]} [#{i[:type]}] #{i[:msg]}"
67
- end
68
- end
69
-
70
- # rubocop:disable Metrics/AbcSize
71
- # rubocop:disable Metrics/MethodLength
72
- def show_errors
73
- errors = 0
74
- # puts "Line : Error description"
75
- @outputs.each do |i|
76
- next if i[:state] == :ok
77
-
78
- errors += 1
79
- if errors < 11
80
- data = { id: i[:id], msg: i[:msg], source: i[:source][0, 40] }
81
- puts format(' %<id>03d : %<msg>s. => %<source>s', data)
82
- end
83
- puts '...' if errors == 11
84
- end
85
-
86
- if errors.positive?
87
- puts Rainbow("[ERROR] #{errors} errors " \
88
- "from #{@inputs.size} lines!").red.bright
89
- end
90
- puts Rainbow('Syntax OK!').green if errors.zero?
91
- end
92
- # rubocop:enable Metrics/AbcSize
93
- # rubocop:enable Metrics/MethodLength
94
-
95
- # rubocop:disable Metrics/MethodLength
96
- # rubocop:disable Metrics/AbcSize
97
- def check
98
- @ok = true
99
- @inputs.each_with_index do |line, index|
100
- check_empty_lines(line, index)
101
- check_map(line, index)
102
- check_concept(line, index)
103
- check_names(line, index)
104
- check_tags(line, index)
105
- check_def(line, index)
106
- check_table(line, index)
107
- check_row(line, index)
108
- check_col(line, index)
109
- check_template(line, index)
110
- check_code(line, index)
111
- check_type(line, index)
112
- check_path(line, index)
113
- check_features(line, index)
114
- check_unknown(line, index)
115
- @ok = false unless @outputs[index][:state] == :ok
116
- @ok = false if @outputs[index][:type] == :unkown
117
- end
118
- @ok
119
- end
120
- # rubocop:enable Metrics/MethodLength
121
- # rubocop:enable Metrics/AbcSize
122
-
123
- private
124
-
125
- def check_empty_lines(line, index)
126
- return unless line.strip.size.zero? || line.start_with?('#')
127
-
128
- @outputs[index][:type] = :empty
129
- @outputs[index][:level] = -1
130
- @outputs[index][:state] = :ok
131
- end
132
-
133
- # rubocop:disable Metrics/MethodLength
134
- def check_map(line, index)
135
- if index.zero?
136
- @outputs[index][:type] = :map
137
- if line.start_with?('%map{')
138
- @outputs[index][:state] = :ok
139
- else
140
- @outputs[index][:state] = :err
141
- @outputs[index][:msg] = 'Start with %map{'
142
- end
143
- elsif index.positive? && line.include?('%map{')
144
- @outputs[index][:state] = :err
145
- @outputs[index][:type] = :map
146
- @outputs[index][:msg] = 'Write %map on line 0'
147
- end
148
- end
149
- # rubocop:enable Metrics/MethodLength
150
-
151
- # rubocop:disable Metrics/MethodLength
152
- def check_concept(line, index)
153
- return unless @outputs[index][:state] == :none
154
- return unless line.include? '%concept'
155
-
156
- @outputs[index][:type] = :concept
157
- @outputs[index][:level] = 1
158
- @outputs[index][:state] = :ok
159
- if find_parent(index) != :map
160
- @outputs[index][:state] = :err
161
- @outputs[index][:msg] = 'Parent(map) not found!'
162
- elsif line != ' %concept'
163
- @outputs[index][:state] = :err
164
- @outputs[index][:msg] = 'Write 2 spaces before %concept'
165
- end
166
- end
167
- # rubocop:enable Metrics/MethodLength
168
-
169
- # rubocop:disable Metrics/AbcSize
170
- # rubocop:disable Metrics/MethodLength
171
- def check_names(line, index)
172
- return unless @outputs[index][:state] == :none
173
- return unless line.include? '%names'
174
-
175
- @outputs[index][:type] = :names
176
- @outputs[index][:level] = 2
177
- @outputs[index][:state] = :ok
178
- if find_parent(index) != :concept
179
- @outputs[index][:state] = :err
180
- @outputs[index][:msg] = 'Parent(concept) not found!'
181
- elsif !line.start_with? ' %names'
182
- @outputs[index][:state] = :err
183
- @outputs[index][:msg] = 'Write 4 spaces before %names'
184
- end
185
- end
186
- # rubocop:enable Metrics/AbcSize
187
- # rubocop:enable Metrics/MethodLength
188
-
189
- # rubocop:disable Metrics/AbcSize
190
- # rubocop:disable Metrics/MethodLength
191
- def check_tags(line, index)
192
- return unless @outputs[index][:state] == :none
193
- return unless line.include? '%tags'
194
-
195
- @outputs[index][:type] = :tags
196
- @outputs[index][:level] = 2
197
- @outputs[index][:state] = :ok
198
- if find_parent(index) != :concept
199
- @outputs[index][:state] = :err
200
- @outputs[index][:msg] = 'Parent(concept) not found!'
201
- elsif !line.start_with? ' %tags'
202
- @outputs[index][:state] = :err
203
- @outputs[index][:msg] = 'Write 4 spaces before %tags'
204
- end
205
- end
206
- # rubocop:enable Metrics/AbcSize
207
- # rubocop:enable Metrics/MethodLength
208
-
209
- # rubocop:disable Metrics/AbcSize
210
- # rubocop:disable Metrics/MethodLength
211
- def check_def(line, index)
212
- return unless @outputs[index][:state] == :none
213
- return unless line.include? '%def'
214
-
215
- @outputs[index][:type] = :def
216
- @outputs[index][:level] = 2
217
- @outputs[index][:state] = :ok
218
- if find_parent(index) != :concept
219
- @outputs[index][:state] = :err
220
- @outputs[index][:msg] = 'Parent(concept) not found!'
221
- elsif !line.start_with? ' %def'
222
- @outputs[index][:state] = :err
223
- @outputs[index][:msg] = 'Write 4 spaces before %def'
224
- end
225
- end
226
- # rubocop:enable Metrics/AbcSize
227
- # rubocop:enable Metrics/MethodLength
228
-
229
- # rubocop:disable Metrics/AbcSize
230
- # rubocop:disable Metrics/MethodLength
231
- def check_table(line, index)
232
- return unless @outputs[index][:state] == :none
233
- return unless line.include? '%table'
234
-
235
- @outputs[index][:type] = :table
236
- @outputs[index][:level] = 2
237
- @outputs[index][:state] = :ok
238
- if find_parent(index) != :concept
239
- @outputs[index][:state] = :err
240
- @outputs[index][:msg] = 'Parent(concept) not found!'
241
- elsif !line.start_with? ' %table'
242
- @outputs[index][:state] = :err
243
- @outputs[index][:msg] = 'Write 4 spaces before %table'
244
- end
245
- end
246
- # rubocop:enable Metrics/AbcSize
247
- # rubocop:enable Metrics/MethodLength
248
-
249
- # rubocop:disable Metrics/AbcSize
250
- # rubocop:disable Metrics/CyclomaticComplexity
251
- # rubocop:disable Metrics/MethodLength
252
- # rubocop:disable Metrics/PerceivedComplexity
253
- def check_row(line, index)
254
- return unless @outputs[index][:state] == :none
255
- return unless line.include? '%row'
256
-
257
- @outputs[index][:type] = :row
258
- @outputs[index][:state] = :ok
259
-
260
- if count_spaces(line) == 6
261
- @outputs[index][:level] = 3
262
- parent = find_parent(index)
263
- unless %i[table features].include? parent
264
- @outputs[index][:state] = :err
265
- @outputs[index][:msg] = 'Parent(table/features) not found!'
266
- end
267
- elsif count_spaces(line) == 8
268
- @outputs[index][:level] = 4
269
- if find_parent(index) != :template
270
- @outputs[index][:state] = :err
271
- @outputs[index][:msg] = 'Parent(template) not found!'
272
- end
273
- else
274
- @outputs[index][:state] = :err
275
- @outputs[index][:msg] = 'Write 6 or 8 spaces before %row'
276
- end
277
- end
278
- # rubocop:enable Metrics/AbcSize
279
- # rubocop:enable Metrics/CyclomaticComplexity
280
- # rubocop:enable Metrics/MethodLength
281
- # rubocop:enable Metrics/PerceivedComplexity
282
-
283
- # rubocop:disable Metrics/AbcSize
284
- # rubocop:disable Metrics/CyclomaticComplexity
285
- # rubocop:disable Metrics/MethodLength
286
- # rubocop:disable Metrics/PerceivedComplexity
287
- def check_col(line, index)
288
- return unless @outputs[index][:state] == :none
289
- return unless line.include? '%col'
290
-
291
- @outputs[index][:type] = :col
292
- @outputs[index][:state] = :ok
293
- if count_spaces(line) == 8
294
- @outputs[index][:level] = 4
295
- if find_parent(index) != :row
296
- @outputs[index][:state] = :err
297
- @outputs[index][:msg] = 'Parent(row) not found!'
298
- end
299
- elsif count_spaces(line) == 10
300
- @outputs[index][:level] = 5
301
- if find_parent(index) != :row
302
- @outputs[index][:state] = :err
303
- @outputs[index][:msg] = 'Parent(row) not found!'
304
- end
305
- else
306
- @outputs[index][:state] = :err
307
- @outputs[index][:msg] = 'Write 8 or 10 spaces before %col'
308
- end
309
- check_text(line, index)
310
- end
311
- # rubocop:enable Metrics/AbcSize
312
- # rubocop:enable Metrics/CyclomaticComplexity
313
- # rubocop:enable Metrics/MethodLength
314
- # rubocop:enable Metrics/PerceivedComplexity
315
-
316
- def check_text(line, index)
317
- return unless @outputs[index][:state] == :ok
318
-
319
- ok = ''
320
- %w[< >].each do |char|
321
- ok = char if line.include? char
322
- end
323
- return if ok == ''
324
-
325
- @outputs[index][:state] = :err
326
- @outputs[index][:msg] = "Char #{ok} not allow!"
327
- end
328
-
329
- # rubocop:disable Metrics/MethodLength
330
- # rubocop:disable Metrics/AbcSize
331
- def check_template(line, index)
332
- return unless @outputs[index][:state] == :none
333
- return unless line.include? '%template'
334
-
335
- @outputs[index][:type] = :template
336
- @outputs[index][:level] = 3
337
- @outputs[index][:state] = :ok
338
- if find_parent(index) != :table
339
- @outputs[index][:state] = :err
340
- @outputs[index][:msg] = 'Parent(concept) not found!'
341
- elsif !line.start_with? ' %template'
342
- @outputs[index][:state] = :err
343
- @outputs[index][:msg] = 'Write 6 spaces before %template'
344
- end
345
- end
346
- # rubocop:enable Metrics/AbcSize
347
- # rubocop:enable Metrics/MethodLength
348
-
349
- # rubocop:disable Metrics/MethodLength
350
- def check_code(line, index)
351
- return unless @outputs[index][:state] == :none
352
- return unless line.include? '%code'
353
-
354
- @outputs[index][:type] = :code
355
- @outputs[index][:level] = 1
356
- @outputs[index][:state] = :ok
357
- if find_parent(index) != :map
358
- @outputs[index][:state] = :err
359
- @outputs[index][:msg] = 'Parent(map) not found!'
360
- elsif line != ' %code'
361
- @outputs[index][:state] = :err
362
- @outputs[index][:msg] = 'Write 2 spaces before %code'
363
- end
364
- end
365
- # rubocop:enable Metrics/MethodLength
366
-
367
- # rubocop:disable Metrics/MethodLength
368
- # rubocop:disable Metrics/AbcSize
369
- def check_type(line, index)
370
- return unless @outputs[index][:state] == :none
371
- return unless line.include? '%type'
372
-
373
- @outputs[index][:type] = :type
374
- @outputs[index][:level] = 2
375
- @outputs[index][:state] = :ok
376
- if find_parent(index) != :code
377
- @outputs[index][:state] = :err
378
- @outputs[index][:msg] = 'Parent(code) not found!'
379
- elsif !line.start_with? ' %type'
380
- @outputs[index][:state] = :err
381
- @outputs[index][:msg] = 'Write 4 spaces before %type'
382
- end
383
- end
384
- # rubocop:enable Metrics/AbcSize
385
- # rubocop:enable Metrics/MethodLength
386
-
387
- # rubocop:disable Metrics/MethodLength
388
- # rubocop:disable Metrics/AbcSize
389
- def check_path(line, index)
390
- return unless @outputs[index][:state] == :none
391
- return unless line.include? '%path'
392
-
393
- @outputs[index][:type] = :path
394
- @outputs[index][:level] = 2
395
- @outputs[index][:state] = :ok
396
- if find_parent(index) != :code
397
- @outputs[index][:state] = :err
398
- @outputs[index][:msg] = 'Parent(code) not found!'
399
- elsif !line.start_with? ' %path'
400
- @outputs[index][:state] = :err
401
- @outputs[index][:msg] = 'Write 4 spaces before %type'
402
- end
403
- end
404
- # rubocop:enable Metrics/AbcSize
405
- # rubocop:enable Metrics/MethodLength
406
-
407
- # rubocop:disable Metrics/MethodLength
408
- # rubocop:disable Metrics/AbcSize
409
- def check_features(line, index)
410
- return unless @outputs[index][:state] == :none
411
- return unless line.include? '%features'
412
-
413
- @outputs[index][:type] = :features
414
- @outputs[index][:level] = 2
415
- @outputs[index][:state] = :ok
416
- if find_parent(index) != :code
417
- @outputs[index][:state] = :err
418
- @outputs[index][:msg] = 'Parent(code) not found!'
419
- elsif !line.start_with? ' %features'
420
- @outputs[index][:state] = :err
421
- @outputs[index][:msg] = 'Write 4 spaces before %features'
422
- end
423
- end
424
- # rubocop:enable Metrics/AbcSize
425
- # rubocop:enable Metrics/MethodLength
426
-
427
- def check_unknown(line, index)
428
- return unless @outputs[index][:state] == :none
429
-
430
- @outputs[index][:type] = :unknown
431
- @outputs[index][:level] = count_spaces(line) / 2
432
- @outputs[index][:state] = :err
433
- @outputs[index][:msg] = "Unknown tag with parent(#{find_parent(index)})!"
434
- end
435
-
436
- def find_parent(index)
437
- current_level = @outputs[index][:level]
438
- return :noparent if current_level.zero?
439
-
440
- i = index - 1
441
- while i >= 0
442
- return @outputs[i][:type] if @outputs[i][:level] == current_level - 1
443
-
444
- i -= 1
445
- end
446
- :noparent
447
- end
448
-
449
- def count_spaces(line)
450
- a = line.split('%')
451
- a[0].count(' ')
452
- end
453
- end
454
- # rubocop:enable Metrics/ClassLength
455
- end
data/lib/asker/project.rb DELETED
@@ -1,146 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'singleton'
4
- require 'rainbow'
5
- # require 'fileutils'
6
- require_relative 'application'
7
- require_relative 'logger'
8
-
9
- # Contains Project data and methods
10
- class Project
11
- include Singleton
12
- attr_reader :default, :param
13
-
14
- ##
15
- # Initialize
16
- def initialize
17
- reset
18
- end
19
-
20
- ##
21
- # Reset project params
22
- def reset
23
- @default = { inputbasedir: FileUtils.pwd,
24
- stages: { d: true, b: true, f: true, i: true, s: true, t: true },
25
- threshold: 0.5 }
26
- @param = {}
27
- end
28
-
29
- ##
30
- # Get value param
31
- # @param key (Symbol) key
32
- def get(key)
33
- return @param[key] unless @param[key].nil?
34
-
35
- @default[key]
36
- end
37
-
38
- ##
39
- # Set value param
40
- # @param key (Symbol) key
41
- # @param value (String) value
42
- def set(key, value)
43
- @param[key] = value
44
- end
45
-
46
- ##
47
- # Open new project
48
- # * setting new params and
49
- # * creating output files
50
- # IMPORTANT: We need at least theses values
51
- # * process_file
52
- # * inputdirs
53
- def open
54
- config = Application.instance.config
55
- ext = File.extname(@param[:process_file]) || '.haml'
56
- #@param[:process_file] = @param[:process_file] ||
57
- # get(:projectdir).split(File::SEPARATOR).last + ext
58
- @param[:projectname] = @param[:projectname] ||
59
- File.basename(@param[:process_file], ext)
60
- #@param[:inputdirs] = @param[:inputdirs] ||
61
- # File.join(get(:inputbasedir), @param[:projectdir])
62
-
63
- @param[:logname] = "#{@param[:projectname]}-log.txt"
64
- @param[:outputname] = "#{@param[:projectname]}-gift.txt"
65
- @param[:lessonname] = "#{@param[:projectname]}-doc.txt"
66
- @param[:yamlname] = "#{@param[:projectname]}.yaml"
67
-
68
- outputdir = config['global']['outputdir']
69
- @param[:logpath] = File.join(outputdir, get(:logname))
70
- @param[:outputpath] = File.join(outputdir, get(:outputname))
71
- @param[:lessonpath] = File.join(outputdir, get(:lessonname))
72
- @param[:yamlpath] = File.join(outputdir, get(:yamlname))
73
-
74
- Dir.mkdir(outputdir) unless Dir.exist?(outputdir)
75
- create_log_file
76
- create_output_file
77
- create_lesson_file
78
- create_yaml_file
79
- end
80
-
81
- ##
82
- # Close output files
83
- def close
84
- get(:logfile).close
85
- get(:outputfile).close
86
- get(:lessonfile).close
87
- get(:yamlfile).close
88
- end
89
-
90
- def method_missing(method, *_args, &_block)
91
- get(method)
92
- end
93
-
94
- private
95
-
96
- # create or reset logfile
97
- def create_log_file
98
- @param[:logfile] = File.open(get(:logpath), 'w')
99
- f = get(:logfile)
100
- f.write('=' * 50 + "\n")
101
- f.write("Created by : #{Application::NAME}")
102
- f.write(" (version #{Application::VERSION})\n")
103
- f.write("File : #{get(:logname)}\n")
104
- f.write("Time : #{Time.new}\n")
105
- f.write("Author : David Vargas Ruiz\n")
106
- f.write('=' * 50 + "\n\n")
107
-
108
- Logger.verbose '[INFO] Project open'
109
- Logger.verbose ' ├── inputdirs = ' + Rainbow(get(:inputdirs)).bright
110
- Logger.verbose ' └── process_file = ' + Rainbow(get(:process_file)).bright
111
- end
112
-
113
- # Create or reset output file
114
- def create_output_file
115
- config = Application.instance.config
116
- @param[:outputfile] = File.open(get(:outputpath), 'w')
117
- f = get(:outputfile)
118
- f.write('// ' + ('=' * 50) + "\n")
119
- f.write("// Created by : #{Application::NAME}")
120
- f.write(" (version #{Application::VERSION})\n")
121
- f.write("// File : #{get(:outputname)}\n")
122
- f.write("// Time : #{Time.new}\n")
123
- f.write("// Author : David Vargas Ruiz\n")
124
- f.write('// ' + ('=' * 50) + "\n\n")
125
- category = config['questions']['category']
126
- f.write("$CATEGORY: $course$/#{category}\n") unless category.nil?
127
- end
128
-
129
- # Create or reset lesson file
130
- def create_lesson_file
131
- @param[:lessonfile] = File.new(get(:lessonpath), 'w')
132
- f = get(:lessonfile)
133
- f.write('=' * 50 + "\n")
134
- f.write("Created by : #{Application::NAME}")
135
- f.write(" (version #{Application::VERSION})\n")
136
- f.write("File : #{get(:lessonname)}\n")
137
- f.write("Time : #{Time.new}\n")
138
- f.write("Author : David Vargas Ruiz\n")
139
- f.write('=' * 50 + "\n")
140
- end
141
-
142
- # Create or reset yaml file
143
- def create_yaml_file
144
- @param[:yamlfile] = File.open(get(:yamlpath), 'w')
145
- end
146
- end