forked from mtylty/backgroundrb-rails3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
131 lines (116 loc) · 3.56 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
require 'rake'
require 'rubygems'
require 'rake/testtask'
require 'rake/rdoctask'
#require 'spec/rake/spectask'
#require 'rspec_helper'
require 'rspec/core/rake_task'
require 'rake/contrib/sshpublisher'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the backgroundrb plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/test_*.rb'
t.verbose = true
end
desc "Run all specs"
#Spec::Rake::SpecTask.new('specs') do |t|
RSpec::Core::RakeTask.new('specs') do |t|
t.rspec_opts = ["--format", "specdoc"]
#t.libs = ['lib', 'server/lib' ]
t.pattern = FileList['specs/**/*_spec.rb']
end
desc "RCov"
task :rcov do
sh("rcov test/**/*.rb")
end
desc 'Generate documentation for the backgroundrb plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'doc/output/manual'
rdoc.title = 'Backgroundrb'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('LICENSE')
rdoc.rdoc_files.include('lib/*.rb')
rdoc.rdoc_files.include('lib/backgroundrb/*.rb')
rdoc.rdoc_files.include('server/*.rb')
rdoc.rdoc_files.include('server/lib/*.rb')
rdoc.template = 'jamis'
end
module Rake
class BackgrounDRbPublisher < SshDirPublisher
attr_reader :project, :proj_id, :user
def initialize(projname, user)
super(
"#{user}@rubyforge.org",
"/var/www/gforge-projects/backgroundrb",
"doc/output")
end
end
end
desc "Publish documentation to Rubyforge"
task :publish_rdoc => [:rdoc] do
user = ENV['RUBYFORGE_USER']
publisher = Rake::BackgrounDRbPublisher.new('backgroundrb', user)
publisher.upload
end
namespace :git do
def current_branch
branches = `git branch`
return branches.split("\n").detect {|x| x =~ /^\*/}.split(' ')[1]
end
desc "Push changes to central git repo"
task :push do
sh("git push origin master")
end
desc "update master branch"
task :up do
t_branch = current_branch
sh("git checkout master")
sh("git pull")
sh("git checkout #{t_branch}")
end
desc "rebase current branch to master"
task :rebase => [:up] do
sh("git rebase master")
end
desc "merge current branch to master"
task :merge => [:up] do
t_branch = current_branch
sh("git checkout master")
sh("git merge #{t_branch}")
sh("git checkout #{t_branch}")
end
desc "commot current branch"
task :commit => [:merge] do
t_branch = current_branch
sh("git checkout master")
sh("git push origin master")
sh("git checkout #{t_branch}")
end
end
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "backgroundrb-rails3"
gem.homepage = "http://github.com/mtylty/backgroundrb-rails3"
gem.license = "MIT"
gem.summary = %Q{BackgrounDRb is a Ruby job server and scheduler.}
gem.description = %Q{
BackgrounDRb is a Ruby job server and scheduler. Its main intent is to be used with Ruby on Rails applications for offloading long-running tasks.
Since a Rails application blocks while serving a request it is best to move long-running tasks off into a background process that is divorced from http request/response cycle.
This is the RoR 3 version (Railtie based) of the gem. Please read the GitHub homepage for installation instructions.
}
gem.email = "[email protected]"
gem.authors = ["Matteo Latini"]
gem.version = "1.1.6"
end
Jeweler::RubygemsDotOrgTasks.new