You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Mark McLoughlin <ma...@redhat.com> on 2011/08/18 10:51:48 UTC

[PATCH 0/3] Some small client patches

Hey,

It seems to me that the deltacloud client lib was broken recently
and the first patch in this series fixes it. Perhaps I'm missing
something, though. If I'm not, the fix should go into 0.4.0.

Cheers,
Mark.

Re: [PATCH 3/3] Client: fix Gem.available? deprecation warning

Posted by Michal Fojtik <mf...@redhat.com>.
On Aug 18, 2011, at 10:51 AM, Mark McLoughlin wrote:

ACK.

  -- Michal

> Gem.available? was deprecated by RubyGems 1.8 in favour of
> the recently introducted Gem::Specification.find_by_name.
> ---
> client/Rakefile |   10 +++++++++-
> 1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/client/Rakefile b/client/Rakefile
> index 25e99cb..4fed388 100644
> --- a/client/Rakefile
> +++ b/client/Rakefile
> @@ -32,7 +32,15 @@ Gem::PackageTask.new(spec) do |pkg|
>   pkg.need_tar = true
> end
> 
> -if Gem.available?('rspec')
> +def available?(name)
> +  Gem::Specification.find_by_name(name)
> +rescue Gem::LoadError
> +  false
> +rescue
> +  Gem.available?(name)
> +end
> +
> +if available?('rspec')
>   require 'spec/rake/spectask'
>   desc "Run all examples"
>   Spec::Rake::SpecTask.new('spec') do |t|
> -- 
> 1.7.4.4
> 

------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org


[PATCH 3/3] Client: fix Gem.available? deprecation warning

Posted by Mark McLoughlin <ma...@redhat.com>.
Gem.available? was deprecated by RubyGems 1.8 in favour of
the recently introducted Gem::Specification.find_by_name.
---
 client/Rakefile |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/client/Rakefile b/client/Rakefile
index 25e99cb..4fed388 100644
--- a/client/Rakefile
+++ b/client/Rakefile
@@ -32,7 +32,15 @@ Gem::PackageTask.new(spec) do |pkg|
   pkg.need_tar = true
 end
 
-if Gem.available?('rspec')
+def available?(name)
+  Gem::Specification.find_by_name(name)
+rescue Gem::LoadError
+  false
+rescue
+  Gem.available?(name)
+end
+
+if available?('rspec')
   require 'spec/rake/spectask'
   desc "Run all examples"
   Spec::Rake::SpecTask.new('spec') do |t|
-- 
1.7.4.4


Re: [PATCH 1/3] Client: don't require lib/base_object

Posted by Michal Fojtik <mf...@redhat.com>.
On Aug 18, 2011, at 10:51 AM, Mark McLoughlin wrote:

> client/lib/deltacloud.rb was recently changed to require 'lib/base_object'
> rather than 'base_object' which results in:
> 
>  $ irb -rubygems
>  irb(main):001:0> require 'deltacloud'
>  LoadError: no such file to load -- lib/base_object
>    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
>    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
>    from /usr/lib/ruby/gems/1.8/gems/deltacloud-client-0.4.0/lib/deltacloud.rb:26
>    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59:in `gem_original_require'
>    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59:in `require'
>    from (irb):1
> 
> When you load a gem, 'lib' is automatically included in the load path.

Good catch Mark! I added this there probably during testing client.

ACK.

  -- Michal


> ---
> client/lib/deltacloud.rb |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
> index 258a48f..782f926 100644
> --- a/client/lib/deltacloud.rb
> +++ b/client/lib/deltacloud.rb
> @@ -23,7 +23,7 @@ require 'logger'
> require 'hwp_properties'
> require 'instance_state'
> require 'documentation'
> -require 'lib/base_object'
> +require 'base_object'
> require 'client_bucket_methods'
> 
> module DeltaCloud
> -- 
> 1.7.4.4
> 

------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org


[PATCH 1/3] Client: don't require lib/base_object

Posted by Mark McLoughlin <ma...@redhat.com>.
client/lib/deltacloud.rb was recently changed to require 'lib/base_object'
rather than 'base_object' which results in:

  $ irb -rubygems
  irb(main):001:0> require 'deltacloud'
  LoadError: no such file to load -- lib/base_object
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /usr/lib/ruby/gems/1.8/gems/deltacloud-client-0.4.0/lib/deltacloud.rb:26
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59:in `gem_original_require'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59:in `require'
    from (irb):1

When you load a gem, 'lib' is automatically included in the load path.
---
 client/lib/deltacloud.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
index 258a48f..782f926 100644
--- a/client/lib/deltacloud.rb
+++ b/client/lib/deltacloud.rb
@@ -23,7 +23,7 @@ require 'logger'
 require 'hwp_properties'
 require 'instance_state'
 require 'documentation'
-require 'lib/base_object'
+require 'base_object'
 require 'client_bucket_methods'
 
 module DeltaCloud
-- 
1.7.4.4


Re: [PATCH 2/3] Client: remove the init.rb

Posted by Michal Fojtik <mf...@redhat.com>.
On Aug 18, 2011, at 10:51 AM, Mark McLoughlin wrote:

ACK.

  -- Michal

> AFAICT, this is completely unused. Rails plugins have an init.rb file,
> but not standard gems.
> ---
> client/deltacloud-client.gemspec |    2 +-
> client/init.rb                   |   20 --------------------
> 2 files changed, 1 insertions(+), 21 deletions(-)
> delete mode 100644 client/init.rb
> 
> diff --git a/client/deltacloud-client.gemspec b/client/deltacloud-client.gemspec
> index 52cbb1a..d81d26f 100644
> --- a/client/deltacloud-client.gemspec
> +++ b/client/deltacloud-client.gemspec
> @@ -25,7 +25,7 @@ Gem::Specification.new do |s|
>   s.description = %q{Deltacloud REST Client for API}
>   s.version = '0.4.0'
>   s.summary = %q{Deltacloud REST Client}
> -  s.files = Dir['Rakefile', 'lib/**/*.rb', 'init.rb', 'bin/deltacloudc']
> +  s.files = Dir['Rakefile', 'lib/**/*.rb', 'bin/deltacloudc']
>   s.bindir = 'bin'
>   s.executables = 'deltacloudc'
>   s.test_files= Dir.glob("specs/**/**")
> diff --git a/client/init.rb b/client/init.rb
> deleted file mode 100644
> index 2d73e78..0000000
> --- a/client/init.rb
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -#
> -# Copyright (C) 2009  Red Hat, Inc.
> -#
> -# Licensed to the Apache Software Foundation (ASF) under one or more
> -# contributor license agreements.  See the NOTICE file distributed with
> -# this work for additional information regarding copyright ownership.  The
> -# ASF licenses this file to you under the Apache License, Version 2.0 (the
> -# "License"); you may not use this file except in compliance with the
> -# License.  You may obtain a copy of the License at
> -#
> -#       http://www.apache.org/licenses/LICENSE-2.0
> -#
> -# Unless required by applicable law or agreed to in writing, software
> -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
> -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
> -# License for the specific language governing permissions and limitations
> -# under the License.
> -
> -
> -require 'deltacloud'
> \ No newline at end of file
> -- 
> 1.7.4.4
> 

------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org


[PATCH 2/3] Client: remove the init.rb

Posted by Mark McLoughlin <ma...@redhat.com>.
AFAICT, this is completely unused. Rails plugins have an init.rb file,
but not standard gems.
---
 client/deltacloud-client.gemspec |    2 +-
 client/init.rb                   |   20 --------------------
 2 files changed, 1 insertions(+), 21 deletions(-)
 delete mode 100644 client/init.rb

diff --git a/client/deltacloud-client.gemspec b/client/deltacloud-client.gemspec
index 52cbb1a..d81d26f 100644
--- a/client/deltacloud-client.gemspec
+++ b/client/deltacloud-client.gemspec
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
   s.description = %q{Deltacloud REST Client for API}
   s.version = '0.4.0'
   s.summary = %q{Deltacloud REST Client}
-  s.files = Dir['Rakefile', 'lib/**/*.rb', 'init.rb', 'bin/deltacloudc']
+  s.files = Dir['Rakefile', 'lib/**/*.rb', 'bin/deltacloudc']
   s.bindir = 'bin'
   s.executables = 'deltacloudc'
   s.test_files= Dir.glob("specs/**/**")
diff --git a/client/init.rb b/client/init.rb
deleted file mode 100644
index 2d73e78..0000000
--- a/client/init.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-
-require 'deltacloud'
\ No newline at end of file
-- 
1.7.4.4