Class: Gapic::Runner
- Inherits:
-
Object
- Object
- Gapic::Runner
- Defined in:
- lib/gapic/runner.rb
Overview
TODO: Enter docs Dooooooooocs!!!
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Class Method Summary collapse
-
.run(request, generator: nil) ⇒ Google::Protobuf::Compiler::CodeGeneratorResponse
Run protoc generation.
Instance Method Summary collapse
-
#initialize(request) ⇒ Runner
constructor
Initializes the runner.
-
#run(generator_type: nil) ⇒ Google::Protobuf::Compiler::CodeGeneratorResponse
Run protoc generation.
Constructor Details
#initialize(request) ⇒ Runner
Initializes the runner.
29 30 31 |
# File 'lib/gapic/runner.rb', line 29 def initialize request @request = request end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
25 26 27 |
# File 'lib/gapic/runner.rb', line 25 def request @request end |
Class Method Details
.run(request, generator: nil) ⇒ Google::Protobuf::Compiler::CodeGeneratorResponse
Run protoc generation.
59 60 61 |
# File 'lib/gapic/runner.rb', line 59 def self.run request, generator: nil new(request).run generator_type: generator end |
Instance Method Details
#run(generator_type: nil) ⇒ Google::Protobuf::Compiler::CodeGeneratorResponse
Run protoc generation.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/gapic/runner.rb', line 36 def run generator_type: nil # Create an API Schema from the FileDescriptorProtos api = Gapic::Schema::Api.new request write_binary_file! api # Retrieve generator type from protoc_options if not already provided. generator_type ||= api.["generator"] # Find the generator for the generator type. generator = Gapic::Generator.find generator_type # Create and run the generator from the API. output_files = generator.new(api).generate # Create and write the response Google::Protobuf::Compiler::CodeGeneratorResponse.new \ file: output_files end |