paperclip-meta 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e36414c9d1d67bd4c52d90b1ebef4e61dacaa3d
4
- data.tar.gz: 404a380bcfba1fb3a592022d2b9a1d7e25e0a512
3
+ metadata.gz: e5144016b9bfc125ed6df81bcb20304bdc0d0e36
4
+ data.tar.gz: 256c57dfea9350300f01fd20cce281ffeae0b0a8
5
5
  SHA512:
6
- metadata.gz: 09d94966b9b47d6299fbd31f57811cfc8bb7c40973e89d37aea473ca38d34cb91646790bde29f1dde7f5fc3e6f9a9a7c5bb4362411db6faa29a1ede87f6d9fb9
7
- data.tar.gz: f3c1adadc65147c11b6d6e08da2d9183e69f75eb47075c510845c449689857e978c31d7810e7b0e607113eac5cc9341be56683146f0655758e04108a52b07a8a
6
+ metadata.gz: 8f6f8282f21b20850a2b7e2a1a06fcee52930978740c133d33bedc3928ddb357a79a57501f447a694ec1f271a6ff99b3d93f0a57fa91673f6db1201dfec78e5a
7
+ data.tar.gz: 567a4d3ef8302a5a3d9ca8caecb4d27d942ade18fe7a67aa6d36a1059f36189c183df2ab42045740894e7df406d37dec36a5a0fd10fc79b7c1b7a87ec84a9fcc
@@ -0,0 +1,13 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ Style/AlignParameters:
4
+ Enabled: false
5
+
6
+ Style/MultilineOperationIndentation:
7
+ Enabled: false
8
+
9
+ Style/SignalException:
10
+ EnforcedStyle: only_raise
11
+
12
+ Style/StringLiterals:
13
+ EnforcedStyle: double_quotes
@@ -0,0 +1,41 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2015-12-29 14:24:38 -0700 using RuboCop version 0.35.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 4
10
+ # Configuration parameters: AllowURI, URISchemes.
11
+ Metrics/LineLength:
12
+ Max: 95
13
+
14
+ # Offense count: 6
15
+ # Configuration parameters: Exclude.
16
+ Style/Documentation:
17
+ Exclude:
18
+ - 'spec/**/*'
19
+ - 'test/**/*'
20
+ - 'lib/paperclip-meta/attachment.rb'
21
+ - 'lib/paperclip-meta/railtie.rb'
22
+ - 'lib/paperclip-meta/version.rb'
23
+
24
+ # Offense count: 1
25
+ # Configuration parameters: Exclude.
26
+ Style/FileName:
27
+ Exclude:
28
+ - 'lib/paperclip-meta.rb'
29
+
30
+ # Offense count: 1
31
+ # Configuration parameters: MinBodyLength.
32
+ Style/GuardClause:
33
+ Exclude:
34
+ - 'lib/paperclip-meta/attachment.rb'
35
+
36
+ # Offense count: 1
37
+ # Cop supports --auto-correct.
38
+ Style/SpecialGlobalVars:
39
+ Exclude:
40
+ - 'paperclip-meta.gemspec'
41
+
@@ -5,7 +5,6 @@ rvm:
5
5
  - 2.2
6
6
  - 2.1
7
7
  - 2.0.0
8
- - 1.9.3
9
8
  gemfile:
10
9
  - spec/gemfiles/Gemfile.paperclip-4
11
10
  - spec/gemfiles/Gemfile.paperclip-3
data/Gemfile CHANGED
@@ -1,10 +1,10 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  platforms :jruby do
4
- gem 'activerecord-jdbcsqlite3-adapter'
4
+ gem "activerecord-jdbcsqlite3-adapter"
5
5
  end
6
6
 
7
7
  # See paperclip-meta.gemspec
8
8
  gemspec
9
9
 
10
- gem 'paperclip'
10
+ gem "paperclip"
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
3
 
4
4
  Rake::TestTask.new(:spec) do |t|
5
- t.libs << 'spec'
5
+ t.libs << "spec"
6
6
  t.test_files = %w(spec/**/*_spec.rb)
7
7
  t.verbose = false
8
8
  end
@@ -1,3 +1,3 @@
1
- require 'paperclip-meta/version'
2
- require 'paperclip-meta/railtie'
3
- require 'paperclip-meta/attachment'
1
+ require "paperclip-meta/version"
2
+ require "paperclip-meta/railtie"
3
+ require "paperclip-meta/attachment"
@@ -1,8 +1,7 @@
1
- require 'paperclip-meta'
1
+ require "paperclip-meta"
2
2
 
3
3
  module Paperclip
4
4
  module Meta
5
-
6
5
  if defined? ::Rails::Railtie
7
6
  class Railtie < ::Rails::Railtie
8
7
  initializer :paperclip_meta do
@@ -18,6 +17,5 @@ module Paperclip
18
17
  Paperclip::Attachment.send(:include, Paperclip::Meta::Attachment)
19
18
  end
20
19
  end
21
-
22
20
  end
23
21
  end
@@ -1,5 +1,5 @@
1
1
  module Paperclip
2
2
  module Meta
3
- VERSION = "1.2.0"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Alexey Bondar", "Tee Parham"]
9
9
  s.email = ["y8@ya.ru", "tee@neighborland.com"]
10
10
  s.homepage = "http://github.com/teeparham/paperclip-meta"
11
- s.summary = %q{Add width, height, and size to paperclip images}
12
- s.description = %q{Add width, height and size methods to paperclip images}
11
+ s.summary = "Add width, height, and size to paperclip images"
12
+ s.description = "Add width, height and size methods to paperclip images"
13
13
  s.license = "MIT"
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
@@ -17,12 +17,12 @@ Gem::Specification.new do |s|
17
17
  s.executables = []
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.required_ruby_version = ">= 1.9.3"
20
+ s.required_ruby_version = ">= 2.0.0"
21
21
 
22
22
  s.add_dependency "paperclip", ">= 3.0.2", "< 5.0"
23
23
 
24
24
  s.add_development_dependency "bundler", "~> 1.5"
25
- s.add_development_dependency "rake", "~> 10.1"
25
+ s.add_development_dependency "rake", "~> 10.4"
26
26
  s.add_development_dependency "mocha", "~> 1.0"
27
27
  s.add_development_dependency "activerecord", ">= 4.0"
28
28
  s.add_development_dependency "sqlite3", ">= 1.3.10"
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe "Attachment" do
4
4
  it "saves image geometry for original image" do
@@ -8,7 +8,7 @@ describe "Attachment" do
8
8
  assert_equal geometry.width, img.small_image.width
9
9
  assert_equal geometry.height, img.small_image.height
10
10
  assert_equal "50x64", img.small_image.image_size
11
- assert_equal (50.0 / 64.0), img.small_image.aspect_ratio
11
+ assert_equal((50.0 / 64.0), img.small_image.aspect_ratio)
12
12
  end
13
13
 
14
14
  it "saves geometry for styles" do
@@ -37,19 +37,19 @@ describe "Attachment" do
37
37
  @image = Image.create(big_image: big_image)
38
38
  end
39
39
 
40
- it 'should save file size with meta data ' do
40
+ it "should save file size with meta data " do
41
41
  path = File.join(File.dirname(__FILE__), "tmp/fixtures/tmp/thumb/#{@image.id}.jpg")
42
42
  size = File.stat(path).size
43
43
  assert_equal size, @image.big_image.size(:thumb)
44
44
  end
45
45
 
46
- it 'should access normal paperclip method when no style passed' do
46
+ it "should access normal paperclip method when no style passed" do
47
47
  @image.big_image.expects size_without_meta_data: 1234
48
48
  assert_equal 1234, @image.big_image.size
49
49
  end
50
50
 
51
- it 'should have access to original file size' do
52
- assert_equal 37042, @image.big_image.size
51
+ it "should have access to original file size" do
52
+ assert_equal 37_042, @image.big_image.size
53
53
  end
54
54
  end
55
55
 
@@ -117,15 +117,15 @@ describe "Attachment" do
117
117
  assert_equal "50x64", img.big_image.image_size
118
118
  assert_equal "100x100", img.big_image.image_size(:thumb)
119
119
  assert_equal "500x500", img.big_image.image_size(:large)
120
- assert_equal (50.0 / 64.0), img.big_image.aspect_ratio
121
- assert_equal (100.0 / 100.0), img.big_image.aspect_ratio(:thumb)
122
- assert_equal (500.0 / 500.0), img.big_image.aspect_ratio(:large)
120
+ assert_equal((50.0 / 64.0), img.big_image.aspect_ratio)
121
+ assert_equal((100.0 / 100.0), img.big_image.aspect_ratio(:thumb))
122
+ assert_equal((500.0 / 500.0), img.big_image.aspect_ratio(:large))
123
123
  end
124
124
 
125
125
  private
126
126
 
127
127
  def small_path
128
- File.join(File.dirname(__FILE__), 'fixtures', 'small.png')
128
+ File.join(File.dirname(__FILE__), "fixtures", "small.png")
129
129
  end
130
130
 
131
131
  # 50x64
@@ -139,10 +139,10 @@ describe "Attachment" do
139
139
 
140
140
  # 600x277
141
141
  def big_image
142
- File.open(File.join(File.dirname(__FILE__), 'fixtures', 'big.jpg'))
142
+ File.open(File.join(File.dirname(__FILE__), "fixtures", "big.jpg"))
143
143
  end
144
144
 
145
145
  def not_image
146
- File.open(File.join(File.dirname(__FILE__), 'fixtures', 'big.zip'))
146
+ File.open(File.join(File.dirname(__FILE__), "fixtures", "big.zip"))
147
147
  end
148
148
  end
@@ -1,15 +1,15 @@
1
1
  ActiveRecord::Schema.define do
2
2
  create_table :images do |t|
3
- t.string :small_image_file_name
4
- t.string :small_image_content_type
3
+ t.string :small_image_file_name
4
+ t.string :small_image_content_type
5
5
  t.integer :small_image_updated_at
6
6
  t.integer :small_image_file_size
7
- t.string :small_image_meta
7
+ t.string :small_image_meta
8
8
 
9
- t.string :big_image_file_name
10
- t.string :big_image_content_type
9
+ t.string :big_image_file_name
10
+ t.string :big_image_content_type
11
11
  t.integer :big_image_updated_at
12
12
  t.integer :big_image_file_size
13
- t.string :big_image_meta
13
+ t.string :big_image_meta
14
14
  end
15
15
  end
@@ -1,8 +1,8 @@
1
- require 'bundler/setup'
1
+ require "bundler/setup"
2
2
  Bundler.require(:default)
3
- require 'active_record'
4
- require 'minitest/autorun'
5
- require 'mocha/setup'
3
+ require "active_record"
4
+ require "minitest/autorun"
5
+ require "mocha/setup"
6
6
 
7
7
  ActiveRecord::Base.establish_connection(
8
8
  adapter: "sqlite3",
@@ -15,13 +15,18 @@ else
15
15
  Paperclip.options[:log] = false
16
16
  end
17
17
 
18
- load(File.join(File.dirname(__FILE__), 'schema.rb'))
18
+ load(File.join(File.dirname(__FILE__), "schema.rb"))
19
19
 
20
20
  ActiveRecord::Base.send(:include, Paperclip::Glue)
21
21
  Paperclip::Meta::Railtie.insert
22
22
 
23
23
  I18n.enforce_available_locales = true
24
24
 
25
+ # suppress AR 4.2 warnings
26
+ if ActiveRecord::Base.respond_to?(:raise_in_transactional_callbacks)
27
+ ActiveRecord::Base.raise_in_transactional_callbacks = true
28
+ end
29
+
25
30
  class Image < ActiveRecord::Base
26
31
  has_attached_file :small_image,
27
32
  storage: :filesystem,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-meta
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Bondar
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-04 00:00:00.000000000 Z
12
+ date: 2015-12-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: paperclip
@@ -51,14 +51,14 @@ dependencies:
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.1'
54
+ version: '10.4'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.1'
61
+ version: '10.4'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: mocha
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -110,6 +110,8 @@ extensions: []
110
110
  extra_rdoc_files: []
111
111
  files:
112
112
  - ".gitignore"
113
+ - ".rubocop.yml"
114
+ - ".rubocop_todo.yml"
113
115
  - ".travis.yml"
114
116
  - Gemfile
115
117
  - LICENSE.txt
@@ -140,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
142
  requirements:
141
143
  - - ">="
142
144
  - !ruby/object:Gem::Version
143
- version: 1.9.3
145
+ version: 2.0.0
144
146
  required_rubygems_version: !ruby/object:Gem::Requirement
145
147
  requirements:
146
148
  - - ">="
@@ -148,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
150
  version: '0'
149
151
  requirements: []
150
152
  rubyforge_project:
151
- rubygems_version: 2.4.6
153
+ rubygems_version: 2.5.1
152
154
  signing_key:
153
155
  specification_version: 4
154
156
  summary: Add width, height, and size to paperclip images
@@ -161,3 +163,4 @@ test_files:
161
163
  - spec/gemfiles/Gemfile.paperclip-4
162
164
  - spec/schema.rb
163
165
  - spec/spec_helper.rb
166
+ has_rdoc: