carrierwave-docsplit 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +0 -8
- data/lib/carrierwave-docsplit.rb +6 -4
- data/lib/carrierwave-docsplit/version.rb +1 -1
- data/test/test_uploader.rb +2 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b75c00d23477b0b3873d9d15a9a330cab8a9eae0
|
4
|
+
data.tar.gz: fb4794cbc4987fd2efc03a99deae459529d00b0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af20adcae93b6e22d14bfa60c861eda27172696f6d30a2302e18ef89ac445bf45b0f802c7ab8342db50deb207137f3131a99514d02ba14cc5898a4b23b87bae7
|
7
|
+
data.tar.gz: c339cce2d5e8a446ea06f5963c104d745075dd033529f685b3bc24590c26de4b856c5f4dce5ffbc70e82f06b1447d682877bd3a7e43b3cbef6cc2735ca5fc4ee
|
data/Gemfile.lock
CHANGED
@@ -11,16 +11,10 @@ GEM
|
|
11
11
|
activemodel (3.2.2)
|
12
12
|
activesupport (= 3.2.2)
|
13
13
|
builder (~> 3.0.0)
|
14
|
-
activerecord (3.2.2)
|
15
|
-
activemodel (= 3.2.2)
|
16
|
-
activesupport (= 3.2.2)
|
17
|
-
arel (~> 3.0.2)
|
18
|
-
tzinfo (~> 0.3.29)
|
19
14
|
activesupport (3.2.2)
|
20
15
|
i18n (~> 0.6)
|
21
16
|
multi_json (~> 1.0)
|
22
17
|
ansi (1.4.2)
|
23
|
-
arel (3.0.2)
|
24
18
|
builder (3.0.0)
|
25
19
|
carrierwave (0.6.0)
|
26
20
|
activemodel (>= 3.2.0)
|
@@ -30,12 +24,10 @@ GEM
|
|
30
24
|
multi_json (1.2.0)
|
31
25
|
turn (0.9.4)
|
32
26
|
ansi
|
33
|
-
tzinfo (0.3.32)
|
34
27
|
|
35
28
|
PLATFORMS
|
36
29
|
ruby
|
37
30
|
|
38
31
|
DEPENDENCIES
|
39
|
-
activerecord
|
40
32
|
carrierwave-docsplit!
|
41
33
|
turn
|
data/lib/carrierwave-docsplit.rb
CHANGED
@@ -51,7 +51,7 @@ module CarrierWave
|
|
51
51
|
|
52
52
|
define_method :output_path do
|
53
53
|
return nil if self.file.nil?
|
54
|
-
File.join self.store_dir, self.file.basename
|
54
|
+
File.expand_path(File.join self.store_dir, self.file.basename)
|
55
55
|
end
|
56
56
|
|
57
57
|
# Latch our extraction method into the processing queue.
|
@@ -73,12 +73,15 @@ module CarrierWave
|
|
73
73
|
define_method options[:to] do
|
74
74
|
path = File.join(self.output_path, '*')
|
75
75
|
|
76
|
+
# require 'pry'
|
77
|
+
|
78
|
+
# binding.pry
|
79
|
+
|
76
80
|
dirs_or_files = Dir.glob(path)
|
77
81
|
reduced = {}
|
78
82
|
|
79
83
|
# Multiple Sizes
|
80
84
|
if dirs_or_files.any? { |entry| entry.match /\d+x\d*/ }
|
81
|
-
|
82
85
|
Dir.glob(path) do |dirs|
|
83
86
|
if dirs.is_a?(String)
|
84
87
|
dirs = [] << dirs
|
@@ -94,7 +97,7 @@ module CarrierWave
|
|
94
97
|
# Only as single size supplied
|
95
98
|
else
|
96
99
|
options.delete :to
|
97
|
-
size = options.values.first
|
100
|
+
size = options[:sizes].values.first
|
98
101
|
reduced[size] = dirs_or_files
|
99
102
|
end
|
100
103
|
|
@@ -116,7 +119,6 @@ module CarrierWave
|
|
116
119
|
end
|
117
120
|
|
118
121
|
out = self.output_path
|
119
|
-
|
120
122
|
FileUtils.mkdir_p out
|
121
123
|
|
122
124
|
Docsplit.extract_images self.file.path, :size => sizes.values, :output => out
|
data/test/test_uploader.rb
CHANGED
@@ -44,9 +44,7 @@ class SingleSizeUploader < CarrierWave::Uploader::Base
|
|
44
44
|
file = File.open(File.join(ROOT, 'data/w9_single.pdf'))
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
extract :images => image_options
|
47
|
+
extract :images => { :to => :thumbs, :sizes => self.sizes }
|
50
48
|
end
|
51
49
|
|
52
50
|
class TextExtractionUploader < CarrierWave::Uploader::Base
|
@@ -121,7 +119,7 @@ class TestCarrierWaveDocsplit < MiniTest::Unit::TestCase
|
|
121
119
|
uploader.retrieve_from_store! 'w9_single.pdf'
|
122
120
|
else
|
123
121
|
file = File.open SingleSizeUploader.file_path
|
124
|
-
|
122
|
+
uploader.store! file
|
125
123
|
end
|
126
124
|
|
127
125
|
assert uploader.thumbs.include?(SingleSizeUploader.sizes.values.first)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-docsplit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Woodbridge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: turn
|