falcon 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/falcon/base.rb CHANGED
@@ -30,10 +30,9 @@ module Falcon
30
30
  has_many :falcon_encodings,
31
31
  :class_name => 'Falcon::Encoding',
32
32
  :as => :videoable,
33
- :dependent => :delete_all
33
+ :dependent => :destroy
34
34
 
35
35
  after_save :save_falcon_medias
36
- before_destroy :destroy_falcon_medias
37
36
 
38
37
  define_falcon_callbacks :encode, :"#{name}_encode"
39
38
 
@@ -24,6 +24,7 @@ module Falcon
24
24
  validates_presence_of :name, :profile_name, :source_path
25
25
 
26
26
  before_validation :set_resolution
27
+ before_destroy :remove_output
27
28
 
28
29
  scope :with_profile, lambda {|name| where(:profile_name => Falcon::Profile.detect(name).name) }
29
30
  scope :with_name, lambda {|name| where(:name => name) }
@@ -218,6 +219,10 @@ module Falcon
218
219
  return false
219
220
  end
220
221
  end
222
+
223
+ def remove_output
224
+ FileUtils.rm(output_path, :force => true) if File.exists?(output_path)
225
+ end
221
226
  end
222
227
  end
223
228
  end
data/lib/falcon/media.rb CHANGED
@@ -148,10 +148,9 @@ module Falcon
148
148
 
149
149
  # Clear generated files and created encodings
150
150
  def flush_deletes
151
- instance.falcon_encodings.delete_all
152
-
153
151
  profiles.each do |profile_name, profile|
154
- FileUtils.rm(path(profile), :force => true)
152
+ filepath = path(profile)
153
+ FileUtils.rm(filepath, :force => true) if filepath && File.exists?(filepath)
155
154
  end
156
155
  end
157
156
  end
@@ -1,3 +1,3 @@
1
1
  module Falcon
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.1.1".freeze
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falcon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Igor Galeta
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-05-18 00:00:00 +03:00
19
+ date: 2011-05-24 00:00:00 +03:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency