goatless 0.1.2 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/goatless +4 -2
- data/lib/goatless/friend_fetcher.rb +4 -1
- data/lib/goatless/goatless.rb +10 -3
- data/lib/goatless/opml_fetcher.rb +3 -1
- metadata +3 -3
data/bin/goatless
CHANGED
@@ -15,14 +15,16 @@ optparse = OptionParser.new do |opts|
|
|
15
15
|
opts.on("-f", "--file [filepath]", "File to dump RSS feed") do |v|
|
16
16
|
options[:filename] = v
|
17
17
|
end
|
18
|
+
opts.on("-v", "--verbose", "Display full info in progress") do |v|
|
19
|
+
options[:verbose] = v
|
20
|
+
end
|
18
21
|
end
|
19
22
|
optparse.parse!
|
20
23
|
|
21
|
-
|
22
24
|
if [options[:username], options[:password], options[:filename]].include? nil
|
23
25
|
puts optparse
|
24
26
|
exit(-1)
|
25
27
|
end
|
26
28
|
|
27
|
-
goatless = Goatless::Goatless.new(options
|
29
|
+
goatless = Goatless::Goatless.new(options)
|
28
30
|
File.new(options[:filename], "w+").write(goatless.rss)
|
@@ -1,9 +1,12 @@
|
|
1
1
|
module Goatless
|
2
|
+
|
2
3
|
class FriendFetcher
|
3
4
|
attr_accessor :friend_url, :username, :password, :items
|
4
5
|
|
5
6
|
def initialize(friend_url, username, password)
|
6
|
-
|
7
|
+
if Goatless.options[:verbose]
|
8
|
+
puts "Processing feed: #{friend_url}"
|
9
|
+
end
|
7
10
|
@friend_url = friend_url
|
8
11
|
@username = username
|
9
12
|
@password = password
|
data/lib/goatless/goatless.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
module Goatless
|
2
|
+
|
2
3
|
class Goatless
|
3
|
-
|
4
|
-
|
4
|
+
|
5
|
+
def initialize(options)
|
6
|
+
@@options = options
|
7
|
+
@username, @password = options[:username], options[:password]
|
5
8
|
@threads = []
|
6
9
|
friends_urls = OpmlFetcher.new(@username).fetch
|
7
10
|
friends_urls.each_slice(3) do |rss_urls|
|
@@ -12,7 +15,7 @@ module Goatless
|
|
12
15
|
friend_fetcher.fetch
|
13
16
|
rescue Exception => e
|
14
17
|
# Still have a lot's of "connection timed out" here
|
15
|
-
puts e
|
18
|
+
$stderr.puts("#{rss_url} fetching failed with error: #{e}")
|
16
19
|
end
|
17
20
|
end
|
18
21
|
}
|
@@ -20,6 +23,10 @@ module Goatless
|
|
20
23
|
@threads.each { |t| t.join }
|
21
24
|
end
|
22
25
|
|
26
|
+
def self.options
|
27
|
+
@@options
|
28
|
+
end
|
29
|
+
|
23
30
|
def rss
|
24
31
|
@storage = PStore.new('goatless.pstore')
|
25
32
|
@storage.transaction(true) do
|
@@ -17,7 +17,9 @@ module Goatless
|
|
17
17
|
opml_doc.elements.xpath("//outline").each do |outline|
|
18
18
|
@rss_urls << outline['xmlUrl']
|
19
19
|
end
|
20
|
-
|
20
|
+
if Goatless.options[:verbose]
|
21
|
+
puts "You have #{@rss_urls.size} friends!"
|
22
|
+
end
|
21
23
|
@rss_urls
|
22
24
|
end
|
23
25
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goatless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 21
|
10
|
+
version: 0.1.21
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Semka Novikov
|