musical 0.0.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +23 -0
- data/.ruby-version +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +3 -13
- data/Guardfile +24 -0
- data/README.md +59 -0
- data/Rakefile +4 -34
- data/bin/musical +39 -2
- data/lib/musical.rb +33 -25
- data/lib/musical/configuration.rb +18 -0
- data/lib/musical/dvd.rb +80 -100
- data/lib/musical/dvd/chapter.rb +29 -0
- data/lib/musical/dvd/wav.rb +12 -0
- data/lib/musical/util.rb +31 -0
- data/lib/musical/version.rb +4 -0
- data/musical.gemspec +30 -69
- data/spec/musical/configuration_spec.rb +17 -0
- data/spec/musical/dvd/chapter_spec.rb +47 -0
- data/spec/musical/dvd/wav_spec.rb +18 -0
- data/spec/musical/dvd_spec.rb +235 -0
- data/spec/musical_spec.rb +54 -4
- data/spec/spec_helper.rb +19 -8
- data/spec/util_spec.rb +68 -0
- metadata +221 -108
- data/README.rdoc +0 -63
- data/VERSION +0 -1
- data/lib/musical/itunes.rb +0 -31
data/spec/musical_spec.rb
CHANGED
@@ -1,7 +1,57 @@
|
|
1
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'musical'
|
2
4
|
|
3
|
-
describe
|
4
|
-
|
5
|
-
|
5
|
+
describe Musical do
|
6
|
+
describe '#setup', fakefs: true do
|
7
|
+
subject(:setup) { Musical.setup }
|
8
|
+
before { Musical.should_receive(:check_env).and_return(true) }
|
9
|
+
|
10
|
+
context 'when argument `info` is given' do
|
11
|
+
before { stub_const('ARGV', ['--info']) }
|
12
|
+
it { expect(setup.info).to be_true }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when argument `ignore-convert-sound` is given' do
|
16
|
+
before { stub_const('ARGV', ['--ignore-convert-sound']) }
|
17
|
+
it { expect(setup.ignore_convert_sound).to be_true }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when argument `ignore-use-itunes` is given' do
|
21
|
+
before { stub_const('ARGV', ['--ignore-use-itunes']) }
|
22
|
+
it { expect(setup.ignore_use_itunes).to be_true }
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'when argument `path` is given' do
|
26
|
+
before { stub_const('ARGV', ['--path=/dev/foo']) }
|
27
|
+
it { expect(setup.path).to eq('/dev/foo') }
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when argument `title` is given' do
|
31
|
+
before { stub_const('ARGV', ['--title=new!']) }
|
32
|
+
it { expect(setup.title).to eq("new!") }
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when argument `artist` is given' do
|
36
|
+
before { stub_const('ARGV', ['--artist=artist!']) }
|
37
|
+
it { expect(setup.artist).to eq("artist!") }
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'when argument `output` is given' do
|
41
|
+
before { stub_const('ARGV', ['--output=/tmp']) }
|
42
|
+
it { expect(setup.output).to eq('/tmp') }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#configuration' do
|
47
|
+
subject { Musical.configuration }
|
48
|
+
|
49
|
+
it 'returns a subclass of OpenStruct' do
|
50
|
+
expect(subject).to be_an OpenStruct
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'includes working directory' do
|
54
|
+
expect(subject.working_dir).to eq(File.join(File.expand_path('~'), '.musical'))
|
55
|
+
end
|
6
56
|
end
|
7
57
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,12 +1,23 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'musical'
|
1
|
+
# coding: utf-8
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
require 'bundler'
|
4
|
+
require 'fakefs/spec_helpers'
|
5
|
+
require 'simplecov'
|
6
|
+
require 'coveralls'
|
7
|
+
|
8
|
+
Bundler.setup(:default, :development)
|
9
9
|
|
10
10
|
RSpec.configure do |config|
|
11
|
-
|
11
|
+
config.color_enabled = true
|
12
|
+
config.tty = true
|
13
|
+
#config.formatter = :documentation
|
14
|
+
config.include FakeFS::SpecHelpers, fakefs: true
|
15
|
+
end
|
16
|
+
|
17
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
18
|
+
SimpleCov::Formatter::HTMLFormatter,
|
19
|
+
Coveralls::SimpleCov::Formatter
|
20
|
+
]
|
21
|
+
SimpleCov.start do
|
22
|
+
add_filter '/spec/'
|
12
23
|
end
|
data/spec/util_spec.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'musical'
|
4
|
+
|
5
|
+
describe Musical::Util do
|
6
|
+
class DummyClass
|
7
|
+
include Musical::Util
|
8
|
+
end
|
9
|
+
let!(:klass) { DummyClass.new }
|
10
|
+
|
11
|
+
describe '#check_env' do
|
12
|
+
subject(:check_env) { klass.check_env }
|
13
|
+
|
14
|
+
context 'when app is not installed' do
|
15
|
+
before do
|
16
|
+
klass.should_receive(:installed?).and_return(false)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'raises a RuntimeError' do
|
20
|
+
expect { check_env }.to raise_error(RuntimeError)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when app is installed' do
|
25
|
+
before do
|
26
|
+
klass.should_receive(:installed?).twice.and_return(true)
|
27
|
+
end
|
28
|
+
|
29
|
+
it { should be_true }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'installed?' do
|
34
|
+
subject { klass.installed?(app) }
|
35
|
+
let(:app) { 'dvdbackup' }
|
36
|
+
|
37
|
+
context 'when app is not installed' do
|
38
|
+
before do
|
39
|
+
klass.should_receive(:execute_command).with("which #{app}").and_return('')
|
40
|
+
end
|
41
|
+
it { should be_false }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when spp is installed' do
|
45
|
+
before do
|
46
|
+
klass.should_receive(:execute_command).with("which #{app}").and_return('/path/to/app')
|
47
|
+
end
|
48
|
+
it { should be_true }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#execute_command' do
|
53
|
+
let(:cmd) { 'which app' }
|
54
|
+
let(:path) { '/path/to/app' }
|
55
|
+
|
56
|
+
context 'when silent options is not given' do
|
57
|
+
subject { klass.execute_command(cmd) }
|
58
|
+
before { Open3.should_receive(:capture2).with(cmd).and_return(path) }
|
59
|
+
it { expect(subject).to eq(path) }
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'when silent option is given' do
|
63
|
+
subject { klass.execute_command(cmd, true) }
|
64
|
+
before { Open3.should_receive(:capture2).with("#{cmd} 2>/dev/null").and_return(path) }
|
65
|
+
it { expect(subject).to eq(path) }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
metadata
CHANGED
@@ -1,149 +1,262 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: musical
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
6
|
+
authors:
|
8
7
|
- ryo katsuma
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.16.2
|
24
|
-
type: :runtime
|
25
|
-
prerelease: false
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: progressbar
|
29
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
-
none: false
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 0.9.1
|
35
|
-
type: :runtime
|
11
|
+
date: 2013-09-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
36
21
|
prerelease: false
|
37
|
-
version_requirements:
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 10.0.3
|
34
|
+
type: :development
|
47
35
|
prerelease: false
|
48
|
-
version_requirements:
|
49
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 10.0.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
50
42
|
name: rspec
|
51
|
-
requirement:
|
52
|
-
|
53
|
-
requirements:
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
54
45
|
- - ~>
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 2.
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.14.0
|
57
48
|
type: :development
|
58
49
|
prerelease: false
|
59
|
-
version_requirements:
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.14.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rb-fsevent
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
65
73
|
- - ~>
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: 1.
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.6.2
|
68
76
|
type: :development
|
69
77
|
prerelease: false
|
70
|
-
version_requirements:
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.6.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.4.1
|
79
90
|
type: :development
|
80
91
|
prerelease: false
|
81
|
-
version_requirements:
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.4.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: growl
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.0.3
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
|
-
version_requirements:
|
93
|
-
|
94
|
-
|
95
|
-
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.0.3
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: fakefs
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.4.2
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.4.2
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.7.1
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.7.1
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: coveralls
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.6.6
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.6.6
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: ruby-progressbar
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 1.2.0
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 1.2.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: trollop
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '2.0'
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '2.0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: itunes-client
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ~>
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 0.1.2
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ~>
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 0.1.2
|
195
|
+
description: Musical is a simple tool for your favorite music DVD. You can rip vob
|
196
|
+
file by DVD chapter, convert it to wav file and add it to your iTunes library.
|
197
|
+
email:
|
198
|
+
- katsuma@gmail.com
|
199
|
+
executables:
|
96
200
|
- musical
|
97
201
|
extensions: []
|
98
|
-
|
99
|
-
|
100
|
-
-
|
101
|
-
- README.rdoc
|
102
|
-
files:
|
202
|
+
extra_rdoc_files: []
|
203
|
+
files:
|
204
|
+
- .coveralls.yml
|
103
205
|
- .document
|
206
|
+
- .gitignore
|
104
207
|
- .rspec
|
208
|
+
- .ruby-version
|
209
|
+
- .travis.yml
|
105
210
|
- Gemfile
|
211
|
+
- Guardfile
|
106
212
|
- LICENSE.txt
|
107
|
-
- README.
|
213
|
+
- README.md
|
108
214
|
- Rakefile
|
109
|
-
- VERSION
|
110
215
|
- bin/musical
|
111
216
|
- lib/musical.rb
|
217
|
+
- lib/musical/configuration.rb
|
112
218
|
- lib/musical/dvd.rb
|
113
|
-
- lib/musical/
|
219
|
+
- lib/musical/dvd/chapter.rb
|
220
|
+
- lib/musical/dvd/wav.rb
|
221
|
+
- lib/musical/util.rb
|
222
|
+
- lib/musical/version.rb
|
114
223
|
- musical.gemspec
|
224
|
+
- spec/musical/configuration_spec.rb
|
225
|
+
- spec/musical/dvd/chapter_spec.rb
|
226
|
+
- spec/musical/dvd/wav_spec.rb
|
227
|
+
- spec/musical/dvd_spec.rb
|
115
228
|
- spec/musical_spec.rb
|
116
229
|
- spec/spec_helper.rb
|
117
|
-
|
230
|
+
- spec/util_spec.rb
|
118
231
|
homepage: http://github.com/katsuma/musical
|
119
|
-
licenses:
|
232
|
+
licenses:
|
120
233
|
- MIT
|
234
|
+
metadata: {}
|
121
235
|
post_install_message:
|
122
236
|
rdoc_options: []
|
123
|
-
|
124
|
-
require_paths:
|
237
|
+
require_paths:
|
125
238
|
- lib
|
126
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
none: false
|
137
|
-
requirements:
|
138
|
-
- - ">="
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
version: "0"
|
239
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - '>='
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '0'
|
244
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
|
+
requirements:
|
246
|
+
- - '>='
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
version: '0'
|
141
249
|
requirements: []
|
142
|
-
|
143
250
|
rubyforge_project:
|
144
|
-
rubygems_version:
|
251
|
+
rubygems_version: 2.0.3
|
145
252
|
signing_key:
|
146
|
-
specification_version:
|
253
|
+
specification_version: 4
|
147
254
|
summary: A simple rip, encode and iTunes library tool for your favorite music DVD
|
148
|
-
test_files:
|
149
|
-
|
255
|
+
test_files:
|
256
|
+
- spec/musical/configuration_spec.rb
|
257
|
+
- spec/musical/dvd/chapter_spec.rb
|
258
|
+
- spec/musical/dvd/wav_spec.rb
|
259
|
+
- spec/musical/dvd_spec.rb
|
260
|
+
- spec/musical_spec.rb
|
261
|
+
- spec/spec_helper.rb
|
262
|
+
- spec/util_spec.rb
|