You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Ben Browning <bb...@redhat.com> on 2010/08/25 21:07:29 UTC

[PATCH 0/2] Deltacloud Client JRuby Compatibility

The following two patches are the steps I had to take to
get deltacloud-client running properly under JRuby.

The output of the 'rake package' task now produces two
gems - deltacloud-client-x.x.x.x-java.gem and
deltacloud-client-x.x.x.x.gem.

The JRuby gem depends on Nokogiri 1.5.0.beta.2 because
that is the earliest version with a pure-Java (no FFI)
implementation.

Ben Browning (2):
  Fix authorization header encoding under JRuby
  Build java and ruby versions of client gem

 client/Rakefile                  |   11 +++++++++--
 client/deltacloud-client.gemspec |   10 ++++++++--
 client/lib/deltacloud.rb         |    6 +++++-
 3 files changed, 22 insertions(+), 5 deletions(-)

-- 
1.7.2.1


[PATCH 1/2] Fix authorization header encoding under JRuby

Posted by Ben Browning <bb...@redhat.com>.
---
 client/lib/deltacloud.rb |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
index f8f3cd7..71b0c97 100644
--- a/client/lib/deltacloud.rb
+++ b/client/lib/deltacloud.rb
@@ -387,8 +387,12 @@ module DeltaCloud
     private
 
     def default_headers
+      # The linebreaks inserted every 60 characters in the Base64
+      # encoded header cause problems under JRuby
+      auth_header = "Basic "+Base64.encode64("#{@username}:#{@password}")
+      auth_header.gsub!("\n", "")
       {
-        :authorization => "Basic "+Base64.encode64("#{@username}:#{@password}"),
+        :authorization => auth_header,
         :accept => "application/xml"
       }
     end
-- 
1.7.2.1


Re: [PATCH 0/2] Deltacloud Client JRuby Compatibility

Posted by Benjamin Browning <bb...@redhat.com>.
On Aug 30, 2010, at 6:21 PM, David Lutterkort wrote:
> 
> I'd love to see you become a committer for Deltacloud; we definitely
> need somebody with jRuby experience who can keep an eye on it not
> breaking again once the fixes are in.
> 
> The ASF process for this is that we'll vote on that once you've
> established a track record of contributions - so, I suggest you continue
> submitting the jRuby fixes; when they're in, we'll discuss making you a
> committer again.
> 
> Sorry that this seems a little bureaucratic - look at it as the flipside
> of the ASF's value of meritocracy ;)

I'm cool with the process - patches will keep flowing :)

Ben

Re: [PATCH 0/2] Deltacloud Client JRuby Compatibility

Posted by David Lutterkort <lu...@redhat.com>.
On Fri, 2010-08-27 at 16:17 -0400, Benjamin Browning wrote:
> On Aug 26, 2010, at 4:43 AM, Michal Fojtik wrote:
> > 
> > All two patches looks good to me. Applied cleanly. All Test::Unit
> > passed both in client and server. 
> > ACK to both.
> 
> Thanks for ACKing my patches.
> 
> I'd like to get JRuby officially supported for deltacloud-client and
> deltacloud-core. I'm currently using a forked version of both because
> my application runs under JRuby and it would be great to get back on
> the official gems.
> 
> There is some additional work needed to get deltacloud-core
> functioning. I'm fine with continuing to submit patches but would also
> like to discuss becoming more officially involved so I can help test,
> document, package, and support the JRuby side of things.

I'd love to see you become a committer for Deltacloud; we definitely
need somebody with jRuby experience who can keep an eye on it not
breaking again once the fixes are in.

The ASF process for this is that we'll vote on that once you've
established a track record of contributions - so, I suggest you continue
submitting the jRuby fixes; when they're in, we'll discuss making you a
committer again.

Sorry that this seems a little bureaucratic - look at it as the flipside
of the ASF's value of meritocracy ;)

David


Re: [PATCH 0/2] Deltacloud Client JRuby Compatibility

Posted by Benjamin Browning <bb...@redhat.com>.
On Aug 26, 2010, at 4:43 AM, Michal Fojtik wrote:
> 
> All two patches looks good to me. Applied cleanly. All Test::Unit
> passed both in client and server. 
> ACK to both.

Thanks for ACKing my patches.

I'd like to get JRuby officially supported for deltacloud-client and deltacloud-core. I'm currently using a forked version of both because my application runs under JRuby and it would be great to get back on the official gems.

There is some additional work needed to get deltacloud-core functioning. I'm fine with continuing to submit patches but would also like to discuss becoming more officially involved so I can help test, document, package, and support the JRuby side of things.

Ben

Re: [PATCH 0/2] Deltacloud Client JRuby Compatibility

Posted by Benjamin Browning <bb...@redhat.com>.
On Sep 22, 2010, at 6:15 PM, David Lutterkort wrote:
> 
> Sorry about dropping these. I just committed them.

No problem - thanks!

Ben


Re: [PATCH 0/2] Deltacloud Client JRuby Compatibility

Posted by David Lutterkort <lu...@redhat.com>.
On Wed, 2010-09-22 at 16:18 -0400, Benjamin Browning wrote:
> On Aug 26, 2010, at 4:43 AM, Michal Fojtik wrote:
> > All two patches looks good to me. Applied cleanly. All Test::Unit
> > passed both in client and server. 
> > ACK to both.
> 
> These patches were ACKed but never committed. I'd love to get JRuby
> compatibility into the official deltacloud-client if someone can
> commit these.

Sorry about dropping these. I just committed them.

David



Re: [PATCH 0/2] Deltacloud Client JRuby Compatibility

Posted by Benjamin Browning <bb...@redhat.com>.
On Aug 26, 2010, at 4:43 AM, Michal Fojtik wrote:
> All two patches looks good to me. Applied cleanly. All Test::Unit
> passed both in client and server. 
> ACK to both.

These patches were ACKed but never committed. I'd love to get JRuby compatibility into the official deltacloud-client if someone can commit these.

Thanks,

Ben

> 
> -- Michal
> 
> -- 
> --------------------------------------------------------
> Michal Fojtik, mfojtik@redhat.com, +420 532 294 4307
> Ruby / Ruby On Rails Developer
> Deltacloud API: http://deltacloud.org
> --------------------------------------------------------


Re: [PATCH 0/2] Deltacloud Client JRuby Compatibility

Posted by Michal Fojtik <mf...@redhat.com>.
On 25/08/10 15:07 -0400, Ben Browning wrote:
>The following two patches are the steps I had to take to
>get deltacloud-client running properly under JRuby.
>
>The output of the 'rake package' task now produces two
>gems - deltacloud-client-x.x.x.x-java.gem and
>deltacloud-client-x.x.x.x.gem.
>
>The JRuby gem depends on Nokogiri 1.5.0.beta.2 because
>that is the earliest version with a pure-Java (no FFI)
>implementation.
>
>Ben Browning (2):
>  Fix authorization header encoding under JRuby
>  Build java and ruby versions of client gem
>
> client/Rakefile                  |   11 +++++++++--
> client/deltacloud-client.gemspec |   10 ++++++++--
> client/lib/deltacloud.rb         |    6 +++++-
> 3 files changed, 22 insertions(+), 5 deletions(-)

All two patches looks good to me. Applied cleanly. All Test::Unit
passed both in client and server. 

ACK to both.

  -- Michal

-- 
--------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com, +420 532 294 4307
Ruby / Ruby On Rails Developer
Deltacloud API: http://deltacloud.org
--------------------------------------------------------

[PATCH 2/2] Build java and ruby versions of client gem

Posted by Ben Browning <bb...@redhat.com>.
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-client.gemspec' then the version built
will depend on which interpreter you're using.
---
 client/Rakefile                  |   11 +++++++++--
 client/deltacloud-client.gemspec |   10 ++++++++--
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/client/Rakefile b/client/Rakefile
index b539ed5..5d7f1f1 100644
--- a/client/Rakefile
+++ b/client/Rakefile
@@ -25,8 +25,15 @@ task 'documentation' do
   load 'lib/documentation.rb'
 end
 
-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-client.gemspec'))
+end
+
+@specs.values.each do |spec|
+  Rake::GemPackageTask.new(spec) do |pkg|
+    pkg.need_tar = true
+  end
 end
 
 if Gem.available?('rspec')
diff --git a/client/deltacloud-client.gemspec b/client/deltacloud-client.gemspec
index f756108..da72343 100644
--- a/client/deltacloud-client.gemspec
+++ b/client/deltacloud-client.gemspec
@@ -17,7 +17,7 @@
 # under the License.
 
 
-@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'
@@ -32,7 +32,13 @@
   s.test_files= Dir.glob("specs/**/**")
   s.extra_rdoc_files = Dir["COPYING"]
 
+  # 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('rest-client', '>= 1.4.2')
-  s.add_dependency('nokogiri', '>= 1.4.1')
+  s.add_dependency('nokogiri', '>= 1.4.1') if s.platform.to_s == 'ruby'
+  s.add_dependency('nokogiri', '>= 1.5.0.beta.2') if s.platform.to_s == 'java'
   s.add_development_dependency('rspec', '>= 1.3.0')
 end
-- 
1.7.2.1