Sha256: 7d5172987847df2a7644e1bdc6e453a2d2ae4d43e2a5a18b9a9c174fdec005e7

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

#!/usr/bin/env ruby
require 'optparse'
if File.exist? "#{File.dirname(__FILE__)}/../lib"
  $: << "#{File.dirname(__FILE__)}/../lib"
else
  require 'rubygems'
  gem 'ruby_protobuf'
end
require 'ruby_protobuf'
require 'protobuf/compiler/compiler'


OPT = {}
opts = OptionParser.new("#{$0} [OPTIONS] PROTO_FILE")
opts.on('-p', '--proto_path <PATH>', 'Specify the directory in which to search for imports. The current directory is default.'){|v| OPT[:proto_path] = v}
opts.on('-o', '--out <OUT_DIR>', 'Specify the directory in which Ruby source file is generated. The current directory is default.'){|v| OPT[:out] = v}
opts.on_tail('-v', '--version', 'Show version.'){puts(opts.ver); exit}
opts.on_tail('-h', '--help', 'Show this message.'){puts(opts.help); exit}

::Version = RubyProtobuf::VERSION

begin
  opts.order! ARGV
rescue OptionParser::ParseError
  $stderr.puts $!.to_s
  exit 1
end

PROTO_FILE = ARGV.shift

unless PROTO_FILE
  puts opts
  exit
end

Protobuf::Compiler.compile(PROTO_FILE, (OPT[:proto_path] or '.'), (OPT[:out] or '.'))

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
macks-ruby_protobuf-0.3.2.1 bin/rprotoc
macks-ruby_protobuf-0.3.2.2 bin/rprotoc
macks-ruby_protobuf-0.3.2.3 bin/rprotoc