Class: Metanorma::Release::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/metanorma/release/cli.rb

Defined Under Namespace

Classes: PipelineError

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/metanorma/release/cli.rb', line 8

def self.exit_on_failure?
  true
end

Instance Method Details

#aggregateObject



92
93
94
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
# File 'lib/metanorma/release/cli.rb', line 92

def aggregate
  config = AggregateCommand::Config.new(
    source: options[:source],
    organizations: options[:organizations],
    topic: options[:topic],
    repos: options[:repos],
    channels: options[:channels],
    stages: options[:stages],
    output_dir: options[:output_dir],
    file_routing: options[:file_routing],
    cache_dir: options[:cache_dir],
    include_drafts: options[:include_drafts],
    concurrency: options[:concurrency],
    min_documents: options[:min_documents],
    token: options[:token],
    create_zip: nil,
  )
  result = AggregateCommand.new(config).call
  print_aggregate_result(result)

  if options[:min_documents].positive? && result.publications.length < options[:min_documents]
    raise PipelineError,
          "Found #{result.publications.length} documents, minimum is #{options[:min_documents]}"
  end

  unless result.failed_repos.empty?
    raise PipelineError,
          format_repo_failures(result)
  end
end

#packageObject

Raises:



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/metanorma/release/cli.rb', line 23

def package
  config = PackageCommand::Config.new(
    output_dir: options[:output_dir],
    dest: options[:dest],
    manifest: options[:manifest],
    config_source: options[:config],
  )
  result = PackageCommand.new(config).call
  print_package_result(result, config.dest)
  raise PipelineError, format_failures(result) unless result.failed.empty?
end

#releaseObject

Raises:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/metanorma/release/cli.rb', line 51

def release
  config = ReleaseCommand::Config.new(
    output_dir: options[:output_dir],
    platform: options[:platform],
    manifest: options[:manifest],
    force: options[:force],
    force_replace: options[:force_replace],
    channels: options[:channels],
    concurrency: options[:concurrency],
    token: options[:token],
    config_source: options[:config],
  )
  result = ReleaseCommand.new(config).call
  print_publish_result(result)
  raise PipelineError, format_failures(result) unless result.failed.empty?
end