Sha256: c6235d14d8c2ac4947c29152a3d61bdcd8f4a2e12dc7563f84d7b7eb4cdebca9
Contents?: true
Size: 1.14 KB
Versions: 11
Compression:
Stored size: 1.14 KB
Contents
#!/usr/bin/env ruby require 'optparse' if File.directory?("#{File.dirname(__FILE__)}/../lib") $: << "#{File.dirname(__FILE__)}/../lib" else require 'rubygems' gem 'protobuf' end require 'protobuf' require 'protobuf/version' require 'protobuf/compiler/compiler' ::Version = Protobuf::VERSION 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 } begin opts.order! rescue OptionParser::ParseError $stderr.puts $!.to_s exit 1 end unless ARGV.size > 0 puts opts exit end begin ARGV.each do |proto_file| Protobuf::Compiler.compile(proto_file, options[:proto_path], options[:out]) end rescue $stderr.puts $!.message exit 1 end
Version data entries
11 entries across 11 versions & 1 rubygems