Class: OasContrib::Command

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/oas_contrib/command.rb

Overview

Command class

Instance Method Summary collapse

Instance Method Details

#divide(spec_file, outdir) ⇒ Integer

Divide the spec file command

Parameters:

  • spec_file (String)

    spec file path

  • outdir (String)

    output directory path

Returns:

  • (Integer)

    return code



18
19
20
21
22
23
24
25
26
# File 'lib/oas_contrib/command.rb', line 18

def divide(spec_file, outdir)
  resolver = OasContrib::Resolver::Divide.new(spec_file, outdir, options)
  resolver.setup
  resolver.load
  resolver.resolve
  resolver.distribute
  say 'complete!', :green
  exit(0)
end

#merge(indir, spec_file) ⇒ Integer

Merge divided files to spec file command

Parameters:

  • indir (String)

    input directory path

  • spec_file (String)

    spec file path

Returns:

  • (Integer)

    return code



35
36
37
38
39
40
41
42
43
# File 'lib/oas_contrib/command.rb', line 35

def merge(indir, spec_file)
  resolver = OasContrib::Resolver::Merge.new(indir, spec_file, options)
  resolver.setup
  resolver.load
  resolver.resolve
  resolver.distribute
  say 'complete!', :green
  exit(0)
end

#preview(spec_file) ⇒ Integer

Preview the spec file with Swagger UI

Parameters:

  • spec_file (String)

    spec file path

Returns:

  • (Integer)

    return code



51
52
53
54
55
56
57
# File 'lib/oas_contrib/command.rb', line 51

def preview(spec_file)
  resolver = OasContrib::Resolver::Preview.new(spec_file, options)
  resolver.setup
  resolver.distribute
  say 'complete!', :green
  exit(0)
end