bulldog 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.0.10 2009-12-01
2
+
3
+ * Fix recording video frame when frame attachment already exists.
4
+
1
5
  == 0.0.9 2009-11-18
2
6
 
3
7
  * Allow specifying a subset of styles to process via a :styles option
data/Rakefile CHANGED
@@ -42,7 +42,6 @@ namespace :spec do
42
42
  Spec::Rake::SpecTask.new(:unit) do |t|
43
43
  t.pattern = 'spec/unit/**/*_spec.rb'
44
44
  t.libs << 'lib' << 'spec'
45
- t.spec_opts = ['--options', "\"#{PLUGIN_ROOT}/spec/spec.opts\""]
46
45
  end
47
46
 
48
47
  Spec::Rake::SpecTask.new(:integration) do |t|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.9
1
+ 0.0.10
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bulldog}
8
- s.version = "0.0.9"
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-11-23}
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
- file = SavedFile.new(output_path, :file_name => basename)
70
- record.update_attribute(attribute, file)
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.9
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-11-23 00:00:00 -05:00
12
+ date: 2009-12-01 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency