Sha256: c5c2a3276380e1857f4cf518542002cb469b73af48b3abe85e2d607da24b68db

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

#!/usr/bin/env ruby
require 'sord'
require 'commander/import'

program :name, 'sord'
program :version, Sord::VERSION
program :description, 'Generate Sorbet RBIs from YARD documentation'

default_command :gen
command :gen do |c|
  c.syntax = 'sord gen <output-file> [options]'
  c.description = 'Generates an RBI file from this directory\'s YARD docs'
  c.option '--[no-]comments', 'Controls informational/warning comments in the RBI file'
  c.option '--[no-]regenerate', 'Controls whether YARD is executed before Sord runs'

  c.action do |args, options|
    options.default comments: true, regenerate: true

    if args.length != 1
      Sord::Logging.error('Must specify filename')
      exit 1
    end

    begin
      Sord::Logging.info('Running YARD...')
      `yard`
    rescue Errno::ENOENT
      Sord::Logging.error('The YARD tool could not be found on your PATH.')
      Sord::Logging.error('You may need to run \'gem install yard\'.')
      Sord::Logging.error('If documentation has already been generated, pass --no-regenerate to Sord.')
      exit 1
    end

    Sord::RbiGenerator.new(options).run(args.first)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sord-0.7.0 exe/sord