I have this simple program:
require 'rubygems'
require 'curb'
gem_name = ARGV[0]
raise ArgumentError.new("gem name missing") if gem_name.nil?
if Curl.get("https://rubygems.org/gems/#{gem_name}").status == '200 OK'
$stdout.puts 'Name not available.'
else
$stdout.puts 'Name available.'
end
When I run the program, I get this error:
/Users/marcc/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in
`require': cannot load such file -- curb (LoadError) from
/Users/marcc/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in
`require' from checker.rb:4:in `<main>'
When I check my gems, curl is in there:
activemodel (4.2.6)
activerecord (4.2.6)
activesupport (4.2.6)
arel (6.0.3)
awesome_print (1.7.0)
bigdecimal (1.2.3)
blankslate (2.1.2.4)
builder (3.2.2)
bundler (1.7.3, 1.5.1)
bundler-unload (1.0.2)
celluloid (0.16.0)
chunky_png (1.3.1)
classifier-reborn (2.0.1)
coffee-script (2.3.0)
coffee-script-source (1.8.0)
colorator (0.1)
compass (0.12.7)
curl (0.0.9)
execjs (2.2.1)
etc...
What am I missing?
I think you typed wrong the require line.
Is 'require "curl"' not 'require "curb"'
···
El 16/08/2016 20:23, "Marc Chanliau" <marc.chanliau@gmail.com> escribió:
I have this simple program:
require 'rubygems'
require 'curb'
gem_name = ARGV[0]
raise ArgumentError.new("gem name missing") if gem_name.nil?
if Curl.get("Gems | RubyGems.org | your community gem host).status == '200 OK'
$stdout.puts 'Name not available.'
else
$stdout.puts 'Name available.'
end
When I run the program, I get this error:
/Users/marcc/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.
0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such
file -- curb (LoadError) from /Users/marcc/.rvm/rubies/ruby-
2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in
`require' from checker.rb:4:in `<main>'
When I check my gems, curl is in there:
activemodel (4.2.6)
activerecord (4.2.6)
activesupport (4.2.6)
arel (6.0.3)
awesome_print (1.7.0)
bigdecimal (1.2.3)
blankslate (2.1.2.4)
builder (3.2.2)
bundler (1.7.3, 1.5.1)
bundler-unload (1.0.2)
celluloid (0.16.0)
chunky_png (1.3.1)
classifier-reborn (2.0.1)
coffee-script (2.3.0)
coffee-script-source (1.8.0)
colorator (0.1)
compass (0.12.7)
curl (0.0.9)
execjs (2.2.1)
etc...
What am I missing?
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Hi Marc,
There’s another typo or error here:
if Curl.get("Gems | RubyGems.org | your community gem host).status == '200 OK'
$stdout.puts ‚Name not available.‘
After checking that the gem is available with status = 200 you print out that it’s not available…that’s probably not what you intend to do here…
Cheers,
Michael
Thanks Felipe and Marcus. I feel a bit silly for this typo!
However, having the curl spelling right, I still get an error when I run
the program:
~/desktop marcc$ ruby checker.rb sass
checker.rb:10:in `<main>': uninitialized constant Curl (NameError)
Thanks in advance.
···
On Tue, Aug 16, 2016 at 11:27 AM, <sto.mar@web.de> wrote:
Am 16.08.2016 um 20:23 schrieb Marc Chanliau:
> require 'curb'
It's only a typo.
> When I check my gems, curl is in there:
> What am I missing?
Regards,
Marcus
--
GitHub: stomar (Marcus Stollsteimer) · GitHub
PGP: 0x6B3A101A
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Looks like the gem you are looking for is actually named Curb.
Could see why this is a little confusing.
<goog_1830626299>
···
On Tue, Aug 16, 2016 at 3:18 PM, Marc Chanliau <marc.chanliau@gmail.com> wrote:
Thanks Felipe and Marcus. I feel a bit silly for this typo!
However, having the curl spelling right, I still get an error when I run
the program:
~/desktop marcc$ ruby checker.rb sass
checker.rb:10:in `<main>': uninitialized constant Curl (NameError)
Thanks in advance.
On Tue, Aug 16, 2016 at 11:27 AM, <sto.mar@web.de> wrote:
Am 16.08.2016 um 20:23 schrieb Marc Chanliau:
> require 'curb'
It's only a typo.
> When I check my gems, curl is in there:
> What am I missing?
Regards,
Marcus
--
GitHub: stomar (Marcus Stollsteimer) · GitHub
PGP: 0x6B3A101A
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
--
Patrick Sullivan
email - patsul12@gmail.com
phone - (804)386-3414