-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rakefile
113 lines (100 loc) · 3.5 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
require 'rubygems'
require 'rake'
require 'rubygems/package_task'
PKG_NAME='jl4rb'
PKG_VERSION='0.0.1'
PKG_FILES=FileList[
'Rakefile','jl4rb.gemspec',
'ext/jl4rb/*.c',
'ext/jl4rb/extconf.rb',
'ext/jl4rb/*.inc',
'ext/jl4rb/*.h',
'ext/jl4rb/MANIFEST',
'lib/**/*.rb',
'test/**/*.rb'
]
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.summary = "Julia for ruby"
s.name = PKG_NAME
s.version = PKG_VERSION
s.requirements << 'none'
s.require_paths = ["lib","ext/jl4rb"]
s.files = PKG_FILES.to_a
s.extensions = ["ext/jl4rb/extconf.rb"]
s.licenses = ['MIT', 'GPL-2']
s.description = <<-EOF
R is embedded in ruby with some communication support .
EOF
s.author = "CQLS"
s.email= "[email protected]"
s.homepage = "http://cqls.upmf-grenoble.fr"
s.rubyforge_project = nil
end
## this allows to produce some parameter for task like Gem::PackageTask (without additional argument!)
opt={};ARGV.select{|e| e=~/\=/ }.each{|e| tmp= e.split("=");opt[tmp[0]]=tmp[1]}
## rake ... pkgdir=<path to provide> to update PKGDIR
PKGDIR=opt["pkgdir"] || ENV["RUBYGEMS_PKGDIR"] || "pkg"
## OLD: gem task!!!
# desc "Create #{PKG_NAME+'-'+PKG_VERSION+'.gem'}"
# Gem::PackageTask.new(spec) do |pkg|
# pkg.package_dir=PKGDIR
# pkg.need_zip = false
# pkg.need_tar = false
# end
# it is less verbose than the previous one
desc "Create #{PKG_NAME+'-'+PKG_VERSION+'.gem'}"
task :package do |t|
#Gem::Builder.new(spec_client).build
unless File.directory? PKGDIR
require 'fileutils'
FileUtils.mkdir_p PKGDIR
end
Gem::Package.build(spec)
`mv #{PKG_NAME+'-'+PKG_VERSION+'.gem'} #{PKGDIR}`
end
## clean task
desc "Remove #{File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION+'.gem')}"
task :clean do |t|
rm File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION+'.gem') if File.exist? File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION+'.gem')
rm_rf File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION) if File.exist? File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION)
end
## install task with doc
desc "Install #{File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION+'.gem')}"
task :install_with_doc do |t|
`gem install #{File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION+'.gem')} --local`
end
## quick install task
desc "Quick install #{File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION+'.gem')}"
task :install do |t|
`gem install #{File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION+'.gem')} --local --no-rdoc --no-ri`
rm_rf File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION) if File.exist? File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION)
end
desc "Docker install #{File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION+'.gem')}"
task :docker => :package do |t|
`gem install #{File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION+'.gem')} --local --no-rdoc --no-ri`
rm_rf File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION) if File.exist? File.join(PKGDIR,PKG_NAME+'-'+PKG_VERSION)
end
## binary task (mainly for Windows binary)
spec_bin=Gem::Specification.new do |s|
s.platform = Gem::Platform::CURRENT
s.summary = "Julia for ruby"
s.name = PKG_NAME
s.version = PKG_VERSION
s.requirements << 'none'
s.require_paths = ["lib"]
s.files = Dir['lib/**/*.rb'] + Dir['lib/*.so']
s.required_ruby_version = '>= 1.8.0'
s.description = <<-EOF
R is embedded in ruby with some communication support .
EOF
s.author = "CQLS"
s.email= "[email protected]"
s.homepage = "http://cqls.upmf-grenoble.fr"
s.rubyforge_project = nil
s.has_rdoc = false
end
task :gem_bin do |t|
`cp ext/jl4rb/*.so lib`
Gem::Builder.new(spec_bin).build
end