Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: madeindjs/active_storage-send_zip
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2.0
Choose a base ref
...
head repository: madeindjs/active_storage-send_zip
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 17 commits
  • 9 files changed
  • 6 contributors

Commits on Dec 4, 2018

  1. Correct subfolder creation

    madeindjs committed Dec 4, 2018
    Copy the full SHA
    33b762a View commit details

Commits on Dec 21, 2018

  1. Copy the full SHA
    278f3f2 View commit details

Commits on Jan 28, 2019

  1. Correct dependency

    madeindjs committed Jan 28, 2019
    Copy the full SHA
    65921be View commit details

Commits on Feb 20, 2020

  1. Copy the full SHA
    43a3273 View commit details
  2. Updated README

    L33tH4x0r committed Feb 20, 2020
    Copy the full SHA
    ccb9cdc View commit details
  3. Updated README

    L33tH4x0r committed Feb 20, 2020
    Copy the full SHA
    92b1160 View commit details
  4. Copy the full SHA
    2ed5a1f View commit details
  5. Copy the full SHA
    3a4259f View commit details
  6. Copy the full SHA
    4823b11 View commit details

Commits on Feb 21, 2020

  1. Updated Version number

    L33tH4x0r committed Feb 21, 2020
    Copy the full SHA
    566a07f View commit details

Commits on Feb 22, 2020

  1. Merge pull request #8 from GAPartners/master

    Recursive File structure
    madeindjs authored Feb 22, 2020
    Copy the full SHA
    9d8ec11 View commit details
  2. Bundle update

    madeindjs committed Feb 22, 2020
    Copy the full SHA
    ad4398e View commit details

Commits on Feb 29, 2020

  1. Update rake requirement from ~> 10.0 to ~> 13.0 (#13)

    Updates the requirements on [rake](https://github.com/ruby/rake) to permit the latest version.
    - [Release notes](https://github.com/ruby/rake/releases)
    - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc)
    - [Commits](ruby/rake@v10.5.0...v13.0.1)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Feb 29, 2020
    Copy the full SHA
    84311be View commit details

Commits on Jul 26, 2020

  1. Feature : Allow resizing of files before downloading (#22)

    * chore: Update `bundler`, `rake` and `Gemfile.lock`
    
    Updates the gem dependencies.
    Update bundler and rake.
    
    * feat: Add resize_to_limit filter
    
    Allow resizing of zipped files before downloading.
    
    * fix: Fix dependency on `service_url`
    
    According to the documentation, `service_url` shouldn't be used
    directly. Replace the call to `service_url` with `url_for`.
    
    * fix: send `url_for` isn't supported by all services
    
    Sending the `url_for` method isn't supported by all services.
    
    * chore: Update `CHANGELOG.yml`
    
    Update the `CHANGELOG.yml` for version 0.3.4 with the resize feature.
    
    * chore: Update `README.md`
    
    Update the `README.md` with details on how to use the resize feature.
    
    * chore: Bump version number
    
    Increase the version number to 0.3.4.
    Add my name to the authors.
    
    * chore: Document `resize_to_limit` filter
    
    Document the `resize_to_limit` filter that can be applied to images
    before being zipped.
    
    * feat: Add a test for `resize_to_limit`
    
    Add a test to ensure the behavior of resize_to_limit is working.
    biximilien authored Jul 26, 2020
    Copy the full SHA
    18b7443 View commit details

Commits on Nov 17, 2020

  1. Bump actionview from 6.0.3.2 to 6.0.3.3 (#23)

    Bumps [actionview](https://github.com/rails/rails) from 6.0.3.2 to 6.0.3.3.
    - [Release notes](https://github.com/rails/rails/releases)
    - [Changelog](https://github.com/rails/rails/blob/v6.0.3.3/actionview/CHANGELOG.md)
    - [Commits](rails/rails@v6.0.3.2...v6.0.3.3)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 17, 2020
    Copy the full SHA
    2385308 View commit details

Commits on Feb 27, 2024

  1. Bump rails to 7.1.2 (#57)

    * Bump actionpack from 6.0.3.3 to 7.0.4.2
    
    Bumps [actionpack](https://github.com/rails/rails) from 6.0.3.3 to 7.0.4.2.
    - [Release notes](https://github.com/rails/rails/releases)
    - [Changelog](https://github.com/rails/rails/blob/v7.0.4.2/actionpack/CHANGELOG.md)
    - [Commits](rails/rails@v6.0.3.3...v7.0.4.2)
    
    ---
    updated-dependencies:
    - dependency-name: actionpack
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    * Bump nokogiri from 1.10.10 to 1.14.2
    
    Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.10 to 1.14.2.
    - [Release notes](https://github.com/sparklemotion/nokogiri/releases)
    - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
    - [Commits](sparklemotion/nokogiri@v1.10.10...v1.14.2)
    
    ---
    updated-dependencies:
    - dependency-name: nokogiri
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    * Update Gemfile.lock
    
    * Update rails to 7.1.2
    
    * Bump to rails 7.1.3.2
    
    ---------
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    mustafa90 and dependabot[bot] authored Feb 27, 2024
    Copy the full SHA
    cc97d40 View commit details
  2. chore: publish v0.3.5

    madeindjs committed Feb 27, 2024
    Copy the full SHA
    84b916a View commit details
Showing with 401 additions and 150 deletions.
  1. +8 −0 CHANGELOG.yml
  2. +0 −4 Gemfile
  3. +168 −101 Gemfile.lock
  4. +36 −1 README.md
  5. +7 −3 active_storage-send_zip.gemspec
  6. +3 −2 lib/active_storage/send_zip.rb
  7. +3 −1 lib/active_storage/send_zip/version.rb
  8. +62 −23 lib/active_storage/send_zip_helper.rb
  9. +114 −15 test/active_storage/send_zip_helper_test.rb
8 changes: 8 additions & 0 deletions CHANGELOG.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
0.3.4:
- add resize before download capability
0.3.2:
- correct rubyzip dependency
0.3.1:
- correct comportement when `ActiveStorage::Attached::Many` is given as paramter
0.3.0:
- correct subfolders creation (and break some methods signature)
0.2.0:
- move some methods to avoid to polute controller methods
- `ActiveStorage::SendZip#save_files_on_server` become `ActiveStorage::SendZipHelperSendZip#save_files_on_server`
4 changes: 0 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -4,7 +4,3 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in active_storage-send_zip.gemspec
gemspec

gem "rails", "~> 5.2"

gem "rubyzip", "~> 1.2"
269 changes: 168 additions & 101 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,130 +1,197 @@
PATH
remote: .
specs:
active_storage-send_zip (0.2.0)
active_storage-send_zip (0.3.5)
rails (> 5.2)
rubyzip (< 3.0)

GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.1.1)
actionpack (= 5.2.1.1)
actioncable (7.1.3.2)
actionpack (= 7.1.3.2)
activesupport (= 7.1.3.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.1.1)
actionpack (= 5.2.1.1)
actionview (= 5.2.1.1)
activejob (= 5.2.1.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.3.2)
actionpack (= 7.1.3.2)
activejob (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.3.2)
actionpack (= 7.1.3.2)
actionview (= 7.1.3.2)
activejob (= 7.1.3.2)
activesupport (= 7.1.3.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.1.1)
actionview (= 5.2.1.1)
activesupport (= 5.2.1.1)
rack (~> 2.0)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.2)
actionpack (7.1.3.2)
actionview (= 7.1.3.2)
activesupport (= 7.1.3.2)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.1.1)
activesupport (= 5.2.1.1)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.3.2)
actionpack (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.3.2)
activesupport (= 7.1.3.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.1.1)
activesupport (= 5.2.1.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.3.2)
activesupport (= 7.1.3.2)
globalid (>= 0.3.6)
activemodel (5.2.1.1)
activesupport (= 5.2.1.1)
activerecord (5.2.1.1)
activemodel (= 5.2.1.1)
activesupport (= 5.2.1.1)
arel (>= 9.0)
activestorage (5.2.1.1)
actionpack (= 5.2.1.1)
activerecord (= 5.2.1.1)
marcel (~> 0.3.1)
activesupport (5.2.1.1)
activemodel (7.1.3.2)
activesupport (= 7.1.3.2)
activerecord (7.1.3.2)
activemodel (= 7.1.3.2)
activesupport (= 7.1.3.2)
timeout (>= 0.4.0)
activestorage (7.1.3.2)
actionpack (= 7.1.3.2)
activejob (= 7.1.3.2)
activerecord (= 7.1.3.2)
activesupport (= 7.1.3.2)
marcel (~> 1.0)
activesupport (7.1.3.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (9.0.0)
builder (3.2.3)
concurrent-ruby (1.1.3)
crass (1.0.4)
erubi (1.7.1)
globalid (0.4.1)
activesupport (>= 4.2.0)
i18n (1.1.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
base64 (0.2.0)
bigdecimal (3.1.6)
builder (3.2.4)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
crass (1.0.6)
date (3.3.4)
drb (2.2.0)
ruby2_keywords
erubi (1.12.0)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
loofah (2.2.3)
io-console (0.7.2)
irb (1.11.2)
rdoc
reline (>= 0.4.2)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mimemagic (0.3.2)
mini_mime (1.0.1)
mini_portile2 (2.3.0)
minitest (5.11.3)
nio4r (2.3.1)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
rack (2.0.6)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.1.1)
actioncable (= 5.2.1.1)
actionmailer (= 5.2.1.1)
actionpack (= 5.2.1.1)
actionview (= 5.2.1.1)
activejob (= 5.2.1.1)
activemodel (= 5.2.1.1)
activerecord (= 5.2.1.1)
activestorage (= 5.2.1.1)
activesupport (= 5.2.1.1)
bundler (>= 1.3.0)
railties (= 5.2.1.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
net-imap
net-pop
net-smtp
marcel (1.0.2)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.22.2)
mutex_m (0.2.0)
net-imap (0.4.10)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-protocol
nio4r (2.7.0)
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
psych (5.1.2)
stringio
racc (1.7.3)
rack (3.0.9.1)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.1.3.2)
actioncable (= 7.1.3.2)
actionmailbox (= 7.1.3.2)
actionmailer (= 7.1.3.2)
actionpack (= 7.1.3.2)
actiontext (= 7.1.3.2)
actionview (= 7.1.3.2)
activejob (= 7.1.3.2)
activemodel (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
bundler (>= 1.15.0)
railties (= 7.1.3.2)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.1.1)
actionpack (= 5.2.1.1)
activesupport (= 5.2.1.1)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rake (10.5.0)
rubyzip (1.2.2)
sprockets (3.7.2)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.1.3.2)
actionpack (= 7.1.3.2)
activesupport (= 7.1.3.2)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rake (13.1.0)
rdoc (6.6.2)
psych (>= 4.0.0)
reline (0.4.3)
io-console (~> 0.5)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
stringio (3.1.0)
thor (1.3.1)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (0.20.3)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
websocket-driver (0.7.0)
webrick (1.8.1)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
websocket-extensions (0.1.5)
zeitwerk (2.6.13)

PLATFORMS
ruby

DEPENDENCIES
active_storage-send_zip!
bundler (~> 1.17)
bundler
minitest (~> 5.0)
rails (~> 5.2)
rake (~> 10.0)
rubyzip (~> 1.2)
rake

BUNDLED WITH
1.17.1
2.4.1
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -61,7 +61,10 @@ class HolidaysController < ApplicationController
def zip
send_zip {
'Holidays in Lyon <3' => Holidays.where(place: 'lyon').first.pictures,
'Holidays in Paris' => Holidays.where(place: 'paris').first.pictures,
'Holidays in Paris' => [
'Eiffle Tower' => Holidays.where(place: 'eiffle_tower').first.pictures,
Holidays.where(place: 'paris').first.pictures
]
}
end
end
@@ -75,11 +78,43 @@ Will produce a `.zip` archive like this:
│   ├── b.png
│   └── c.gif
└── Holidays in Paris
├── Eiffle Tower
├── d.jpg
├── e.jpg
├── f.jpg
├── a.jpg
├── b.png
└── c.gif
~~~


### Resize images before downloading

You can resize the images before zipping and downloading them :

~~~ruby
# app/controllers/galleries_controller.rb
class GalleriesController < ApplicationController
include ActiveStorage::SendZip

# ...

# GET /galleries/1/download
def download
respond_to do |format|
if params[:format] == 'web_size'
format.zip { send_zip @gallery.photos, resize_to_limit: [1920, 1080] }
elsif params[:format] == 'tiny'
format.zip { send_zip @gallery.photos, resize_to_limit: [480, 270] }
else
format.zip { send_zip @gallery.photos }
end
end
end
end
~~~


## Installation

Add this line to your application's Gemfile:
Loading