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.



15
16
17
# File 'lib/metanorma/release/commands/release_command.rb', line 15

def initialize(config)
  @config = config
end

Instance Method Details

#callObject



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
45
46
47
48
# File 'lib/metanorma/release/commands/release_command.rb', line 19

def call
  org_config = load_org_config
  config = load_config(org_config: org_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