Sha256: 89e5aa3492c8a00fdd414cd913ce268d7ddf68a499a33a803f8fbba0f7968cc1

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env ruby

require 'optparse'

if File.directory?("#{File.dirname(__FILE__)}/../lib")
  $: << "#{File.dirname(__FILE__)}/../lib"
else
  require 'rubygems'
  gem 'ruby_protobuf'
end
require 'protobuf/compiler/compiler'


options = {
  :proto_path => '.',
  :out => '.',
}
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 = Protobuf::Version

begin
  opts.order!
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], options[:out])

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ruby_protobuf-0.4.11 bin/rprotoc
ruby_protobuf-0.4.10 bin/rprotoc
ruby_protobuf-0.4.9 bin/rprotoc
ruby_protobuf-0.4.8 bin/rprotoc
ruby_protobuf-0.4.7 bin/rprotoc
ruby_protobuf-0.4.6 bin/rprotoc
ruby_protobuf-0.4.5 bin/rprotoc