Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update yard options and add a Rake task to upload docs

  • Loading branch information...
commit 81bf24e72c42ee2b09dedfbb098f057818fa1dda 1 parent 3a57a8e
@bhuga authored
Showing with 39 additions and 1 deletion.
  1. +1 −1  .yardopts
  2. +38 −0 Rakefile
View
2  .yardopts
@@ -1,4 +1,4 @@
---title "Promises and Futures for Ruby"
+--title "Lazy and optimistic evaluation for Ruby"
--output-dir doc/yard
--protected
--no-private
View
38 Rakefile
@@ -27,3 +27,41 @@ task 'coverage' do
t.spec_opts = ["-c"]
end
end
+
+task :default => [:spec]
+
+desc "Create yardocs according to .yardopts file"
+task :yardoc do
+ `yardoc`
+end
+
+desc "Add analytics tracking information to yardocs"
+task :addanalytics do
+tracking_code = <<EOC
+<script type="text\/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-3784741-4']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text\/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https:\/\/ssl' : 'http:\/\/www') + '.google-analytics.com\/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+</script>
+EOC
+ files = Dir.glob('./doc/yard/**/*.html').reject { |file| %w{class_list file_list frames.html _index.html method_list}.any? { |skipfile| file.include?(skipfile) }}
+ files.each do |file|
+ contents = File.read(file)
+ writer = File.open(file, 'w')
+ writer.write(contents.gsub(/\<\/body\>/, tracking_code + "</body>"))
+ writer.flush
+ end
+end
+
+desc "Upload docs to rubyforge"
+task :uploadyardocs => [:yardoc, :addanalytics] do
+ `rsync -av doc/yard/* bhuga@rubyforge.org:/var/www/gforge-projects/promise`
+end
Please sign in to comment.
Something went wrong with that request. Please try again.