imgix-rails 4.1.0 → 4.3.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
  SHA256:
3
- metadata.gz: ee4ca6aecc3acbcbb35b5c9b68731403e423f9b76421e14bbf270b727aa0c75d
4
- data.tar.gz: 5397fee06ecb6b23d2e5fb0464736681b3d68976a87e5959b1b33f890a164acf
3
+ metadata.gz: 98533b06694b9f4b6e0a1a7efa85f10542da35f6e3de8f41db8bf81f7e43cca0
4
+ data.tar.gz: 448ab739e71fd41287b9c8eecdac0fc0214c09bda78104287fc13552030299bc
5
5
  SHA512:
6
- metadata.gz: 54700c22ae9e911dd22139e4e03b45bff2c07b38ca8a23f6253a9311420424903babb1189db3a31bd0eaa70e88f8babeefe26cd95ce3d1691ab0804cdca782dc
7
- data.tar.gz: df2ef3b2ba35d0f1296c6a161ff37ecbbe11a1dfda97c69b4c330b6049cdacf8129363db6b39394e6ce1146daed6f33049807763d4045753690ada32db276c98
6
+ metadata.gz: 0a3de9ced7e43cbf79f35aca4c7b102994b8e8fa91e97ac4884b376f5741b7fee7dbf0fdb1be3e4eedf6a1a0e3538800d1af9e8cd28b1647b00924df18483dd6
7
+ data.tar.gz: 6f46063c7cd96e2bc1793dd5df3e7b93c529fe9bc6a9c1d5b6fd7b05382cc9a28e662697b5dea3ea7144eb4bf6ceea5b6cc5fe166d28ab3be6ccb024422dda54
@@ -0,0 +1,129 @@
1
+ version: 2.1 # Use 2.1 to enable using orbs and other features.
2
+
3
+ orbs:
4
+ ruby: circleci/ruby@1.2.0
5
+ node: circleci/node@2
6
+
7
+ commands:
8
+ rspec:
9
+ parameters:
10
+ out-path:
11
+ default: /tmp/test-results/rspec
12
+ description: >-
13
+ Where to save the rspec.xml file. Will automatically be saved to
14
+ test_results and artifacts on CircleCI.
15
+ type: string
16
+ steps:
17
+ - run:
18
+ command: >
19
+ mkdir -p <<parameters.out-path>>
20
+
21
+ bundle exec rspec --format RspecJunitFormatter --out <<parameters.out-path>>/results.xml --format progress
22
+ name: "Run tests with RSpec"
23
+ - store_test_results:
24
+ path: <<parameters.out-path>>
25
+ - store_artifacts:
26
+ destination: test-results
27
+ path: <<parameters.out-path>>
28
+ # Have to override the command from the ruby orb, since it doesn't support the --add-platform command
29
+ # Since this command wholly comes from the ruby orb, the best documentation can be found at: https://circleci.com/developer/orbs/orb/circleci/ruby
30
+ install-deps:
31
+ description: Install gems with Bundler.
32
+ parameters:
33
+ app-dir:
34
+ default: .
35
+ description: >
36
+ Path to the directory containing your Gemfile file. Not needed if Gemfile
37
+ lives in the root.
38
+ type: string
39
+ bundler-version:
40
+ default: ''
41
+ description: >
42
+ Configure which version of bundler to install and utilize. By default, it
43
+ gets the bundler version from Gemfile.lock, but if it is not working use
44
+ this to override.
45
+ type: string
46
+ key:
47
+ default: gems-v1
48
+ description: The cache key to use. The key is immutable.
49
+ type: string
50
+ path:
51
+ default: ./vendor/bundle
52
+ description: >
53
+ Installation path. By default, it will run bundle with `--deployment` flag
54
+ and installs gems to the vendor/bundle directory.
55
+ type: string
56
+ with-cache:
57
+ default: true
58
+ description: Enable automatic caching of your gemfile dependencies for increased speed.
59
+ type: boolean
60
+ platform:
61
+ default: 'x86_64-linux'
62
+ type: string
63
+ steps:
64
+ - when:
65
+ condition: <<parameters.with-cache>>
66
+ steps:
67
+ - restore_cache:
68
+ keys:
69
+ - >-
70
+ << parameters.key >>-{{ checksum
71
+ "<<parameters.app-dir>>/Gemfile" }}-{{ .Branch }}
72
+ - >-
73
+ << parameters.key >>-{{ checksum
74
+ "<<parameters.app-dir>>/Gemfile" }}
75
+ - << parameters.key >>
76
+ - run:
77
+ command: |
78
+ gem install bundler
79
+
80
+ # here is only part that is changed from the orb command,
81
+ # where we add the platform command to allow CircleCI to bundle
82
+ bundle lock --add-platform <<parameters.platform>>
83
+ if [ "<< parameters.path >>" == "./vendor/bundle" ]; then
84
+ bundle config set deployment 'true'
85
+ fi
86
+ bundle config set path << parameters.path >>
87
+ bundle check || bundle install
88
+ name: >-
89
+ Bundle Install <<^parameters.with-cache>>(No
90
+ Cache)<</parameters.with-cache>>
91
+ working_directory: <<parameters.app-dir>>
92
+ - when:
93
+ condition: <<parameters.with-cache>>
94
+ steps:
95
+ - save_cache:
96
+ key: >-
97
+ << parameters.key >>-{{ checksum
98
+ "<<parameters.app-dir>>/Gemfile" }}-{{ .Branch }}
99
+ paths:
100
+ - <<parameters.app-dir>>/<< parameters.path >>
101
+
102
+ jobs:
103
+ test:
104
+ parameters:
105
+ version:
106
+ default: "cimg/ruby:3.0-node"
107
+ description: Ruby image to use
108
+ type: string
109
+ docker:
110
+ - image: <<parameters.version>>
111
+ steps:
112
+ - checkout
113
+ - install-deps:
114
+ key: <<parameters.version>>
115
+ - rspec
116
+
117
+
118
+ workflows:
119
+ version: 2
120
+ test:
121
+ jobs:
122
+ - test:
123
+ matrix:
124
+ parameters:
125
+ version:
126
+ - "cimg/ruby:3.0-node"
127
+ - "cimg/ruby:2.7-node"
128
+ - "cimg/ruby:3.1-node"
129
+ - "circleci/jruby:9.2.11.0-node"
@@ -1,28 +1,46 @@
1
1
  ---
2
2
  name: Bug report
3
3
  about: Create a report to help us improve
4
- title: ''
5
- labels: bug
6
- assignees: ''
7
-
8
4
  ---
9
5
 
10
- Please provide the following information and someone from @imgix/imgix-sdk-team will respond to your issue shortly.
6
+ **Before you submit:**
7
+
8
+ - [ ] Please read the [contributing guidelines](CONTRIBUTING.md)
9
+ - [ ] Please search through the existing issues (both open AND closed) to see if your issue has been discussed before. Github issue search can be used for this: https://github.com/imgix/vue/issues?utf8=%E2%9C%93&q=is%3Aissue
10
+ - [ ] Please ensure the problem has been isolated and reduced. This link explains more: http://css-tricks.com/6263-reduced-test-cases/
11
11
 
12
12
  **Describe the bug**
13
- A clear and concise description of what the bug is.
13
+ A clear and concise description of what the bug is. Please strive to reach the **root problem** of your issue to avoid the XY problem. See more: https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem
14
14
 
15
15
  **To Reproduce**
16
- Steps to reproduce the behavior:
16
+ A bug is a _demonstrable problem_ that is caused by the code in the repository. Thus, the contributors need a way to reproduce your issue - if we can't reproduce your issue, we can't help you! Also, please be as detailed as possible.
17
+
18
+ [a link to a codesandox or repl.it; here is a link to a codesandbox with @imgix/vue installed which can be forked: https://codesandbox.io/s/vue-imgix-base-codesandbox-bhz8n]
19
+
20
+ [alternatively, please provide a code example]
17
21
 
18
- **Expected behavior**
22
+ ```js
23
+ // A *self-contained* demonstration of the problem follows...
24
+ // This should be able to be dropped into a file with @imgix/vue installed and just work
25
+ ```
26
+
27
+ Steps to reproduce the behaviour:
28
+
29
+ 1. Go to '...'
30
+ 2. Click on '....'
31
+ 3. Scroll down to '....'
32
+ 4. See error
33
+
34
+ **Expected behaviour**
19
35
  A clear and concise description of what you expected to happen.
20
36
 
21
37
  **Screenshots**
22
38
  If applicable, add screenshots to help explain your problem.
23
39
 
24
40
  **Information:**
25
- - imgix-rails version: [e.g. 4.0.0]
41
+
42
+ - @imgix/vue version: [e.g. v1.0]
43
+ - browser version: [include link from [https://www.whatsmybrowser.org/](https://www.whatsmybrowser.org/) or details about the OS used and browser version]
26
44
 
27
45
  **Additional context**
28
46
  Add any other context about the problem here.
@@ -1,24 +1,19 @@
1
1
  ---
2
2
  name: Feature request
3
3
  about: Suggest an idea for this project
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
4
  ---
9
5
 
10
- Please provide the following information and someone from @imgix/imgix-sdk-team will respond to your issue shortly.
11
-
12
6
  **Before you submit:**
13
7
 
14
- - [ ] Please search through the [existing issues](https://github.com/imgix/imgix-rails/issues?utf8=%E2%9C%93&q=is%3Aissue) to see if your feature has already been discussed.
15
- - [ ] Please take a moment to find out whether your idea fits with the scope and aims of this project.
8
+ - [ ] Please read the [contributing guidelines](CONTRIBUTING.md)
9
+ - [ ] Please search through the existing issues (both open AND closed) to see if your feature has already been discussed. Github issue search can be used for this: https://github.com/imgix/vue/issues?utf8=%E2%9C%93&q=is%3Aissue
10
+ - [ ] Please take a moment to find out whether your idea fits with the scope and aims of the project
16
11
 
17
12
  **Is your feature request related to a problem? Please describe.**
18
13
  A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
19
14
 
20
15
  **Describe the solution you'd like**
21
- A clear and concise description of what you want to happen.
16
+ A clear and concise description of how this feature would function.
22
17
 
23
18
  **Describe alternatives you've considered**
24
19
  A clear and concise description of any alternative solutions or features you've considered.
@@ -1,17 +1,12 @@
1
1
  ---
2
2
  name: Question
3
3
  about: Ask a question about the project
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
4
  ---
9
5
 
10
- Please provide the following information and someone from @imgix/imgix-sdk-team will respond to your issue shortly.
11
-
12
6
  **Before you submit:**
13
7
 
14
- - [ ] Please search through the [existing issues](https://github.com/imgix/imgix-rails/issues?utf8=%E2%9C%93&q=is%3Aissue) to see if your question has already been discussed.
8
+ - [ ] Please read the [contributing guidelines](CONTRIBUTING.md)
9
+ - [ ] Please search through the existing issues (both open AND closed) to see if your question has already been discussed. Github issue search can be used for this: https://github.com/imgix/vue/issues?utf8=%E2%9C%93&q=is%3Aissue
15
10
 
16
11
  **Question**
17
- A clear and concise description of your question.
12
+ A clear and concise description of your question
@@ -1,73 +1,36 @@
1
1
  <!--
2
- Hello, and thanks for contributing to imgix-rails! 🎉🙌
2
+ Hello, and thanks for contributing 🎉🙌
3
3
  Please take a second to fill out PRs with the following template!
4
4
  -->
5
5
 
6
- # Description
6
+ ## Description
7
7
 
8
- <!-- What is accomplished by this PR? If there is something potentially controversial in your PR, please take a moment to tell us about your choices. -->
8
+ <!-- What is accomplished by this PR? If there is something potentially
9
+ controversial in your PR, please take a moment to tell us about your choices.-->
9
10
 
10
- <!--
11
- Please use the checklist that is most closely related to your PR, and delete the other checklists. -->
11
+ <!-- Before this PR... -->
12
12
 
13
- ## Checklist: Fixing typos/Doc change
13
+ <!-- After this PR... -->
14
14
 
15
- - [ ] Each commit follows the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) format: e.g. `chore(readme): fixed typo`. See the end of this file for more information.
15
+ <!-- Steps to test: either provide a code snippet that exhibits this change or a link to a codepen/codesandbox demo -->
16
16
 
17
- ## Checklist: Bug Fix
17
+ ## Checklist
18
18
 
19
- - [ ] Each commit follows the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) format: e.g. `chore(readme): fixed typo`. See the end of this file for more information.
20
- - [ ] All existing unit tests are still passing (if applicable)
21
- - [ ] Add new passing unit tests to cover the code introduced by your PR
22
- - [ ] Update the readme
23
- - [ ] Update or add any necessary API documentation
24
- - [ ] Add some [steps](#steps-to-test) so we can test your bug fix
25
-
26
- ## Checklist: New Feature
27
-
28
- - [ ] Each commit follows the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) format: e.g. `chore(readme): fixed typo`. See the end of this file for more information.
29
- - [ ] Any breaking changes are specified on the commit on which they are introduced with `BREAKING CHANGE` in the body of the commit.
30
- - [ ] If this is a big feature with breaking changes, consider [opening an issue](https://github.com/imgix/imgix-rails/issues/new?assignees=&labels=&template=feature_request.md&title=) to discuss first. This is completely up to you, but please keep in mind that your PR might not be accepted.
31
- - [ ] Run unit tests to ensure all existing tests are still passing
32
- - [ ] Add new passing unit tests to cover the code introduced by your PR
33
- - [ ] Update the readme
34
- - [ ] Add some [steps](#steps-to-test) so we can test your cool new feature!
35
-
36
- ## Steps to Test
37
-
38
- <!-- Delete this selction if you are just submitting a doc change/small fix -->
39
-
40
- <!-- A code example or a set of steps is preferred -->
41
-
42
- Related issue: [e.g. #42]
43
-
44
- Code:
45
-
46
- ```rb
47
- # A standalone example of what the PR solves
48
- ```
49
-
50
- <!-- A link to a codepen/codesandbox is also an option. -->
51
-
52
- <!--
19
+ <!-- Please ensure you've completed this checklist before submitting a PR. If
20
+ You're not submitting a bugfix or feature, delete that part of the checklist.
21
+ -->
53
22
 
54
- ## Conventional Commit Spec
23
+ <!-- For all Pull Requests -->
55
24
 
56
- PR titles should be in the format `<type>(<scope>): <description>`. For example: `chore(readme): fix typo`
25
+ - [ ] Read the [contributing guidelines](CONTRIBUTING.md).
26
+ - [ ] Each commit follows the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) spec format.
27
+ - [ ] Update the readme (if applicable).
28
+ - [ ] Update or add any necessary API documentation (if applicable)
29
+ - [ ] All existing unit tests are still passing (if applicable).
57
30
 
58
- `type` can be any of the follow:
59
- - `feat`: a feature, or breaking change
60
- - `fix`: a bug-fix
61
- - `test`: Adding missing tests or correcting existing tests
62
- - `docs`: documentation only changes (readme, changelog, contributing guide)
63
- - `refactor`: a code change that neither fixes a bug nor adds a feature
64
- - `chore`: reoccurring tasks for project maintainability (example scopes: release, deps)
65
- - `config`: changes to tooling configurations used in the project
66
- - `build`: changes that affect the build system or external dependencies (example scopes: npm, bundler, gradle)
67
- - `ci`: changes to CI configuration files and scripts (example scopes: travis)
68
- - `perf`: a code change that improves performance
69
- - `style`: changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
31
+ <!-- For new feature and bugfix Pull Requests-->
70
32
 
71
- `scope` is optional, and can be anything.
72
- `description` should be a short description of the change, written in the imperative-mood.
73
- -->
33
+ - [ ] Add some [steps](#steps-to-test) so we can test your bug fix or feature (if applicable).
34
+ - [ ] Add new passing unit tests to cover the code introduced by your PR (if applicable).
35
+ - [ ] Any breaking changes are specified on the commit on which they are introduced with `BREAKING CHANGE` in the body of the commit.
36
+ - [ ] If this is a big feature with breaking changes, consider opening an issue to discuss first. This is completely up to you, but please keep in mind that your PR might not be accepted.
@@ -0,0 +1,16 @@
1
+ name: Add issues to project
2
+
3
+ on:
4
+ issues:
5
+ types:
6
+ - opened
7
+
8
+ jobs:
9
+ add-to-project:
10
+ name: Add issue to project
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/add-to-project@v0.3.0
14
+ with:
15
+ project-url: https://github.com/orgs/imgix/projects/4
16
+ github-token: ${{ secrets.GH_TOKEN }}
@@ -0,0 +1,16 @@
1
+ name: Add needs-review and size/XL pull requests to projects
2
+
3
+ on:
4
+ pull_request:
5
+ types:
6
+ - opened
7
+
8
+ jobs:
9
+ add-to-project:
10
+ name: Add issue to project
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/add-to-project@v0.3.0
14
+ with:
15
+ project-url: https://github.com/orgs/imgix/projects/4
16
+ github-token: ${{ secrets.GH_TOKEN }}
data/CHANGELOG.md CHANGED
@@ -3,9 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [4.3.0](https://github.com/imgix/imgix-rb/compare/4.2.0...4.3.0) - December 14, 2022
7
+
8
+ - Add img_tag_options to ix_picture_tag ([#118] (https://github.com/imgix/imgix-rails/pull/118))
9
+
10
+ ## [4.2.0](https://github.com/imgix/imgix-rb/compare/4.1.0...4.2.0) - January 05, 2021
11
+
12
+ - Add support for lazy image loading ([#108](https://github.com/imgix/imgix-rails/pull/108))
13
+
6
14
  ## [4.1.0](https://github.com/imgix/imgix-rb/compare/4.0.2...4.1.0) - October 13, 2020
7
15
 
8
16
  ### Release Notes
17
+
9
18
  Version 4.1.0 has been released! The goal of this release is to offer flexibility to those using imgix-rb's purger capabilities through imgix-rails.
10
19
 
11
20
  Prior to this release, this gem offered purging capability through `imgix '~> 3.0'`. However, that purging capability has been deprecated in favor of the new-style purging API––available now in [imgix-rb v4.0.0](https://github.com/imgix/imgix-rb/releases/tag/4.0.0).
@@ -17,9 +26,11 @@ To upgrade to the new purging API used in `imgix '~> 4.0'`:
17
26
  - use this new key in your imgix client: `Imgix::Client.new(domain: '...', api_key: NEW_API_KEY)`
18
27
 
19
28
  ### Changes
29
+
20
30
  - build: use optimistic constraint for imgix >= 3.0 ([#104](https://github.com/imgix/imgix-rails/pull/104))
21
31
 
22
32
  ## [4.0.2](https://github.com/imgix/imgix-rb/compare/4.0.1...4.0.2) - July 31, 2020
33
+
23
34
  - fix: replace `opts[:host`] with `opts[:domain]` to resolve deprecation warnings ([#96](https://github.com/imgix/imgix-rails/pull/96))
24
35
 
25
36
  ## [4.0.1](https://github.com/imgix/imgix-rb/compare/4.0.0...4.0.1) - June 10, 2020
@@ -40,13 +51,13 @@ For users migrating to version 4.0 or later, it is important that all srcset-rel
40
51
 
41
52
  In addition to these changes, imgix-rails is now capable of producing [fixed-image srcsets](https://github.com/imgix/imgix-rb#fixed-image-rendering). Users should note that when certain dimension information is provided, imgix-rails will produce a `srcset` at different screen resolutions rather than the typical width pairs. This feature provides expanded functionality to cover more `srcset` use cases that users can take advantage of. We are always happy to provide our users with more tools to assist them in their efforts to build out responsive images on the web.
42
53
 
43
- * feat: utilize Imgix::Path#to_srcset when constructing srcsets ([#83](https://github.com/imgix/imgix-rails/pull/83))
44
- * chore: remove deprecated domain sharding behavior ([#80](https://github.com/imgix/imgix-rails/pull/80))
45
- * fix: deprecate resizing height when maintaining aspect ratio ([#78](https://github.com/imgix/imgix-rails/pull/78))
54
+ - feat: utilize Imgix::Path#to_srcset when constructing srcsets ([#83](https://github.com/imgix/imgix-rails/pull/83))
55
+ - chore: remove deprecated domain sharding behavior ([#80](https://github.com/imgix/imgix-rails/pull/80))
56
+ - fix: deprecate resizing height when maintaining aspect ratio ([#78](https://github.com/imgix/imgix-rails/pull/78))
46
57
 
47
58
  ## [3.1.0](https://github.com/imgix/imgix-rb/compare/3.0.2...3.1.0) - October 25, 2019
48
59
 
49
- * Update bundler dev dependency to include new major version 2.x ([#71](https://github.com/imgix/imgix-rb/pull/71))
50
- * README: Fix typo ([#73](https://github.com/imgix/imgix-rb/pull/73))
51
- * docs: add ActiveStorage instructions to README ([#74](https://github.com/imgix/imgix-rb/pull/74))
52
- * chore(deprecate): emit warning when generating srcsets ([ccc906b](https://github.com/imgix/imgix-rails/commit/ccc906be749945f6f843b5eeb04ab03a292ccbfb)) ([e2ffc2b](https://github.com/imgix/imgix-rails/commit/e2ffc2b4f847c15ea73fa161b673885e704e4cf2))
60
+ - Update bundler dev dependency to include new major version 2.x ([#71](https://github.com/imgix/imgix-rb/pull/71))
61
+ - README: Fix typo ([#73](https://github.com/imgix/imgix-rb/pull/73))
62
+ - docs: add ActiveStorage instructions to README ([#74](https://github.com/imgix/imgix-rb/pull/74))
63
+ - chore(deprecate): emit warning when generating srcsets ([ccc906b](https://github.com/imgix/imgix-rails/commit/ccc906be749945f6f843b5eeb04ab03a292ccbfb)) ([e2ffc2b](https://github.com/imgix/imgix-rails/commit/e2ffc2b4f847c15ea73fa161b673885e704e4cf2))
@@ -0,0 +1,3 @@
1
+ # Code of Conduct
2
+
3
+ Please read the imgix [Code of Conduct](https://github.com/imgix/code-of-conduct).
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,108 @@
1
+ # Contributing Guide
2
+
3
+ Thank you for investing your time in contributing to this project! Please take a moment to review this document in order to streamline the contribution process for you and any reviewers involved.
4
+
5
+ Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable.
6
+
7
+ In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.
8
+
9
+ ## New contributor guide
10
+
11
+ To get an overview of the project, read the [README](README.md). Here are some resources to help you get started with open source contributions:
12
+
13
+ - [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
14
+ - [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
15
+ - [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow)
16
+ - [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)
17
+
18
+ ## Opening a Pull Request
19
+
20
+ _To help the project's maintainers and community quickly understand the nature of your pull request, please be sure to do the following:_
21
+
22
+ 1. Include a descriptive Pull Request title.
23
+ 2. Provide a detailed description that explains the nature of the change(s) introduced. This is not only helpful for your reviewer, but also for future users who may need to revisit your Pull Request for context purposes. Screenshots/video captures are helpful here!
24
+ 3. Make incremental, modular changes, with a clean commit history. This helps reviewers understand your contribution more easily and maintain project quality.
25
+
26
+ ### Checklist
27
+
28
+ Check to see that you have completed each of the following before requesting a review of your Pull Request:
29
+
30
+ - [ ] All existing unit tests are still passing (if applicable)
31
+ - [ ] Add new passing unit tests to cover the code introduced by your PR
32
+ - [ ] Update the README
33
+ - [ ] Update or add any necessary API documentation
34
+ - [ ] All commits in the branch adhere to the [conventional commit](#conventional-commit-spec) format: e.g. `fix: bug #issue-number`
35
+
36
+ ## Conventional Commit Spec
37
+
38
+ Commits should be in the format `<type>(<scope>): <description>`. This allows our team to leverage tooling for automatic releases and changelog generation. An example of a commit in this format might be: `docs(readme): fix typo in documentation`
39
+
40
+ `type` can be any of the follow:
41
+
42
+ - `feat`: a feature, or breaking change
43
+ - `fix`: a bug-fix
44
+ - `test`: Adding missing tests or correcting existing tests
45
+ - `docs`: documentation only changes (readme, changelog, contributing guide)
46
+ - `refactor`: a code change that neither fixes a bug nor adds a feature
47
+ - `chore`: reoccurring tasks for project maintainability (example scopes: release, deps)
48
+ - `config`: changes to tooling configurations used in the project
49
+ - `build`: changes that affect the build system or external dependencies (example scopes: npm, bundler, gradle)
50
+ - `ci`: changes to CI configuration files and scripts (example scopes: travis)
51
+ - `perf`: a code change that improves performance
52
+ - `style`: changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
53
+
54
+ `scope` is optional, and can be anything.
55
+ `description` should be a short description of the change, written in the imperative-mood.
56
+
57
+ ### Example workflow
58
+
59
+ Follow this process if you'd like your work considered for inclusion in the
60
+ project:
61
+
62
+ 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
63
+ and configure the remotes:
64
+
65
+ ```bash
66
+ # Clone your fork of the repo into the current directory
67
+ git clone git@github.com:<YOUR_USERNAME>/imgix-rails.git
68
+ # Navigate to the newly cloned directory
69
+ cd imgix-rails
70
+ # Assign the original repo to a remote called "upstream"
71
+ git remote add upstream https://github.com/imgix/imgix-rails
72
+ ```
73
+
74
+ 2. If you cloned a while ago, get the latest changes from upstream:
75
+
76
+ ```bash
77
+ git checkout <dev-branch>
78
+ git pull upstream <dev-branch>
79
+ ```
80
+
81
+ 3. Create a new topic branch (off the main project development branch) to
82
+ contain your feature, change, or fix:
83
+
84
+ ```bash
85
+ git checkout -b <topic-branch-name>
86
+ ```
87
+
88
+ 4. Commit your changes in logical chunks. Use Git's
89
+ [interactive rebase](https://help.github.com/articles/interactive-rebase)
90
+ feature to tidy up your commits before making them public.
91
+
92
+ 5. Locally merge (or rebase) the upstream development branch into your topic branch:
93
+
94
+ ```bash
95
+ git pull [--rebase] upstream <dev-branch>
96
+ ```
97
+
98
+ 6. Push your topic branch up to your fork:
99
+
100
+ ```bash
101
+ git push origin <topic-branch-name>
102
+ ```
103
+
104
+ 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
105
+ with a clear title and description.
106
+
107
+ **IMPORTANT**: By submitting a patch, you agree to allow the project owner to
108
+ license your work under the same license as that used by the project.
data/README.md CHANGED
@@ -4,33 +4,37 @@
4
4
  `imgix-rails` is a gem for integrating [imgix](https://www.imgix.com/) into Ruby on Rails applications. It builds on [imgix-rb](https://github.com/imgix/imgix-rb) to offer a few Rails-specific interfaces.
5
5
 
6
6
  [![Gem Version](https://img.shields.io/gem/v/imgix-rails.svg)](https://rubygems.org/gems/imgix-rails)
7
- [![Build Status](https://travis-ci.org/imgix/imgix-rails.svg?branch=main)](https://travis-ci.org/imgix/imgix-rails)
7
+ [![Build Status](https://circleci.com/gh/imgix/imgix-rails.svg?style=shield)](https://circleci.com/gh/imgix/imgix-rails)
8
8
  ![Downloads](https://img.shields.io/gem/dt/imgix-rails)
9
9
  [![License](https://img.shields.io/github/license/imgix/imgix-rails)](https://github.com/imgix/imgix-rails/blob/main/LICENSE)
10
+ [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fimgix%2Fimgix-rails.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fimgix%2Fimgix-rails?ref=badge_shield)
10
11
 
11
12
  ---
12
13
  <!-- /ix-docs-ignore -->
13
14
 
14
15
  - [Installation](#installation)
15
16
  - [Usage](#usage)
16
- - [Configuration](#configuration)
17
- - [Multi-source configuration](#multi-source-configuration)
18
- - [`ix_image_tag`](#iximagetag)
19
- - [Fixed image rendering](#fixed-image-rendering)
20
- - [`ix_picture_tag`](#ixpicturetag)
21
- - [`ix_image_url`](#iximageurl)
22
- - [Usage in Sprockets](#usage-in-sprockets)
17
+ * [Configuration](#configuration)
18
+ + [Multi-source configuration](#multi-source-configuration)
19
+ * [`ix_image_tag`](#ix_image_tag)
20
+ + [Fixed image rendering](#fixed-image-rendering)
21
+ + [Lazy loading](#lazy-loading)
22
+ * [`ix_picture_tag`](#ix_picture_tag)
23
+ * [`ix_image_url`](#ix_image_url)
24
+ + [Usage in Model](#usage-in-model)
25
+ + [Usage in Sprockets](#usage-in-sprockets)
23
26
  - [Using With Image Uploading Libraries](#using-with-image-uploading-libraries)
24
- - [Paperclip and CarrierWave](#paperclip-and-carrierwave)
25
- - [Refile](#refile)
26
- - [Active Storage](#active-storage)
27
- - [S3](#s3)
28
- - [GCS](#gcs)
27
+ * [Paperclip and CarrierWave](#paperclip-and-carrierwave)
28
+ * [Refile](#refile)
29
+ * [Active Storage](#active-storage)
30
+ * [S3](#s3)
31
+ * [GCS](#gcs)
29
32
  - [Upgrade Guides](#upgrade-guides)
30
- - [3.x to 4.0](#3x-to-40)
33
+ * [3.x to 4.0](#3x-to-40)
31
34
  - [Development](#development)
32
35
  - [Contributing](#contributing)
33
36
  - [Code of Conduct](#code-of-conduct)
37
+ - [License](#license)
34
38
 
35
39
  ## Installation
36
40
 
@@ -108,6 +112,8 @@ The `ix_image_tag` helper method makes it easy to pass parameters to imgix to ha
108
112
  * [`min_width`](https://github.com/imgix/imgix-rb#minimum-and-maximum-width-ranges): The minimum width that `srcset` pairs will be generated with. Will be ignored if `widths` are provided.
109
113
  * [`max_width`](https://github.com/imgix/imgix-rb#minimum-and-maximum-width-ranges): The maximum width that `srcset` pairs will be generated with. Will be ignored if `widths` are provided.
110
114
  * [`disable_variable_quality`](https://github.com/imgix/imgix-rb#variable-qualities): Pass `true` to disable variable quality parameters when generating a `srcset` ([fixed-images only](https://github.com/imgix/imgix-rails#fixed-image-rendering)). In addition, imgix-rails will respect an overriding `q` (quality) parameter if one is provided through `url_params`.
115
+ * `attribute_options`: Allow you to change where imgix-rails renders
116
+ attributes. This can be helpful if you want to add lazy-loading.
111
117
 
112
118
  ```erb
113
119
  <%= ix_image_tag('/unsplash/hotairballoon.jpg', url_params: { w: 300, h: 500, fit: 'crop', crop: 'right'}, tag_options: { alt: 'A hot air balloon on a sunny day' }) %>
@@ -177,6 +183,29 @@ https://assets.imgix.net/image.jpg?ixlib=rails-3.0.2&amp;w=1000&amp;dpr=5&amp;q=
177
183
 
178
184
  Fixed image rendering will automatically append a variable `q` parameter mapped to each `dpr` parameter when generating a `srcset`. This technique is commonly used to compensate for the increased filesize of high-DPR images. Since high-DPR images are displayed at a higher pixel density on devices, image quality can be lowered to reduce overall filesize without sacrificing perceived visual quality. For more information and examples of this technique in action, see [this blog post](https://blog.imgix.com/2016/03/30/dpr-quality?_ga=utm_medium=referral&utm_source=sdk&utm_campaign=rails-readme). This behavior will respect any overriding `q` value passed in via `url_params` and can be disabled altogether with `srcset_options: { disable_variable_quality: true }`.
179
185
 
186
+ #### Lazy loading
187
+
188
+ If you'd like to lazy load images, we recommend using [lazysizes](https://github.com/aFarkas/lazysizes). In order to use imgix-rails with lazysizes, you need to use `attribute_options` as well as set `tag_options[:src]`:
189
+
190
+ ```erb
191
+ <%= ix_image_tag('image.jpg', attribute_options: {src: "data-src",
192
+ srcset: "data-srcset", sizes: "data-sizes"}, url_params: {w: 1000},
193
+ tag_options: {src: "lqip.jpg"}) %>
194
+ ```
195
+
196
+ Will render the following HTML:
197
+
198
+ ```html
199
+ <img data-srcset="https://assets.imgix.net/image.jpg?ixlib=rails-3.0.2&amp;w=1000&amp;dpr=1&amp;q=75 1x,
200
+ https://assets.imgix.net/image.jpg?ixlib=rails-3.0.2&amp;w=1000&amp;dpr=2&amp;q=50 2x,
201
+ https://assets.imgix.net/image.jpg?ixlib=rails-3.0.2&amp;w=1000&amp;dpr=3&amp;q=35 3x,
202
+ https://assets.imgix.net/image.jpg?ixlib=rails-3.0.2&amp;w=1000&amp;dpr=4&amp;q=23 4x,
203
+ https://assets.imgix.net/image.jpg?ixlib=rails-3.0.2&amp;w=1000&amp;dpr=5&amp;q=20 5x"
204
+ data-sizes="100vw"
205
+ data-src="https://assets.imgix.net/image.jpg?ixlib=rails-3.0.2&amp;w=1000"
206
+ src="lqip.jpg">
207
+ ```
208
+
180
209
  ### `ix_picture_tag`
181
210
 
182
211
  The `ix_picture_tag` helper method makes it easy to generate `picture` elements in your Rails app. `picture` elements are useful when an images needs to be art directed differently at different screen sizes.
@@ -186,6 +215,7 @@ The `ix_picture_tag` helper method makes it easy to generate `picture` elements
186
215
  * `source`: an optional String indicating the source to be used. If unspecified `:source` or `:default_source` will be used. If specified, the value must be defined in the config.
187
216
  * `path`: The path or URL of the image to display.
188
217
  * `tag_options`: Any options to apply to the parent `picture` element. This is useful for adding class names, etc.
218
+ * `img_tag_options`: Any options to apply to the generated `img` element. This can be useful to add an `alt` attribute.
189
219
  * `url_params`: Default imgix options. These will be used to generate a fallback `img` tag for older browsers, and used in each `source` unless overridden by `breakpoints`.
190
220
  * `breakpoints`: A hash describing the variants. Each key must be a media query (e.g. `(max-width: 880px)`), and each value must be a hash of parameter overrides for that media query. A `source` element will be generated for each breakpoint specified.
191
221
  * `srcset_options`: A variety of options that allow for fine tuning `srcset` generation. More information on each of these modifiers can be found in the [imgix-rb documentation](https://github.com/imgix/imgix-rb#srcset-generation). Any of the following can be passed as arguments:
@@ -199,6 +229,9 @@ The `ix_picture_tag` helper method makes it easy to generate `picture` elements
199
229
  tag_options: {
200
230
  class: 'a-picture-tag'
201
231
  },
232
+ img_tag_options: {
233
+ alt: 'A picture of Bert and Ernie arguing'
234
+ },
202
235
  url_params: {
203
236
  w: 300,
204
237
  h: 300,
@@ -238,6 +271,7 @@ To generate a `picture` element on a different source:
238
271
  ```erb
239
272
  <%= ix_picture_tag('assets2.imgix.net', 'bertandernie.jpg',
240
273
  tag_options: {},
274
+ img_tag_options: {},
241
275
  url_params: {},
242
276
  breakpoints: {
243
277
  '(max-width: 640px)' => {
@@ -252,7 +286,7 @@ To generate a `picture` element on a different source:
252
286
 
253
287
  The `ix_image_url` helper makes it easy to generate a URL to an image in your Rails app.
254
288
 
255
- `ix_image_url` takes four arguments:
289
+ `ix_image_url` takes three arguments:
256
290
 
257
291
  * `source`: an optional String indicating the source to be used. If unspecified `:source` or `:default_source` will be used. If specified, the value must be defined in the config.
258
292
  * `path`: The path or URL of the image to display.
@@ -270,6 +304,8 @@ https://assets.imgix.net/users/1/avatar.png?w=400&h=300
270
304
  https://assets2.imgix.net/users/1/avatar.png?w=400&h=300
271
305
  ```
272
306
 
307
+ #### Usage in Model
308
+
273
309
  Since `ix_image_url` lives inside `UrlHelper`, it can also be used in places other than your views quite easily. This is useful for things such as including imgix URLs in JSON output from a serializer class.
274
310
 
275
311
  ```rb
@@ -279,6 +315,8 @@ puts ix_image_url('/users/1/avatar.png', { w: 400, h: 300 })
279
315
  # => https://assets.imgix.net/users/1/avatar.png?w=400&h=300
280
316
  ```
281
317
 
318
+ Alternatively, you can also use the imgix [Ruby client](https://github.com/imgix/imgix-rb) in the same way.
319
+
282
320
  #### Usage in Sprockets
283
321
 
284
322
  `ix_image_url` is also pulled in as a Sprockets helper, so you can generate imgix URLs in your asset pipeline files. For example, here's how it would work inside an `.scss.erb` file:
@@ -415,11 +453,10 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
415
453
 
416
454
  ## Contributing
417
455
 
418
- 1. Fork it ( https://github.com/[my-github-username]/imgix-rails/fork )
419
- 2. Create your feature branch (`git checkout -b my-new-feature`)
420
- 3. Commit your changes (`git commit -am 'Add some feature'`)
421
- 4. Push to the branch (`git push origin my-new-feature`)
422
- 5. Create a new Pull Request
456
+ See [contributing guidelines](CONTRIBUTING.md).
423
457
 
424
458
  ## Code of Conduct
425
459
  Users contributing to or participating in the development of this project are subject to the terms of imgix's [Code of Conduct](https://github.com/imgix/code-of-conduct).
460
+
461
+ ## License
462
+ [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fimgix%2Fimgix-rails.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fimgix%2Fimgix-rails?ref=badge_large)
data/imgix-rails.gemspec CHANGED
@@ -39,4 +39,5 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "rake", "~> 12.3"
40
40
  spec.add_development_dependency "rspec"
41
41
  spec.add_development_dependency "rspec-rails"
42
+ spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
42
43
  end
@@ -3,9 +3,28 @@ require "imgix/rails/tag"
3
3
  class Imgix::Rails::ImageTag < Imgix::Rails::Tag
4
4
 
5
5
  def render
6
- @tag_options[:srcset] = srcset
7
- @tag_options[:sizes] ||= '100vw'
6
+ url = ix_image_url(@source, @path, @url_params)
8
7
 
9
- image_tag(ix_image_url(@source, @path, @url_params), @tag_options)
8
+ if @attribute_options[:srcset].present?
9
+ @tag_options[@attribute_options[:srcset]] = srcset
10
+ else
11
+ @tag_options[:srcset] = srcset
12
+ end
13
+
14
+ if @attribute_options[:size].present?
15
+ @tag_options[@attribute_options[:size]] ||= '100vw'
16
+ else
17
+ @tag_options[:sizes] ||= '100vw'
18
+ end
19
+
20
+ if @attribute_options[:src].present?
21
+ @tag_options[@attribute_options[:src]] = url
22
+ end
23
+
24
+ if @tag_options[:src].present?
25
+ image_tag(@tag_options[:src], @tag_options)
26
+ else
27
+ image_tag(url, @tag_options)
28
+ end
10
29
  end
11
30
  end
@@ -5,10 +5,11 @@ require "action_view"
5
5
  class Imgix::Rails::PictureTag < Imgix::Rails::Tag
6
6
  include ActionView::Context
7
7
 
8
- def initialize(path, source: nil, tag_options: {}, url_params: {}, breakpoints: {}, srcset_options: {})
8
+ def initialize(path, source: nil, tag_options: {}, img_tag_options: {}, url_params: {}, breakpoints: {}, srcset_options: {})
9
9
  @path = path
10
10
  @source = source
11
11
  @tag_options = tag_options
12
+ @img_tag_options = img_tag_options
12
13
  @url_params = url_params
13
14
  @breakpoints = breakpoints
14
15
  @srcset_options = srcset_options
@@ -28,7 +29,7 @@ class Imgix::Rails::PictureTag < Imgix::Rails::Tag
28
29
  concat(content_tag(:source, nil, source_tag_opts))
29
30
  end
30
31
 
31
- concat Imgix::Rails::ImageTag.new(@path, source: @source, url_params: @url_params, srcset_options: @srcset_options).render
32
+ concat Imgix::Rails::ImageTag.new(@path, source: @source, tag_options: @img_tag_options, url_params: @url_params, srcset_options: @srcset_options).render
32
33
  end
33
34
  end
34
35
 
@@ -5,12 +5,13 @@ class Imgix::Rails::Tag
5
5
  include Imgix::Rails::UrlHelper
6
6
  include ActionView::Helpers
7
7
 
8
- def initialize(path, source: nil, tag_options: {}, url_params: {}, srcset_options: {})
8
+ def initialize(path, source: nil, tag_options: {}, url_params: {}, srcset_options: {}, attribute_options: {})
9
9
  @path = path
10
10
  @source = source
11
11
  @tag_options = tag_options
12
12
  @url_params = url_params
13
13
  @srcset_options = srcset_options
14
+ @attribute_options = attribute_options
14
15
  end
15
16
 
16
17
  protected
@@ -1,5 +1,5 @@
1
1
  module Imgix
2
2
  module Rails
3
- VERSION = '4.1.0'
3
+ VERSION = '4.3.0'
4
4
  end
5
5
  end
@@ -8,12 +8,12 @@ module Imgix
8
8
  module ViewHelper
9
9
  include UrlHelper
10
10
 
11
- def ix_image_tag(source=nil, path, tag_options: {}, url_params: {}, srcset_options: {})
12
- return Imgix::Rails::ImageTag.new(path, source: source, tag_options: tag_options, url_params: url_params, srcset_options: srcset_options).render
11
+ def ix_image_tag(source=nil, path, tag_options: {}, url_params: {}, srcset_options: {}, attribute_options: {})
12
+ return Imgix::Rails::ImageTag.new(path, source: source, tag_options: tag_options, url_params: url_params, srcset_options: srcset_options, attribute_options: attribute_options).render
13
13
  end
14
14
 
15
- def ix_picture_tag(source=nil, path, tag_options: {}, url_params: {}, breakpoints: {}, srcset_options: {})
16
- return Imgix::Rails::PictureTag.new(path, source: source, tag_options: tag_options, url_params: url_params, breakpoints: breakpoints, srcset_options: srcset_options).render
15
+ def ix_picture_tag(source=nil, path, tag_options: {}, img_tag_options: {}, url_params: {}, breakpoints: {}, srcset_options: {})
16
+ return Imgix::Rails::PictureTag.new(path, source: source, tag_options: tag_options, img_tag_options: img_tag_options, url_params: url_params, breakpoints: breakpoints, srcset_options: srcset_options).render
17
17
  end
18
18
  end
19
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imgix-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Sutton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-10-15 00:00:00.000000000 Z
12
+ date: 2022-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: imgix
@@ -81,6 +81,20 @@ dependencies:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec_junit_formatter
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: 0.4.1
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: 0.4.1
84
98
  description: Makes integrating imgix into your Rails app easier. It builds on imgix-rb
85
99
  to offer a few Rails-specific interfaces. Please see https://github.com/imgix/imgix-rails
86
100
  for more details.
@@ -91,15 +105,19 @@ executables: []
91
105
  extensions: []
92
106
  extra_rdoc_files: []
93
107
  files:
108
+ - ".circleci/config.yml"
94
109
  - ".github/CODEOWNERS"
95
110
  - ".github/ISSUE_TEMPLATE/bug_report.md"
96
111
  - ".github/ISSUE_TEMPLATE/feature_request.md"
97
112
  - ".github/ISSUE_TEMPLATE/question.md"
98
113
  - ".github/pull_request_template.md"
114
+ - ".github/workflows/add-issue-to-project.yml"
115
+ - ".github/workflows/add-pr-to-project.yml"
99
116
  - ".gitignore"
100
117
  - ".rspec"
101
- - ".travis.yml"
102
118
  - CHANGELOG.md
119
+ - CODE-OF-CONDUCT.md
120
+ - CONTRIBUTING.md
103
121
  - Gemfile
104
122
  - LICENSE
105
123
  - README.md
@@ -121,8 +139,8 @@ licenses:
121
139
  metadata:
122
140
  bug_tracker_uri: https://github.com/imgix/imgix-rails/issues
123
141
  changelog_uri: https://github.com/imgix/imgix-rails/blob/main/CHANGELOG.md
124
- documentation_uri: https://www.rubydoc.info/gems/imgix-rails/4.1.0
125
- source_code_uri: https://github.com/imgix/imgix-rails/tree/v4.1.0
142
+ documentation_uri: https://www.rubydoc.info/gems/imgix-rails/4.3.0
143
+ source_code_uri: https://github.com/imgix/imgix-rails/tree/v4.3.0
126
144
  allowed_push_host: https://rubygems.org
127
145
  post_install_message:
128
146
  rdoc_options: []
@@ -139,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
157
  - !ruby/object:Gem::Version
140
158
  version: '0'
141
159
  requirements: []
142
- rubygems_version: 3.1.2
160
+ rubygems_version: 3.0.3.1
143
161
  signing_key:
144
162
  specification_version: 4
145
163
  summary: Makes integrating imgix into your Rails app easier. It builds on imgix-rb
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3.1
4
- - 2.2.5
5
- - jruby
6
- script: bundle exec rspec