Sha256: ab5a283524fd3a3ebd252690aad0135a26b2bb89edd5858689fd966a807471ca

Contents?: true

Size: 1.77 KB

Versions: 8

Compression:

Stored size: 1.77 KB

Contents

#!/usr/bin/env ruby

# encoding: UTF-8

require "fileutils"
# resolve bin path, ignoring symlinks
require "pathname"
bin_file = Pathname.new(__FILE__).realpath

# add self to libpath
$:.unshift File.expand_path("../../lib", bin_file)

# Fixes https://github.com/rubygems/rubygems/issues/1420
require "rubygems/specification"

module Gem
  class Specification
    def this; self; end
  end
end

require "bundler/setup"
require "optparse"

def log(message)
  puts "[stepmod-utils] #{message}"
end

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: #{$0} [options]"

  opts.on(
    "--stepmod-data-dir STEPMOD_DATA_DIR",
    String,
    "Path to STEPmod data directory",
  ) do |path|
    options[:stepmod_dir] = path
  end

  opts.on(
    "--srl-docs-dir SRL_DOCS_DIR",
    String,
    "Path to output srl docs",
  ) do |path|
    options[:srl_output_docs_dir] = path
  end

  opts.on(
    "-s",
    "--stepmod2mn-executeable STEPMOD2MN_EXECUTEABLE",
    String,
    "Path to STEPMOD2MN_EXECUTEABLE",
  ) do |path|
    options[:stepmod2mn_path] = path
  end

  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
end.parse!

stepmod2mn_path = options[:stepmod2mn_path]
if stepmod2mn_path.nil?
  raise StandardError.new(
    "stepmod2mn executeable is required, set with the `-s` option.",
  )
else
  log "stepmod2mn executeable path: `#{stepmod2mn_path}`"
end

stepmod_dir = options[:stepmod_dir] || "stepmod/data"
log "STEPmod data path: `#{stepmod_dir}`"

srl_output_docs_dir = options[:srl_output_docs_dir] || "documents"
unless File.directory?(srl_output_docs_dir)
  FileUtils.mkdir_p(srl_output_docs_dir)
end
log "SRL output docs directory path: `#{srl_output_docs_dir}`"

system "java -Xss5m -jar #{stepmod2mn_path} #{stepmod_dir} --output #{srl_output_docs_dir}"

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
stepmod-utils-0.4.0 exe/stepmod-srl-migrate-docs
stepmod-utils-0.3.37 exe/stepmod-srl-migrate-docs
stepmod-utils-0.3.36 exe/stepmod-srl-migrate-docs
stepmod-utils-0.3.35 exe/stepmod-srl-migrate-docs
stepmod-utils-0.3.34 exe/stepmod-srl-migrate-docs
stepmod-utils-0.3.33 exe/stepmod-srl-migrate-docs
stepmod-utils-0.3.32 exe/stepmod-srl-migrate-docs
stepmod-utils-0.3.31 exe/stepmod-srl-migrate-docs