ruby-extensions - where do i get them - for opensuse 13.1

love opensuse and all that things - but today i have another serious quesiton

run opensuse with version 13.1

where do i get the following ruby modules / ingedients to run this programme…



require 'open-uri'
require "net/http"
require 'rexml/document'

def query_overpass(object_type, left,bottom,right,top, key, value)
   base_url = "http://www.overpass-api.de/api/xapi?"
   query_string = "#{object_type}[bbox=#{left},#{bottom},#{right},#{top}]#{key}=#{value}]"
   url = "#{base_url}#{URI.encode(query_string)}"
   resp = Net::HTTP.get_response(URI.parse(url))
   data = resp.body
   return data and so on and so forth 

do i find them in a repo or should i install it with / trough the software-installation-programme…

love to hear from you

Those 3 are part of the standard ruby package:

wolfi@amiga:~> rpm -ql ruby20 |egrep "(open-uri|net/http|rexml/document)"
/usr/lib64/ruby/2.0.0/net/http
/usr/lib64/ruby/2.0.0/net/http.rb
/usr/lib64/ruby/2.0.0/net/http/backward.rb
/usr/lib64/ruby/2.0.0/net/http/exceptions.rb
/usr/lib64/ruby/2.0.0/net/http/generic_request.rb
/usr/lib64/ruby/2.0.0/net/http/header.rb
/usr/lib64/ruby/2.0.0/net/http/proxy_delta.rb
/usr/lib64/ruby/2.0.0/net/http/request.rb
/usr/lib64/ruby/2.0.0/net/http/requests.rb
/usr/lib64/ruby/2.0.0/net/http/response.rb
/usr/lib64/ruby/2.0.0/net/http/responses.rb
/usr/lib64/ruby/2.0.0/net/https.rb
/usr/lib64/ruby/2.0.0/open-uri.rb
/usr/lib64/ruby/2.0.0/rexml/document.rb

So you shouldn’t have to install anything special…

hello dear wolfi

many thanks - this makes it a bit easier.

greetings

hello dear wolfi - and hello dear linux experts

while installing ruby-gems i run into issues


linux-70ce:/home/martin/perl # ^C
linux-70ce:/home/martin/perl # gem install mysql2 
Fetching: mysql2-0.3.16.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.0 extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h


Gem files will remain installed in /usr/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16 for inspection.
Results logged to /usr/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/ext/mysql2/gem_make.out
linux-70ce:/home/martin/perl # ^C
linux-70ce:/home/martin/perl # ^C
linux-70ce:/home/martin/perl # ^C
linux-70ce:/home/martin/perl #  gem install sequel

Fetching: sequel-4.11.0.gem (100%)
Successfully installed sequel-4.11.0
Parsing documentation for sequel-4.11.0
Installing ri documentation for sequel-4.11.0
1 gem installed
linux-70ce:/home/martin/perl # 
linux-70ce:/home/martin/perl # gem install mysql
Fetching: mysql-2.9.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.0 extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

eeee..?
Gem files will remain installed in /usr/lib/ruby/gems/2.0.0/gems/mysql-2.9.1 for inspection.
Results logged to /usr/lib/ruby/gems/2.0.0/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
linux-70ce:/home/martin/perl # 

i have no glue what happens here

can you hep he ?

i would be glad

hello dear wolfi - hello also linux experts

while installing ruby-gems i run into issues


linux-70ce:/home/martin/perl # ^C
linux-70ce:/home/martin/perl # gem install mysql2 
Fetching: mysql2-0.3.16.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.0 extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h


Gem files will remain installed in /usr/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16 for inspection.
Results logged to /usr/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/ext/mysql2/gem_make.out
linux-70ce:/home/martin/perl # ^C
linux-70ce:/home/martin/perl # ^C
linux-70ce:/home/martin/perl # ^C
linux-70ce:/home/martin/perl #  gem install sequel

Fetching: sequel-4.11.0.gem (100%)
Successfully installed sequel-4.11.0
Parsing documentation for sequel-4.11.0
Installing ri documentation for sequel-4.11.0
1 gem installed
linux-70ce:/home/martin/perl # 
linux-70ce:/home/martin/perl # gem install mysql
Fetching: mysql-2.9.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.0 extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h


Gem files will remain installed in /usr/lib/ruby/gems/2.0.0/gems/mysql-2.9.1 for inspection.
Results logged to /usr/lib/ruby/gems/2.0.0/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
linux-70ce:/home/martin/perl # 

i have no glue what happens here

Well, I have absolutely no experience with ruby and installing gems.

But maybe you should try to install them via openSUSE rpms?

rubygem-mysql and rubygem-mysql2 are part of the standard distribution:
http://software.opensuse.org/package/rubygem-mysql
http://software.opensuse.org/package/rubygem-mysql2

rubygem-sequel is available from the devel:language:ruby:extensions repo:
http://software.opensuse.org/package/rubygem-sequel

hello dear wolfi many many thanks for all the help!!!

while running this code i get the following results



import urllib
import urlparse
import re

url = "http://search.cpan.org/author/?W"
html = urllib.urlopen(url).read()
for lk, capname, name in re.findall('<a href="(/~.*?/)"><b>(.*?)</b></
a><br/><small>(.*?)</small>', html):
    alk = urlparse.urljoin(url, lk)

    data = { 'url':alk, 'name':name, 'cname':capname }

    phtml = urllib.urlopen(alk).read()
    memail = re.search('<a href="mailto:(.*?)">', phtml)
    if memail:
        data'email'] = memail.group(1)

    print data


see the results…

martin@linux-c5sz:~/perl> python cpan1.py
  File "cpan1.py", line 7
    for lk, capname, name in re.findall('<a href="(/~.*?/)"><b>(.*?)</b></
                                                                         ^
SyntaxError: EOL while scanning string literal
martin@linux-c5sz:~/perl> 

hmm mi guess that i have to look more into the details…
will do so and come back and report all the findings

greetings

Why are you still trying to harvest email addresses from cpan?
Do you plan on spamming people?

Extensive cross post history here
Short summary here