lmarlow / gemedit

Gemedit lets you quickly open up the source for a gem in your favorite editor.

This URL has Read+Write access

gemedit / tasks / doco.rake
100644 24 lines (22 sloc) 0.749 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
namespace :docs do
  task :inject_google_analytics do
    GA_TRACKING_CODE = 'UA-729069-2'
    
    sed_cmd = <<EOS.chomp
sed -i "" 's|^</body>|<script type="text/javascript">\\
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");\\
document.write(unescape("%3Cscript src='"'"'" + gaJsHost + "google-analytics.com/ga.js'"'"' type='"'"'text/javascript'"'"'%3E%3C/script%3E"));\
</script>\\
<script type="text/javascript">\\
var pageTracker = _gat._getTracker("#{GA_TRACKING_CODE}");\\
pageTracker._initData();\\
pageTracker._trackPageview();\\
</script>\\
&|'
EOS
    Dir['doc/**/*.html'].each do |f|
      cmd = "#{sed_cmd} #{f}"
      system cmd
    end
  end
end
 
task :docs => 'docs:inject_google_analytics'