This repository has been archived by the owner on Aug 10, 2020. It is now read-only.
forked from gnufied/backgroundrb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
103 lines (89 loc) · 2.43 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
require 'rake'
require 'rubygems'
require 'rake/testtask'
require 'rake/rdoctask'
require 'spec/rake/spectask'
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|
t.spec_opts = ["--format", "specdoc"]
t.libs = ['lib', 'server/lib' ]
t.spec_files = 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