From 0a7586802762bbcc393323203779dea6575a6791 Mon Sep 17 00:00:00 2001 From: Ernest Landrito Date: Wed, 10 May 2017 10:11:02 -0700 Subject: [PATCH 1/2] Ruby: Update gemspec and add useful metadata files --- .../ruby/RubyPackageMetadataTransformer.java | 44 ++++++++++++--- .../metadata/PackageMetadataView.java | 5 ++ .../com/google/api/codegen/ruby/Gemfile.snip | 8 +++ .../com/google/api/codegen/ruby/gemspec.snip | 51 ++++++++--------- .../google/api/codegen/ruby/gitignore.snip | 11 ++++ .../google/api/codegen/ruby/rubocop.yml.snip | 56 +++++++++++++++++++ .../com/google/api/codegen/ruby/yardopts.snip | 10 ++++ .../testdata/ruby_Gemfile_library.baseline | 9 +++ .../ruby_doc_Gemfile_library.baseline | 9 +++ .../ruby_doc_gemspec_library.baseline | 55 +++++++++--------- .../ruby_doc_gitignore_library.baseline | 9 +++ .../ruby_doc_rubocop_library.baseline | 54 ++++++++++++++++++ .../ruby_doc_yardopts_library.baseline | 9 +++ .../testdata/ruby_gemspec_library.baseline | 55 +++++++++--------- .../testdata/ruby_gitignore_library.baseline | 9 +++ .../testdata/ruby_rubocop_library.baseline | 54 ++++++++++++++++++ .../testdata/ruby_yardopts_library.baseline | 9 +++ 17 files changed, 363 insertions(+), 94 deletions(-) create mode 100644 src/main/resources/com/google/api/codegen/ruby/gitignore.snip create mode 100644 src/main/resources/com/google/api/codegen/ruby/rubocop.yml.snip create mode 100644 src/main/resources/com/google/api/codegen/ruby/yardopts.snip create mode 100644 src/test/java/com/google/api/codegen/testdata/ruby_doc_gitignore_library.baseline create mode 100644 src/test/java/com/google/api/codegen/testdata/ruby_doc_rubocop_library.baseline create mode 100644 src/test/java/com/google/api/codegen/testdata/ruby_doc_yardopts_library.baseline create mode 100644 src/test/java/com/google/api/codegen/testdata/ruby_gitignore_library.baseline create mode 100644 src/test/java/com/google/api/codegen/testdata/ruby_rubocop_library.baseline create mode 100644 src/test/java/com/google/api/codegen/testdata/ruby_yardopts_library.baseline diff --git a/src/main/java/com/google/api/codegen/transformer/ruby/RubyPackageMetadataTransformer.java b/src/main/java/com/google/api/codegen/transformer/ruby/RubyPackageMetadataTransformer.java index 58d13b7812..b132d339c5 100644 --- a/src/main/java/com/google/api/codegen/transformer/ruby/RubyPackageMetadataTransformer.java +++ b/src/main/java/com/google/api/codegen/transformer/ruby/RubyPackageMetadataTransformer.java @@ -23,11 +23,13 @@ import com.google.api.codegen.transformer.ModelToViewTransformer; import com.google.api.codegen.transformer.ModelTypeTable; import com.google.api.codegen.transformer.PackageMetadataTransformer; +import com.google.api.codegen.transformer.SurfaceNamer; import com.google.api.codegen.util.ruby.RubyTypeTable; import com.google.api.codegen.viewmodel.ImportSectionView; import com.google.api.codegen.viewmodel.ViewModel; import com.google.api.tools.framework.model.Interface; import com.google.api.tools.framework.model.Model; +import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import java.util.List; @@ -37,6 +39,8 @@ public class RubyPackageMetadataTransformer implements ModelToViewTransformer { private static final List TOP_LEVEL_FILES = ImmutableList.of( "ruby/Gemfile.snip", "ruby/Rakefile.snip", "ruby/README.md.snip", "LICENSE.snip"); + private static final List TOP_LEVEL_DOT_FILES = + ImmutableList.of("ruby/gitignore.snip", "ruby/rubocop.yml.snip", "ruby/yardopts.snip"); private final FileHeaderTransformer fileHeaderTransformer = new FileHeaderTransformer(new RubyImportSectionTransformer()); private final PackageMetadataConfig packageConfig; @@ -50,7 +54,11 @@ public RubyPackageMetadataTransformer(PackageMetadataConfig packageConfig) { @Override public List getTemplateFileNames() { - return ImmutableList.builder().add(GEMSPEC_FILE).addAll(TOP_LEVEL_FILES).build(); + return ImmutableList.builder() + .add(GEMSPEC_FILE) + .addAll(TOP_LEVEL_FILES) + .addAll(TOP_LEVEL_DOT_FILES) + .build(); } @Override @@ -58,7 +66,8 @@ public List transform(Model model, GapicProductConfig productConfig) RubyPackageMetadataNamer namer = new RubyPackageMetadataNamer(productConfig.getPackageName()); return ImmutableList.builder() .add(generateGemspecView(model, namer)) - .addAll(generateMetadataViews(model, productConfig, namer)) + .addAll(generateMetadataViews(model, productConfig, namer, TOP_LEVEL_FILES)) + .addAll(generateMetadataViews(model, productConfig, namer, TOP_LEVEL_DOT_FILES, ".")) .build(); } @@ -71,10 +80,22 @@ private ViewModel generateGemspecView(Model model, RubyPackageMetadataNamer name } private List generateMetadataViews( - Model model, GapicProductConfig productConfig, RubyPackageMetadataNamer namer) { + Model model, + GapicProductConfig productConfig, + RubyPackageMetadataNamer namer, + List snippets) { + return generateMetadataViews(model, productConfig, namer, snippets, null); + } + + private List generateMetadataViews( + Model model, + GapicProductConfig productConfig, + RubyPackageMetadataNamer namer, + List snippets, + String filePrefix) { ImmutableList.Builder views = ImmutableList.builder(); - for (String template : TOP_LEVEL_FILES) { - views.add(generateMetadataView(model, productConfig, template, namer)); + for (String template : snippets) { + views.add(generateMetadataView(model, productConfig, template, namer, filePrefix)); } return views.build(); } @@ -83,9 +104,13 @@ private ViewModel generateMetadataView( Model model, GapicProductConfig productConfig, String template, - RubyPackageMetadataNamer namer) { + RubyPackageMetadataNamer namer, + String filePrefix) { String noLeadingRubyDir = template.startsWith(RUBY_PREFIX) ? template.substring(RUBY_PREFIX.length()) : template; + if (!Strings.isNullOrEmpty(filePrefix)) { + noLeadingRubyDir = filePrefix + noLeadingRubyDir; + } int extensionIndex = noLeadingRubyDir.lastIndexOf("."); String outputPath = noLeadingRubyDir.substring(0, extensionIndex); @@ -98,15 +123,16 @@ private ViewModel generateMetadataView( } } + SurfaceNamer surfaceNamer = new RubySurfaceNamer(productConfig.getPackageName()); + return metadataTransformer .generateMetadataView(packageConfig, model, template, outputPath, TargetLanguage.RUBY) .identifier(namer.getMetadataIdentifier()) .fileHeader( fileHeaderTransformer.generateFileHeader( - productConfig, - ImportSectionView.newBuilder().build(), - new RubySurfaceNamer(productConfig.getPackageName()))) + productConfig, ImportSectionView.newBuilder().build(), surfaceNamer)) .hasSmokeTests(hasSmokeTests) + .versionPath(surfaceNamer.getVersionIndexFileImportName()) .build(); } diff --git a/src/main/java/com/google/api/codegen/viewmodel/metadata/PackageMetadataView.java b/src/main/java/com/google/api/codegen/viewmodel/metadata/PackageMetadataView.java index aba218b2df..9b95159fe0 100644 --- a/src/main/java/com/google/api/codegen/viewmodel/metadata/PackageMetadataView.java +++ b/src/main/java/com/google/api/codegen/viewmodel/metadata/PackageMetadataView.java @@ -84,6 +84,9 @@ public String resourceRoot() { public abstract String protoPath(); + @Nullable + public abstract String versionPath(); + public abstract String author(); public abstract String email(); @@ -169,6 +172,8 @@ public abstract static class Builder { /** The path to the API protos in the googleapis repo. */ public abstract Builder protoPath(String val); + public abstract Builder versionPath(String val); + /** The author of the package. */ public abstract Builder author(String val); diff --git a/src/main/resources/com/google/api/codegen/ruby/Gemfile.snip b/src/main/resources/com/google/api/codegen/ruby/Gemfile.snip index 65f58d3b90..ae773ad40d 100644 --- a/src/main/resources/com/google/api/codegen/ruby/Gemfile.snip +++ b/src/main/resources/com/google/api/codegen/ruby/Gemfile.snip @@ -3,4 +3,12 @@ gemspec + gem "rake", "~> 11.0" + gem "gcloud-jsondoc", + git: "https://github.com/GoogleCloudPlatform/google-cloud-ruby.git", + branch: "gcloud-jsondoc" + + @# TEMP: rainbow (a dependency of rubocop) version 2.2 seems to have a problem, + @# so pinning to 2.1 for now. + gem "rainbow", "~> 2.1.0" @end diff --git a/src/main/resources/com/google/api/codegen/ruby/gemspec.snip b/src/main/resources/com/google/api/codegen/ruby/gemspec.snip index 905e108342..4e1fcd220c 100644 --- a/src/main/resources/com/google/api/codegen/ruby/gemspec.snip +++ b/src/main/resources/com/google/api/codegen/ruby/gemspec.snip @@ -2,36 +2,33 @@ @# -*- ruby -*- @# encoding: utf-8 - Gem::Specification.new do |s| - s.name = "{@metadata.identifier}" - s.version = "{@metadata.packageVersionBound.lower}" - - s.authors = ["{@metadata.author}"] - s.description = "{@metadata.fullName} client for Ruby." - s.email = "{@metadata.email}" - s.files = Dir.glob(File.join("lib", "**", "*.rb")) - s.files += Dir.glob(File.join('lib', '**', '*.json')) - s.files += %w(Rakefile README.md LICENSE) - s.homepage = "{@metadata.homepage}" - s.license = "{@metadata.licenseName}" - s.platform = Gem::Platform::RUBY - s.require_paths = ["lib"] - s.required_ruby_version = ">= 2.0.0" - s.requirements << "libgrpc ~> 1.0 needs to be installed" - s.summary = "GRPC library for {@metadata.fullName}" - - s.add_dependency "grpc", "~> {@metadata.grpcVersionBound.lower}" - s.add_dependency "googleauth", "~> {@metadata.authVersionBound.lower}" - s.add_dependency "google-gax", "~> {@metadata.gaxVersionBound.lower}" + Gem::Specification.new do |gem| + gem.name = "{@metadata.identifier}" + gem.version = "{@metadata.packageVersionBound.lower}" + + gem.authors = ["{@metadata.author}"] + gem.email = "{@metadata.email}" + gem.description = "{@metadata.identifier} is the official library for {@metadata.fullName}." + gem.summary = "API Client library for {@metadata.fullName}" + gem.homepage = "{@metadata.homepage}" + gem.license = "{@metadata.licenseName}" + + gem.platform = Gem::Platform::RUBY + + gem.files = `git ls-files -- lib/*`.split("\n") + + ["README.md", "LICENSE", ".yardopts"] + gem.require_paths = ["lib"] + + gem.required_ruby_version = ">= 2.0.0" + + gem.add_dependency "google-gax", "~> {@metadata.gaxVersionBound.lower}" @join packageDep : metadata.protoPackageDependencies - s.add_dependency "{@packageDep.name}", "~> {@packageDep.versionBound.lower}" + gem.add_dependency "{@packageDep.name}", "~> {@packageDep.versionBound.lower}" @end - s.add_development_dependency "bundler", "~> 1.9" - s.add_development_dependency "rake", "~> 10.4" - s.add_development_dependency "rubocop", "~> 0.32" - s.add_development_dependency "simplecov", "~> 0.9" - s.add_development_dependency "minitest", "~> 5.10" + gem.add_development_dependency "minitest", "~> 5.10" + gem.add_development_dependency "rubocop", "<= 0.35.1" + gem.add_development_dependency "simplecov", "~> 0.9" end @end diff --git a/src/main/resources/com/google/api/codegen/ruby/gitignore.snip b/src/main/resources/com/google/api/codegen/ruby/gitignore.snip new file mode 100644 index 0000000000..b3d930a10a --- /dev/null +++ b/src/main/resources/com/google/api/codegen/ruby/gitignore.snip @@ -0,0 +1,11 @@ +@snippet generate(metadata) + Gemfile.lock + coverage/* + doc/* + pkg/* + html/* + jsondoc/* + + # Ignore YARD stuffs + .yardoc +@end diff --git a/src/main/resources/com/google/api/codegen/ruby/rubocop.yml.snip b/src/main/resources/com/google/api/codegen/ruby/rubocop.yml.snip new file mode 100644 index 0000000000..f463a8acf4 --- /dev/null +++ b/src/main/resources/com/google/api/codegen/ruby/rubocop.yml.snip @@ -0,0 +1,56 @@ +@snippet generate(metadata) + AllCops: + Exclude: + - "{@metadata.identifier}.gemspec" + - "lib/{@metadata.protoPath}/**/*" + # This should be removed in the future after we are sanitizing client files. + - "lib/{@metadata.versionPath}/**/*" + - "Rakefile" + - "test/**/*" + + Documentation: + Enabled: false + + Style/StringLiterals: + EnforcedStyle: double_quotes + Style/MethodDefParentheses: + EnforcedStyle: require_no_parentheses + Style/NumericLiterals: + Enabled: false + Style/SpaceAroundOperators: + Enabled: false + Metrics/ClassLength: + Enabled: false + Style/EmptyLines: + Enabled: false + Style/EmptyElse: + Enabled: false + Style/HashSyntax: + Exclude: + - "lib/{@metadata.versionPath}/**/*" + Metrics/LineLength: + Exclude: + - "lib/{@metadata.versionPath}/**/*" + Metrics/CyclomaticComplexity: + Max: 10 + Metrics/PerceivedComplexity: + Max: 10 + Metrics/AbcSize: + Max: 25 + Exclude: + - "lib/{@metadata.versionPath}/**/*" + Metrics/MethodLength: + Max: 20 + Exclude: + - "lib/{@metadata.versionPath}/**/*" + Metrics/ParameterLists: + Enabled: false + Style/RescueModifier: + Enabled: false + Style/ClassVars: + Enabled: false + Style/TrivialAccessors: + Enabled: false + Style/FileName: + Enabled: false +@end diff --git a/src/main/resources/com/google/api/codegen/ruby/yardopts.snip b/src/main/resources/com/google/api/codegen/ruby/yardopts.snip new file mode 100644 index 0000000000..32e1110be1 --- /dev/null +++ b/src/main/resources/com/google/api/codegen/ruby/yardopts.snip @@ -0,0 +1,10 @@ +@snippet generate(metadata) + --no-private + --title={@metadata.fullName} + --exclude lib/{@metadata.versionPath} + --markup markdown + + ./lib/**/*.rb + - + README.md +@end diff --git a/src/test/java/com/google/api/codegen/testdata/ruby_Gemfile_library.baseline b/src/test/java/com/google/api/codegen/testdata/ruby_Gemfile_library.baseline index d7289bd560..45ef455faa 100644 --- a/src/test/java/com/google/api/codegen/testdata/ruby_Gemfile_library.baseline +++ b/src/test/java/com/google/api/codegen/testdata/ruby_Gemfile_library.baseline @@ -2,3 +2,12 @@ source 'https://rubygems.org' gemspec + +gem "rake", "~> 11.0" +gem "gcloud-jsondoc", + git: "https://github.com/GoogleCloudPlatform/google-cloud-ruby.git", + branch: "gcloud-jsondoc" + +# TEMP: rainbow (a dependency of rubocop) version 2.2 seems to have a problem, +# so pinning to 2.1 for now. +gem "rainbow", "~> 2.1.0" diff --git a/src/test/java/com/google/api/codegen/testdata/ruby_doc_Gemfile_library.baseline b/src/test/java/com/google/api/codegen/testdata/ruby_doc_Gemfile_library.baseline index d7289bd560..45ef455faa 100644 --- a/src/test/java/com/google/api/codegen/testdata/ruby_doc_Gemfile_library.baseline +++ b/src/test/java/com/google/api/codegen/testdata/ruby_doc_Gemfile_library.baseline @@ -2,3 +2,12 @@ source 'https://rubygems.org' gemspec + +gem "rake", "~> 11.0" +gem "gcloud-jsondoc", + git: "https://github.com/GoogleCloudPlatform/google-cloud-ruby.git", + branch: "gcloud-jsondoc" + +# TEMP: rainbow (a dependency of rubocop) version 2.2 seems to have a problem, +# so pinning to 2.1 for now. +gem "rainbow", "~> 2.1.0" diff --git a/src/test/java/com/google/api/codegen/testdata/ruby_doc_gemspec_library.baseline b/src/test/java/com/google/api/codegen/testdata/ruby_doc_gemspec_library.baseline index b79e4c585c..861a86ec80 100644 --- a/src/test/java/com/google/api/codegen/testdata/ruby_doc_gemspec_library.baseline +++ b/src/test/java/com/google/api/codegen/testdata/ruby_doc_gemspec_library.baseline @@ -2,34 +2,31 @@ # -*- ruby -*- # encoding: utf-8 -Gem::Specification.new do |s| - s.name = "library" - s.version = "0.6.8" - - s.authors = ["Google, Inc."] - s.description = "Google Example Library API client for Ruby." - s.email = "googleapis-packages@google.com" - s.files = Dir.glob(File.join("lib", "**", "*.rb")) - s.files += Dir.glob(File.join('lib', '**', '*.json')) - s.files += %w(Rakefile README.md LICENSE) - s.homepage = "https://github.com/googleapis/googleapis" - s.license = "Apache-2.0" - s.platform = Gem::Platform::RUBY - s.require_paths = ["lib"] - s.required_ruby_version = ">= 2.0.0" - s.requirements << "libgrpc ~> 1.0 needs to be installed" - s.summary = "GRPC library for Google Example Library API" - - s.add_dependency "grpc", "~> 1.0" - s.add_dependency "googleauth", "~> 0.5.1" - s.add_dependency "google-gax", "~> 0.8.0" - s.add_dependency "google-common-protos", "~> 1.3.1" - s.add_dependency "google-some-other-package-v1", "~> 0.2.1" - - s.add_development_dependency "bundler", "~> 1.9" - s.add_development_dependency "rake", "~> 10.4" - s.add_development_dependency "rubocop", "~> 0.32" - s.add_development_dependency "simplecov", "~> 0.9" - s.add_development_dependency "minitest", "~> 5.10" +Gem::Specification.new do |gem| + gem.name = "library" + gem.version = "0.6.8" + + gem.authors = ["Google, Inc."] + gem.email = "googleapis-packages@google.com" + gem.description = "library is the official library for Google Example Library API." + gem.summary = "API Client library for Google Example Library API" + gem.homepage = "https://github.com/googleapis/googleapis" + gem.license = "Apache-2.0" + + gem.platform = Gem::Platform::RUBY + + gem.files = `git ls-files -- lib/*`.split("\n") + + ["README.md", "LICENSE", ".yardopts"] + gem.require_paths = ["lib"] + + gem.required_ruby_version = ">= 2.0.0" + + gem.add_dependency "google-gax", "~> 0.8.0" + gem.add_dependency "google-common-protos", "~> 1.3.1" + gem.add_dependency "google-some-other-package-v1", "~> 0.2.1" + + gem.add_development_dependency "minitest", "~> 5.10" + gem.add_development_dependency "rubocop", "<= 0.35.1" + gem.add_development_dependency "simplecov", "~> 0.9" end diff --git a/src/test/java/com/google/api/codegen/testdata/ruby_doc_gitignore_library.baseline b/src/test/java/com/google/api/codegen/testdata/ruby_doc_gitignore_library.baseline new file mode 100644 index 0000000000..9d0bcfabcf --- /dev/null +++ b/src/test/java/com/google/api/codegen/testdata/ruby_doc_gitignore_library.baseline @@ -0,0 +1,9 @@ +============== file: .gitignore ============== +Gemfile.lock +coverage/* +doc/* +pkg/* +html/* +jsondoc/* + +.yardoc diff --git a/src/test/java/com/google/api/codegen/testdata/ruby_doc_rubocop_library.baseline b/src/test/java/com/google/api/codegen/testdata/ruby_doc_rubocop_library.baseline new file mode 100644 index 0000000000..3113cd4443 --- /dev/null +++ b/src/test/java/com/google/api/codegen/testdata/ruby_doc_rubocop_library.baseline @@ -0,0 +1,54 @@ +============== file: .rubocop.yml ============== +AllCops: + Exclude: + - "library.gemspec" + - "lib/google/library/**/*" + - "lib/library/v1/**/*" + - "Rakefile" + - "test/**/*" + +Documentation: + Enabled: false + +Style/StringLiterals: + EnforcedStyle: double_quotes +Style/MethodDefParentheses: + EnforcedStyle: require_no_parentheses +Style/NumericLiterals: + Enabled: false +Style/SpaceAroundOperators: + Enabled: false +Metrics/ClassLength: + Enabled: false +Style/EmptyLines: + Enabled: false +Style/EmptyElse: + Enabled: false +Style/HashSyntax: + Exclude: + - "lib/library/v1/**/*" +Metrics/LineLength: + Exclude: + - "lib/library/v1/**/*" +Metrics/CyclomaticComplexity: + Max: 10 +Metrics/PerceivedComplexity: + Max: 10 +Metrics/AbcSize: + Max: 25 + Exclude: + - "lib/library/v1/**/*" +Metrics/MethodLength: + Max: 20 + Exclude: + - "lib/library/v1/**/*" +Metrics/ParameterLists: + Enabled: false +Style/RescueModifier: + Enabled: false +Style/ClassVars: + Enabled: false +Style/TrivialAccessors: + Enabled: false +Style/FileName: + Enabled: false diff --git a/src/test/java/com/google/api/codegen/testdata/ruby_doc_yardopts_library.baseline b/src/test/java/com/google/api/codegen/testdata/ruby_doc_yardopts_library.baseline new file mode 100644 index 0000000000..e355f5ca70 --- /dev/null +++ b/src/test/java/com/google/api/codegen/testdata/ruby_doc_yardopts_library.baseline @@ -0,0 +1,9 @@ +============== file: .yardopts ============== +--no-private +--title=Google Example Library API +--exclude lib/library/v1 +--markup markdown + +./lib/**/*.rb +- +README.md diff --git a/src/test/java/com/google/api/codegen/testdata/ruby_gemspec_library.baseline b/src/test/java/com/google/api/codegen/testdata/ruby_gemspec_library.baseline index b79e4c585c..861a86ec80 100644 --- a/src/test/java/com/google/api/codegen/testdata/ruby_gemspec_library.baseline +++ b/src/test/java/com/google/api/codegen/testdata/ruby_gemspec_library.baseline @@ -2,34 +2,31 @@ # -*- ruby -*- # encoding: utf-8 -Gem::Specification.new do |s| - s.name = "library" - s.version = "0.6.8" - - s.authors = ["Google, Inc."] - s.description = "Google Example Library API client for Ruby." - s.email = "googleapis-packages@google.com" - s.files = Dir.glob(File.join("lib", "**", "*.rb")) - s.files += Dir.glob(File.join('lib', '**', '*.json')) - s.files += %w(Rakefile README.md LICENSE) - s.homepage = "https://github.com/googleapis/googleapis" - s.license = "Apache-2.0" - s.platform = Gem::Platform::RUBY - s.require_paths = ["lib"] - s.required_ruby_version = ">= 2.0.0" - s.requirements << "libgrpc ~> 1.0 needs to be installed" - s.summary = "GRPC library for Google Example Library API" - - s.add_dependency "grpc", "~> 1.0" - s.add_dependency "googleauth", "~> 0.5.1" - s.add_dependency "google-gax", "~> 0.8.0" - s.add_dependency "google-common-protos", "~> 1.3.1" - s.add_dependency "google-some-other-package-v1", "~> 0.2.1" - - s.add_development_dependency "bundler", "~> 1.9" - s.add_development_dependency "rake", "~> 10.4" - s.add_development_dependency "rubocop", "~> 0.32" - s.add_development_dependency "simplecov", "~> 0.9" - s.add_development_dependency "minitest", "~> 5.10" +Gem::Specification.new do |gem| + gem.name = "library" + gem.version = "0.6.8" + + gem.authors = ["Google, Inc."] + gem.email = "googleapis-packages@google.com" + gem.description = "library is the official library for Google Example Library API." + gem.summary = "API Client library for Google Example Library API" + gem.homepage = "https://github.com/googleapis/googleapis" + gem.license = "Apache-2.0" + + gem.platform = Gem::Platform::RUBY + + gem.files = `git ls-files -- lib/*`.split("\n") + + ["README.md", "LICENSE", ".yardopts"] + gem.require_paths = ["lib"] + + gem.required_ruby_version = ">= 2.0.0" + + gem.add_dependency "google-gax", "~> 0.8.0" + gem.add_dependency "google-common-protos", "~> 1.3.1" + gem.add_dependency "google-some-other-package-v1", "~> 0.2.1" + + gem.add_development_dependency "minitest", "~> 5.10" + gem.add_development_dependency "rubocop", "<= 0.35.1" + gem.add_development_dependency "simplecov", "~> 0.9" end diff --git a/src/test/java/com/google/api/codegen/testdata/ruby_gitignore_library.baseline b/src/test/java/com/google/api/codegen/testdata/ruby_gitignore_library.baseline new file mode 100644 index 0000000000..9d0bcfabcf --- /dev/null +++ b/src/test/java/com/google/api/codegen/testdata/ruby_gitignore_library.baseline @@ -0,0 +1,9 @@ +============== file: .gitignore ============== +Gemfile.lock +coverage/* +doc/* +pkg/* +html/* +jsondoc/* + +.yardoc diff --git a/src/test/java/com/google/api/codegen/testdata/ruby_rubocop_library.baseline b/src/test/java/com/google/api/codegen/testdata/ruby_rubocop_library.baseline new file mode 100644 index 0000000000..3113cd4443 --- /dev/null +++ b/src/test/java/com/google/api/codegen/testdata/ruby_rubocop_library.baseline @@ -0,0 +1,54 @@ +============== file: .rubocop.yml ============== +AllCops: + Exclude: + - "library.gemspec" + - "lib/google/library/**/*" + - "lib/library/v1/**/*" + - "Rakefile" + - "test/**/*" + +Documentation: + Enabled: false + +Style/StringLiterals: + EnforcedStyle: double_quotes +Style/MethodDefParentheses: + EnforcedStyle: require_no_parentheses +Style/NumericLiterals: + Enabled: false +Style/SpaceAroundOperators: + Enabled: false +Metrics/ClassLength: + Enabled: false +Style/EmptyLines: + Enabled: false +Style/EmptyElse: + Enabled: false +Style/HashSyntax: + Exclude: + - "lib/library/v1/**/*" +Metrics/LineLength: + Exclude: + - "lib/library/v1/**/*" +Metrics/CyclomaticComplexity: + Max: 10 +Metrics/PerceivedComplexity: + Max: 10 +Metrics/AbcSize: + Max: 25 + Exclude: + - "lib/library/v1/**/*" +Metrics/MethodLength: + Max: 20 + Exclude: + - "lib/library/v1/**/*" +Metrics/ParameterLists: + Enabled: false +Style/RescueModifier: + Enabled: false +Style/ClassVars: + Enabled: false +Style/TrivialAccessors: + Enabled: false +Style/FileName: + Enabled: false diff --git a/src/test/java/com/google/api/codegen/testdata/ruby_yardopts_library.baseline b/src/test/java/com/google/api/codegen/testdata/ruby_yardopts_library.baseline new file mode 100644 index 0000000000..e355f5ca70 --- /dev/null +++ b/src/test/java/com/google/api/codegen/testdata/ruby_yardopts_library.baseline @@ -0,0 +1,9 @@ +============== file: .yardopts ============== +--no-private +--title=Google Example Library API +--exclude lib/library/v1 +--markup markdown + +./lib/**/*.rb +- +README.md From 384594460b5b01a3b966fd9a8dfccf5d8df462e9 Mon Sep 17 00:00:00 2001 From: Ernest Landrito Date: Wed, 17 May 2017 18:37:56 -0700 Subject: [PATCH 2/2] Add IDE files --- .../transformer/ruby/RubyPackageMetadataTransformer.java | 6 +----- .../resources/com/google/api/codegen/ruby/gitignore.snip | 6 +++++- .../codegen/testdata/ruby_doc_gitignore_library.baseline | 5 +++++ .../api/codegen/testdata/ruby_gitignore_library.baseline | 5 +++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/google/api/codegen/transformer/ruby/RubyPackageMetadataTransformer.java b/src/main/java/com/google/api/codegen/transformer/ruby/RubyPackageMetadataTransformer.java index 0d2e8b8ade..dc44880fda 100644 --- a/src/main/java/com/google/api/codegen/transformer/ruby/RubyPackageMetadataTransformer.java +++ b/src/main/java/com/google/api/codegen/transformer/ruby/RubyPackageMetadataTransformer.java @@ -27,11 +27,8 @@ import com.google.api.codegen.transformer.ModelToViewTransformer; import com.google.api.codegen.transformer.ModelTypeTable; import com.google.api.codegen.transformer.PackageMetadataTransformer; -<<<<<<< HEAD import com.google.api.codegen.transformer.SurfaceNamer; -======= import com.google.api.codegen.transformer.TestCaseTransformer; ->>>>>>> 2f4e1211124adf97089742a3e72214e3ac44254f import com.google.api.codegen.util.ruby.RubyTypeTable; import com.google.api.codegen.util.testing.StandardValueProducer; import com.google.api.codegen.util.testing.ValueProducer; @@ -53,8 +50,7 @@ public class RubyPackageMetadataTransformer implements ModelToViewTransformer { private static final String README_FILE = "ruby/README.md.snip"; private static final String README_OUTPUT_FILE = "README.md"; private static final List TOP_LEVEL_FILES = - ImmutableList.of( - "ruby/Gemfile.snip", "ruby/Rakefile.snip", "ruby/README.md.snip", "LICENSE.snip"); + ImmutableList.of("ruby/Gemfile.snip", "ruby/Rakefile.snip", "LICENSE.snip"); private static final List TOP_LEVEL_DOT_FILES = ImmutableList.of("ruby/gitignore.snip", "ruby/rubocop.yml.snip", "ruby/yardopts.snip"); diff --git a/src/main/resources/com/google/api/codegen/ruby/gitignore.snip b/src/main/resources/com/google/api/codegen/ruby/gitignore.snip index b3d930a10a..2ef918366c 100644 --- a/src/main/resources/com/google/api/codegen/ruby/gitignore.snip +++ b/src/main/resources/com/google/api/codegen/ruby/gitignore.snip @@ -6,6 +6,10 @@ html/* jsondoc/* - # Ignore YARD stuffs + @# Ignore YARD stuffs .yardoc + + @# IDE settings + .idea + *.iml @end diff --git a/src/test/java/com/google/api/codegen/testdata/ruby_doc_gitignore_library.baseline b/src/test/java/com/google/api/codegen/testdata/ruby_doc_gitignore_library.baseline index 9d0bcfabcf..9b3326aaac 100644 --- a/src/test/java/com/google/api/codegen/testdata/ruby_doc_gitignore_library.baseline +++ b/src/test/java/com/google/api/codegen/testdata/ruby_doc_gitignore_library.baseline @@ -6,4 +6,9 @@ pkg/* html/* jsondoc/* +# Ignore YARD stuffs .yardoc + +# IDE settings +.idea +*.iml diff --git a/src/test/java/com/google/api/codegen/testdata/ruby_gitignore_library.baseline b/src/test/java/com/google/api/codegen/testdata/ruby_gitignore_library.baseline index 9d0bcfabcf..1d760dcffc 100644 --- a/src/test/java/com/google/api/codegen/testdata/ruby_gitignore_library.baseline +++ b/src/test/java/com/google/api/codegen/testdata/ruby_gitignore_library.baseline @@ -6,4 +6,9 @@ pkg/* html/* jsondoc/* +# Ignore YARD stuffs .yardoc + +# IDE settings +.idea +*.iml \ No newline at end of file