das_catalog 0.1.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,8 +40,8 @@ module DasCatalog
40
40
  # TODO spec this
41
41
  def self.sync
42
42
  feed = Feed.get
43
- feed.entries.each do |entry|
44
- sc = Screencast.for_link(entry.url)
43
+ feed.items.each do |entry|
44
+ sc = Screencast.for_link(entry.link)
45
45
  sc.download
46
46
  end
47
47
  end
@@ -1,11 +1,16 @@
1
- require 'feedzirra'
1
+ require 'rss/1.0'
2
+ require 'rss/2.0'
2
3
 
3
4
  module DasCatalog
4
5
  class Feed
5
6
  FEED_URL = "https://www.destroyallsoftware.com/screencasts/feed"
6
7
 
7
8
  def self.get
8
- Feedzirra::Feed.fetch_and_parse(FEED_URL)
9
+ content = ""
10
+ open(FEED_URL) do |s|
11
+ content = s.read
12
+ end
13
+ RSS::Parser.parse(content,false)
9
14
  end
10
15
  end
11
16
  end
@@ -1,3 +1,3 @@
1
1
  module DasCatalog
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -1,8 +1,20 @@
1
1
  require_relative "spec_helper"
2
2
 
3
3
  describe DasCatalog::Feed do
4
- it "grabs the feed with feedzirra" do
5
- Feedzirra::Feed.expects(:fetch_and_parse).with("https://www.destroyallsoftware.com/screencasts/feed")
4
+ let(:feed) { File.readlines(File.join(File.dirname(__FILE__), "fixtures/feed.xml")).to_s }
5
+
6
+ before do
7
+ FakeWeb.register_uri(:get, "https://www.destroyallsoftware.com/screencasts/feed", :body => feed)
8
+ end
9
+
10
+ it "grabs the feed with open" do
11
+ # This is from openuri but I feel dirty setting mocks on high level objects
12
+ DasCatalog::Feed.expects(:open).with("https://www.destroyallsoftware.com/screencasts/feed")
13
+ DasCatalog::Feed.get
14
+ end
15
+
16
+ it "parses the feed with RSS::Parser" do
17
+ RSS::Parser.expects(:parse).with(feed, false)
6
18
  DasCatalog::Feed.get
7
19
  end
8
20
  end
@@ -7,6 +7,7 @@ require 'fakefs/safe'
7
7
  require 'fileutils'
8
8
  require 'tempfile'
9
9
  require 'logger'
10
+ require 'fakeweb'
10
11
 
11
12
  require_relative '../lib/das_catalog'
12
13
 
@@ -20,3 +21,5 @@ MiniTest::Spec.add_setup_hook do
20
21
  c.logger = null_logger
21
22
  end
22
23
  end
24
+
25
+ FakeWeb.allow_net_connect = false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: das_catalog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-19 00:00:00.000000000Z
12
+ date: 2012-03-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: feedzirra
16
- requirement: &2164441260 !ruby/object:Gem::Requirement
15
+ name: mechanize
16
+ requirement: &2152533740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2164441260
24
+ version_requirements: *2152533740
25
25
  - !ruby/object:Gem::Dependency
26
- name: mechanize
27
- requirement: &2164440780 !ruby/object:Gem::Requirement
26
+ name: highline
27
+ requirement: &2152533220 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,21 +32,21 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2164440780
35
+ version_requirements: *2152533220
36
36
  - !ruby/object:Gem::Dependency
37
- name: highline
38
- requirement: &2164440260 !ruby/object:Gem::Requirement
37
+ name: minitest
38
+ requirement: &2152532580 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
42
42
  - !ruby/object:Gem::Version
43
43
  version: '0'
44
- type: :runtime
44
+ type: :development
45
45
  prerelease: false
46
- version_requirements: *2164440260
46
+ version_requirements: *2152532580
47
47
  - !ruby/object:Gem::Dependency
48
- name: minitest
49
- requirement: &2164439720 !ruby/object:Gem::Requirement
48
+ name: mocha
49
+ requirement: &2152531960 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2164439720
57
+ version_requirements: *2152531960
58
58
  - !ruby/object:Gem::Dependency
59
- name: mocha
60
- requirement: &2164439140 !ruby/object:Gem::Requirement
59
+ name: fakefs
60
+ requirement: &2152531280 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2164439140
68
+ version_requirements: *2152531280
69
69
  - !ruby/object:Gem::Dependency
70
- name: fakefs
71
- requirement: &2164438280 !ruby/object:Gem::Requirement
70
+ name: fakeweb
71
+ requirement: &2152530860 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2164438280
79
+ version_requirements: *2152530860
80
80
  description: Download screencasts from Destroy All Software catalog. Uses the rss
81
81
  feed plus Mechanize to log you in and then download new movies to your local drive.
82
82
  email: xternal1+github@gmail.com