carrierwave-video 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -0
- data/lib/carrierwave-video/version.rb +1 -1
- data/lib/carrierwave/video.rb +12 -0
- data/spec/lib/carrierwave_video_spec.rb +10 -3
- metadata +55 -71
data/README.rdoc
CHANGED
@@ -44,9 +44,12 @@ Watermark:
|
|
44
44
|
}
|
45
45
|
|
46
46
|
Callbacks:
|
47
|
+
These are methods defined on the model. They will be run as part of the transcoding process.
|
48
|
+
Useful for notating failure and completion.
|
47
49
|
callbacks: {
|
48
50
|
before_transcode: :method
|
49
51
|
after_transcode: :method
|
52
|
+
rescue: :method
|
50
53
|
ensure: :method
|
51
54
|
}
|
52
55
|
|
data/lib/carrierwave/video.rb
CHANGED
@@ -35,6 +35,18 @@ module CarrierWave
|
|
35
35
|
setup_logger(logger_opt)
|
36
36
|
block.call
|
37
37
|
send_callback(callbacks[:after_transcode])
|
38
|
+
rescue => e
|
39
|
+
send_callback(callbacks[:rescue])
|
40
|
+
|
41
|
+
if logger_opt
|
42
|
+
logger = model.send(logger_opt)
|
43
|
+
logger.error "#{e.class}: #{e.message}"
|
44
|
+
e.backtrace.each do |b|
|
45
|
+
logger.error b
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
raise e
|
38
50
|
ensure
|
39
51
|
reset_logger
|
40
52
|
send_callback(callbacks[:ensure])
|
@@ -62,12 +62,14 @@ describe CarrierWave::Video do
|
|
62
62
|
it "calls before_transcode, after_transcode, and ensure" do
|
63
63
|
converter.model.should_receive(:method1).ordered
|
64
64
|
converter.model.should_receive(:method2).ordered
|
65
|
-
converter.model.
|
65
|
+
converter.model.should_not_receive(:method3)
|
66
|
+
converter.model.should_receive(:method4).ordered
|
66
67
|
|
67
68
|
converter.encode_video(format, callbacks: {
|
68
69
|
before_transcode: :method1,
|
69
70
|
after_transcode: :method2,
|
70
|
-
|
71
|
+
rescue: :method3,
|
72
|
+
ensure: :method4
|
71
73
|
})
|
72
74
|
end
|
73
75
|
end
|
@@ -80,12 +82,14 @@ describe CarrierWave::Video do
|
|
80
82
|
converter.model.should_receive(:method1).ordered
|
81
83
|
converter.model.should_not_receive(:method2)
|
82
84
|
converter.model.should_receive(:method3).ordered
|
85
|
+
converter.model.should_receive(:method4).ordered
|
83
86
|
|
84
87
|
lambda do
|
85
88
|
converter.encode_video(format, callbacks: {
|
86
89
|
before_transcode: :method1,
|
87
90
|
after_transcode: :method2,
|
88
|
-
|
91
|
+
rescue: :method3,
|
92
|
+
ensure: :method4
|
89
93
|
})
|
90
94
|
end.should raise_exception(e)
|
91
95
|
end
|
@@ -115,6 +119,9 @@ describe CarrierWave::Video do
|
|
115
119
|
before { File.should_receive(:rename).and_raise(e) }
|
116
120
|
|
117
121
|
it "logs exception" do
|
122
|
+
logger.should_receive(:error).with("#{e.class}: #{e.message}")
|
123
|
+
logger.should_receive(:error).any_number_of_times #backtrace
|
124
|
+
|
118
125
|
lambda do
|
119
126
|
converter.encode_video(format, logger: :logger)
|
120
127
|
end.should raise_exception(e)
|
metadata
CHANGED
@@ -1,68 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-video
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
version: 0.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- rheaton
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-04-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rspec
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
- 0
|
29
|
-
version: "0"
|
16
|
+
requirement: &70331058547100 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
30
22
|
type: :development
|
31
|
-
version_requirements: *id001
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
|
-
name: streamio-ffmpeg
|
34
23
|
prerelease: false
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
24
|
+
version_requirements: *70331058547100
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: streamio-ffmpeg
|
27
|
+
requirement: &70331058546500 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
42
33
|
type: :runtime
|
43
|
-
version_requirements: *id002
|
44
|
-
- !ruby/object:Gem::Dependency
|
45
|
-
name: carrierwave
|
46
34
|
prerelease: false
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
35
|
+
version_requirements: *70331058546500
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: carrierwave
|
38
|
+
requirement: &70331058545760 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
54
44
|
type: :runtime
|
55
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70331058545760
|
56
47
|
description: Transcodes to html5-friendly videos.
|
57
|
-
email:
|
48
|
+
email:
|
58
49
|
- rachelmheaton@gmail.com
|
59
50
|
executables: []
|
60
|
-
|
61
51
|
extensions: []
|
62
|
-
|
63
52
|
extra_rdoc_files: []
|
64
|
-
|
65
|
-
files:
|
53
|
+
files:
|
66
54
|
- .gitignore
|
67
55
|
- Gemfile
|
68
56
|
- README.rdoc
|
@@ -73,37 +61,33 @@ files:
|
|
73
61
|
- lib/carrierwave/video/ffmpeg_options.rb
|
74
62
|
- spec/lib/carrierwave_video_spec.rb
|
75
63
|
- spec/spec_helper.rb
|
76
|
-
|
77
|
-
homepage: ""
|
64
|
+
homepage: ''
|
78
65
|
licenses: []
|
79
|
-
|
80
66
|
post_install_message:
|
81
67
|
rdoc_options: []
|
82
|
-
|
83
|
-
require_paths:
|
68
|
+
require_paths:
|
84
69
|
- lib
|
85
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
requirements:
|
94
|
-
- -
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
|
97
|
-
|
98
|
-
version: "0"
|
99
|
-
requirements:
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements:
|
100
83
|
- ruby, version 1.9 or greater
|
101
|
-
- ffmpeg, version 0.10 or greater with libx256, libfaac, libtheora, libvorbid, libvpx
|
84
|
+
- ffmpeg, version 0.10 or greater with libx256, libfaac, libtheora, libvorbid, libvpx
|
85
|
+
enabled
|
102
86
|
rubyforge_project: carrierwave-video
|
103
|
-
rubygems_version: 1.
|
87
|
+
rubygems_version: 1.8.17
|
104
88
|
signing_key:
|
105
89
|
specification_version: 3
|
106
90
|
summary: Carrierwave extension that uses ffmpeg to transcode videos.
|
107
|
-
test_files:
|
91
|
+
test_files:
|
108
92
|
- spec/lib/carrierwave_video_spec.rb
|
109
93
|
- spec/spec_helper.rb
|