zipline 0.0.12 → 0.0.13

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: 32af17d30455f2322945e79505b8b245a7763598
4
- data.tar.gz: 8b88a1960a3fa863f133e80af46b807367ae9f3e
3
+ metadata.gz: 4432974ae414c5818803a87592a48724c6529cf4
4
+ data.tar.gz: 49d506143661ddcee1d31bd0bcf01552cf69f330
5
5
  SHA512:
6
- metadata.gz: 453ec64461138092d23c1bcaefe156666c642366e03795bd7b8934f8b7c7af267f34734c256cd783f8b96eb612c0eea8461cf77a30226e7779597a472ac981e6
7
- data.tar.gz: 42fac533765d6c69f56e37d58c997ef6cbe6d8cdffc947b2fc902de69aad34b79f0de6b80cf186f64245372f3438dfd0b0675ecfd4b2ef87b94ad248ecef3cf7
6
+ metadata.gz: 6542c37c2b31036c03a7df68cd986dc68a62a823fcbe92ff08892c2f68b31aae8f405445d05f3ce4ac36605fd4ab3d535fdce38538e4c1e14e746f3ec9d28398
7
+ data.tar.gz: 1897313e5748f76d89fbffd238327cbf8058b615f97f0af24f7379476b8e1740958cdaf4ffdd53683f05f3d1e2f1cdd1c16d820473cc2fba8f4c1c5155090296
data/README.md CHANGED
@@ -5,6 +5,8 @@ A gem to stream dynamically generated zip files from a rails application. Unlike
5
5
  - Removes need for large disk space or memory allocation to generate zips, even huge zips. So it works on Heroku.
6
6
  - The user begins downloading immediately, which decreaceses latency, download time, and timeouts on Heroku.
7
7
 
8
+ Zipline now depends on [zip tricks](https://github.com/WeTransfer/zip_tricks), and you might want to just use that directly if you have more advanced use cases.
9
+
8
10
  ## Installation
9
11
 
10
12
  Add this line to your application's Gemfile:
@@ -17,12 +19,12 @@ And then execute:
17
19
 
18
20
  ## Usage
19
21
 
20
- Set up some models with [carrierwave](https://github.com/jnicklas/carrierwave)
21
- or [paperclip](https://github.com/thoughtbot/paperclip). Right now only plain
22
+ Set up some models with [carrierwave](https://github.com/jnicklas/carrierwave), [paperclip](https://github.com/thoughtbot/paperclip), or [shrine](https://github.com/janko-m/shrine). Right now only plain
22
23
  file storage and S3 are supported in the case of
23
24
  [carrierwave](https://github.com/jnicklas/carrierwave) and only plain file
24
25
  storage and S3 are supported in the case of
25
- [paperclip](https://github.com/thoughtbot/paperclip).
26
+ [paperclip](https://github.com/thoughtbot/paperclip). [Mutiple file storages](http://shrinerb.com/#external) are supported with [shrine](https://github.com/janko-m/shrine).
27
+
26
28
  You'll need to be using puma or some other server that supports streaming output.
27
29
 
28
30
  class MyController < ApplicationController
@@ -66,4 +68,5 @@ To stream files from a remote URL, use open-uri with a [lazy enumerator](http://
66
68
 
67
69
  ## TODO (possible contributions?)
68
70
 
69
- * tests!
71
+ * Add support for your favorite attachment plugin.
72
+ * Tests.
@@ -1,3 +1,3 @@
1
1
  module Zipline
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -21,7 +21,6 @@ module Zipline
21
21
 
22
22
  def handle_file(streamer, file, name)
23
23
  file = normalize(file)
24
- name = uniquify_name(name)
25
24
  write_file(streamer, file, name)
26
25
  end
27
26
 
@@ -50,11 +49,11 @@ module Zipline
50
49
  writer_for_file << data
51
50
  data.bytesize
52
51
  end
53
- end
52
+ end
54
53
  c.perform
55
54
  elsif is_io?(file)
56
55
  IO.copy_stream(file, writer_for_file)
57
- else
56
+ else
58
57
  raise(ArgumentError, 'Bad File/Stream')
59
58
  end
60
59
  end
@@ -63,41 +62,5 @@ module Zipline
63
62
  def is_io?(io_ish)
64
63
  io_ish.respond_to? :read
65
64
  end
66
-
67
- def uniquify_name(name)
68
- @used_names ||= Set.new
69
-
70
- if @used_names.include?(name)
71
-
72
- #remove suffix e.g. ".foo"
73
- parts = name.split '.'
74
- name, extension =
75
- if parts.length == 1
76
- #no suffix, e.g. README
77
- parts << ''
78
- else
79
- extension = parts.pop
80
- [parts.join('.'), ".#{extension}"]
81
- end
82
-
83
- #trailing _#{number}
84
- pattern = /_(\d+)$/
85
-
86
- unless name.match pattern
87
- name = "#{name}_1"
88
- end
89
-
90
- while @used_names.include? name + extension
91
- #increment trailing number
92
- name = name.sub( pattern ) { |x| "_#{$1.to_i + 1}" }
93
- end
94
-
95
- #reattach suffix
96
- name += extension
97
- end
98
-
99
- @used_names << name
100
- name
101
- end
102
65
  end
103
66
  end
data/zipline.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Zipline::VERSION
17
17
 
18
- gem.add_dependency 'zip_tricks', ['>= 4.0.0', '<= 5.0.0']
19
- gem.add_dependency 'rails', ['>= 3.2.1', '< 5.1']
18
+ gem.add_dependency 'zip_tricks', ['>= 4.2.1', '<= 5.0.0']
19
+ gem.add_dependency 'rails', ['>= 3.2.1', '< 5.2']
20
20
  gem.add_dependency 'curb', ['>= 0.8.0', '< 0.10']
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zipline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ram Dobson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-06 00:00:00.000000000 Z
11
+ date: 2017-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zip_tricks
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: 4.2.1
20
20
  - - "<="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 5.0.0
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 4.0.0
29
+ version: 4.2.1
30
30
  - - "<="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 5.0.0
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: 3.2.1
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '5.1'
42
+ version: '5.2'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: 3.2.1
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '5.1'
52
+ version: '5.2'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: curb
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.5.1
109
+ rubygems_version: 2.6.12
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: stream zip files from rails