forked from mtodd/halcyon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
153 lines (132 loc) · 3.98 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "lib")))
%w(rubygems rake rake/clean rake/packagetask rake/gempackagetask rake/rdoctask rake/contrib/rubyforgepublisher fileutils pp).each{|dep|require dep}
include FileUtils
require 'halcyon'
project = {
:name => "halcyon",
:version => Halcyon.version,
:author => "Matt Todd",
:email => "[email protected]",
:description => "A JSON App Server Framework",
:homepath => 'http://halcyon.rubyforge.org',
:bin_files => %w(halcyon),
:rdoc_files => %w(lib),
:rdoc_opts => %w[
--all
--quiet
--op rdoc
--line-numbers
--inline-source
--title "Halcyon\ API"
--exclude "^(_darcs|spec|pkg|.svn)/"
],
:dependencies => {
'json_pure' => '>=1.1.2',
'rack' => '>=0.3.0',
'merb' => '>=0.4.1'
},
:requirements => 'install the json gem to get faster JSON parsing',
:ruby_version_required => '>=1.8.6'
}
BASEDIR = File.expand_path(File.dirname(__FILE__))
spec = Gem::Specification.new do |s|
s.name = project[:name]
s.rubyforge_project = project[:name]
s.version = project[:version]
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = project[:rdoc_files]
s.rdoc_options += project[:rdoc_opts]
s.summary = project[:description]
s.description = project[:description]
s.author = project[:author]
s.email = project[:email]
s.homepage = project[:homepath]
s.executables = project[:bin_files]
s.bindir = "bin"
s.require_path = "lib"
project[:dependencies].each{|dep|
s.add_dependency(dep[0], dep[1])
}
s.requirements << project[:requirements]
s.required_ruby_version = project[:ruby_version_required]
s.files = (project[:rdoc_files] + %w[Rakefile] + Dir["{spec,lib}/**/*"]).uniq
end
Rake::GemPackageTask.new(spec) do |p|
p.need_zip = true
p.need_tar = true
end
desc "Package and Install halcyon"
task :install do
name = "#{project[:name]}-#{project[:version]}.gem"
sh %{rake package}
sh %{sudo gem install pkg/#{name}}
end
desc "Uninstall the halcyon gem"
task :uninstall => [:clean] do
sh %{sudo gem uninstall #{project[:name]}}
end
namespace 'spec' do
desc "generate spec"
task :gen do
sh "bacon -r~/lib/bacon/output -rlib/halcyon -rtest/spec_helper spec/**/* -s > spec/SPEC"
end
desc "run rspec"
task :run do
sh "bacon -r~/lib/bacon/output -rlib/halcyon -rspec/spec_helper spec/**/* -o CTestUnit"
end
desc "run rspec verbosely"
task :verb do
sh "bacon -r~/lib/bacon/output -rlib/halcyon -rspec/spec_helper spec/**/* -o CSpecDox"
end
end
desc "Do predistribution stuff"
task :predist => [:chmod, :changelog, :manifest, :rdoc]
def manifest
require 'find'
paths = []
manifest = File.new('MANIFEST', 'w+')
Find.find('.') do |path|
path.gsub!(/\A\.\//, '')
next if path =~ /(\.svn|doc|pkg|^\.|MANIFEST)/
paths << path
end
paths.sort.each do |path|
manifest.puts path
end
manifest.close
end
desc "Make binaries executable"
task :chmod do
Dir["bin/*"].each { |binary| File.chmod(0775, binary) }
Dir["test/cgi/test*"].each { |binary| File.chmod(0775, binary) }
end
desc "Generate a MANIFEST"
task :manifest do
manifest
end
desc "Generate a CHANGELOG"
task :changelog do
sh "svn log > CHANGELOG"
end
desc "Generate RDoc documentation"
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.options << '--line-numbers' << '--inline-source' <<
'--main' << 'README' <<
'--title' << 'Halcyon Documentation' <<
'--charset' << 'utf-8'
rdoc.rdoc_dir = "doc"
rdoc.rdoc_files.include 'README'
rdoc.rdoc_files.include('lib/halcyon.rb')
rdoc.rdoc_files.include('lib/halcyon/*.rb')
rdoc.rdoc_files.include('lib/halcyon/*/*.rb')
end
task :pushsite => [:rdoc] do
sh "rsync -avz doc/ [email protected]:/var/www/gforge-projects/halcyon/doc/"
sh "rsync -avz site/ [email protected]:/var/www/gforge-projects/halcyon/"
end
desc "find . -name \"*.rb\" | xargs wc -l | grep total"
task :loc do
sh "find . -name \"*.rb\" | xargs wc -l | grep total"
end
task :default => Rake::Task['spec:run']