Sha256: ed4331368ef8d34ca2d208fe81119442544b98bf47fa561bb6dd23f3419d52ca

Contents?: true

Size: 1.84 KB

Versions: 9

Compression:

Stored size: 1.84 KB

Contents

#!/usr/bin/env ruby
#
# review: Wrapper command to call subcommand
#
# ex.
#    review epubmaker config.yml
#      -> call `review-epubmaker config.yml`
#
# Copyright (c) 2017-2018 Kenshi Muto, Masayoshi Takahashi
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
# For details of the GNU LGPL, see the file "COPYING".

require 'pathname'
bindir = Pathname.new(__FILE__).realpath.dirname
$LOAD_PATH.unshift((bindir + '../lib').realpath)

require 'review'

def usage
  message = <<-EOB
usage: review <command> [<args>]

Re:VIEW commands are:
  init      : generate Re:VIEW project directory.
  update    : update Re:VIEW project to newest environment.
  preproc   : preprocess Re:VIEW document file.
  compile   : convert Re:VIEW document file.
  epubmaker : build EPUB.
  webmaker  : build web pages.
  epub2html : convert EPUB to single HTML.
  pdfmaker  : build PDF with LaTeX.
  textmaker : build text files.
  vol       : show volume of Re:VIEW document.
  check     : check there are no REJECT words in the document.
  index     : show heading list.
  validate  : validate Re:VIEW document files.
  version   : show Re:VIEW version.
  --help    : show this message.
EOB
  print message
  exit 1
end

usage if ARGV.length == 0 || ARGV[0] == '--help'

if ARGV[0] == 'version'
  puts ReVIEW::VERSION
  exit
end

command = "review-#{ARGV.shift}"
bindir = Pathname.new(__FILE__).realpath.dirname
command_path = File.join(bindir, command)

unless File.exist?(command_path)
  print "cannot find command: #{command}\n\n"
  usage
end

if RUBY_PLATFORM =~ /mswin|bccwin|mingw/
  cmd = File.join(RbConfig::CONFIG['bindir'],
                  RbConfig::CONFIG['ruby_install_name'])
  cmd << RbConfig::CONFIG['EXEEXT']
  exec(cmd, command_path, *ARGV)
else
  exec(command_path, *ARGV)
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
review-5.0.0 bin/review
review-4.2.0 bin/review
review-4.1.0 bin/review
review-4.0.0 bin/review
review-3.2.0 bin/review
review-3.1.0 bin/review
review-3.0.0 bin/review
review-3.0.0.rc1 bin/review
review-3.0.0.preview4 bin/review