T
Thufir
I seem to be missing a gem, yet, according to gem list, I seem to have
sufficient gems. It's a bit puzzling in that this script was running and
now just throws this error.
Is this a missing gem? If so, which one? The MySQL gem seems to be
installed.
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ ruby 5.rb
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/
connection_adapters/abstract/connection_specification.rb:76:in
`establish_connection': Please install the adapter: `gem install
activerecord--adapter` (no such file to load -- active_record/
connection_adapters/_adapter) (RuntimeError)
from 5.rb:7
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ gem list
*** LOCAL GEMS ***
actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
builder (2.1.2)
columnize (0.3.1)
composite_primary_keys (2.3.2)
feedtools (0.2.29)
mysql (2.8.1)
rack (1.0.0)
rails (2.3.4)
rake (0.8.7)
rdoc (2.4.3)
rogerdpack-rbeautify (0.0.6)
uuidtools (2.0.0)
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ nl 5.rb
1 require 'rubygems'
2 require 'active_record'
3 require 'feed_tools'
4 require 'yaml'
5 db = YAML.load_file("database.yml")
6 ActiveRecord::Base.establish_connection(
7 :adapter => db["adapter"],
8 :host => db["host"],
9 :username => db["username"],
10 assword => db["password"],
11 :database => db["database"])
12 class Items < ActiveRecord::Base
13 end
14 # If the table doesn't exist, we'll create it.
15 unless Items.table_exists?
16 ActiveRecord::Schema.define do
17 create_table :items do |t|
18 t.column :title, :string
19 t.column :content, :string
20 t.column :source, :string
21 t.column :url, :string
22 t.column :timestamp, :timestamp
23 t.column :keyword_id, :integer
24 t.column :guid, :string
25 t.column :html, :string
26 end
27 end
28 end
29 feed_url = 'http://www.slashdot.org/index.rss'
30 feed=FeedTools::Feed.open(feed_url)
31 feed.items.each do |feed_item|
32 unless (Items.find_by_title(feed_item.title) \
33 or Items.find_by_url(feed_item.link) \
34 or Items.find_by_guid(feed_item.guid))
35 puts "processing item '#{feed_item.title}' - new"
36 Items.new do |newitem|
37 newitem.title=feed_item.title.gsub(/<[^>]*>/, '')
38 newitem.guid=feed_item.guid
39 if feed_item.publisher.name
40 newitem.source=feed_item.publisher.name
41 end
42 newitem.url=feed_item.link
43 newitem.content=feed_item.description
44 newitem.timestamp=feed_item.published
45 newitem.save
46 end
47 else
48 puts "processing item '#{feed_item.title}' - old"
49 end
50 end
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.04
DISTRIB_CODENAME=jaunty
DISTRIB_DESCRIPTION="Ubuntu 9.04"
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
thufir@ARRAKIS:~/projects/rss$
thanks,
Thufir
sufficient gems. It's a bit puzzling in that this script was running and
now just throws this error.
Is this a missing gem? If so, which one? The MySQL gem seems to be
installed.
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ ruby 5.rb
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/
connection_adapters/abstract/connection_specification.rb:76:in
`establish_connection': Please install the adapter: `gem install
activerecord--adapter` (no such file to load -- active_record/
connection_adapters/_adapter) (RuntimeError)
from 5.rb:7
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ gem list
*** LOCAL GEMS ***
actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
builder (2.1.2)
columnize (0.3.1)
composite_primary_keys (2.3.2)
feedtools (0.2.29)
mysql (2.8.1)
rack (1.0.0)
rails (2.3.4)
rake (0.8.7)
rdoc (2.4.3)
rogerdpack-rbeautify (0.0.6)
uuidtools (2.0.0)
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ nl 5.rb
1 require 'rubygems'
2 require 'active_record'
3 require 'feed_tools'
4 require 'yaml'
5 db = YAML.load_file("database.yml")
6 ActiveRecord::Base.establish_connection(
7 :adapter => db["adapter"],
8 :host => db["host"],
9 :username => db["username"],
10 assword => db["password"],
11 :database => db["database"])
12 class Items < ActiveRecord::Base
13 end
14 # If the table doesn't exist, we'll create it.
15 unless Items.table_exists?
16 ActiveRecord::Schema.define do
17 create_table :items do |t|
18 t.column :title, :string
19 t.column :content, :string
20 t.column :source, :string
21 t.column :url, :string
22 t.column :timestamp, :timestamp
23 t.column :keyword_id, :integer
24 t.column :guid, :string
25 t.column :html, :string
26 end
27 end
28 end
29 feed_url = 'http://www.slashdot.org/index.rss'
30 feed=FeedTools::Feed.open(feed_url)
31 feed.items.each do |feed_item|
32 unless (Items.find_by_title(feed_item.title) \
33 or Items.find_by_url(feed_item.link) \
34 or Items.find_by_guid(feed_item.guid))
35 puts "processing item '#{feed_item.title}' - new"
36 Items.new do |newitem|
37 newitem.title=feed_item.title.gsub(/<[^>]*>/, '')
38 newitem.guid=feed_item.guid
39 if feed_item.publisher.name
40 newitem.source=feed_item.publisher.name
41 end
42 newitem.url=feed_item.link
43 newitem.content=feed_item.description
44 newitem.timestamp=feed_item.published
45 newitem.save
46 end
47 else
48 puts "processing item '#{feed_item.title}' - old"
49 end
50 end
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.04
DISTRIB_CODENAME=jaunty
DISTRIB_DESCRIPTION="Ubuntu 9.04"
thufir@ARRAKIS:~/projects/rss$
thufir@ARRAKIS:~/projects/rss$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
thufir@ARRAKIS:~/projects/rss$
thanks,
Thufir