chore: Extract generator into google-apis-generator gem (#2143)

This commit is contained in:
Daniel Azuma 2021-01-01 12:29:10 -08:00 committed by GitHub
parent abb3c968fe
commit 1cc46b843e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 533 additions and 41 deletions

View File

@ -4,6 +4,7 @@ source 'https://rubygems.org'
gemspec gemspec
gem 'google-apis-core', path: '../google-apis-core' gem 'google-apis-core', path: '../google-apis-core'
gem 'google-apis-generator', path: '../google-apis-generator'
group :development do group :development do
gem 'bundler', '>= 1.7' gem 'bundler', '>= 1.7'

View File

@ -16,16 +16,13 @@ Gem::Specification.new do |gem|
gem.files = Dir.glob("lib/**/*") + gem.files = Dir.glob("lib/**/*") +
Dir.glob("generated/**/*.rb") + Dir.glob("generated/**/*.rb") +
Dir.glob("docs/**/*") + Dir.glob("docs/**/*") +
Dir.glob("bin/**/*") +
Dir.glob("*.md") + Dir.glob("*.md") +
[".yardopts", "LICENSE"] [".yardopts", "LICENSE"]
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
gem.require_paths = %w[lib generated] gem.require_paths = %w[lib generated]
gem.required_ruby_version = '>= 2.4' gem.required_ruby_version = '>= 2.4'
gem.add_runtime_dependency 'google-apis-core', '~> 0.1' gem.add_runtime_dependency 'google-apis-core', '~> 0.1'
gem.add_development_dependency 'thor', '~> 0.19' gem.add_runtime_dependency 'google-apis-generator', '~> 0.1'
gem.add_development_dependency 'activesupport', '>= 4.2', '< 5.1'
end end

View File

@ -1,17 +1,20 @@
# Core classes for Google REST Clients # Generator for Google REST Clients
This library includes common base classes and dependencies used by legacy REST This library implements the code generator used by legacy REST clients for
clients for Google APIs. It is used by client libraries, but you should not Google APIs. It automatically generates client gems given discovery documents.
need to install it by itself. Google-managed clients for publicly-available APIs are maintained using this
tool, and users may also use it to generate clients for private or early-access
APIs.
## Documentation ## Usage
More detailed descriptions of the Google legacy REST clients are available in two documents. To generate from a local discovery file:
* The [Usage Guide](https://github.com/googleapis/google-api-ruby-client/blob/master/docs/usage-guide.md) discusses how to make API calls, how to use the provided data structures, and how to work the various features of the client library, including media upload and download, error handling, retries, pagination, and logging. $ generate-api gen <outdir> --file=<path>
* The [Auth Guide](https://github.com/googleapis/google-api-ruby-client/blob/master/docs/auth-guide.md) discusses authentication in the client libraries, including API keys, OAuth 2.0, service accounts, and environment variables.
For reference information on specific calls in the clients, see the {Google::Apis class reference docs}. A URL can also be specified:
$ generate-api gen <outdir> --url=<url>
## License ## License

View File

@ -0,0 +1,13 @@
--hide-void-return
--no-private
--verbose
--markup-provider=redcarpet
--markup=markdown
--title=google-apis-generator
--main OVERVIEW.md
lib/**/*.rb
-
OVERVIEW.md
CHANGELOG.md
LICENSE.md

View File

@ -0,0 +1,5 @@
# Release History
### v0.1.0 (2021-01-01)
* Initial release, extracted from google-api-client.

View File

@ -0,0 +1,40 @@
source 'https://rubygems.org'
gemspec
group :development do
gem 'bundler', '>= 1.7'
gem 'rake', '~> 11.2'
gem 'rspec', '~> 3.1'
gem 'json_spec', '~> 1.1'
gem 'webmock', '~> 2.1'
gem 'simplecov', '~> 0.12'
gem 'coveralls', '~> 0.8'
gem 'rubocop', '~> 0.49.0'
gem 'launchy', '~> 2.4'
gem 'dotenv', '~> 2.0'
gem 'fakefs', '~> 0.6', require: "fakefs/safe"
gem 'google-id-token', '~> 1.3'
gem 'os', '~> 0.9'
gem 'rmail', '~> 1.1'
gem 'redis', '~> 3.2'
gem 'logging', '~> 2.2'
gem 'opencensus', '~> 0.4'
gem 'httparty'
end
platforms :jruby do
group :development do
gem 'jruby-openssl'
end
end
platforms :ruby do
group :development do
gem 'yard', '~> 0.9', '>= 0.9.11'
gem 'redcarpet', '~> 3.2'
gem 'github-markup', '~> 1.3'
gem 'pry-doc', '~> 0.8'
gem 'pry-byebug', '~> 3.2'
end
end

View File

@ -0,0 +1,22 @@
# Core classes for Google REST Clients
This library includes common base classes and dependencies used by legacy REST
clients for Google APIs. It is used by client libraries, but you should not
need to install it by itself.
## Documentation
More detailed descriptions of the Google legacy REST clients are available in two documents.
* The [Usage Guide](https://github.com/googleapis/google-api-ruby-client/blob/master/docs/usage-guide.md) discusses how to make API calls, how to use the provided data structures, and how to work the various features of the client library, including media upload and download, error handling, retries, pagination, and logging.
* The [Auth Guide](https://github.com/googleapis/google-api-ruby-client/blob/master/docs/auth-guide.md) discusses authentication in the client libraries, including API keys, OAuth 2.0, service accounts, and environment variables.
For reference information on specific calls in the clients, see the {Google::Apis class reference docs}.
## License
This library is licensed under Apache 2.0. Full license text is available in the {file:LICENSE.md LICENSE}.
## Support
Please [report bugs at the project on Github](https://github.com/google/google-api-ruby-client/issues). Don't hesitate to [ask questions](http://stackoverflow.com/questions/tagged/google-api-ruby-client) about the client or APIs on [StackOverflow](http://stackoverflow.com).

View File

@ -0,0 +1,38 @@
require "bundler/gem_tasks"
task :release_gem do
Rake::Task["build"].invoke
Rake::Task["release:rubygem_push"].invoke
end
require 'rubocop/rake_task'
desc 'Run RuboCop on the lib directory'
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = ['lib/**/*.rb']
# only show the files with failures
task.formatters = ['progress']
# don't abort rake on failure
task.fail_on_error = false
end
require 'rake/clean'
CLOBBER.include('coverage', 'doc')
CLEAN.include('.yardoc')
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
begin
require 'yard'
require 'yard/rake/yardoc_task'
YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb', 'generated/**/*.rb']
t.options = ['--verbose', '--markup', 'markdown']
end
rescue LoadError
task :yard
puts "YARD not available"
end
task :ci => [:spec, :yard, :build]
task :default => :ci

View File

@ -1,16 +1,14 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
require 'thor' require 'thor'
rescue LoadError => e
puts "Thor is required. Please install the gem with development dependencies."
exit 1
end
require 'open-uri' require 'open-uri'
require 'google/apis/discovery_v1'
require 'logger' require 'logger'
require 'psych' require 'psych'
require 'active_support'
require 'active_support/core_ext'
require 'google/apis'
require 'google/apis/generator'
require 'google/apis/discovery_v1'
module Google module Google
class ApiGenerator < Thor class ApiGenerator < Thor
@ -21,8 +19,8 @@ module Google
include Thor::Actions include Thor::Actions
Google::Apis::ClientOptions.default.application_name = "generate-api" Google::Apis::ClientOptions.default.application_name = "google-apis-generator"
Google::Apis::ClientOptions.default.application_version = Google::Apis::VERSION Google::Apis::ClientOptions.default.application_version = Google::Apis::Generator::VERSION
Discovery = Google::Apis::DiscoveryV1 Discovery = Google::Apis::DiscoveryV1
@ -31,8 +29,6 @@ module Google
verbose: :boolean, names: :string, names_out: :string, api: :string, verbose: :boolean, names: :string, names_out: :string, api: :string,
clean: :boolean, spot_check: :boolean clean: :boolean, spot_check: :boolean
def gen(dir) def gen(dir)
ensure_active_support
require 'google/apis/generator'
self.destination_root = dir self.destination_root = dir
Google::Apis.logger.level = Logger::DEBUG if options[:verbose] Google::Apis.logger.level = Logger::DEBUG if options[:verbose]
@ -194,26 +190,13 @@ module Google
end end
def updater def updater
@updater ||= begin @updater ||= Google::Apis::Generator::Updater.new
require 'google/apis/generator/updater'
Google::Apis::Generator::Updater.new
end
end end
def api_list_config def api_list_config
@api_list_config ||= Psych.load_file(__dir__ + "/../../api_list_config.yaml") @api_list_config ||= Psych.load_file(__dir__ + "/../../api_list_config.yaml")
end end
def ensure_active_support
begin
require 'active_support'
require 'active_support/inflector'
require 'active_support/core_ext'
rescue LoadError => e
error_and_exit('ActiveSupport is required. Please run:', 'gem install activesupport')
end
end
def error_and_exit(*messages) def error_and_exit(*messages)
messages.each { |msg| error(msg) } messages.each { |msg| error(msg) }
exit 1 exit 1

View File

@ -0,0 +1,28 @@
require File.expand_path("lib/google/apis/generator/version", __dir__)
Gem::Specification.new do |gem|
gem.name = "google-apis-generator"
gem.version = Google::Apis::Generator::VERSION
gem.authors = ["Google LLC"]
gem.email = "googleapis-packages@google.com"
gem.summary = "Code generator for legacy Google REST clients"
gem.homepage = "https://github.com/google/google-api-ruby-client"
gem.license = "Apache-2.0"
gem.metadata = {
"bug_tracker_uri" => "https://github.com/googleapis/google-api-ruby-client/issues",
"changelog_uri" => "https://github.com/googleapis/google-api-ruby-client/tree/master/google-apis-generator/CHANGELOG.md",
"documentation_uri" => "https://googleapis.dev/ruby/google-apis-core/v#{Google::Apis::Generator::VERSION}",
"source_code_uri" => "https://github.com/googleapis/google-api-ruby-client/tree/master/google-apis-generator"
}
gem.files = Dir.glob("lib/**/*.rb") + Dir.glob("bin/*") + Dir.glob("*.md") + [".yardopts"]
gem.executables = ["generate-api"]
gem.require_paths = ["lib"]
gem.required_ruby_version = ">= 2.4"
gem.add_runtime_dependency "activesupport", ">= 5.0"
gem.add_runtime_dependency "gems", "~> 1.2"
gem.add_runtime_dependency "google-apis-core", "~> 0.1"
gem.add_runtime_dependency "google-apis-discovery_v1", "~> 0.0"
gem.add_runtime_dependency "thor", "~> 0.20"
end

View File

@ -16,7 +16,10 @@ require 'google/apis/discovery_v1'
require 'google/apis/generator/annotator' require 'google/apis/generator/annotator'
require 'google/apis/generator/model' require 'google/apis/generator/model'
require 'google/apis/generator/template' require 'google/apis/generator/template'
require 'google/apis/generator/updater'
require 'google/apis/generator/version' require 'google/apis/generator/version'
require 'active_support'
require 'active_support/core_ext'
require 'active_support/inflector' require 'active_support/inflector'
require 'yaml' require 'yaml'

View File

@ -1,3 +1,5 @@
require 'active_support/inflector'
module Google module Google
module Apis module Apis
# @private # @private

View File

@ -0,0 +1,2 @@
--color
--format documentation

View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,153 @@
# Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SPEC_DIR = File.expand_path(File.dirname(__FILE__))
ROOT_DIR = File.expand_path(File.join(SPEC_DIR, '..'))
LIB_DIR = File.expand_path(File.join(ROOT_DIR, 'lib'))
GENERATED_DIR = File.expand_path(File.join(ROOT_DIR, 'generated'))
FIXTURES_DIR = File.expand_path(File.join(SPEC_DIR, 'fixtures'))
$LOAD_PATH.uniq!
if defined?(JRUBY_VERSION)
puts 'Skipping coverage on JRuby'
else
# set up coverage
require 'simplecov'
require 'coveralls'
SimpleCov.formatters = [
Coveralls::SimpleCov::Formatter,
SimpleCov::Formatter::HTMLFormatter
]
SimpleCov.start do
add_filter '/spec/'
add_filter '/generated/'
end
end
require 'rspec'
require 'webmock/rspec'
require 'fakefs/spec_helpers'
require 'json_spec'
require 'logging'
require 'ostruct'
require 'rspec/logging_helper'
require 'google/apis'
require 'google/apis/core/base_service'
# Configure RSpec to capture log messages for each test. The output from the
# logs will be stored in the @log_output variable. It is a StringIO instance.
RSpec.configure do |config|
include RSpec::LoggingHelper
config.include FakeFS::SpecHelpers, fakefs: true
config.include JsonSpec::Helpers
config.include WebMock::API
config.capture_log_messages
Google::Apis.logger.level = Logger::DEBUG
WebMock::Config.instance.query_values_notation = :flat_array
end
[JsonSpec::Matchers::BeJsonEql,
JsonSpec::Matchers::IncludeJson,
JsonSpec::Matchers::HaveJsonType,
JsonSpec::Matchers::HaveJsonSize,
JsonSpec::Matchers::HaveJsonPath].each do |klass|
klass.send(:alias_method, :===, :matches?)
end
RSpec.shared_context 'HTTP client' do
let(:client) do
Google::Apis::Core::BaseService.new('', '').client
end
end
module TestHelpers
include WebMock::API
include WebMock::Matchers
end
# Enable retries for tests
Google::Apis::RequestOptions.default.retries = 5
# Allow testing different adapters
Google::Apis::ClientOptions.default.use_net_http = true if ENV['USE_NET_HTTP']
# Temporarily patch WebMock to allow chunked responses for Net::HTTP
module Net
module WebMockHTTPResponse
def eval_chunk(chunk)
chunk if chunk.is_a?(String)
chunk.read if chunk.is_a?(IO)
chunk.call if chunk.is_a?(Proc)
fail chunk if chunk.is_a?(Class)
chunk
end
def read_body(dest = nil, &block)
if !(defined?(@__read_body_previously_called).nil?) && @__read_body_previously_called
return super
end
return @body if dest.nil? && block.nil?
fail ArgumentError.new('both arg and block given for HTTP method') if dest && block
return nil if @body.nil?
dest ||= ::Net::ReadAdapter.new(block)
body_parts = Array(@body)
body_parts.each do |chunk|
chunk = eval_chunk(chunk)
dest << chunk
end
@body = dest
ensure
# allow subsequent calls to #read_body to proceed as normal, without our hack...
@__read_body_previously_called = true
end
end
end
class WebMockHTTPClient
def eval_chunk(chunk)
chunk if chunk.is_a?(String)
chunk.read if chunk.is_a?(IO)
chunk.call if chunk.is_a?(Proc)
fail HTTPClient::TimeoutError if chunk == ::Timeout::Error
fail chunk if chunk.is_a?(Class)
chunk
end
def build_httpclient_response(webmock_response, stream = false, req_header = nil, &block)
body = stream ? StringIO.new(webmock_response.body) : webmock_response.body
response = HTTP::Message.new_response(body, req_header)
response.header.init_response(webmock_response.status[0])
response.reason = webmock_response.status[1]
webmock_response.headers.to_a.each { |name, value| response.header.set(name, value) }
raise HTTPClient::TimeoutError if webmock_response.should_timeout
webmock_response.raise_error_if_any
body_parts = Array(webmock_response.body)
body_parts.each do |chunk|
chunk = eval_chunk(chunk)
block.call(response, chunk) if block
end
response
end
end
def run_integration_tests?
ENV['GOOGLE_APPLICATION_CREDENTIALS'] && ENV['GOOGLE_PROJECT_ID']
end

View File

@ -4,5 +4,5 @@
DIR=$(dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )) DIR=$(dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
cd google-api-client cd google-apis-generator
echo 'a' | bundle exec bin/generate-api gen $DIR/generated --from-discovery --no-preferred-only --names=$DIR/api_names.yaml --names-out=$DIR/api_names_out.yaml echo 'a' | bundle exec bin/generate-api gen $DIR/generated --from-discovery --no-preferred-only --names=$DIR/api_names.yaml --names-out=$DIR/api_names_out.yaml

View File

@ -9,7 +9,7 @@ def execute cmd
abort unless system cmd abort unless system cmd
end end
Dir.chdir "google-api-client" Dir.chdir "google-apis-generator"
execute "bundle install" execute "bundle install"