Skip to content

Commit 88cc7a5

Browse files
committed
rb: Add rubydocs crazy fun task
1 parent de00b18 commit 88cc7a5

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

rake-tasks/crazy_fun/mappings/ruby.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def add_all(fun)
88
fun.add_mapping "ruby_test", RubyTest.new
99
fun.add_mapping "ruby_test", AddTestDependencies.new
1010

11+
fun.add_mapping "rubydocs", RubyDocs.new
1112
fun.add_mapping "rubygem", RubyGem.new
1213
end
1314

@@ -105,6 +106,28 @@ def handle(fun, dir, args)
105106
end
106107
end
107108

109+
class RubyDocs < Tasks
110+
def handle(fun, dir, args)
111+
files = args[:files] || raise("no :files specified for rubydocs")
112+
output_dir = args[:output_dir] || raise("no :output_dir specified for rubydocs")
113+
readme = args[:readme] || raise("no :readme specified for rubydocs")
114+
115+
desc 'Generate Ruby API docs'
116+
t = task "//#{dir}:docs" do |t|
117+
yard_args = %w[doc --verbose]
118+
yard_args += ["--output-dir", output_dir]
119+
yard_args += ["--readme", readme]
120+
121+
ruby :command => "yard",
122+
:args => yard_args,
123+
:files => files,
124+
:gemfile => "build/rb/Gemfile"
125+
end
126+
127+
add_dependencies t, dir, args[:deps]
128+
end
129+
end # RubyDocs
130+
108131
class RubyGem
109132
def handle(fun, dir, args)
110133
raise "no :gemspec for rubygem" unless args[:gemspec]

rb/build.desc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ rubygem(
1717
]
1818
)
1919

20+
rubydocs(
21+
files = [
22+
"build/rb/lib/**/*.rb",
23+
"build/rb/CHANGES"
24+
],
25+
readme = "rb/README.md",
26+
output_dir = "build/docs/api/rb",
27+
deps = [ "//rb:gem:build" ]
28+
)
29+
2030
ruby_library(name = "common",
2131
srcs = [
2232
"lib/selenium/webdriver/common/**/*.rb",

rb/selenium-webdriver.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ Gem::Specification.new do |s|
3131
s.add_development_dependency "rack", ["~> 1.0"]
3232
s.add_development_dependency "ci_reporter", ["~> 1.6", ">= 1.6.2"]
3333
s.add_development_dependency "webmock", ["~> 1.7", ">= 1.7.5"]
34+
s.add_development_dependency "yard", ["~> 0.8.7"]
3435
end

0 commit comments

Comments
 (0)