Sha256: 84c6ce78a2db2d0e1b9ef92d69698e71f1f5e92a8271c36388307af7d9a6c3ce

Contents?: true

Size: 1.8 KB

Versions: 3

Compression:

Stored size: 1.8 KB

Contents

#!/usr/bin/ruby

require_relative("../lib/yes_ship_it.rb")

options = {}
option_parser = OptionParser.new do |opts|
  opts.banner = "Usage: yes_ship_it [options] [command]"

  opts.separator ""
  opts.separator "Commands:"
  opts.separator "  changelog - show change log since last release"
  opts.separator "  init      - initialize directory for shipping with yes_ship_it"
  opts.separator ""
  opts.separator "Specific options:"

  opts.on("--dry-run", "Just pretend. Don't change anything.") do |v|
    options[:dry_run] = v
  end

  opts.on("--data-dir=DIR", "Set directory for storing internal data") do |v|
    options[:data_dir] = v
  end

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

config_file = "yes_ship_it.conf"

if ARGV == ["changelog"]
  engine = YSI::Engine.new
  engine.check_assertion(YSI::Version)
  tag = `git tag`.split("\n").last
  system("git log #{tag}..HEAD")
  exit 0
elsif ARGV == ["init"]
  File.open("yes_ship_it.conf", "w") do |file|
    file.puts "# Experimental release automation. See https://github.com/cornelius/yes_ship_it."
    file.puts "include:"
    file.puts "  ruby_gem"
  end
  puts "Initialized directory for shipping."
  puts
  puts "Check the file `yes_ship_it.conf` and adapt it to your needs."
  puts
  puts "Happy shipping!"
elsif ARGV.empty?
  if !File.exist?(config_file)
    STDERR.puts("Unable to find file `yes_ship_it.conf`. I need it.")
    exit 1
  end

  puts "Shipping..."
  puts

  engine = YSI::Engine.new
  engine.dry_run = options[:dry_run]
  engine.data_dir = options[:data_dir] if options[:data_dir]

  begin
    engine.read(config_file)

    exit engine.run
  rescue YSI::Error => e
    STDERR.puts e
    exit 1
  end
else
  $stderr.puts "Unrecognized arguments: #{ARGV.join(" ")}"
  puts option_parser
  exit 1
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yes_ship_it-0.0.5 bin/yes_ship_it
yes_ship_it-0.0.4 bin/yes_ship_it
yes_ship_it-0.0.3 bin/yes_ship_it