Class: ReVIEW::Update

Inherits:
Object show all
Defined in:
lib/review/update.rb

Constant Summary collapse

TARGET_VERSION =

should be

'5.0'
EPUB_VERSION =
'3'
HTML_VERSION =
'5'
TEX_DOCUMENTCLASS =
['review-jsbook', 'review-jlreq']
TEX_DOCUMENTCLASS_BAD =
['jsbook', nil]
TEX_DOCUMENTCLASS_OPTS =
'media=print,paper=a5'
TEX_COMMAND =
'uplatex'
TEX_OPTIONS =
'-interaction=nonstopmode -file-line-error -halt-on-error'
DVI_COMMAND =
'dvipdfmx'
DVI_OPTIONS =
'-d 5 -z 9'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUpdate

Returns a new instance of Update.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/review/update.rb', line 37

def initialize
  @template = '__DEFAULT__'
  @specified_template = nil
  @force = nil
  @logger = ReVIEW.logger
  @review_dir = File.dirname(File.expand_path('..', __dir__))
  @config_ymls = []
  @locale_ymls = []
  @catalog_ymls = []
  @tex_ymls = []
  @epub_ymls = []

  @backup = true
end

Instance Attribute Details

#catalog_ymlsObject (readonly)

Returns the value of attribute catalog_ymls.



34
35
36
# File 'lib/review/update.rb', line 34

def catalog_ymls
  @catalog_ymls
end

#config_ymlsObject (readonly)

Returns the value of attribute config_ymls.



34
35
36
# File 'lib/review/update.rb', line 34

def config_ymls
  @config_ymls
end

#epub_ymlsObject (readonly)

Returns the value of attribute epub_ymls.



34
35
36
# File 'lib/review/update.rb', line 34

def epub_ymls
  @epub_ymls
end

#forceObject

Returns the value of attribute force.



35
36
37
# File 'lib/review/update.rb', line 35

def force
  @force
end

#locale_ymlsObject (readonly)

Returns the value of attribute locale_ymls.



34
35
36
# File 'lib/review/update.rb', line 34

def locale_ymls
  @locale_ymls
end

#specified_templateObject

Returns the value of attribute specified_template.



35
36
37
# File 'lib/review/update.rb', line 35

def specified_template
  @specified_template
end

#tex_ymlsObject (readonly)

Returns the value of attribute tex_ymls.



34
35
36
# File 'lib/review/update.rb', line 34

def tex_ymls
  @tex_ymls
end

Class Method Details

.execute(*args) ⇒ Object



18
19
20
# File 'lib/review/update.rb', line 18

def self.execute(*args)
  new.execute(*args)
end

Instance Method Details

#check_old_catalogs(dir) ⇒ Object



208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/review/update.rb', line 208

def check_old_catalogs(dir)
  files = Dir.glob(File.join(dir, '*')).map do |fname|
    if %w[PREDEF CHAPS POSTDEF PART].include?(File.basename(fname))
      File.basename(fname)
    else
      return nil
    end
  end.compact

  unless files.empty?
    @logger.error t("!! %s file(s) is obsoleted. Run 'review-catalog-converter' to convert to 'catalog.yml' and remove old files. Aborted. !!", files.join(', '))
    raise ApplicationError
  end
end

#check_own_files(dir) ⇒ Object



227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/review/update.rb', line 227

def check_own_files(dir)
  if File.exist?(File.join(dir, 'layouts/layout.tex.erb'))
    # rubocop:disable Style/SoleNestedConditional
    unless confirm('** There is custom layouts/layout.tex.erb file. Updating may break to make PDF until you fix layout.tex.erb. Do you really proceed to update? **', [], nil)
      raise ApplicationError
    end
    # rubocop:enable Style/SoleNestedConditional
  end

  if File.exist?(File.join(dir, 'review-ext.rb'))
    @logger.info t('** There is review-ext.rb file. You need to update it by yourself. **')
  end
end

#confirm(message, args = [], default = true) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/review/update.rb', line 95

def confirm(message, args = [], default = true)
  if @force
    @logger.info t(message, args)
    if default
      @logger.info ' yes'
      return true
    else
      @logger.info 'no'
      return nil
    end
  end

  loop do
    print t(message, args)
    if default
      print ' [y]/n '
    else
      print ' y/[n] '
    end
    case gets.chomp.downcase
    when 'yes', 'y'
      return true
    when 'no', 'n'
      return nil
    when ''
      return default
    end
  end
end

#convert_documentclass_opts(yml, cls, prev_opts) ⇒ Object



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/review/update.rb', line 413

def convert_documentclass_opts(yml, cls, prev_opts)
  # XXX: at this time, review-jsbook and review-jlreq uses same parameters
  opts = []
  flag = true
  case cls
  when 'review-jsbook' # at this time, it ignores keyval
    prev_opts.split(/\s*,\s*/).each do |v|
      case v
      when 'a4j', 'a5j', 'b4j', 'b5j', 'a3paper', 'a4paper', 'a5paper', 'a6paper', 'b4paper', 'b5paper', 'b6paper', 'letterpaper', 'legalpaper', 'executivepaper'
        opts << "paper=#{v.sub('j', '').sub('paper', '')}"
      when /[\d.]+ptj/ # not cared...
        opts << "fontsize=#{v.sub('j', '')}"
      when /[\d.]+pt/, /[\d.]+Q/
        opts << "fontsize=#{v}"
      when 'landscape', 'oneside', 'twoside', 'vartwoside', 'onecolumn',
           'twocolumn', 'titlepage', 'notitlepage', 'openright',
           'openany', 'leqno', 'fleqn', 'disablejfam', 'draft', 'final',
           'mingoth', 'winjis', 'jis', 'papersize', 'english', 'report',
           'jslogo', 'nojslogo'
        # pass-through
        opts << v
      when 'uplatex', 'nomag', 'usemag', 'nomag*', 'tombow', 'tombo', 'mentuke', 'autodetect-engine'
        # can be ignored
        next
      else
        flag = nil
      end
    end
    opts << 'media=print'
    opts << 'cover=false'
  when 'review-jlreq'
    # at this time, only think about jsbook->jlreq
    prev_opts.split(/\s*,\s*/).each do |v|
      case v
      when 'a4j', 'a5j', 'b4j', 'b5j', 'a3paper', 'a4paper', 'a5paper', 'a6paper', 'b4paper', 'b5paper', 'b6paper', 'letterpaper', 'legalpaper', 'executivepaper'
        opts << "paper=#{v.sub('j', '').sub('paper', '')}"
      when /[\d.]+ptj/ # not cared...
        opts << "fontsize=#{v.sub('j', '')}"
      when /[\d.]+pt/, /[\d.]+Q/
        opts << "fontsize=#{v}"
      when 'landscape', 'oneside', 'twoside', 'onecolumn', 'twocolumn', 'titlepage', 'notitlepage', 'openright', 'openany', 'leqno', 'fleqn', 'draft', 'final', 'report'
        # pass-through
        opts << v
      when 'uplatex', 'nomag', 'usemag', 'nomag*', 'tombow', 'tombo', 'mentuke', 'autodetect-engine'
        # can be ignored
        next
      else
        # 'vartwoside', 'disablejfam', 'mingoth', 'winjis', 'jis', 'papersize', 'english', 'jslogo', 'nojslogo'
        flag = nil
      end
    end
    opts << 'media=print'
    opts << 'cover=false'
  else
    flag = nil
    @logger.error t("%s: ** '%s' is unknown class. Ignored. **", [File.basename(yml), cls])
  end
  return flag, opts.join(',')
end

#execute(*args) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/review/update.rb', line 52

def execute(*args)
  parse_options(args)
  dir = Dir.pwd

  parse_ymls(dir)
  check_old_catalogs(dir)

  show_version

  if @config_ymls.empty?
    @logger.error t("!! No *.yml file with 'review_version' was found. Aborted. !!")
    raise ApplicationError
  end

  check_own_files(dir)
  update_version
  update_rakefile(dir)
  update_epub_version
  update_locale
  update_tex_parameters

  if @template
    if @template == '__DEFAULT__'
      @template = TEX_DOCUMENTCLASS[0]
    end
    update_tex_stys(@template, dir)
  end

  update_tex_command
  update_dvi_command

  puts t('Finished.')
rescue ApplicationError
  exit 1
end

#parse_options(args) ⇒ Object



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/review/update.rb', line 134

def parse_options(args)
  opts = OptionParser.new
  opts.version = ReVIEW::VERSION
  opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} [option]"
  opts.on('-h', '--help', 'print this message and quit.') do
    puts opts.help
    exit 0
  end
  opts.on('--latex-template name', 'specify LaTeX template name. (default: review-jsbook)') do |tname|
    @specified_template = tname
  end

  begin
    opts.parse!(args)
  rescue OptionParser::ParseError => e
    @logger.error e.message
    $stderr.puts opts.help
    raise ApplicationError
  end

  if @specified_template
    tdir = File.join(@review_dir, 'templates/latex', @specified_template)
    unless File.exist?(tdir)
      @logger.error "!! #{tdir} not found. Aborted. !!"
      raise ApplicationError
    end
  end
end

#parse_ymls(dir) ⇒ Object



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/review/update.rb', line 163

def parse_ymls(dir)
  language = 'en'

  Dir.glob(File.join(dir, '*.yml')).sort.each do |yml|
    begin
      config = YAMLLoader.safe_load_file(yml)
      if config['language'].present?
        language = config['language']
      end

      if config['review_version'].present?
        @config_ymls.push(yml)
      end
      if config['texdocumentclass'].present? ||
         config['texcommand'].present? ||
         config['texoptions'].present? ||
         config['dvicommand'].present? ||
         config['dvioptions'].present? ||
         config['pdfmaker'].present?
        @tex_ymls.push(yml)
      end
      if config['epubmaker'].present? || config['epubversion'].present? ||
         config['htmlversion'].present?
        @epub_ymls.push(yml)
      end
      if config['locale'].present?
        @locale_ymls.push(yml)
      end
      if config['PREDEF'].present? || config['CHAPS'].present? ||
         config['APPENDIX'].present? || config['POSTDEF'].present?
        @catalog_ymls.push(yml)
      end
    rescue Psych::SyntaxError
      @logger.error "!! #{yml} is broken. Ignored. !!"
    end
  end
  I18n.setup(language)

  @config_ymls.uniq!
  @locale_ymls.uniq!
  @catalog_ymls.uniq!
  @tex_ymls.uniq!
  @epub_ymls.uniq!
end

#rewrite_documentclass_opts_by_flag(flag, yml, old_opts, modified_opts) ⇒ Object



386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/review/update.rb', line 386

def rewrite_documentclass_opts_by_flag(flag, yml, old_opts, modified_opts)
  if flag # successfully converted
    @logger.info t("%s: previous 'texdocumentclass' option '%s' is safely replaced with '%s'.", [File.basename(yml), old_opts, modified_opts])
  else # something wrong
    unless confirm("%s: previous 'texdocumentclass' option '%s' couldn't be converted fully. '%s' is suggested. Do you really proceed?", [File.basename(yml), old_opts, modified_opts], nil)
      @template = nil
      return nil
    end
  end

  rewrite_yml(yml, 'texdocumentclass', %Q(["#{@template}", "#{modified_opts}"]))
end

#rewrite_yml(yml, key, val) ⇒ Object



125
126
127
128
129
130
131
132
# File 'lib/review/update.rb', line 125

def rewrite_yml(yml, key, val)
  content = File.read(yml)
  content.gsub!(/^(\s*)#{key}:.*$/, '\1' + "#{key}: #{val}")
  if @backup
    FileUtils.mv(yml, "#{yml}-old")
  end
  File.write(yml, content)
end

#show_versionObject



223
224
225
# File 'lib/review/update.rb', line 223

def show_version
  puts t('** review-update updates your project to %s **', ReVIEW::VERSION)
end

#t(message, args = []) ⇒ Object



88
89
90
91
92
93
# File 'lib/review/update.rb', line 88

def t(message, args = [])
  unless I18n.get(message)
    I18n.set(message, message) # just copy
  end
  I18n.t(message, args)
end

#update_dvi_commandObject



540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
# File 'lib/review/update.rb', line 540

def update_dvi_command
  @tex_ymls.each do |yml|
    config = YAMLLoader.safe_load_file(yml)
    if !config['dvicommand'] || config['dvicommand'] !~ /\s+-/
      next
    end

    # option should be moved to dvioptions
    cmd, opts = config['dvicommand'].split(/\s+-/, 2)
    opts = "-#{opts}"

    unless confirm("%s: 'dvicommand' has options ('%s'). Move it to 'dvioptions'?", [File.basename(yml), opts])
      next
    end

    if config['dvioptions'].present?
      config['dvioptions'] += " #{opts}"
      rewrite_yml(yml, 'dvicommand', %Q("#{cmd}"))
      rewrite_yml(yml, 'dvioptions', %Q("#{config['dvioptions']}"))
    else
      rewrite_yml(yml, 'dvicommand', %Q("#{cmd}"\ndvioptions: "#{DVI_OPTIONS} #{opts}"))
    end
  end
end

#update_epub_versionObject



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/review/update.rb', line 297

def update_epub_version
  @epub_ymls.each do |yml|
    config = YAMLLoader.safe_load_file(yml)
    if config['epubversion'].present? && config['epubversion'].to_f < EPUB_VERSION.to_f
      # rubocop:disable Style/SoleNestedConditional
      if confirm("%s: Update '%s' to '%s' from '%s'?", [File.basename(yml), 'epubversion', EPUB_VERSION, config['epubversion']])
        rewrite_yml(yml, 'epubversion', EPUB_VERSION)
      end
      # rubocop:enable Style/SoleNestedConditional
    end
    if !config['htmlversion'].present? || config['htmlversion'].to_f >= HTML_VERSION.to_f
      next
    end

    if confirm("%s: Update '%s' to '%s' from '%s'?", [File.basename(yml), 'htmlversion', HTML_VERSION, config['htmlversion']])
      rewrite_yml(yml, 'htmlversion', HTML_VERSION)
    end
  end
end

#update_localeObject



317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/review/update.rb', line 317

def update_locale
  @locale_ymls.each do |yml|
    config = YAMLLoader.safe_load_file(yml)
    if !config['chapter_quote'].present? || config['chapter_quote'].scan('%s').size != 1
      next
    end

    v = config['chapter_quote'].sub('%s', '%s %s')
    if confirm("%s: 'chapter_quote' now takes 2 values. Update '%s' to '%s'?", [File.basename(yml), config['chapter_quote'], v])
      rewrite_yml(yml, 'chapter_quote', v)
    end
  end
end

#update_rakefile(dir) ⇒ Object



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/review/update.rb', line 259

def update_rakefile(dir)
  taskdir = File.join(dir, 'lib/tasks')
  FileUtils.mkdir_p(taskdir)

  master_rakefile = File.join(@review_dir, 'samples/sample-book/src/Rakefile')

  target_rakefile = File.join(dir, 'Rakefile')
  if File.exist?(target_rakefile)
    if Digest::SHA256.hexdigest(File.read(target_rakefile)) != Digest::SHA256.hexdigest(File.read(master_rakefile))
      # rubocop:disable Style/SoleNestedConditional
      if confirm('%s will be overridden with Re:VIEW version (%s). Do you really proceed?', ['Rakefile', master_rakefile])
        FileUtils.mv(target_rakefile, "#{target_rakefile}-old")
        FileUtils.cp(master_rakefile, target_rakefile)
      end
      # rubocop:enable Style/SoleNestedConditional
    end
  else
    @logger.info t('new file %s is created.', [target_rakefile]) unless @force
    FileUtils.cp(master_rakefile, target_rakefile)
  end

  master_rakefile = File.join(@review_dir, 'samples/sample-book/src/lib/tasks/review.rake')
  target_rakefile = File.join(taskdir, 'review.rake')
  if File.exist?(target_rakefile)
    # rubocop:disable Style/SoleNestedConditional
    if Digest::SHA256.hexdigest(File.read(target_rakefile)) != Digest::SHA256.hexdigest(File.read(master_rakefile))
      if confirm('%s will be overridden with Re:VIEW version (%s). Do you really proceed?', ['lib/tasks/review.rake', master_rakefile])
        FileUtils.mv(target_rakefile, "#{target_rakefile}-old")
        FileUtils.cp(master_rakefile, target_rakefile)
      end
    end
    # rubocop:enable Style/SoleNestedConditional
  else
    @logger.info t('new file %s is created.', [target_rakefile]) unless @force
    FileUtils.cp(master_rakefile, target_rakefile)
  end
end

#update_review_jsbook_opts(yml, old_opts) ⇒ Object



399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/review/update.rb', line 399

def update_review_jsbook_opts(yml, old_opts)
  modified_opts = old_opts.gsub(/Q=([^,]+)/, 'fontsize=\1Q').
                  gsub(/W=([^,]+)/, 'line_length=\1zw').
                  gsub(/L=([^,]+)/, 'number_of_lines=\1').
                  gsub(/H=([^,]+)/, 'baselineskip=\1H').
                  gsub(/head=([^,]+)/, 'head_space=\1')

  if modified_opts == old_opts
    return nil
  end

  rewrite_documentclass_opts_by_flag(true, yml, old_opts, modified_opts)
end

#update_tex_commandObject



515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
# File 'lib/review/update.rb', line 515

def update_tex_command
  @tex_ymls.each do |yml|
    config = YAMLLoader.safe_load_file(yml)
    if !config['texcommand'] || config['texcommand'] !~ /\s+-/
      next
    end

    # option should be moved to texoptions
    cmd, opts = config['texcommand'].split(/\s+-/, 2)
    opts = "-#{opts}"

    unless confirm("%s: 'texcommand' has options ('%s'). Move it to 'texoptions'?", [File.basename(yml), opts])
      next
    end

    if config['texoptions'].present?
      config['texoptions'] += " #{opts}"
      rewrite_yml(yml, 'texcommand', %Q("#{cmd}"))
      rewrite_yml(yml, 'texoptions', %Q("#{config['texoptions']}"))
    else
      rewrite_yml(yml, 'texcommand', %Q("#{cmd}"\ntexoptions: "#{TEX_OPTIONS} #{opts}"))
    end
  end
end

#update_tex_parametersObject



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/review/update.rb', line 331

def update_tex_parameters
  @tex_ymls.each do |yml|
    config = YAMLLoader.safe_load_file(yml)
    unless config['texdocumentclass']
      next
    end

    if TEX_DOCUMENTCLASS.include?(config['texdocumentclass'][0])
      if @specified_template.present? && config['texdocumentclass'][0] != @specified_template
        # want to use other template?
        @logger.error t("%s: !! 'texdocumentclass' uses new class '%s' already, but you specified '%s'. This tool can't handle such migration. Ignored. !!", [File.basename(yml), config['texdocumentclass'][0], @specified_template])
        @template = nil
      else
        @template = config['texdocumentclass'][0]

        if @template == 'review-jsbook'
          update_review_jsbook_opts(yml, config['texdocumentclass'][1])
        end
      end

      # no need to update
      next
    end

    if TEX_DOCUMENTCLASS_BAD.include?(config['texdocumentclass'][0])
      cno = TEX_DOCUMENTCLASS_BAD.index(config['texdocumentclass'][0])

      if @specified_template && @specified_template != TEX_DOCUMENTCLASS[cno]
        # not default, manually selected
        unless confirm("%s: 'texdocumentclass' uses the old class '%s'. By default it is migrated to '%s', but you specify '%s'. Do you really migrate 'texdocumentclass' to '%s'?",
                       [File.basename(yml), TEX_DOCUMENTCLASS_BAD[cno],
                        TEX_DOCUMENTCLASS[cno],
                        @specified_template, @specified_template])
          @template = nil
          next
        end
        @template = @specified_template
      else
        # default migration
        @template = TEX_DOCUMENTCLASS[cno]
        unless confirm("%s: 'texdocumentclass' uses the old class '%s'. By default it is migrated to '%s'. Do you really migrate 'texdocumentclass' to '%s'?", [File.basename(yml), TEX_DOCUMENTCLASS_BAD[cno], @template, @template])
          @template = nil
          next
        end
      end

      flag, modified_opts = convert_documentclass_opts(yml, @template, config['texdocumentclass'][1])
      rewrite_documentclass_opts_by_flag(flag, yml, config['texdocumentclass'][1], modified_opts)
    else
      @template = nil
      @logger.error t("%s: ** 'texdocumentclass' specifies '%s'. Because this is unknown class for this tool, you need to update it by yourself if it won't work. **", [File.basename(yml), config['texdocumentclass'][0]])
    end
  end
end

#update_tex_stys(template, dir) ⇒ Object



473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/review/update.rb', line 473

def update_tex_stys(template, dir)
  texmacrodir = File.join(dir, 'sty')
  FileUtils.mkdir_p(texmacrodir)

  tdir = File.join(@review_dir, 'templates/latex', template)
  Dir.glob(File.join(tdir, '*.*')).each do |master_styfile|
    target_styfile = File.join(texmacrodir, File.basename(master_styfile))

    unless File.exist?(target_styfile)
      # just copy
      @logger.info t('new file %s is created.', [target_styfile]) unless @force
      FileUtils.cp(master_styfile, target_styfile)
      next
    end
    if File.basename(target_styfile) == 'review-custom.sty'
      next
    end

    if Digest::SHA256.hexdigest(File.read(target_styfile)) == Digest::SHA256.hexdigest(File.read(master_styfile))
      # same
      next
    end

    if confirm('%s will be overridden with Re:VIEW version (%s). Do you really proceed?', [target_styfile, master_styfile])
      FileUtils.mv(target_styfile, "#{target_styfile}-old")
      FileUtils.cp(master_styfile, target_styfile)
    end
  end

  if template == 'review-jsbook'
    unless File.exist?(File.join(texmacrodir, 'jsbook.cls'))
      @logger.info t('new file %s is created.', [File.join(texmacrodir, 'jsbook.cls')]) unless @force
      FileUtils.cp(File.join(@review_dir, 'vendor/jsclasses/jsbook.cls'), File.join(texmacrodir, 'jsbook.cls'))
    end

    unless File.exist?(File.join(texmacrodir, 'gentombow.sty'))
      @logger.info t('new file %s is created.', [File.join(texmacrodir, 'gentombow.sty')]) unless @force
      FileUtils.cp(File.join(@review_dir, 'vendor/gentombow/gentombow.sty'), File.join(texmacrodir, 'gentombow.sty'))
    end
  end
end

#update_versionObject



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/review/update.rb', line 241

def update_version
  @config_ymls.each do |yml|
    config = YAMLLoader.safe_load_file(yml)
    if config['review_version'].to_f.round(1) == TARGET_VERSION.to_f.round(1)
      next
    end

    flag = true
    if config['review_version'].to_f > TARGET_VERSION.to_f
      flag = nil
    end

    if confirm("%s: Update '%s' to '%s'?", [File.basename(yml), 'review_version', TARGET_VERSION], flag)
      rewrite_yml(yml, 'review_version', TARGET_VERSION)
    end
  end
end