Skip to content
Newer
Older
100644 93 lines (84 sloc) 2.38 KB
eea3757 Packaging
wycats@localhost authored Sep 12, 2008
1 require 'rubygems'
2 require 'rake/gempackagetask'
3 require 'rubygems/specification'
4 require 'date'
c191200 Add Rubinius license to LICENSE, and switch to the BSD license
Wayne Meissner authored Oct 30, 2008
5 require 'fileutils'
547209c Hook in libtest build
Wayne Meissner authored Nov 6, 2008
6 require 'rbconfig'
eea3757 Packaging
wycats@localhost authored Sep 13, 2008
7
8 GEM = "ffi"
43ec6db Bump version to 0.2
Wayne Meissner authored Nov 1, 2008
9 GEM_VERSION = "0.2.0"
eea3757 Packaging
wycats@localhost authored Sep 13, 2008
10 AUTHOR = "Wayne Meissner"
11 EMAIL = "wmeissner@gmail.com"
12 HOMEPAGE = "http://kenai.com/projects/ruby-ffi"
379e9dd Fixup SUMMARY
Wayne Meissner authored Sep 18, 2008
13 SUMMARY = "A Ruby foreign function interface (compatible with Rubinius and JRuby FFI)"
eea3757 Packaging
wycats@localhost authored Sep 13, 2008
14
15 spec = Gem::Specification.new do |s|
16 s.name = GEM
17 s.version = GEM_VERSION
18 s.platform = Gem::Platform::RUBY
19 s.has_rdoc = true
20 s.extra_rdoc_files = ["README", "LICENSE"]
21 s.summary = SUMMARY
22 s.description = s.summary
23 s.author = AUTHOR
24 s.email = EMAIL
25 s.homepage = HOMEPAGE
c2be701 Add rubyforge_project
Wayne Meissner authored Oct 30, 2008
26 s.rubyforge_project = 'ffi'
eea3757 Packaging
wycats@localhost authored Sep 13, 2008
27 s.extensions = %w(ext/extconf.rb)
28
29 s.require_path = 'lib'
30 s.autorequire = GEM
31 s.files = %w(LICENSE README Rakefile) + Dir.glob("{ext,lib,nbproject,samples,specs}/**/*")
32 end
33
68da870 @wycats rake specs works right on jruby and mri
wycats authored Sep 13, 2008
34 if RUBY_PLATFORM == "java"
7892618 Fix specs and rbxspecs tasks for ruby1.8/ruby1.9
Wayne Meissner authored Nov 10, 2008
35 desc "Run all specs"
68da870 @wycats rake specs works right on jruby and mri
wycats authored Sep 13, 2008
36 task :specs do
9ad1bb6 Move rubinius-api-only specs into specs/rbx
Wayne Meissner authored Sep 19, 2008
37 sh %{#{Gem.ruby} -S spec #{Dir["specs/**/*_spec.rb"].join(" ")} -fs --color}
68da870 @wycats rake specs works right on jruby and mri
wycats authored Sep 13, 2008
38 end
7892618 Fix specs and rbxspecs tasks for ruby1.8/ruby1.9
Wayne Meissner authored Nov 9, 2008
39 desc "Run rubinius specs"
e6e3518 Add FFI::Buffer specs
Wayne Meissner authored Sep 19, 2008
40 task :rbxspecs do
41 sh %{#{Gem.ruby} -S spec #{Dir["specs/rbx/**/*_spec.rb"].join(" ")} -fs --color}
42 end
68da870 @wycats rake specs works right on jruby and mri
wycats authored Sep 13, 2008
43 else
7892618 Fix specs and rbxspecs tasks for ruby1.8/ruby1.9
Wayne Meissner authored Nov 9, 2008
44 desc "Run all specs"
68da870 @wycats rake specs works right on jruby and mri
wycats authored Sep 13, 2008
45 task :specs do
46 ENV["MRI_FFI"] = "1"
7892618 Fix specs and rbxspecs tasks for ruby1.8/ruby1.9
Wayne Meissner authored Nov 9, 2008
47 sh %{#{Gem.ruby} -I. -Ilib -S spec #{Dir["specs/**/*_spec.rb"].join(" ")} -fs --color}
68da870 @wycats rake specs works right on jruby and mri
wycats authored Sep 13, 2008
48 end
7892618 Fix specs and rbxspecs tasks for ruby1.8/ruby1.9
Wayne Meissner authored Nov 9, 2008
49 desc "Run rubinius specs"
e6e3518 Add FFI::Buffer specs
Wayne Meissner authored Sep 18, 2008
50 task :rbxspecs do
51 ENV["MRI_FFI"] = "1"
7892618 Fix specs and rbxspecs tasks for ruby1.8/ruby1.9
Wayne Meissner authored Nov 9, 2008
52 sh %{#{Gem.ruby} -I. -Ilib -S spec #{Dir["specs/rbx/**/*_spec.rb"].join(" ")} -fs --color}
e6e3518 Add FFI::Buffer specs
Wayne Meissner authored Sep 18, 2008
53 end
348eda3 @wycats specs
wycats authored Sep 13, 2008
54 end
55
eea3757 Packaging
wycats@localhost authored Sep 13, 2008
56 Rake::GemPackageTask.new(spec) do |pkg|
57 pkg.gem_spec = spec
58 end
59
60 desc "install the gem locally"
61 task :install => [:package] do
62 sh %{sudo #{Gem.ruby} -S gem install pkg/#{GEM}-#{GEM_VERSION}}
63 end
64
65 desc "create a gemspec file"
66 task :make_spec do
67 File.open("#{GEM}.gemspec", "w") do |file|
68 file.puts spec.to_ruby
69 end
379e9dd Fixup SUMMARY
Wayne Meissner authored Sep 18, 2008
70 end
c191200 Add Rubinius license to LICENSE, and switch to the BSD license
Wayne Meissner authored Oct 30, 2008
71 file "Makefile" do
72 sh %{#{Gem.ruby} ext/extconf.rb}
73 end
286f236 Make the compile target show up via rake -T
Wayne Meissner authored Nov 5, 2008
74 desc "Compile the native module"
c191200 Add Rubinius license to LICENSE, and switch to the BSD license
Wayne Meissner authored Oct 30, 2008
75 task :compile => "Makefile" do
76 sh %{make}
77 end
547209c Hook in libtest build
Wayne Meissner authored Nov 6, 2008
78 desc "Clean all built files"
c191200 Add Rubinius license to LICENSE, and switch to the BSD license
Wayne Meissner authored Oct 30, 2008
79 task :clean do
c2be701 Add rubyforge_project
Wayne Meissner authored Oct 30, 2008
80 sh %{make clean} if File.exists?("Makefile")
c191200 Add Rubinius license to LICENSE, and switch to the BSD license
Wayne Meissner authored Oct 30, 2008
81 FileUtils.rm_rf("build")
cb1df03 Remove conftest.dSYM
Wayne Meissner authored Nov 8, 2008
82 FileUtils.rm_rf("conftest.dSYM")
c191200 Add Rubinius license to LICENSE, and switch to the BSD license
Wayne Meissner authored Oct 30, 2008
83 FileUtils.rm_f(Dir["pkg/*.gem", "Makefile"])
84 end
547209c Hook in libtest build
Wayne Meissner authored Nov 6, 2008
85 LIBEXT = if Config::CONFIG['host_os'].downcase =~ /darwin/; "dylib"; else "so"; end
86 file "build/libtest.#{LIBEXT}" do
87 sh %{make -f libtest/GNUmakefile}
88 end
89 desc "Test the extension"
90 task :test => [ :compile, "build/libtest.#{LIBEXT}", :specs ] do
91
92 end
Something went wrong with that request. Please try again.