Sha256: ae3a3f7dff423660994d194ee24552c43d4c66f24440c6bd742d25336ac09930

Contents?: true

Size: 1.8 KB

Versions: 24

Compression:

Stored size: 1.8 KB

Contents

$: << ::File.expand_path('../', __FILE__)
$: << ::File.expand_path('../spec', __FILE__)

require 'fileutils'
require 'rubygems'
require 'rubygems/package_task'
require 'bundler/gem_tasks'
require 'benchmark/tasks'

require 'rspec/core/rake_task'

desc 'Default: run specs.'
task :default => :spec

RSpec::Core::RakeTask.new(:spec)

desc 'Run specs'
namespace :compile do

  desc 'Compile spec protos in spec/supprt/ directory'
  task :spec do |task, args|
    proto_path = ::File.expand_path('../spec/support/', __FILE__)
    cmd = %Q{protoc --plugin=./bin/protoc-gen-ruby --ruby_out=#{proto_path} -I #{proto_path} #{File.join(proto_path, '**', '*.proto')}}

    puts cmd
    exec(cmd)
  end

  desc 'Compile rpc protos in protos/ directory'
  task :rpc do |task, args|
    proto_path = ::File.expand_path('../proto', __FILE__)
    output_dir = ::File.expand_path('../tmp/rpc', __FILE__)
    ::FileUtils.mkdir_p(output_dir)

    cmd = %Q{protoc --plugin=./bin/protoc-gen-ruby --ruby_out=#{output_dir} -I #{proto_path} #{File.join(proto_path, '**', '*.proto')}}

    puts cmd
    system(cmd)

    files = {
      'tmp/rpc/dynamic_discovery.pb.rb'               => 'lib/protobuf/rpc',
      'tmp/rpc/rpc.pb.rb'                             => 'lib/protobuf/rpc',
      'tmp/rpc/google/protobuf/descriptor.pb.rb'      => 'lib/protobuf/descriptors/google/protobuf',
      'tmp/rpc/google/protobuf/compiler/plugin.pb.rb' => 'lib/protobuf/descriptors/google/protobuf/compiler'
    }

    files.each_pair do |source_file, destination_dir|
      source_file = ::File.expand_path("../#{source_file}", __FILE__)
      destination_dir = ::File.expand_path("../#{destination_dir}", __FILE__)
      ::FileUtils::Verbose.cp(source_file, destination_dir)
    end
  end

end

task :console do
  require 'pry'
  require 'protobuf'
  ARGV.clear
  ::Pry.start
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
protobuffy-3.6.0 Rakefile
protobuffy-3.5.1 Rakefile
protobuffy-3.4.0 Rakefile
protobuffy-3.3.0 Rakefile
protobuffy-3.2.0 Rakefile
protobuffy-3.1.0 Rakefile
protobuf-3.3.6 Rakefile
protobuf-3.3.5 Rakefile
protobuf-3.3.4 Rakefile
protobuf-3.3.3 Rakefile
protobuf-3.3.2 Rakefile
protobuf-3.3.1 Rakefile
protobuf-3.3.0 Rakefile
protobuf-3.2.1 Rakefile
protobuf-3.2.0 Rakefile
protobuf-3.1.0 Rakefile
protobuf-3.0.5 Rakefile
protobuf-3.0.4 Rakefile
protobuf-3.0.3 Rakefile
protobuf-3.0.2 Rakefile