forked from neo4jrb/activegraph
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
156 lines (128 loc) · 4.54 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
154
155
156
#$:.unshift('lib')
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rake/rdoctask'
# require 'yard'
require 'spec/version'
require 'spec/rake/spectask'
require 'rake/gempackagetask'
#require 'hoe'
require 'lib/neo4j/version'
GEM_NAME = 'neo4j'
PROJECT_SUMMARY= "A graph database for JRuby"
GEM_VERSION =Neo4j::VERSION
task :default => :spec
#
#Hoe.new(GEM_NAME, GEM_VERSION) do |p|
# p.rubyforge_name = GEM_NAME
# s.summary = PROJECT_SUMMARY
#end
desc "Flog all Ruby files in lib"
task :flog do
system("find lib -name '*.rb' | xargs flog")
end
desc "spec"
Spec::Rake::SpecTask.new do |t|
t.libs << "test"
t.libs << "lib"
# t.rcov = true
t.spec_files = FileList['test/**/*_spec.rb']
t.spec_opts = ['--format specdoc', '--color']
# t.spec_opts = ['--format html:../doc/output/report.html'] #,'--backtrace']
end
desc 'Generate RDoc'
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = '../doc/output/rdoc'
rdoc.options << '--title' << 'Neo' << '--line-numbers' << '--inline-source' << '--main' << 'README.rdoc'
rdoc.rdoc_files.include('README.rdoc', 'CHANGELOG', 'lib/**/*.rb')
end
desc "Generated YARD documenation"
YARD::Rake::YardocTask.new do |t|
t.files = ['README.rdoc', 'CHANGELOG', 'lib/**/*.rb'] # optional
t.options << '-r README.rdoc'
end if defined? YARD
desc 'Upload documentation to RubyForge.'
task 'upload-docs' do
sh "scp -r doc/* " +
"ronge@rubyforge.org:/var/www/gforge-projects/neo4j/"
end
##############################################################################
# PACKAGING & INSTALLATION
##############################################################################
# What files/dirs should 'rake clean' remove?
CLEAN.include ["*.gem", "pkg", "rdoc", "coverage", "tools/*.png", 'var']
# The file list used to package tarballs, gems, and for generating the xmpp4r.gemspec.
PKG_FILES = %w( LICENSE CHANGELOG README.rdoc Rakefile neo4j.gemspec ) + Dir["{lib,test,examples}/**/*"]
spec = Gem::Specification.new do |s|
s.name = GEM_NAME
s.version = GEM_VERSION
s.authors = "Andreas Ronge"
s.email = 'andreas.ronge@gmail.com'
s.homepage = "http://github.com/andreasronge/neo4j/tree"
s.rubyforge_project = 'neo4j'
s.summary = PROJECT_SUMMARY
s.description = s.summary
s.require_path = 'lib'
s.executables = []
s.files = PKG_FILES
s.test_files = []
#s.homepage = 'http://neo4j.rubyforge.org'
# rdoc
s.has_rdoc = true
s.extra_rdoc_files = %w( README.rdoc )
s.rdoc_options = ["--quiet", "--title", "Neo4j.rb", "--opname", "index.html", "--line-numbers", "--main", "README.rdoc", "--inline-source"]
s.required_ruby_version = ">= 1.8.4"
end
Rake::GemPackageTask.new(spec) do |pkg|
pkg.gem_spec = spec
pkg.need_tar = true
end
# also keep the gemspec up to date each time we package a tarball or gem
task :package => ['gem:update_gemspec']
task :gem => ['gem:update_gemspec']
namespace :gem do
desc "Run :package and install the .gem locally"
task :install => [:update_gemspec, :package] do
sh %{gem install --local pkg/neo4j-#{spec.version}.gem --no-rdoc --no-ri}
end
desc "Run :clean and uninstall the .gem"
task :uninstall => :clean do
sh %{sudo gem uninstall neo4j}
end
# Thanks to the Merb project for this code.
desc "Update Github Gemspec"
task :update_gemspec do
skip_fields = %w(new_platform original_platform)
integer_fields = %w(specification_version)
result = "# WARNING : RAKE AUTO-GENERATED FILE. DO NOT MANUALLY EDIT!\n"
result << "# LAST UPDATED : #{Time.now.to_s}\n#\n"
result << "# RUN : 'rake gem:update_gemspec'\n\n"
result << "Gem::Specification.new do |s|\n"
spec.instance_variables.each do |ivar|
value = spec.instance_variable_get(ivar)
name = ivar.split("@").last
next if skip_fields.include?(name) || value.nil? || value == "" || (value.respond_to?(:empty?) && value.empty?)
if name == "dependencies"
value.each do |d|
dep, *ver = d.to_s.split(" ")
result << " s.add_dependency #{dep.inspect}, #{ver.join(" ").inspect.gsub(/[()]/, "")}\n"
end
else
case value
when Array
value = name != "files" ? value.inspect : value.inspect.split(",").join(",\n")
when String
value = value.to_i if integer_fields.include?(name)
value = value.inspect
else
value = value.to_s.inspect
end
result << " s.#{name} = #{value}\n"
end
end
result << "end"
File.open(File.join(File.dirname(__FILE__), "#{spec.name}.gemspec"), "w"){|f| f << result}
end
end