@@ -68,103 +68,6 @@ Rake::TestTask.new do |t|
68
68
t . test_files = FileList [ "test/*_test.rb" ]
69
69
end
70
70
71
- task :doc => [ "doc:generate" , "doc:prepare" ]
72
-
73
- namespace :doc do
74
- task :generate do
75
- require "shellwords"
76
-
77
- `rm -rf doc`
78
-
79
- current_branch = `git branch` [ /^\* (.*)$/ , 1 ]
80
-
81
- begin
82
- tags = `git tag -l` . split ( "\n " ) . sort . reverse
83
-
84
- tags . each do |tag |
85
- `git checkout -q #{ tag } 2>/dev/null`
86
-
87
- unless $?. success?
88
- $stderr. puts "Need a clean working copy. Please git-stash away."
89
- exit 1
90
- end
91
-
92
- puts tag
93
-
94
- `mkdir -p doc/#{ tag } `
95
-
96
- files = `git ls-tree -r HEAD lib` . split ( "\n " ) . map do |line |
97
- line [ /\t (.*)$/ , 1 ]
98
- end
99
-
100
- opts = [
101
- "--title" , "A Ruby client for Redis" ,
102
- "--output" , "doc/#{ tag } " ,
103
- "--no-cache" ,
104
- "--no-save" ,
105
- "-q" ,
106
- *files
107
- ]
108
-
109
- `yardoc #{ Shellwords . shelljoin opts } `
110
- end
111
- ensure
112
- `git checkout -q #{ current_branch } `
113
- end
114
- end
115
-
116
- task :prepare do
117
- versions = `git tag -l` . split ( "\n " ) . grep ( /^v/ ) . sort
118
- latest_version = versions . last
119
-
120
- File . open ( "doc/.htaccess" , "w" ) do |file |
121
- file . puts "RedirectMatch 302 ^/?$ /#{ latest_version } "
122
- end
123
-
124
- File . open ( "doc/robots.txt" , "w" ) do |file |
125
- file . puts "User-Agent: *"
126
-
127
- ( versions - [ latest_version ] ) . each do |version |
128
- file . puts "Disallow: /#{ version } "
129
- end
130
- end
131
-
132
- google_analytics = <<-EOS
133
- <script type="text/javascript">
134
-
135
- var _gaq = _gaq || [];
136
- _gaq.push(['_setAccount', 'UA-11356145-2']);
137
- _gaq.push(['_trackPageview']);
138
-
139
- (function() {
140
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
141
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
142
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
143
- })();
144
-
145
- </script>
146
- EOS
147
-
148
- Dir [ "doc/**/*.html" ] . each do |path |
149
- lines = IO . readlines ( path )
150
-
151
- File . open ( path , "w" ) do |file |
152
- lines . each do |line |
153
- if line . include? ( "</head>" )
154
- file . write ( google_analytics )
155
- end
156
-
157
- file . write ( line )
158
- end
159
- end
160
- end
161
- end
162
-
163
- task :deploy do
164
- system "rsync --del -avz doc/ redis-rb.keyvalue.org:deploys/redis-rb.keyvalue.org/"
165
- end
166
- end
167
-
168
71
class Source
169
72
170
73
MATCHER = "(?:\\ s{%d}#[^\\ n]*\\ n)*^\\ s{%d}def ([a-z_?]+)(?:\( .*?\) )?\\ n.*?^\\ s{%d}end\\ n\\ n"
0 commit comments