lib/protobuf/tasks/compile.rake in protobuffy-3.6.0 vs lib/protobuf/tasks/compile.rake in protobuffy-4.0.0
- old
+ new
@@ -1,11 +1,11 @@
require 'fileutils'
namespace :protobuf do
desc 'Clean & Compile the protobuf source to ruby classes. Pass PB_NO_CLEAN=1 if you do not want to force-clean first.'
- task :compile, [ :package, :source, :destination, :plugin, :file_extension ] do |tasks, args|
+ task :compile, [:package, :source, :destination, :plugin, :file_extension] do |_tasks, args|
args.with_defaults(:destination => 'lib')
args.with_defaults(:source => 'definitions')
args.with_defaults(:plugin => 'ruby')
args.with_defaults(:file_extension => '.pb.rb')
@@ -16,19 +16,18 @@
command = []
command << "protoc"
command << "--#{args[:plugin]}_out=#{args[:destination]}"
command << "-I #{args[:source]}"
- command << "#{args[:source]}/#{args[:package]}/*.proto"
- command << "#{args[:source]}/#{args[:package]}/**/*.proto"
+ command << Dir["#{args[:source]}/#{args[:package]}/**/*.proto"].join(" ")
full_command = command.join(' ')
puts full_command
exec(full_command)
end
desc 'Clean the generated *.pb.rb files from the destination package. Pass PB_FORCE_CLEAN=1 to skip confirmation step.'
- task :clean, [ :package, :destination, :file_extension ] do |task, args|
+ task :clean, [:package, :destination, :file_extension] do |_task, args|
args.with_defaults(:destination => 'lib')
args.with_defaults(:file_extension => '.pb.rb')
file_extension = args[:file_extension].sub(/\*?\.+/, '')
files_to_clean = ::File.join(args[:destination], args[:package], '**', "*.#{file_extension}")