bulldog 0.0.9 → 0.0.10
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.
- data/CHANGELOG +4 -0
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/bulldog.gemspec +2 -2
- data/lib/bulldog/processor/ffmpeg.rb +11 -2
- data/spec/unit/processor/ffmpeg_spec.rb +19 -0
- metadata +2 -2
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.10
|
data/bulldog.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bulldog}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["George Ogata"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-12-01}
|
13
13
|
s.description = %q{= Bulldog
|
14
14
|
|
15
15
|
Flexible file attachments for active record.
|
@@ -66,8 +66,12 @@ module Bulldog
|
|
66
66
|
basename = "recorded_frame.#{params[:format]}"
|
67
67
|
output_path = record.send(attribute).interpolate_path(:original, :basename => basename)
|
68
68
|
@still_frame_callbacks << lambda do
|
69
|
-
|
70
|
-
|
69
|
+
if existing_frame_path(attribute) == output_path
|
70
|
+
attachment.reload
|
71
|
+
else
|
72
|
+
file = SavedFile.new(output_path, :file_name => basename)
|
73
|
+
record.update_attribute(attribute, file)
|
74
|
+
end
|
71
75
|
end
|
72
76
|
else
|
73
77
|
output_path = output_file(style.name)
|
@@ -159,6 +163,11 @@ module Bulldog
|
|
159
163
|
record.errors.add name, "convert failed (status #$?)"
|
160
164
|
end
|
161
165
|
|
166
|
+
def existing_frame_path(attribute)
|
167
|
+
stream = record.send(attribute).stream
|
168
|
+
stream && stream.path
|
169
|
+
end
|
170
|
+
|
162
171
|
def run_still_frame_callbacks
|
163
172
|
@still_frame_callbacks.each(&:call)
|
164
173
|
end
|
@@ -184,6 +184,25 @@ describe Processor::Ffmpeg do
|
|
184
184
|
context.should be_a(Processor::Ffmpeg)
|
185
185
|
argument.should == original_frame_path
|
186
186
|
end
|
187
|
+
|
188
|
+
describe "when the frame attachment already exists" do
|
189
|
+
before do
|
190
|
+
thing = Thing.create(:frame => test_image_file('test.jpg'))
|
191
|
+
@thing = Thing.find(thing.id)
|
192
|
+
@thing.video = test_video_file('test.mov')
|
193
|
+
@thing.video.stubs(:duration).returns(1)
|
194
|
+
end
|
195
|
+
|
196
|
+
it "should update the original file of the specified attachment" do
|
197
|
+
lambda do
|
198
|
+
process_video :styles => [:original] do
|
199
|
+
record_frame(:format => 'jpg', :assign_to => :frame)
|
200
|
+
end
|
201
|
+
end.should modify_file(original_frame_path)
|
202
|
+
# file could be empty if it is destroyed before saving
|
203
|
+
File.size(original_frame_path).should > 0
|
204
|
+
end
|
205
|
+
end
|
187
206
|
end
|
188
207
|
|
189
208
|
describe "using style attributes" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bulldog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- George Ogata
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-01 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|