forked from mislav/will_paginate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
53 lines (45 loc) · 1.73 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require 'rubygems'
begin
hanna_dir = '/Users/mislav/Projects/Hanna/lib'
$:.unshift hanna_dir if File.exists? hanna_dir
require 'hanna/rdoctask'
rescue LoadError
require 'rake'
require 'rake/rdoctask'
end
load 'test/tasks.rake'
desc 'Default: run unit tests.'
task :default => :test
desc 'Generate RDoc documentation for the will_paginate plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'CHANGELOG.rdoc').
include('lib/**/*.rb').
exclude('lib/will_paginate/named_scope*').
exclude('lib/will_paginate/array.rb').
exclude('lib/will_paginate/version.rb')
rdoc.main = "README.rdoc" # page to start on
rdoc.title = "will_paginate documentation"
rdoc.rdoc_dir = 'doc' # rdoc output folder
rdoc.options << '--inline-source' << '--charset=UTF-8'
rdoc.options << '--webcvs=http://github.com/mislav/will_paginate/tree/master/'
end
desc %{Update ".manifest" with the latest list of project filenames. Respect\
.gitignore by excluding everything that git ignores. Update `files` and\
`test_files` arrays in "*.gemspec" file if it's present.}
task :manifest do
list = `git ls-files --full-name --exclude=*.gemspec --exclude=.*`.chomp.split("\n")
if spec_file = Dir['*.gemspec'].first
spec = File.read spec_file
spec.gsub! /^(\s* s.(test_)?files \s* = \s* )( \[ [^\]]* \] | %w\( [^)]* \) )/mx do
assignment = $1
bunch = $2 ? list.grep(/^test\//) : list
'%s%%w(%s)' % [assignment, bunch.join(' ')]
end
File.open(spec_file, 'w') { |f| f << spec }
end
File.open('.manifest', 'w') { |f| f << list.join("\n") }
end
task :examples do
%x(haml examples/index.haml examples/index.html)
%x(sass examples/pagination.sass examples/pagination.css)
end