forked from assaf/scrapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
51 lines (41 loc) · 1.21 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
require "benchmark"
require "rubygems"
require "rake"
require "rake/testtask"
require "rake/rdoctask"
spec = Gem::Specification.load(File.join(File.dirname(__FILE__), 'scrapi.gemspec'))
desc "Generate documentation"
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.title = "Scraper"
rdoc.options << "--line-numbers"
rdoc.options << "--inline-source"
rdoc.rdoc_files.include("README.rdoc")
rdoc.rdoc_files.include("lib/**/*.rb")
end
desc "Run all tests"
Rake::TestTask.new(:test) do |test|
test.libs << "lib"
test.pattern = "test/**/*_test.rb"
test.verbose = true
end
task :default=>:test
spec = Gem::Specification.load(Dir["*.gemspec"].first)
desc "Build the Gem"
task :build do
sh "gem build #{spec.name}.gemspec"
end
desc "Install #{spec.name} locally"
task :install=>:build do
sudo = "sudo" unless File.writable?( Gem::ConfigMap[:bindir])
sh "#{sudo} gem install #{spec.name}-#{spec.version}.gem"
end
desc "Push new release to gemcutter and git tag"
task :push=>["test", "build"] do
sh "git push"
puts "Tagging version #{spec.version} .."
sh "git tag v#{spec.version}"
sh "git push --tag"
puts "Building and pushing gem .."
sh "gem push #{spec.name}-#{spec.version}.gem"
end