media_magick 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5010b17bde4d5e416354066e20eac8c98b72d159
4
+ data.tar.gz: e5b8124723fedfbeebfe1335c0082441855980f6
5
+ SHA512:
6
+ metadata.gz: b882cebd2353ce427b12bf2a829af9dfa6534a889ac2f6c88ef2ee3e794bcf246325f49c343de381739d2f6816de5bf167739bcea895c6b836271e053e15fe3d
7
+ data.tar.gz: e96d2a6196100af381b2f0a08a7a8ae723552db67a06f3da6f0d3f2dca298d98a702c453f5888c789e930f31d3d95b74ae539d8c3352e6efb976b89b2a135451
data/.travis.yml CHANGED
@@ -8,7 +8,6 @@ notifications:
8
8
  email:
9
9
  - contato@lucasrenan.com
10
10
  - rbrancher@gmail.com
11
- - tiagogodinho3@gmail.com
12
11
 
13
12
  gemfile:
14
13
  - Gemfile
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  * support rails 4
4
4
 
5
+ ## 0.3.2 - August 2, 2013
6
+
7
+ * bug fix: removes image from file system after remove document
8
+
9
+ * bug fix: works after ajax load
10
+
11
+ ## 0.3.1 - July 1, 2013 (yanked)
12
+
5
13
  ## 0.3.0 - July 1, 2013
6
14
 
7
15
  ### Helpers
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Lucas Renan, Rodrigo Brancher e Tiago Rafael Godinho
1
+ Copyright (c) 2012 Lucas Renan e Rodrigo Brancher
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -6,7 +6,7 @@ MediaMagick aims to make dealing with multimedia resources a very easy task –
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'media_magick', '~> 0.3.0'
9
+ gem 'media_magick', '~> 0.3.2'
10
10
 
11
11
  And then execute:
12
12
 
@@ -39,7 +39,7 @@
39
39
 
40
40
  var $container = $(this);
41
41
  settings.container = $container.attr('id');
42
- var modelAndRelation = $container.data('model').replace('::','-') + "-" + $container.data('relation');
42
+ var modelAndRelation = $container.data('model').replace(/::/g,'-') + "-" + $container.data('relation');
43
43
 
44
44
  // setup unique ids from classes
45
45
  $container.find('.' + settings.browse_button).attr('id', settings.container + '-' + settings.browse_button);
@@ -126,11 +126,11 @@
126
126
 
127
127
  $(function() {
128
128
  // video upload (youtube/vimeo)
129
- $('.attachmentVideoUploader').on('click', 'a.attachmentVideoUploaderButton', function(){
129
+ $('body').on('click', '.attachmentVideoUploader a.attachmentVideoUploaderButton', function(){
130
130
  var $container = $(this).parent(".attachmentVideoUploader");
131
131
  var $attachment = $(this).parents('.attachment');
132
132
  var $videoField = $container.find(".attachmentVideoUploaderField");
133
- var modelAndRelation = $container.data('model').replace('::','-') + "-" + $container.data('relation');
133
+ var modelAndRelation = $container.data('model').replace(/::/g,'-') + "-" + $container.data('relation');
134
134
 
135
135
  $.get('/upload', {
136
136
  model: $container.data('model'),
@@ -148,7 +148,7 @@ $(function() {
148
148
  });
149
149
 
150
150
  // attachment removal
151
- $('.loadedAttachments').on('click', 'a.remove', function() {
151
+ $('body').on('click', '.loadedAttachments a.remove', function() {
152
152
  var confirmation_message = $(this).data("confirmation");
153
153
  var answer = confirm(confirmation_message);
154
154
 
@@ -25,7 +25,7 @@ module MediaMagick
25
25
  embedded_in(:attachmentable, polymorphic: true)
26
26
  end
27
27
 
28
- embeds_many(name, :as => :attachmentable, class_name: "#{self}#{name_camelcase}")
28
+ embeds_many(name, :as => :attachmentable, class_name: "#{self}#{name_camelcase}", cascade_callbacks: true)
29
29
  end
30
30
 
31
31
  # smell
@@ -54,6 +54,17 @@ module MediaMagick
54
54
  field :type, type: String, default: options[:as] || 'image'
55
55
  field :dimensions, type: Hash, default: {}
56
56
 
57
+ before_destroy :cache_store_dir
58
+ after_destroy :remove_directory
59
+
60
+ def cache_store_dir
61
+ @cache_store_dir = store_dir
62
+ end
63
+
64
+ def remove_directory
65
+ FileUtils.remove_dir("#{Rails.root}/public/#{@cache_store_dir}", force: false)
66
+ end
67
+
57
68
  def self.create_video_methods(name)
58
69
  field :video, type: String
59
70
 
@@ -1,3 +1,3 @@
1
1
  module MediaMagick
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.2'
3
3
  end
data/media_magick.gemspec CHANGED
@@ -2,8 +2,8 @@
2
2
  require File.expand_path('../lib/media_magick/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ['Lucas Renan', 'Rodrigo Brancher', 'Tiago Rafael Godinho']
6
- gem.email = ['contato@lucasrenan.com', 'rbrancher@gmail.com', 'tiagogodinho3@gmail.com']
5
+ gem.authors = ['Lucas Renan', 'Rodrigo Brancher']
6
+ gem.email = ['contato@lucasrenan.com', 'rbrancher@gmail.com']
7
7
  gem.description = %q{MediaMagick aims to make dealing with multimedia resources a very easy task – like magic.}
8
8
  gem.summary = %q{MediaMagick aims to make dealing with multimedia resources a very easy task – like magic. It wraps up robust solutions for upload, associate and display images, videos, audios and files to any model in your rails app.}
9
9
  gem.homepage = 'https://github.com/nudesign/media_magick'
@@ -26,4 +26,4 @@ Gem::Specification.new do |gem|
26
26
  gem.add_development_dependency 'simplecov', '~> 0.7.1'
27
27
  gem.add_development_dependency 'guard-rspec', '~> 3.0.2'
28
28
  gem.add_development_dependency 'rb-fsevent', '~> 0.9.3'
29
- end
29
+ end
@@ -131,6 +131,19 @@ describe MediaMagick::Model do
131
131
  it { subject.music.should be_a_instance_of(AmazonS3Uploader) }
132
132
  end
133
133
  end
134
+
135
+ context 'when user removes parent record' do
136
+
137
+ it "should remove the pictures of the system" do
138
+ %w[images photos files photos_and_videos pictures].each do |attaches|
139
+ subject = @klass.create
140
+ @image = subject.send(attaches).create(attaches.singularize => File.open("#{File.expand_path('../../..', __FILE__)}/support/fixtures/nu.jpg") )
141
+
142
+ subject.destroy
143
+ expect(File.directory?("#{Rails.root}/public/#{@image.store_dir}")).to be_false
144
+ end
145
+ end
146
+ end
134
147
  end
135
148
  end
136
149
 
metadata CHANGED
@@ -1,22 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: media_magick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.3.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Lucas Renan
9
8
  - Rodrigo Brancher
10
- - Tiago Rafael Godinho
11
9
  autorequire:
12
10
  bindir: bin
13
11
  cert_chain: []
14
- date: 2013-07-01 00:00:00.000000000 Z
12
+ date: 2013-08-02 00:00:00.000000000 Z
15
13
  dependencies:
16
14
  - !ruby/object:Gem::Dependency
17
15
  name: carrierwave
18
16
  requirement: !ruby/object:Gem::Requirement
19
- none: false
20
17
  requirements:
21
18
  - - ~>
22
19
  - !ruby/object:Gem::Version
@@ -24,7 +21,6 @@ dependencies:
24
21
  type: :runtime
25
22
  prerelease: false
26
23
  version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
24
  requirements:
29
25
  - - ~>
30
26
  - !ruby/object:Gem::Version
@@ -32,23 +28,20 @@ dependencies:
32
28
  - !ruby/object:Gem::Dependency
33
29
  name: mongoid
34
30
  requirement: !ruby/object:Gem::Requirement
35
- none: false
36
31
  requirements:
37
- - - ! '>='
32
+ - - '>='
38
33
  - !ruby/object:Gem::Version
39
34
  version: 2.7.0
40
35
  type: :runtime
41
36
  prerelease: false
42
37
  version_requirements: !ruby/object:Gem::Requirement
43
- none: false
44
38
  requirements:
45
- - - ! '>='
39
+ - - '>='
46
40
  - !ruby/object:Gem::Version
47
41
  version: 2.7.0
48
42
  - !ruby/object:Gem::Dependency
49
43
  name: plupload-rails
50
44
  requirement: !ruby/object:Gem::Requirement
51
- none: false
52
45
  requirements:
53
46
  - - ~>
54
47
  - !ruby/object:Gem::Version
@@ -56,7 +49,6 @@ dependencies:
56
49
  type: :runtime
57
50
  prerelease: false
58
51
  version_requirements: !ruby/object:Gem::Requirement
59
- none: false
60
52
  requirements:
61
53
  - - ~>
62
54
  - !ruby/object:Gem::Version
@@ -64,7 +56,6 @@ dependencies:
64
56
  - !ruby/object:Gem::Dependency
65
57
  name: rails
66
58
  requirement: !ruby/object:Gem::Requirement
67
- none: false
68
59
  requirements:
69
60
  - - ~>
70
61
  - !ruby/object:Gem::Version
@@ -72,7 +63,6 @@ dependencies:
72
63
  type: :runtime
73
64
  prerelease: false
74
65
  version_requirements: !ruby/object:Gem::Requirement
75
- none: false
76
66
  requirements:
77
67
  - - ~>
78
68
  - !ruby/object:Gem::Version
@@ -80,7 +70,6 @@ dependencies:
80
70
  - !ruby/object:Gem::Dependency
81
71
  name: mini_magick
82
72
  requirement: !ruby/object:Gem::Requirement
83
- none: false
84
73
  requirements:
85
74
  - - ~>
86
75
  - !ruby/object:Gem::Version
@@ -88,7 +77,6 @@ dependencies:
88
77
  type: :runtime
89
78
  prerelease: false
90
79
  version_requirements: !ruby/object:Gem::Requirement
91
- none: false
92
80
  requirements:
93
81
  - - ~>
94
82
  - !ruby/object:Gem::Version
@@ -96,7 +84,6 @@ dependencies:
96
84
  - !ruby/object:Gem::Dependency
97
85
  name: rake
98
86
  requirement: !ruby/object:Gem::Requirement
99
- none: false
100
87
  requirements:
101
88
  - - ~>
102
89
  - !ruby/object:Gem::Version
@@ -104,7 +91,6 @@ dependencies:
104
91
  type: :development
105
92
  prerelease: false
106
93
  version_requirements: !ruby/object:Gem::Requirement
107
- none: false
108
94
  requirements:
109
95
  - - ~>
110
96
  - !ruby/object:Gem::Version
@@ -112,7 +98,6 @@ dependencies:
112
98
  - !ruby/object:Gem::Dependency
113
99
  name: rspec-rails
114
100
  requirement: !ruby/object:Gem::Requirement
115
- none: false
116
101
  requirements:
117
102
  - - ~>
118
103
  - !ruby/object:Gem::Version
@@ -120,7 +105,6 @@ dependencies:
120
105
  type: :development
121
106
  prerelease: false
122
107
  version_requirements: !ruby/object:Gem::Requirement
123
- none: false
124
108
  requirements:
125
109
  - - ~>
126
110
  - !ruby/object:Gem::Version
@@ -128,7 +112,6 @@ dependencies:
128
112
  - !ruby/object:Gem::Dependency
129
113
  name: simplecov
130
114
  requirement: !ruby/object:Gem::Requirement
131
- none: false
132
115
  requirements:
133
116
  - - ~>
134
117
  - !ruby/object:Gem::Version
@@ -136,7 +119,6 @@ dependencies:
136
119
  type: :development
137
120
  prerelease: false
138
121
  version_requirements: !ruby/object:Gem::Requirement
139
- none: false
140
122
  requirements:
141
123
  - - ~>
142
124
  - !ruby/object:Gem::Version
@@ -144,7 +126,6 @@ dependencies:
144
126
  - !ruby/object:Gem::Dependency
145
127
  name: guard-rspec
146
128
  requirement: !ruby/object:Gem::Requirement
147
- none: false
148
129
  requirements:
149
130
  - - ~>
150
131
  - !ruby/object:Gem::Version
@@ -152,7 +133,6 @@ dependencies:
152
133
  type: :development
153
134
  prerelease: false
154
135
  version_requirements: !ruby/object:Gem::Requirement
155
- none: false
156
136
  requirements:
157
137
  - - ~>
158
138
  - !ruby/object:Gem::Version
@@ -160,7 +140,6 @@ dependencies:
160
140
  - !ruby/object:Gem::Dependency
161
141
  name: rb-fsevent
162
142
  requirement: !ruby/object:Gem::Requirement
163
- none: false
164
143
  requirements:
165
144
  - - ~>
166
145
  - !ruby/object:Gem::Version
@@ -168,7 +147,6 @@ dependencies:
168
147
  type: :development
169
148
  prerelease: false
170
149
  version_requirements: !ruby/object:Gem::Requirement
171
- none: false
172
150
  requirements:
173
151
  - - ~>
174
152
  - !ruby/object:Gem::Version
@@ -178,7 +156,6 @@ description: MediaMagick aims to make dealing with multimedia resources a very e
178
156
  email:
179
157
  - contato@lucasrenan.com
180
158
  - rbrancher@gmail.com
181
- - tiagogodinho3@gmail.com
182
159
  executables: []
183
160
  extensions: []
184
161
  extra_rdoc_files: []
@@ -303,27 +280,26 @@ files:
303
280
  - tmp/rspec_guard_result
304
281
  homepage: https://github.com/nudesign/media_magick
305
282
  licenses: []
283
+ metadata: {}
306
284
  post_install_message:
307
285
  rdoc_options: []
308
286
  require_paths:
309
287
  - lib
310
288
  required_ruby_version: !ruby/object:Gem::Requirement
311
- none: false
312
289
  requirements:
313
- - - ! '>='
290
+ - - '>='
314
291
  - !ruby/object:Gem::Version
315
292
  version: '0'
316
293
  required_rubygems_version: !ruby/object:Gem::Requirement
317
- none: false
318
294
  requirements:
319
- - - ! '>='
295
+ - - '>='
320
296
  - !ruby/object:Gem::Version
321
297
  version: '0'
322
298
  requirements: []
323
299
  rubyforge_project:
324
- rubygems_version: 1.8.25
300
+ rubygems_version: 2.0.4
325
301
  signing_key:
326
- specification_version: 3
302
+ specification_version: 4
327
303
  summary: MediaMagick aims to make dealing with multimedia resources a very easy task
328
304
  – like magic. It wraps up robust solutions for upload, associate and display images,
329
305
  videos, audios and files to any model in your rails app.