dropcaster 0.0.2 → 0.0.3

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.
@@ -1,69 +1,87 @@
1
- require 'helper'
2
- require 'xml/libxml'
3
-
4
- class TestChannelXML < Test::Unit::TestCase
5
- include DropcasterTest
6
-
7
- def setup
8
- @options = YAML.load_file(File.join(FIXTURES_DIR, Dropcaster::CHANNEL_YML))
9
- @channel = XML::Document.string(Dropcaster::Channel.new(FIXTURES_DIR, @options).to_rss).find("//rss/channel").first
10
- end
11
-
12
- def test_item
13
- item = @channel.find("item").first
14
- assert(item)
15
-
16
- assert_equal('iTunes Name', item.find('title').first.content)
17
- assert_equal('iTunes Artist', item.find('itunes:author', NS_ITUNES).first.content)
18
- assert_equal('iTunes Description (Video Pane)', item.find('itunes:summary', NS_ITUNES).first.content)
19
- assert_equal('http://example.com/podcasts/everything/AllAboutEverything.jpg', item.find('itunes:image', NS_ITUNES).first['href'])
20
-
21
- enclosure = item.find('enclosure').first
22
- assert(enclosure)
23
- assert_equal('http://www.example.com/podcasts/everything/test/fixtures/iTunes.mp3', enclosure['url'])
24
- assert_equal('58119', enclosure['length'])
25
- assert_equal('audio/mp3', enclosure['type'])
26
-
27
- guid = item.find('guid').first
28
- assert(guid)
29
- assert_equal('false', guid['isPermaLink'])
30
- assert_equal('77bf84447c0f69ce4a33a18b0ae1e030b82010de', guid.content)
31
-
32
- assert_equal('Sat, 01 Oct 2011 14:08:20 +0200', item.find('pubDate').first.content)
33
- assert_equal('3', item.find('itunes:duration', NS_ITUNES).first.content)
34
-
35
- # Not used in our fixture yet
36
- # assert_equal('', item.find('itunes:subtitle', NS_ITUNES).first.content)
37
- # assert_equal('', item.find('itunes:keywords', NS_ITUNES).first.content)
38
- end
39
-
40
- def test_attributes_mandatory
41
- options = {:title => 'Test Channel',
42
- :url => 'http://www.example.com/',
43
- :description => 'A test channel',
44
- :enclosure_base => 'http://www.example.com/foo/bar',
45
- }
46
- @channel = XML::Document.string(Dropcaster::Channel.new(FIXTURES_DIR, options).to_rss).find("//rss/channel").first
47
- assert_equal('Test Channel', @channel.find('title').first.content)
48
- assert_equal('http://www.example.com/', @channel.find('link').first.content)
49
- assert_equal('A test channel', @channel.find('description').first.content)
50
- end
51
-
52
- def test_attributes_complete
53
- assert_equal(@options[:title], @channel.find('title').first.content)
54
- assert_equal(@options[:url], @channel.find('link').first.content)
55
- assert_equal(@options[:description], @channel.find('description').first.content)
56
- assert_equal(@options[:subtitle], @channel.find('itunes:subtitle', NS_ITUNES).first.content)
57
- assert_equal(@options[:language], @channel.find('language').first.content)
58
- assert_equal(@options[:copyright], @channel.find('copyright').first.content)
59
- assert_equal(@options[:author], @channel.find('itunes:author', NS_ITUNES).first.content)
60
-
61
- owner = @channel.find('itunes:owner', NS_ITUNES).first
62
- assert_equal(@options[:owner][:name], owner.find('itunes:name', NS_ITUNES).first.content)
63
- assert_equal(@options[:owner][:email], owner.find('itunes:email', NS_ITUNES).first.content)
64
-
65
- assert_equal(@options[:image_url], @channel.find('itunes:image', NS_ITUNES).first['href'])
66
- # TODO :categories: ['Technology', 'Gadgets']
67
- assert_equal(@options[:explicit], @channel.find('itunes:explicit', NS_ITUNES).first.content)
68
- end
69
- end
1
+ require 'helper'
2
+ require 'xml/libxml'
3
+
4
+ class TestChannelXML < Test::Unit::TestCase
5
+ include DropcasterTest
6
+
7
+ def setup
8
+ @options = YAML.load_file(File.join(FIXTURES_DIR, Dropcaster::CHANNEL_YML))
9
+ @channel = channel_node(channel_rss)
10
+ end
11
+
12
+ #
13
+ # Returnes the XML node for the channel passed as XML string
14
+ #
15
+ def channel_node(rss)
16
+ XML::Document.string(rss).find("//rss/channel").first
17
+ end
18
+
19
+ #
20
+ # Returnes the channel under test as XML string
21
+ #
22
+ # Subclasses may overwrite this method in order to re-use the tests in this class, while
23
+ # constructing the XML string in a different way
24
+ #
25
+ def channel_rss
26
+ Dropcaster::Channel.new(FIXTURES_DIR, @options).to_rss
27
+ end
28
+
29
+ def test_item
30
+ item = @channel.find("item").first
31
+ assert(item)
32
+
33
+ assert_equal('iTunes Name', item.find('title').first.content)
34
+ assert_equal('iTunes Artist', item.find('itunes:author', NS_ITUNES).first.content)
35
+ assert_equal('iTunes Description (Video Pane)', item.find('itunes:summary', NS_ITUNES).first.content)
36
+ assert_equal('http://www.example.com/podcasts/everything/AllAboutEverything.jpg', item.find('itunes:image', NS_ITUNES).first['href'])
37
+
38
+ enclosure = item.find('enclosure').first
39
+ assert(enclosure)
40
+ assert_equal('http://www.example.com/podcasts/everything/test/fixtures/iTunes.mp3', enclosure['url'])
41
+ assert_equal('58119', enclosure['length'])
42
+ assert_equal('audio/mp3', enclosure['type'])
43
+
44
+ guid = item.find('guid').first
45
+ assert(guid)
46
+ assert_equal('false', guid['isPermaLink'])
47
+ assert_equal('77bf84447c0f69ce4a33a18b0ae1e030b82010de', guid.content)
48
+
49
+ assert_equal('Sat, 01 Oct 2011 14:08:20 +0200', item.find('pubDate').first.content)
50
+ assert_equal('3', item.find('itunes:duration', NS_ITUNES).first.content)
51
+
52
+ # Not used in our fixture yet
53
+ # assert_equal('', item.find('itunes:subtitle', NS_ITUNES).first.content)
54
+ # assert_equal('', item.find('itunes:keywords', NS_ITUNES).first.content)
55
+ end
56
+
57
+ def test_attributes_mandatory
58
+ options = {:title => 'Test Channel',
59
+ :url => 'http://www.example.com/',
60
+ :description => 'A test channel',
61
+ :enclosures_url => 'http://www.example.com/foo/bar',
62
+ }
63
+
64
+ channel = channel_node(Dropcaster::Channel.new(FIXTURES_DIR, options).to_rss)
65
+ assert_equal('Test Channel', channel.find('title').first.content)
66
+ assert_equal('http://www.example.com/', channel.find('link').first.content)
67
+ assert_equal('A test channel', channel.find('description').first.content)
68
+ end
69
+
70
+ def test_attributes_complete
71
+ assert_equal(@options[:title], @channel.find('title').first.content)
72
+ assert_equal(@options[:url], @channel.find('link').first.content)
73
+ assert_equal(@options[:description], @channel.find('description').first.content)
74
+ assert_equal(@options[:subtitle], @channel.find('itunes:subtitle', NS_ITUNES).first.content)
75
+ assert_equal(@options[:language], @channel.find('language').first.content)
76
+ assert_equal(@options[:copyright], @channel.find('copyright').first.content)
77
+ assert_equal(@options[:author], @channel.find('itunes:author', NS_ITUNES).first.content)
78
+
79
+ owner = @channel.find('itunes:owner', NS_ITUNES).first
80
+ assert_equal(@options[:owner][:name], owner.find('itunes:name', NS_ITUNES).first.content)
81
+ assert_equal(@options[:owner][:email], owner.find('itunes:email', NS_ITUNES).first.content)
82
+ assert_equal(URI.join(@options[:url], @options[:image_url]).to_s, @channel.find('itunes:image', NS_ITUNES).first['href'])
83
+
84
+ # TODO :categories: ['Technology', 'Gadgets']
85
+ assert_equal(@options[:explicit], @channel.find('itunes:explicit', NS_ITUNES).first.content)
86
+ end
87
+ end
@@ -1,61 +1,63 @@
1
- require 'helper'
2
-
3
- class TestItem < Test::Unit::TestCase
4
- def setup
5
- @item = Dropcaster::Item.new(File.join(File.dirname(__FILE__), '..', 'fixtures', 'iTunes.mp3'))
6
- end
7
-
8
- def test_basics
9
- assert_in_delta(3, @item.duration, 0.005)
10
- assert_equal(58119, @item.file_size)
11
- assert_equal('77bf84447c0f69ce4a33a18b0ae1e030b82010de', @item.uuid)
12
- assert_equal(1317470900, @item.pub_date.to_i)
13
- assert_equal('test/fixtures/iTunes.mp3', @item.file_name)
14
- end
15
-
16
- def test_tag
17
- assert_equal('iTunes Artist', @item.tag.artist)
18
- assert_equal('iTunes Genre', @item.tag.genre_s)
19
- assert_equal('iTunes Name', @item.tag.title)
20
- assert_equal(' 00007032 00006EA2 0000A049 00009735 00000559 0000096E 00008000 00008000 00000017 00000017', @item.tag.comments)
21
- assert_equal('iTunes Album', @item.tag.album)
22
- assert_equal(1970, @item.tag.year)
23
- assert_equal(42, @item.tag.tracknum)
24
- end
25
-
26
- def test_tag2
27
- assert_equal('iTunes Artist', @item.tag2.TP1)
28
- assert_equal('iTunes Genre', @item.tag2.TCO)
29
- assert_equal('iTunes Name', @item.tag2.TT2)
30
- assert_equal('iTunes Album', @item.tag2.TAL)
31
- assert_equal('1970', @item.tag2.TYE)
32
- assert_equal('iTunes Album Artist', @item.tag2.TP2)
33
- assert_equal('111', @item.tag2.TBP)
34
- assert_equal('42/99', @item.tag2.TRK)
35
- assert_equal('11', @item.tag2.TPA)
36
- assert_equal('iTunes Grouping', @item.tag2.TT1)
37
- assert_equal('iTunes Description (Video Pane)', @item.tag2.TT3)
38
- assert_equal('iTunes Composer', @item.tag2.TCM)
39
- end
40
-
41
- def test_lyrics
42
- assert_equal(1, @item.lyrics.size)
43
- assert_equal("iTunes Lyrics Line 1\niTunes Lyrics Line 2", @item.lyrics['eng'])
44
- end
45
-
46
- def test_comment_remove_itunes_crap
47
- item = Dropcaster::Item.new(File.join(File.dirname(__FILE__), '..', 'fixtures', 'iTunes.mp3'), {:strip_itunes_private => true})
48
- assert_equal('iTunes Comments (Info Pane)', item.tag2.COM[0])
49
- end
50
-
51
- def test_comment_leave_itunes_crap
52
- item = Dropcaster::Item.new(File.join(File.dirname(__FILE__), '..', 'fixtures', 'iTunes.mp3'), {:strip_itunes_private => false})
53
- assert_equal(' 00007032 00006EA2 0000A049 00009735 00000559 0000096E 00008000 00008000 00000017 00000017', item.tag2.COM[0])
54
- assert_equal('iTunes Comments (Info Pane)', item.tag2.COM[1])
55
- end
56
-
57
- def test_tag2_comment
58
- assert_equal(' 00007032 00006EA2 0000A049 00009735 00000559 0000096E 00008000 00008000 00000017 00000017', @item.tag2.COM[0])
59
- assert_equal('iTunes Comments (Info Pane)', @item.tag2.COM[1])
60
- end
61
- end
1
+ require 'helper'
2
+
3
+ class TestItem < Test::Unit::TestCase
4
+ include DropcasterTest
5
+
6
+ def setup
7
+ @item = Dropcaster::Item.new(FIXTURE_ITUNES_MP3)
8
+ end
9
+
10
+ def test_basics
11
+ assert_in_delta(3, @item.duration, 0.005)
12
+ assert_equal(58119, @item.file_size)
13
+ assert_equal('77bf84447c0f69ce4a33a18b0ae1e030b82010de', @item.uuid)
14
+ assert_equal(1317470900, @item.pub_date.to_i)
15
+ assert_equal('test/fixtures/iTunes.mp3', @item.file_name)
16
+ end
17
+
18
+ def test_tag
19
+ assert_equal('iTunes Artist', @item.tag.artist)
20
+ assert_equal('iTunes Genre', @item.tag.genre_s)
21
+ assert_equal('iTunes Name', @item.tag.title)
22
+ assert_equal(' 00007032 00006EA2 0000A049 00009735 00000559 0000096E 00008000 00008000 00000017 00000017', @item.tag.comments)
23
+ assert_equal('iTunes Album', @item.tag.album)
24
+ assert_equal(1970, @item.tag.year)
25
+ assert_equal(42, @item.tag.tracknum)
26
+ end
27
+
28
+ def test_tag2
29
+ assert_equal('iTunes Artist', @item.tag2.TP1)
30
+ assert_equal('iTunes Genre', @item.tag2.TCO)
31
+ assert_equal('iTunes Name', @item.tag2.TT2)
32
+ assert_equal('iTunes Album', @item.tag2.TAL)
33
+ assert_equal('1970', @item.tag2.TYE)
34
+ assert_equal('iTunes Album Artist', @item.tag2.TP2)
35
+ assert_equal('111', @item.tag2.TBP)
36
+ assert_equal('42/99', @item.tag2.TRK)
37
+ assert_equal('11', @item.tag2.TPA)
38
+ assert_equal('iTunes Grouping', @item.tag2.TT1)
39
+ assert_equal('iTunes Description (Video Pane)', @item.tag2.TT3)
40
+ assert_equal('iTunes Composer', @item.tag2.TCM)
41
+ end
42
+
43
+ def test_lyrics
44
+ assert_equal(1, @item.lyrics.size)
45
+ assert_equal("iTunes Lyrics Line 1\niTunes Lyrics Line 2", @item.lyrics['eng'])
46
+ end
47
+
48
+ def test_comment_remove_itunes_crap
49
+ item = Dropcaster::Item.new(FIXTURE_ITUNES_MP3, {:strip_itunes_private => true})
50
+ assert_equal('iTunes Comments (Info Pane)', item.tag2.COM[0])
51
+ end
52
+
53
+ def test_comment_leave_itunes_crap
54
+ item = Dropcaster::Item.new(FIXTURE_ITUNES_MP3, {:strip_itunes_private => false})
55
+ assert_equal(' 00007032 00006EA2 0000A049 00009735 00000559 0000096E 00008000 00008000 00000017 00000017', item.tag2.COM[0])
56
+ assert_equal('iTunes Comments (Info Pane)', item.tag2.COM[1])
57
+ end
58
+
59
+ def test_tag2_comment
60
+ assert_equal(' 00007032 00006EA2 0000A049 00009735 00000559 0000096E 00008000 00008000 00000017 00000017', @item.tag2.COM[0])
61
+ assert_equal('iTunes Comments (Info Pane)', @item.tag2.COM[1])
62
+ end
63
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dropcaster
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - nerab
@@ -15,9 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-05 00:00:00 Z
18
+ date: 2011-10-13 00:00:00 +02:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
22
+ type: :runtime
21
23
  requirement: &id001 !ruby/object:Gem::Requirement
22
24
  none: false
23
25
  requirements:
@@ -27,11 +29,11 @@ dependencies:
27
29
  segments:
28
30
  - 0
29
31
  version: "0"
30
- version_requirements: *id001
31
32
  name: ruby-mp3info
33
+ version_requirements: *id001
32
34
  prerelease: false
33
- type: :runtime
34
35
  - !ruby/object:Gem::Dependency
36
+ type: :runtime
35
37
  requirement: &id002 !ruby/object:Gem::Requirement
36
38
  none: false
37
39
  requirements:
@@ -41,11 +43,11 @@ dependencies:
41
43
  segments:
42
44
  - 0
43
45
  version: "0"
44
- version_requirements: *id002
45
46
  name: activesupport
47
+ version_requirements: *id002
46
48
  prerelease: false
47
- type: :runtime
48
49
  - !ruby/object:Gem::Dependency
50
+ type: :development
49
51
  requirement: &id003 !ruby/object:Gem::Requirement
50
52
  none: false
51
53
  requirements:
@@ -57,11 +59,11 @@ dependencies:
57
59
  - 0
58
60
  - 0
59
61
  version: 1.0.0
60
- version_requirements: *id003
61
62
  name: bundler
63
+ version_requirements: *id003
62
64
  prerelease: false
63
- type: :development
64
65
  - !ruby/object:Gem::Dependency
66
+ type: :development
65
67
  requirement: &id004 !ruby/object:Gem::Requirement
66
68
  none: false
67
69
  requirements:
@@ -73,11 +75,11 @@ dependencies:
73
75
  - 6
74
76
  - 4
75
77
  version: 1.6.4
76
- version_requirements: *id004
77
78
  name: jeweler
79
+ version_requirements: *id004
78
80
  prerelease: false
79
- type: :development
80
81
  - !ruby/object:Gem::Dependency
82
+ type: :development
81
83
  requirement: &id005 !ruby/object:Gem::Requirement
82
84
  none: false
83
85
  requirements:
@@ -87,11 +89,11 @@ dependencies:
87
89
  segments:
88
90
  - 0
89
91
  version: "0"
90
- version_requirements: *id005
91
92
  name: libxml-ruby
93
+ version_requirements: *id005
92
94
  prerelease: false
93
- type: :development
94
95
  - !ruby/object:Gem::Dependency
96
+ type: :development
95
97
  requirement: &id006 !ruby/object:Gem::Requirement
96
98
  none: false
97
99
  requirements:
@@ -101,15 +103,16 @@ dependencies:
101
103
  segments:
102
104
  - 0
103
105
  version: "0"
104
- version_requirements: *id006
105
106
  name: rdoc
107
+ version_requirements: *id006
106
108
  prerelease: false
107
- type: :development
108
109
  description: Dropcaster is a podcast feed generator for the command line. It is most simple to use with Dropbox, but works equally well with any other hoster.
109
110
  email: nerab@gmx.at
110
111
  executables:
111
112
  - lstags
112
113
  - dropcaster
114
+ - dropcaster
115
+ - lstags
113
116
  extensions: []
114
117
 
115
118
  extra_rdoc_files:
@@ -139,7 +142,8 @@ files:
139
142
  - lib/dropcaster/errors.rb
140
143
  - lib/dropcaster/hashkeys.rb
141
144
  - lib/dropcaster/item.rb
142
- - templates/channel.rss.erb
145
+ - templates/iTunes.rss.erb
146
+ - test/extensions/windows.rb
143
147
  - test/fixtures/channel.yml
144
148
  - test/fixtures/iTunes.mp3
145
149
  - test/helper.rb
@@ -148,7 +152,8 @@ files:
148
152
  - test/unit/test_channel_locator.rb
149
153
  - test/unit/test_channel_xml.rb
150
154
  - test/unit/test_item.rb
151
- homepage: http://github.com/nerab/dropcaster
155
+ has_rdoc: true
156
+ homepage: http://nerab.github.com/dropcaster
152
157
  licenses:
153
158
  - MIT
154
159
  post_install_message:
@@ -177,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
182
  requirements: []
178
183
 
179
184
  rubyforge_project:
180
- rubygems_version: 1.8.9
185
+ rubygems_version: 1.6.1
181
186
  signing_key:
182
187
  specification_version: 3
183
188
  summary: Simple Podcast Publishing with Dropbox