image_optim_rails 0.4.0 → 0.5.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
- SHA1:
3
- metadata.gz: 7ec6959ffaf8e94146e51857bbd6fa8d61c12d43
4
- data.tar.gz: b151102a5974a95aecb7eb9d4238a23d3a6cf4d3
2
+ SHA256:
3
+ metadata.gz: 46fad384b84c00af63a674e3dfd342d647d8a3dbfd0f9ca66ae5bcc50875fc72
4
+ data.tar.gz: e4a0fc9d32035beaf461a2f2b3b88a34bfff7f0720a5a5d7e2661fb4a6c6f10f
5
5
  SHA512:
6
- metadata.gz: a9189dec0dc6125fa5db0345732c35b4e788c13e8ec25839eab4799920cd05e2a2ab0640c7299911435e85f8125d4897884748a3926425ba8d151903264017a3
7
- data.tar.gz: 83bb9dc2cde4d1e8a8e5d99decc2f8a1d44673c5c41d4e9a25f11c0fcadd575793c135e1a7d718d7fa7a39ae10ca70474d4c918836f24b0ea09f9306b5871b64
6
+ metadata.gz: e082b07822f57f78c269f66d15ff163b0f773c6ba1581e80761c7f8e715ead2225c557906f2ac5401b4a6ab6050248484159d2a7f8021e33225d1accc6d280b6
7
+ data.tar.gz: 6943e4399833c44643575eff5e612d0cd0dd2e03d64ad12acf94d74c9dea74c63dc823df23c263647af58928249907a918c6817b9421806ad09c46f5fcbd729e
@@ -0,0 +1,35 @@
1
+ name: check
2
+ on:
3
+ push:
4
+ pull_request:
5
+ schedule:
6
+ - cron: 45 4 * * 0
7
+ jobs:
8
+ check:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ ruby:
13
+ - '2.0'
14
+ - '2.1'
15
+ - '2.2'
16
+ - '2.3'
17
+ - '2.4'
18
+ - '2.5'
19
+ - '2.6'
20
+ - '2.7'
21
+ - '3.0'
22
+ - '3.1'
23
+ fail-fast: false
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: "${{ matrix.ruby }}"
29
+ bundler-cache: true
30
+ bundler: 1
31
+ - run: sudo npm install -g svgo
32
+ - run: curl -L "https://www.jonof.id.au/files/kenutils/pngout-20200115-linux.tar.gz" | sudo tar -xz -C /usr/local/bin --strip-components 2 --wildcards '*/amd64/pngout'
33
+ - run: RUBYOPT=-rset bundle exec appraisal install --jobs=3 --retry=3
34
+ - run: bundle exec image_optim --info
35
+ - run: bundle exec appraisal rspec
@@ -0,0 +1,16 @@
1
+ name: rubocop
2
+ on:
3
+ push:
4
+ pull_request:
5
+ schedule:
6
+ - cron: 45 4 * * 0
7
+ jobs:
8
+ rubocop:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: '3.1'
15
+ bundler-cache: true
16
+ - run: bundle exec rubocop
data/.gitignore CHANGED
@@ -12,3 +12,4 @@ Makefile
12
12
  /tmp/
13
13
 
14
14
  /Gemfile.lock
15
+ /gemfiles/
data/.rubocop.yml CHANGED
@@ -2,34 +2,39 @@ AllCops:
2
2
  Exclude:
3
3
  - '*.gemspec'
4
4
  - 'vendor/**/*'
5
+ - 'gemfiles/*.gemfile'
6
+ NewCops: enable
5
7
 
6
8
  Layout/AccessModifierIndentation:
7
9
  EnforcedStyle: outdent
8
10
 
11
+ Layout/AssignmentIndentation:
12
+ Enabled: false
13
+
9
14
  Layout/CaseIndentation:
10
15
  EnforcedStyle: end
11
16
 
12
17
  Layout/DotPosition:
13
18
  EnforcedStyle: trailing
14
19
 
15
- Layout/IndentArray:
16
- EnforcedStyle: consistent
20
+ Layout/EndAlignment:
21
+ EnforcedStyleAlignWith: variable
17
22
 
18
- Layout/IndentAssignment:
19
- Enabled: false
23
+ Layout/FirstArrayElementIndentation:
24
+ EnforcedStyle: consistent
20
25
 
21
- Layout/IndentHash:
26
+ Layout/FirstHashElementIndentation:
22
27
  EnforcedStyle: consistent
23
28
 
29
+ Layout/LineLength:
30
+ Max: 120
31
+
24
32
  Layout/SpaceBeforeBlockBraces:
25
33
  EnforcedStyle: no_space
26
34
 
27
35
  Layout/SpaceInsideHashLiteralBraces:
28
36
  EnforcedStyle: no_space
29
37
 
30
- Lint/EndAlignment:
31
- EnforcedStyleAlignWith: variable
32
-
33
38
  Metrics/AbcSize:
34
39
  Max: 30
35
40
 
@@ -37,9 +42,6 @@ Metrics/BlockLength:
37
42
  Exclude:
38
43
  - 'spec/**/*.rb'
39
44
 
40
- Metrics/LineLength:
41
- Max: 120
42
-
43
45
  Metrics/MethodLength:
44
46
  Max: 25
45
47
 
@@ -52,14 +54,23 @@ Style/DoubleNegation:
52
54
  Style/EmptyCaseCondition:
53
55
  Enabled: false
54
56
 
55
- Style/Encoding:
56
- EnforcedStyle: when_needed
57
+ Style/ExpandPathArguments:
58
+ Enabled: false
59
+
60
+ Style/HashEachMethods:
61
+ Enabled: true
57
62
 
58
63
  Style/HashSyntax:
59
64
  EnforcedStyle: hash_rockets
60
65
 
66
+ Style/HashTransformKeys:
67
+ Enabled: false
68
+
69
+ Style/HashTransformValues:
70
+ Enabled: false
71
+
61
72
  Style/IfUnlessModifier:
62
- MaxLineLength: 40
73
+ Enabled: false
63
74
 
64
75
  Style/ParallelAssignment:
65
76
  Enabled: false
@@ -73,5 +84,8 @@ Style/SignalException:
73
84
  Style/TrailingCommaInArguments:
74
85
  EnforcedStyleForMultiline: no_comma
75
86
 
76
- Style/TrailingCommaInLiteral:
87
+ Style/TrailingCommaInArrayLiteral:
88
+ EnforcedStyleForMultiline: comma
89
+
90
+ Style/TrailingCommaInHashLiteral:
77
91
  EnforcedStyleForMultiline: comma
data/Appraisals ADDED
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ def appgen(gems)
4
+ description = gems.map{ |name, version| "#{name} #{version}" }.join(', ')
5
+ appraise description do
6
+ gems.each do |name, version|
7
+ gem name, version
8
+ end
9
+
10
+ if RUBY_VERSION < '2.0'
11
+ gem 'concurrent-ruby', '!= 1.1.1'
12
+ gem 'rack-cache', '< 1.7.2'
13
+ gem 'rake', '< 12.3'
14
+ end
15
+
16
+ if RUBY_VERSION < '2.1'
17
+ gem 'nokogiri', '< 1.7'
18
+ end
19
+
20
+ gem 'tzinfo'
21
+
22
+ gem 'sprockets-rails' if gems['railties'] != '~> 3.2' && !gems['sprockets-rails']
23
+ end
24
+ end
25
+
26
+ if RUBY_VERSION < '2.4'
27
+ appgen 'railties' => '~> 3.2'
28
+ end
29
+
30
+ if RUBY_VERSION >= '1.9' && RUBY_VERSION < '2.5'
31
+ appgen 'railties' => '~> 4.0', 'sprockets-rails' => '~> 2.0'
32
+ appgen 'railties' => '~> 4.0', 'sprockets' => '~> 3.0'
33
+ end
34
+
35
+ if RUBY_VERSION >= '2.3' && RUBY_VERSION < '2.7'
36
+ appgen 'railties' => '~> 5.0', 'sprockets-rails' => '~> 2.0'
37
+ appgen 'railties' => '~> 5.0', 'sprockets' => '~> 3.0'
38
+ appgen 'railties' => '~> 5.0', 'sprockets' => '>= 4.0' if RUBY_VERSION >= '2.5'
39
+ end
40
+
41
+ if RUBY_VERSION >= '2.5'
42
+ appgen 'railties' => '~> 6.0', 'sprockets-rails' => '~> 2.0'
43
+ appgen 'railties' => '~> 6.0', 'sprockets' => '~> 3.0'
44
+ appgen 'railties' => '~> 6.0', 'sprockets' => '>= 4.0'
45
+ end
data/CHANGELOG.markdown CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## unreleased
4
4
 
5
+ ## v0.5.0 (2022-02-02)
6
+
7
+ * Depend only on `railties` instead of complete `rails` [#13](https://github.com/toy/image_optim_rails/issues/13) [@toy](https://github.com/toy)
8
+
9
+ ## v0.4.3 (2019-07-14)
10
+
11
+ * Remove deprecated `rubyforge_project` attribute from gemspec [rubygems/rubygems#2436](https://github.com/rubygems/rubygems/pull/2436) [@toy](https://github.com/toy)
12
+
13
+ ## v0.4.2 (2019-05-25)
14
+
15
+ * Enable frozen string literals [@toy](https://github.com/toy)
16
+
17
+ ## v0.4.1 (2017-07-09)
18
+
19
+ * Relax `image_optim` dependency [#5](https://github.com/toy/image_optim_rails/issues/5) [@toy](https://github.com/toy)
20
+
5
21
  ## v0.4.0 (2017-05-31)
6
22
 
7
23
  * Use absolute path to Rails root for default options [#3](https://github.com/toy/image_optim_rails/pull/3) [@wjordan](https://github.com/wjordan)
data/Gemfile CHANGED
@@ -1,16 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
- %w[
6
- rails
7
- sprockets
8
- sprockets-rails
9
- ].each do |gem_name|
10
- version = ENV[gem_name.tr('-', '_').upcase + '_VERSION']
11
- gem gem_name, version if version
12
- end
13
-
14
- if RUBY_VERSION >= '2.0'
15
- gem 'travis_check_rubies', '~> 0.2'
16
- end
7
+ gem 'appraisal', *RUBY_VERSION < '2.3' ? ['< 2.3'] : []
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013-2017 Ivan Kuchin
1
+ Copyright (c) 2013-2022 Ivan Kuchin
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.markdown CHANGED
@@ -1,8 +1,8 @@
1
- [![Gem Version](https://img.shields.io/gem/v/image_optim_rails.svg?style=flat)](https://rubygems.org/gems/image_optim_rails)
2
- [![Build Status](https://img.shields.io/travis/toy/image_optim_rails/master.svg?style=flat)](https://travis-ci.org/toy/image_optim_rails)
3
- [![Code Climate](https://img.shields.io/codeclimate/github/toy/image_optim_rails.svg?style=flat)](https://codeclimate.com/github/toy/image_optim_rails)
4
- [![Dependency Status](https://img.shields.io/gemnasium/toy/image_optim_rails.svg?style=flat)](https://gemnasium.com/toy/image_optim_rails)
5
- [![Inch CI](https://inch-ci.org/github/toy/image_optim_rails.svg?branch=master&style=flat)](https://inch-ci.org/github/toy/image_optim_rails)
1
+ [![Gem Version](https://img.shields.io/gem/v/image_optim_rails?logo=rubygems)](https://rubygems.org/gems/image_optim_rails)
2
+ [![Build Status](https://img.shields.io/github/workflow/status/toy/image_optim_rails/check/master?logo=github)](https://github.com/toy/image_optim_rails/actions/workflows/check.yml)
3
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/toy/image_optim_rails?logo=codeclimate)](https://codeclimate.com/github/toy/image_optim_rails)
4
+ [![Depfu](https://img.shields.io/depfu/toy/image_optim_rails)](https://depfu.com/github/toy/image_optim_rails)
5
+ [![Inch CI](https://inch-ci.org/github/toy/image_optim_rails.svg?branch=master)](https://inch-ci.org/github/toy/image_optim_rails)
6
6
 
7
7
  # image\_optim\_rails
8
8
 
@@ -49,4 +49,4 @@ In separate file [CHANGELOG.markdown](CHANGELOG.markdown).
49
49
 
50
50
  ## Copyright
51
51
 
52
- Copyright (c) 2013-2017 Ivan Kuchin. See [LICENSE.txt](LICENSE.txt) for details.
52
+ Copyright (c) 2013-2022 Ivan Kuchin. See [LICENSE.txt](LICENSE.txt) for details.
@@ -2,26 +2,32 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'image_optim_rails'
5
- s.version = '0.4.0'
5
+ s.version = '0.5.0'
6
6
  s.summary = %q{Optimize image assets using image_optim}
7
- s.homepage = "http://github.com/toy/#{s.name}"
7
+ s.homepage = "https://github.com/toy/#{s.name}"
8
8
  s.authors = ['Ivan Kuchin']
9
9
  s.license = 'MIT'
10
10
 
11
- s.rubyforge_project = s.name
11
+ s.metadata = {
12
+ 'bug_tracker_uri' => "https://github.com/toy/#{s.name}/issues",
13
+ 'changelog_uri' => "https://github.com/toy/#{s.name}/blob/master/CHANGELOG.markdown",
14
+ 'documentation_uri' => "https://www.rubydoc.info/gems/#{s.name}/#{s.version}",
15
+ 'source_code_uri' => "https://github.com/toy/#{s.name}",
16
+ }
12
17
 
13
18
  s.files = `git ls-files`.split("\n")
14
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
21
  s.require_paths = %w[lib]
17
22
 
18
- s.add_dependency 'image_optim', '~> 0.24.0'
19
- s.add_dependency 'rails'
23
+ s.add_dependency 'image_optim', '~> 0.24'
24
+ s.add_dependency 'railties'
20
25
  s.add_dependency 'sprockets'
21
26
 
22
27
  s.add_development_dependency 'image_optim_pack', '~> 0.2', '>= 0.2.2'
23
28
  s.add_development_dependency 'rspec', '~> 3.0'
24
- if RUBY_VERSION >= '2.0'
25
- s.add_development_dependency 'rubocop', '~> 0.49'
29
+ if RUBY_VERSION >= '2.5'
30
+ s.add_development_dependency 'rubocop', '~> 1.22', '!= 1.22.2'
31
+ s.add_development_dependency 'rubocop-rspec', '~> 2.0'
26
32
  end
27
33
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim'
2
4
 
3
5
  class ImageOptim
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/railtie'
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'rails/all'
3
5
  require 'image_optim/railtie'
4
6
 
5
7
  describe 'ImageOptim::Railtie' do
6
- def init_rails_app
8
+ def rails_app
7
9
  Class.new(Rails::Application) do
8
10
  # Rails 4 requires application class to have name
9
11
  define_singleton_method :name do
@@ -27,8 +29,14 @@ describe 'ImageOptim::Railtie' do
27
29
  assets.delete(:compress)
28
30
  end
29
31
 
32
+ config.secret_key_base = 'foo/bar'
33
+
30
34
  yield config if block_given?
31
- end.initialize!
35
+ end
36
+ end
37
+
38
+ def init_rails_app(&block)
39
+ rails_app(&block).initialize!
32
40
  end
33
41
 
34
42
  before do
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/pack'
2
4
  require 'image_optim/path'
3
5
 
@@ -49,6 +51,7 @@ def mepp(image_a, image_b)
49
51
  unless [0, 1].include?($CHILD_STATUS.exitstatus)
50
52
  fail "compare #{image_a} with #{image_b} failed with `#{output}`"
51
53
  end
54
+
52
55
  num_r = '\d+(?:\.\d+(?:[eE][-+]?\d+)?)?'
53
56
  output[/\((#{num_r}), #{num_r}\)/, 1].to_f
54
57
  end
@@ -64,6 +67,6 @@ RSpec::Matchers.define :be_similar_to do |expected, max_difference|
64
67
  end
65
68
  failure_message do |actual|
66
69
  "expected #{actual} to have at most #{max_difference} difference from "\
67
- "#{expected}, got normalized root-mean-square error of #{@diff}"
70
+ "#{expected}, got normalized root-mean-square error of #{@diff}"
68
71
  end
69
72
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_optim_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Kuchin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-30 00:00:00.000000000 Z
11
+ date: 2022-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: image_optim
@@ -16,16 +16,16 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.24.0
19
+ version: '0.24'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.24.0
26
+ version: '0.24'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rails
28
+ name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -92,23 +92,45 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '0.49'
95
+ version: '1.22'
96
+ - - "!="
97
+ - !ruby/object:Gem::Version
98
+ version: 1.22.2
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: '1.22'
106
+ - - "!="
107
+ - !ruby/object:Gem::Version
108
+ version: 1.22.2
109
+ - !ruby/object:Gem::Dependency
110
+ name: rubocop-rspec
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '2.0'
96
116
  type: :development
97
117
  prerelease: false
98
118
  version_requirements: !ruby/object:Gem::Requirement
99
119
  requirements:
100
120
  - - "~>"
101
121
  - !ruby/object:Gem::Version
102
- version: '0.49'
103
- description:
104
- email:
122
+ version: '2.0'
123
+ description:
124
+ email:
105
125
  executables: []
106
126
  extensions: []
107
127
  extra_rdoc_files: []
108
128
  files:
129
+ - ".github/workflows/check.yml"
130
+ - ".github/workflows/rubocop.yml"
109
131
  - ".gitignore"
110
132
  - ".rubocop.yml"
111
- - ".travis.yml"
133
+ - Appraisals
112
134
  - CHANGELOG.markdown
113
135
  - Gemfile
114
136
  - LICENSE.txt
@@ -119,11 +141,15 @@ files:
119
141
  - spec/dummy/app/assets/config/manifest.js
120
142
  - spec/image_optim/railtie_spec.rb
121
143
  - spec/spec_helper.rb
122
- homepage: http://github.com/toy/image_optim_rails
144
+ homepage: https://github.com/toy/image_optim_rails
123
145
  licenses:
124
146
  - MIT
125
- metadata: {}
126
- post_install_message:
147
+ metadata:
148
+ bug_tracker_uri: https://github.com/toy/image_optim_rails/issues
149
+ changelog_uri: https://github.com/toy/image_optim_rails/blob/master/CHANGELOG.markdown
150
+ documentation_uri: https://www.rubydoc.info/gems/image_optim_rails/0.5.0
151
+ source_code_uri: https://github.com/toy/image_optim_rails
152
+ post_install_message:
127
153
  rdoc_options: []
128
154
  require_paths:
129
155
  - lib
@@ -138,9 +164,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
164
  - !ruby/object:Gem::Version
139
165
  version: '0'
140
166
  requirements: []
141
- rubyforge_project: image_optim_rails
142
- rubygems_version: 2.6.11
143
- signing_key:
167
+ rubygems_version: 3.3.5
168
+ signing_key:
144
169
  specification_version: 4
145
170
  summary: Optimize image assets using image_optim
146
171
  test_files:
data/.travis.yml DELETED
@@ -1,38 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache:
4
- bundler: true
5
- directories:
6
- - $(npm root)
7
- - ~/bin
8
- script:
9
- - bundle exec image_optim --info
10
- - bundle exec rspec
11
- before_install:
12
- - mkdir -p ~/bin
13
- - command -v svgo || npm install svgo
14
- - command -v pngout || curl -L "http://static.jonof.id.au/dl/kenutils/pngout-20130221-linux.tar.gz" | tar -xz -C ~/bin --strip-components 2 --wildcards '*/x86_64/pngout'
15
- matrix:
16
- include:
17
- - env: RAILS_VERSION='~> 3.2'
18
- rvm: '1.9.3-p551'
19
- - env: RAILS_VERSION='~> 4.0' SPROCKETS_RAILS_VERSION='~> 2.0'
20
- rvm: '2.0.0-p648'
21
- - env: RAILS_VERSION='~> 4.0' SPROCKETS_VERSION='~> 3.0'
22
- rvm: '2.0.0-p648'
23
- - env: RAILS_VERSION='~> 4.0' SPROCKETS_VERSION='>= 4.0.beta'
24
- rvm: '2.0.0-p648'
25
- - env: RAILS_VERSION='~> 5.0' SPROCKETS_RAILS_VERSION='~> 2.0'
26
- rvm: '2.2.7'
27
- - env: RAILS_VERSION='~> 5.0' SPROCKETS_VERSION='~> 3.0'
28
- rvm: '2.2.7'
29
- - env: RAILS_VERSION='~> 5.0' SPROCKETS_VERSION='>= 4.0.beta'
30
- rvm: '2.2.7'
31
- - env: RUBOCOP=✓
32
- rvm: '2.4.1'
33
- script: bundle exec rubocop
34
- before_install:
35
- - env: CHECK_RUBIES=✓
36
- rvm: '2.4.1'
37
- script: bundle exec travis_check_rubies
38
- before_install: