Skip to content

Commit 5ed06ae

Browse files
committed
Add rake command to generate yard documentation
Use it like: - `bundle exec rake "update_docs[4.0, 4-0-maintenance]"`
1 parent b2e51f9 commit 5ed06ae

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Rakefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,26 @@ task :verify_private_key_present do
229229
end
230230

231231
task build: :verify_private_key_present
232+
233+
desc "Updates the rspec.github.io docs"
234+
task :update_docs, [:version, :branch, :website_path] do |t, args|
235+
abort "You must have ag installed to generate docs" if `which ag` == ""
236+
args.with_defaults(:website_path => "../rspec.github.io")
237+
sh "git checkout #{args[:branch]} && git pull --rebase"
238+
cmd = "bundle install && \
239+
RUBYOPT='-I#{args[:website_path]}/lib' bundle exec yard \
240+
--yardopts .yardopts \
241+
--plugin rspec-docs-template \
242+
--output-dir #{args[:website_path]}/source/documentation/#{args[:version]}/rspec-rails/"
243+
puts cmd
244+
Bundler.clean_system(cmd)
245+
in_place =
246+
if RUBY_PLATFORM =~ /darwin/ # if this is os x then we must modify sed
247+
"-i ''"
248+
else
249+
"-i''"
250+
end
251+
252+
Bundler.clean_system %Q{pushd #{args[:website_path]}; ag -l src=\\"\\\(?:..\/\\\)*js | xargs -I{} sed #{in_place} 's/src="\\\(..\\\/\\\)*js/src="\\\/documentation\\\/#{args[:version]}\\\/rspec-rails\\\/js/' {}; popd}
253+
Bundler.clean_system %Q{pushd #{args[:website_path]}; ag -l href=\\"\\\(?:..\/\\\)*css | xargs -I{} sed #{in_place} 's/href="\\\(..\\\/\\\)*css/href="\\\/documentation\\\/#{args[:version]}\\\/rspec-rails\\\/css/' {}; popd}
254+
end

0 commit comments

Comments
 (0)