Sha256: 3585956363c06860bd4b8146464f62cd00279266d87f6e6e742007c0c95da86b

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 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'


options = {}
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| options[: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| options[: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, (options[:proto_path] or '.'), (options[:out] or '.'))

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
macks-ruby_protobuf-0.3.3 bin/rprotoc
ruby_protobuf-0.3.3 bin/rprotoc