Skip to content

Commit 3594c53

Browse files
authored
feat(generator): Generate toys file for each client (googleapis#23217)
1 parent 89d5f72 commit 3594c53

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

google-apis-generator/lib/google/apis/generator.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def render(json)
7979
result.files[result.version_path] = render_template("initial-gem_version.rb", context)
8080
result.files[File.join(spec_path, "generated_spec.rb")] = render_template("generated_spec.rb", context)
8181
result.files[File.join(base_path, ".repo-metadata.json")] = render_template("repo-metadata.json", context)
82+
result.files[File.join(base_path, ".toys.rb")] = render_template("toys.rb", context)
8283
result
8384
end
8485

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
expand :clean, paths: :gitignore
2+
3+
expand :rspec do |t|
4+
t.libs = ["lib", "spec"]
5+
t.use_bundler
6+
end
7+
8+
expand :yardoc do |t|
9+
t.generate_output_flag = true
10+
t.use_bundler
11+
end
12+
13+
expand :gem_build
14+
15+
tool "bundle" do
16+
flag :update
17+
18+
include :exec, e: true
19+
20+
def run
21+
exec ["bundle", update ? "update" : "install"]
22+
end
23+
end
24+
25+
tool "ci" do
26+
include :terminal
27+
include :exec
28+
29+
def run
30+
Dir.chdir context_directory
31+
@gem_name = File.basename context_directory
32+
@failures = []
33+
step "bundle"
34+
step "spec"
35+
step "yardoc"
36+
step "build"
37+
if @failures.empty?
38+
puts "CI SUCEEDED", :green, :bold
39+
else
40+
puts "CI FAILED", :red, :bold
41+
@failures.each { |name| puts " failed: #{name}", :red, :bold }
42+
exit 1
43+
end
44+
end
45+
46+
def step tool
47+
full_name = "#{@gem_name}:#{tool}"
48+
puts "Starting: #{full_name}...", :cyan, :bold
49+
result = exec_separate_tool [tool]
50+
if result.success?
51+
puts "SUCCESS: #{full_name}", :green, :bold
52+
else
53+
@failures << full_name
54+
puts "FAILED: #{full_name}", :red, :bold
55+
end
56+
end
57+
end

0 commit comments

Comments
 (0)