popcap 0.7.2 → 0.8.0
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.
- checksums.yaml +7 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +23 -32
- data/README.md +27 -24
- data/lib/pop_cap/audio_file.rb +13 -11
- data/lib/pop_cap/class_support.rb +73 -0
- data/lib/pop_cap/{commander.rb → ffmpeg/commander.rb} +8 -2
- data/lib/pop_cap/ffmpeg/converter.rb +57 -0
- data/lib/pop_cap/ffmpeg/ffmpeg.rb +45 -0
- data/lib/pop_cap/ffmpeg/tag_reader.rb +45 -0
- data/lib/pop_cap/ffmpeg/tag_writer.rb +44 -0
- data/lib/pop_cap/formatter.rb +62 -0
- data/lib/pop_cap/formatters/bit_rate.rb +5 -7
- data/lib/pop_cap/formatters/date.rb +12 -10
- data/lib/pop_cap/formatters/duration.rb +10 -12
- data/lib/pop_cap/formatters/filesize.rb +6 -8
- data/lib/pop_cap/tag/formatted_tag.rb +31 -0
- data/lib/pop_cap/tag/tag_hash.rb +55 -0
- data/lib/pop_cap/{tag_struct.rb → tag/tag_struct.rb} +2 -0
- data/lib/pop_cap/taggable.rb +50 -30
- data/lib/pop_cap/version.rb +1 -1
- data/popcap.gemspec +1 -2
- data/spec/integration/convert_audio_file_spec.rb +2 -2
- data/spec/integration/read_metatags_spec.rb +1 -1
- data/spec/integration/update_metatags_spec.rb +1 -1
- data/spec/lib/pop_cap/audio_file_spec.rb +3 -9
- data/spec/lib/pop_cap/class_support_spec.rb +59 -0
- data/spec/lib/pop_cap/{commander_spec.rb → ffmpeg/commander_spec.rb} +1 -1
- data/spec/lib/pop_cap/ffmpeg/converter_spec.rb +92 -0
- data/spec/lib/pop_cap/ffmpeg/ffmpeg_spec.rb +37 -0
- data/spec/lib/pop_cap/ffmpeg/tag_reader_spec.rb +67 -0
- data/spec/lib/pop_cap/ffmpeg/tag_writer_spec.rb +60 -0
- data/spec/lib/pop_cap/fileable_spec.rb +5 -5
- data/spec/lib/pop_cap/formatter_spec.rb +71 -0
- data/spec/lib/pop_cap/formatters/bit_rate_spec.rb +8 -0
- data/spec/lib/pop_cap/formatters/date_spec.rb +8 -0
- data/spec/lib/pop_cap/formatters/duration_spec.rb +8 -0
- data/spec/lib/pop_cap/formatters/filesize_spec.rb +8 -0
- data/spec/lib/pop_cap/tag/formatted_tag_spec.rb +29 -0
- data/spec/lib/pop_cap/tag/tag_hash_spec.rb +35 -0
- data/spec/lib/pop_cap/{tag_struct_spec.rb → tag/tag_struct_spec.rb} +5 -1
- data/spec/lib/pop_cap/taggable_spec.rb +24 -10
- data/spec/spec_helper.rb +0 -3
- data/spec/support/popcap_spec_helper.rb +50 -33
- metadata +40 -56
- data/lib/pop_cap/converter.rb +0 -40
- data/lib/pop_cap/ffmpeg.rb +0 -130
- data/lib/pop_cap/formatters.rb +0 -33
- data/lib/pop_cap/helper.rb +0 -53
- data/lib/pop_cap/tag_key.rb +0 -32
- data/lib/pop_cap/tag_line.rb +0 -36
- data/spec/lib/pop_cap/converter_spec.rb +0 -67
- data/spec/lib/pop_cap/ffmpeg_spec.rb +0 -96
- data/spec/lib/pop_cap/formatters_spec.rb +0 -36
- data/spec/lib/pop_cap/helper_spec.rb +0 -42
- data/spec/lib/pop_cap/tag_key_spec.rb +0 -48
- data/spec/lib/pop_cap/tag_line_spec.rb +0 -26
- /data/spec/{support → fixtures}/sample.flac +0 -0
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'pop_cap/formatters'
|
3
|
-
|
4
|
-
module PopCap
|
5
|
-
describe Formatters do
|
6
|
-
|
7
|
-
let(:formatter_files) { Dir['lib/pop_cap/formatters/*.rb'] }
|
8
|
-
|
9
|
-
it 'requires all formatters in "formatter/"' do
|
10
|
-
loaded_files = $LOADED_FEATURES
|
11
|
-
formatter_files.each do |path|
|
12
|
-
expect(loaded_files).to include(File.realpath(path))
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context "#included_formatters" do
|
17
|
-
it 'builds a hash of included formatters' do
|
18
|
-
expect(::INCLUDED_FORMATTERS).to be_a Hash
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'has formatter names as keys' do
|
22
|
-
formatter_files.each do |file|
|
23
|
-
formatter_key = File.basename(file, '.rb').to_sym
|
24
|
-
expect(::INCLUDED_FORMATTERS.keys).to include(formatter_key)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'has the formatter path as the value' do
|
29
|
-
formatter_files.each do |file|
|
30
|
-
value = file.sub(%r(^lib\/),'').sub(%r(\.rb$),'')
|
31
|
-
expect(::INCLUDED_FORMATTERS.values).to include(value)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'pop_cap/helper'
|
3
|
-
|
4
|
-
module PopCap
|
5
|
-
describe Helper do
|
6
|
-
context '#camelize' do
|
7
|
-
it 'converts to CamelCase' do
|
8
|
-
helper = Helper.new('one_two')
|
9
|
-
expect(helper.camelize).to eq('OneTwo')
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'handles symbols' do
|
13
|
-
helper = Helper.new(:one_two_three)
|
14
|
-
expect(helper.camelize).to eq('OneTwoThree')
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context '#namespace' do
|
19
|
-
it 'accounts for namespacing with a forward slash' do
|
20
|
-
helper = Helper.new('one/two/three_four')
|
21
|
-
expect(helper.namespace).to eq('One::Two::ThreeFour')
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'accounts for mixed case in namespacing' do
|
25
|
-
helper = Helper.new('One/Two/Three_Four')
|
26
|
-
expect(helper.namespace).to eq('One::Two::ThreeFour')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context '#constantize' do
|
31
|
-
it 'converts to a constant' do
|
32
|
-
helper = Helper.new('array')
|
33
|
-
expect(helper.constantize).to eq(Array)
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'handles module namespacing' do
|
37
|
-
helper = Helper.new('file/stat')
|
38
|
-
expect(helper.constantize).to eq(File::Stat)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'pop_cap/tag_key'
|
3
|
-
|
4
|
-
module PopCap
|
5
|
-
describe TagKey do
|
6
|
-
context '#format' do
|
7
|
-
it 'is downcased' do
|
8
|
-
expect(TagKey.new('UPCASE').format).to eq(:upcase)
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'is symbolized' do
|
12
|
-
expect(TagKey.new('symbol').format).to eq(:symbol)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'removes "TAG:" if at beginning of string' do
|
16
|
-
expect(TagKey.new('TAG:artist').format).to eq(:artist)
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'does remove "TAG:" if not at beginning of string' do
|
20
|
-
expect(TagKey.new('TAG:fooTAG:').format).to eq(:"footag:")
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'renames "size" to "filesize" if at beginning of line' do
|
24
|
-
expect(TagKey.new('size').format).to eq(:filesize)
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'does not rename "size" to "filesize" if not at beginning of line' do
|
28
|
-
expect(TagKey.new('cosize').format).to eq(:cosize)
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'renames "size" to "filesize" if word boundary' do
|
32
|
-
expect(TagKey.new('size dot').format).to eq(:"filesize dot")
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'does not rename "size" to "filesize" if not word boundary' do
|
36
|
-
expect(TagKey.new('sizedot').format).to eq(:sizedot)
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'returns empty string if empty' do
|
40
|
-
expect(TagKey.new('').format).to eq('')
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'returns empty string if nil' do
|
44
|
-
expect(TagKey.new(nil).format).to eq('')
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'pop_cap/tag_line'
|
3
|
-
|
4
|
-
module PopCap
|
5
|
-
describe TagLine do
|
6
|
-
it 'builds a hash by splitting on first equal sign' do
|
7
|
-
tl = TagLine.new('one=two=four')
|
8
|
-
expect(tl.to_hash).to eq({one: 'two=four'})
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'returns an empty hash for empty string' do
|
12
|
-
tl = TagLine.new('')
|
13
|
-
expect(tl.to_hash).to eq({})
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'returns an empty hash for nil' do
|
17
|
-
tl = TagLine.new(nil)
|
18
|
-
expect(tl.to_hash).to eq({})
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'return an empty hash if no equal sign in string' do
|
22
|
-
tl = TagLine.new('onetwofour')
|
23
|
-
expect(tl.to_hash).to eq({})
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
File without changes
|