root/trunk/Rakefile

Revision 326, 2.4 kB (checked in by gethema..@gmail.com, 2 weeks ago)

check in new backgroundrb code

Line 
1 require 'rake'
2 require 'rubygems'
3 require 'rake/testtask'
4 require 'rake/rdoctask'
5 require 'spec/rake/spectask'
6 require 'rake/contrib/sshpublisher'
7
8 desc 'Default: run unit tests.'
9 task :default => :test
10
11 desc 'Test the backgroundrb plugin.'
12 Rake::TestTask.new(:test) do |t|
13   t.libs << 'lib'
14   t.pattern = 'test/**/test_*.rb'
15   t.verbose = true
16 end
17
18 desc "Run all specs"
19 Spec::Rake::SpecTask.new('specs') do |t|
20   t.spec_opts = ["--format", "specdoc"]
21   t.libs = ['lib', 'server/lib' ]
22   t.spec_files = FileList['specs/**/*_spec.rb']
23 end
24
25 desc "RCov"
26 task :rcov do
27   sh("rcov test/**/*.rb")
28 end
29
30 desc 'Generate documentation for the backgroundrb plugin.'
31 Rake::RDocTask.new(:rdoc) do |rdoc|
32   rdoc.rdoc_dir = 'doc/output/manual'
33   rdoc.title    = 'Backgroundrb'
34   rdoc.options << '--line-numbers' << '--inline-source'
35   rdoc.rdoc_files.include('README')
36   rdoc.rdoc_files.include('LICENSE')
37   rdoc.rdoc_files.include('lib/*.rb')
38   rdoc.rdoc_files.include('lib/backgroundrb/*.rb')
39   rdoc.rdoc_files.include('server/*.rb')
40   rdoc.rdoc_files.include('server/lib/*.rb')
41   rdoc.template = 'jamis'
42 end
43
44 module Rake
45   class BackgrounDRbPublisher <  SshDirPublisher
46     attr_reader :project, :proj_id, :user
47     def initialize(projname, user)
48       super(
49             "#{user}@rubyforge.org",
50             "/var/www/gforge-projects/backgroundrb",
51             "doc/output")
52     end
53   end
54 end
55
56 desc "Publish documentation to Rubyforge"
57 task :publish_rdoc => [:rdoc] do
58   user = ENV['RUBYFORGE_USER']
59   publisher = Rake::BackgrounDRbPublisher.new('backgroundrb', user)
60   publisher.upload
61 end
62
63 namespace :git do
64   def current_branch
65     branches = `git branch`
66     return branches.split("\n").detect {|x| x =~ /^\*/}.split(' ')[1]
67   end
68
69   desc "Push changes to central git repo"
70   task :push do
71     sh("git push origin master")
72   end
73
74   desc "update master branch"
75   task :up do
76     t_branch = current_branch
77     sh("git checkout master")
78     sh("git pull")
79     sh("git checkout #{t_branch}")
80   end
81
82   desc "rebase current branch to master"
83   task :rebase => [:up] do
84     sh("git rebase master")
85   end
86
87   desc "merge current branch to master"
88   task :merge => [:up] do
89     t_branch = current_branch
90     sh("git checkout master")
91     sh("git merge #{t_branch}")
92     sh("git checkout #{t_branch}")
93   end
94
95   desc "commot current branch"
96   task :commit => [:merge] do
97     t_branch = current_branch
98     sh("git checkout master")
99     sh("git push origin master")
100     sh("git checkout #{t_branch}")
101   end
102 end
103
Note: See TracBrowser for help on using the browser.