Sha256: 68ecb7b901f67827df3c8a11b70274e73e9bc383a5faf6b8d93f1256001fcd20

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

#!/usr/bin/env ruby
# encoding: UTF-8

require 'optparse'
require 'open_source'

options = {}

option_parser = OptionParser.new do |opts|
  opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} OPTIONS"
  opts.separator ''
  opts.separator 'Specific options:'

  opts.on('-s', '--setup', 'Setup user credentials in ~/.osrc file') do |s|
    OpenSource.setup_owner_credentails
    exit
  end

  opts.on('-l', '--license LICENSE', OpenSource::LICENSES, "LICENSE can be #{OpenSource::LICENSES.join(', ')}") do |l|
    options[:license] = l
  end

  opts.on('-a', '--append README', 'Append LICENSE content to README file') do |a|
    options[:append] = a
  end

  opts.separator ''
  opts.separator 'Common options:'

  opts.on_tail('-v', '--version', 'Print the version') do
    puts OpenSource::VERSION
    exit
  end

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

begin
  option_parser.parse!
  if options.empty?
    puts option_parser
    exit 0
  end

  OpenSource::License.new(options).process
rescue OpenSource::Error => e
  # TODO: Make sure the above call raises only OpenSource::Error
  puts "Error: #{e.message}"
  exit 1
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opensource-0.6.2 bin/opensource