carrierwave-docsplit 0.0.1 → 0.0.2

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: 130d69ad01b1df6ed26e49629fdba48deb463cc0
4
- data.tar.gz: f288596517c59c64764c5a4a9b64734c75ba326c
3
+ metadata.gz: b75c00d23477b0b3873d9d15a9a330cab8a9eae0
4
+ data.tar.gz: fb4794cbc4987fd2efc03a99deae459529d00b0f
5
5
  SHA512:
6
- metadata.gz: f78aa024c446ade564da2c3b18b46025bb5d2009e178142cdccee0ce5d68cecb7f66acacd25a93d79d4ee93ea620ccf7abe2ef37a34634c7b0dbfbe97ed02e3e
7
- data.tar.gz: 8c5e6679a90e2da7e8658988bdf79d02cff814c51f65ba03f14125aad8ca153fc19765f051ff2f2fdd4672c3976bef1d89e71b924efce08f271b5d5e6a97207a
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Carrierwave
2
2
  module Docsplit
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -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
- image_options = {:to => :thumbs }.merge self.sizes
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
- uploads.store! file
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.1
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-07-28 00:00:00.000000000 Z
11
+ date: 2013-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: turn