Sha256: 9512ff43ca7a88e682c5bd4e19a12f8307960db49fc1a94f55f9e89e954754ec

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

#!/usr/bin/env ruby

require 'fileutils'
require 'logger'

err_log = Logger.new(STDERR)

EFF_WIRE_ROOT = File.join(__dir__, '..', '..')

EFF_CLARITY_PROTO_ROOT =
  begin
    ENV.fetch('EFF_CLARITY_PROTO_ROOT')
  rescue KeyError
    File.join(
      EFF_WIRE_ROOT,
      '..',
      'clarity-protobuf',
      'src', 'main', 'proto'
    )
  end

EFF_CLARITY_PROTO_BIN_ROOT =
  begin
    ENV.fetch('EFF_CLARITY_PROTO_BIN_ROOT')
  rescue KeyError
    File.join(EFF_CLARITY_PROTO_ROOT, 'bin')
  end

EFF_CLARITY_PROTO_COMMON_ROOT =
  begin
    ENV.fetch('EFF_CLARITY_PROTO_COMMON_ROOT')
  rescue KeyError
    File.join(EFF_CLARITY_PROTO_ROOT, 'common')
  end

EFF_PROTO_ROOT =
  begin
    ENV.fetch('EFF_PROTO_ROOT')
  rescue KeyError
    File.join(EFF_WIRE_ROOT, 'proto')
  end

src_package_paths =
  Dir.glob("#{EFF_CLARITY_PROTO_ROOT}/*").select do |package_path|
    next(false) if package_path.include?(EFF_CLARITY_PROTO_BIN_ROOT)
    next(false) if package_path.include?(EFF_CLARITY_PROTO_COMMON_ROOT)
    true
  end

if src_package_paths.empty?
  raise <<-EOV


  Provided clarity-protobuf proto root is apparently empty. Exiting.

  EOV
end

src_package_paths.each do |src_package_path|
  puts "> Copying '#{src_package_path}'"
  FileUtils.cp_r(src_package_path, EFF_PROTO_ROOT)
end

puts "> Copying '#{EFF_CLARITY_PROTO_COMMON_ROOT}'"
FileUtils.cp(
  Dir.glob(File.join(EFF_CLARITY_PROTO_COMMON_ROOT, '*.proto')),
  EFF_PROTO_ROOT
)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
effigy_wire-0.0.3 bin/support/10-clarity_protobuf_copy