Class: ThreeScaleToolbox::Commands::ProductCommand::ExportSubcommand

Inherits:
Cri::CommandRunner
  • Object
show all
Includes:
ThreeScaleToolbox::Command
Defined in:
lib/3scale_toolbox/commands/product_command/export_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ThreeScaleToolbox::Command

#config, #config_file, #exit_with_message, #fetch_required_option, included, #remotes, #threescale_client, #verbose, #verify_ssl

Class Method Details

.commandObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/3scale_toolbox/commands/product_command/export_command.rb', line 7

def self.command
  Cri::Command.define do
    name        'export'
    usage       'export [opts] <remote> <product>'
    summary     'Export product to serialized format'
    description 'This command serializes the referenced product and associated backends into a yaml format'

    option      :f, :file, 'Write to file instead of stdout', argument: :required
    param       :remote
    param       :product_ref

    runner ExportSubcommand
  end
end

Instance Method Details

#runObject



22
23
24
25
26
# File 'lib/3scale_toolbox/commands/product_command/export_command.rb', line 22

def run
  select_output do |output|
    output.write(serialized_object.to_yaml)
  end
end