-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
112 lines (95 loc) · 3.47 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
require 'rubygems'
require 'rake'
require 'jeweler'
require 'rake/testtask'
#require 'rcov/rcovtask'
NAME = "ms-msrun"
WEBSITE_BASE = "website"
WEBSITE_OUTPUT = WEBSITE_BASE + "/output"
gemspec = Gem::Specification.new do |s|
s.name = NAME
s.authors = ["John T. Prince"]
s.email = "[email protected]"
s.homepage = "http://jtprince.github.com/" + NAME + "/rdoc"
s.summary = "an mspire library for working with LC/MS runs (mzxml, mzData, mzML)"
s.description = 'A library for working with LC/MS runs. Part of mspire. Has parsers for mzXML v1, 2, and 3, mzData (currently broken) and mzML (planned). Can convert to commonly desired search output (such as mgf). Fast random access of scans, and fast reading of the entire file.'
s.rubyforge_project = 'mspire'
s.add_dependency 'ms-core', ">= 0.0.3"
s.add_dependency 'nokogiri'
end
Jeweler::Tasks.new(gemspec)
Rake::TestTask.new(:spec) do |spec|
ENV['TEST'] = ENV['SPEC'] if ENV['SPEC']
spec.libs << 'lib' << 'spec'
spec.pattern = 'spec/**/*_spec.rb'
spec.verbose = true
end
#Rcov::RcovTask.new do |spec|
# spec.libs << 'spec'
# spec.pattern = 'spec/**/*_spec.rb'
# spec.verbose = true
#end
def rdoc_redirect(base_rdoc_output_dir, package_website_page, version)
content = %Q{
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>mspire: } + NAME + %Q{rdoc</title>
<meta http-equiv="REFRESH" content="0;url=#{package_website_page}/rdoc/#{version}/">
</head> </html>
}
FileUtils.mkpath(base_rdoc_output_dir)
File.open(base_rdoc_output_dir + "/index.html", 'w') {|out| out.print content }
end
require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
base_rdoc_output_dir = WEBSITE_OUTPUT + '/rdoc'
version = File.read('VERSION')
rdoc.rdoc_dir = 'rdoc'
rdoc.title = NAME + ' ' + version
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
task :create_redirect do
base_rdoc_output_dir = WEBSITE_OUTPUT + '/rdoc'
rdoc_redirect(base_rdoc_output_dir, gemspec.homepage,version)
end
namespace :website do
desc "checkout and configure the gh-pages submodule (assumes you have it)"
task :submodule_update do
if File.exist?(WEBSITE_OUTPUT + "/.git")
puts "!! not doing anything, #{WEBSITE_OUTPUT + "/.git"} already exists !!"
else
puts "(not sure why this won't work programmatically)"
puts "################################################"
puts "[Execute these commands]"
puts "################################################"
puts "git submodule init"
puts "git submodule update"
puts "pushd #{WEBSITE_OUTPUT}"
puts "git co --track -b gh-pages origin/gh-pages ;"
puts "popd"
puts "################################################"
# not sure why this won't work!
#%x{git submodule init}
#%x{git submodule update}
#Dir.chdir(WEBSITE_OUTPUT) do
# %x{git co --track -b gh-pages origin/gh-pages ;}
#end
end
end
desc "setup your initial gh-pages"
task :init_ghpages do
puts "################################################"
puts "[Execute these commands]"
puts "################################################"
puts "git symbolic-ref HEAD refs/heads/gh-pages"
puts "rm .git/index"
puts "git clean -fdx"
puts 'echo "Hello" > index.html'
puts "git add ."
puts 'git commit -a -m "my first gh-page"'
puts "git push origin gh-pages"
end
end
task :default => :spec
task :build => :gemspec
# credit: Rakefile modeled after Jeweler's