incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Browning <bbrow...@redhat.com>
Subject [PATCH 1/2] Build java and ruby versions of core gem
Date Tue, 31 Aug 2010 20:06:43 GMT
The Rakefile was modified so that 'rake gem' or 'rake package'
builds both the java and ruby versions. If you manually run
'gem build deltacloud-core.gemspec' then the version built
will depend on which interpreter you're using.

The java gem doesn't include eventmachine, thin, or rerun. The
deltacloudd script will need to be modified to run under jruby.
---
 server/Rakefile                |   12 +++++++++---
 server/deltacloud-core.gemspec |   14 ++++++++++----
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/server/Rakefile b/server/Rakefile
index 769e7d0..482b62f 100644
--- a/server/Rakefile
+++ b/server/Rakefile
@@ -43,10 +43,16 @@ Rake::TestTask.new("test") { |t|
   t.warning = false
 }
 
-load 'deltacloud-core.gemspec'
 
-Rake::GemPackageTask.new(@spec) do |pkg|
-  pkg.need_tar = true
+@specs = ['ruby', 'java'].inject({}) do |hash, spec_platform|
+  $platform = spec_platform
+  hash.update(spec_platform => Gem::Specification.load('deltacloud-core.gemspec'))
+end
+
+@specs.values.each do |spec|
+  Rake::GemPackageTask.new(spec) do |pkg|
+    pkg.need_tar = true
+  end
 end
 
 desc "Install API"
diff --git a/server/deltacloud-core.gemspec b/server/deltacloud-core.gemspec
index 8918fdc..c10cdf0 100644
--- a/server/deltacloud-core.gemspec
+++ b/server/deltacloud-core.gemspec
@@ -18,7 +18,7 @@
 
 require 'rake'
 
-@spec=Gem::Specification.new do |s|
+Gem::Specification.new do |s|
   s.author = 'Red Hat, Inc.'
   s.homepage = "http://www.deltacloud.org"
   s.email = 'deltacloud-users@lists.fedorahosted.org'
@@ -57,13 +57,19 @@ require 'rake'
   s.test_files= Dir.glob("tests/*_test.rb")
   s.extra_rdoc_files = Dir["COPYING"]
   s.required_ruby_version = '>= 1.8.1'
+
+  # Rakefile needs to create spec for both platforms (ruby and java), using the
+  # $platform global variable. In all other cases, we figure it out from
+  # RUBY_PLATFORM.
+  s.platform = $platform || RUBY_PLATFORM[/java/] || 'ruby'
+
   s.add_dependency('rake', '>= 0.8.7')
-  s.add_dependency('eventmachine', '>= 0.12.10')
+  s.add_dependency('eventmachine', '>= 0.12.10') if s.platform.to_s == 'ruby'
   s.add_dependency('haml', '>= 2.2.17')
   s.add_dependency('sinatra', '>= 0.9.4')
   s.add_dependency('rack', '>= 1.0.0')
-  s.add_dependency('thin', '>= 1.2.5')
-  s.add_dependency('rerun', '>= 0.5.2')
+  s.add_dependency('thin', '>= 1.2.5') if s.platform.to_s == 'ruby'
+  s.add_dependency('rerun', '>= 0.5.2') if s.platform.to_s == 'ruby'
   s.add_dependency('json', '>= 1.4.3')
   s.add_development_dependency('compass', '>= 0.8.17')
   s.add_development_dependency('nokogiri', '>= 1.4.1')
-- 
1.7.2.1


Mime
View raw message