Sha256: 085dbb80d7c1703f410a93bd1d7cc8823720522a17f5f58e99c3c5d128939460

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

Contents

require "pathname"

require_relative "repo_metadata.rb"

class DevsiteBuilder
  def initialize master_dir = "."
    @master_dir = Pathname.new master_dir
    @output_dir = "doc"
    @metadata = RepoMetadata.from_source "#{master_dir}/.repo-metadata.json"
  end

  def build
    FileUtils.remove_dir @output_dir if Dir.exist? @output_dir
    markup = "--markup markdown"

    Dir.chdir @master_dir do
      cmds = ["-o #{@output_dir}", markup]
      cmd "yard --verbose #{cmds.join ' '}"
    end
    @metadata.build @master_dir + @output_dir
  end

  def upload
    Dir.chdir @output_dir do
      opts = [
        "--credentials=#{ENV['KOKORO_KEYSTORE_DIR']}/73713_docuploader_service_account",
        "--staging-bucket=#{ENV.fetch 'STAGING_BUCKET', 'docs-staging'}",
        "--metadata-file=./docs.metadata"
      ]
      cmd "python3 -m docuploader upload . #{opts.join ' '}"
    end
  end

  def publish
    build
    upload
  end

  def cmd line
    puts line
    output = `#{line}`
    puts output
    output
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
googleauth-0.16.0 rakelib/devsite_builder.rb
googleauth-0.15.1 rakelib/devsite_builder.rb
googleauth-0.15.0 rakelib/devsite_builder.rb
googleauth-0.14.0 rakelib/devsite_builder.rb
googleauth-0.13.1 rakelib/devsite_builder.rb
googleauth-0.13.0 rakelib/devsite_builder.rb
googleauth-0.12.0 rakelib/devsite_builder.rb
googleauth-0.11.0 rakelib/devsite_builder.rb