Sha256: 0cced9c55945aacd48c0ca41d8bb77baf151693554af12c3deb9fdd85a77a006

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 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 ""
  opts.separator "Specific options:"

  opts.on("--dry-run", "Just pretend. Don't change anything.") do |v|
    options[:dry_run] = 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 !File.exist?(config_file)
  STDERR.puts("Unable to find file `yes_ship_it.conf`. I need it.")
  exit 1
end

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.empty?
  puts "Shipping..."
  puts

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

  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

1 entries across 1 versions & 1 rubygems

Version Path
yes_ship_it-0.0.2 bin/yes_ship_it