Class: Metanorma::Release::ReleaseCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/metanorma/release/commands/release_command.rb

Defined Under Namespace

Classes: Config

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ ReleaseCommand

Returns a new instance of ReleaseCommand.



12
13
14
# File 'lib/metanorma/release/commands/release_command.rb', line 12

def initialize(config)
  @config = config
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/metanorma/release/commands/release_command.rb', line 16

def call
  config = load_config
  options = { token: @config.token }
  publisher = PlatformFactory.build_publisher(@config.platform, options)
  channel_override = Channel.parse_list(@config.channels) if @config.channels

  deps = ReleasePipeline::Dependencies.new(
    extractor: Publication,
    filters: [],
    change_detector: ContentHashChangeDetector.new(previous_releases: {}),
    packager: ZipPackager.new(output_dir: @config.output_dir),
    publisher: publisher,
    slug_registry: SlugRegistry.from_config(config),
    manifest: nil,
    channel_override: channel_override,
    config: config,
  )

  pipeline_config = ReleasePipeline::Config.new(
    output_dir: @config.output_dir,
    manifest_path: @config.manifest,
    force: @config.force,
    force_replace_patterns: @config.force_replace && !@config.force_replace.empty? ? @config.force_replace : nil,
    concurrency: @config.concurrency,
    default_visibility: "public",
  )

  ReleasePipeline.new(deps).run(pipeline_config)
end