paperclip-document 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c2461acd828b0cf325460c5bcb8645d910bdb987
4
+ data.tar.gz: 2471f4c3b01c65cc62265f44f17e6e872442d8d9
5
+ SHA512:
6
+ metadata.gz: ac39f1658c38850862a9d69595dc21e67bd195c081ebb68817b3240e4b2625947261eb44eaf8bfcbc884e20a3460adeb1f41ce0d989bd72aa53085aaaae955ee
7
+ data.tar.gz: 7a840089e0e23bba7e1ffda17fe704c699bcb6b2d22aadc07cc1a78659a107d278059c53d3511106fec2e4a1ed2dc97ac85237ce0804e5f72b41b13d215e52dc
@@ -1,5 +1,5 @@
1
1
  module Paperclip
2
2
  module Document
3
- VERSION = "0.0.0"
3
+ VERSION = "0.0.1"
4
4
  end
5
5
  end
@@ -11,7 +11,9 @@ module Paperclip
11
11
  def initialize(file, options = {}, attachment = nil)
12
12
  super(file, options, attachment)
13
13
  @instance = @attachment.instance
14
- @tmp_dir = Pathname.new(Dir.tmpdir).join("paperclip-document", instance.class.name, attachment.name.to_s, basename, Time.now.to_i.to_s(36) + "-" + rand(1_000_000).to_s(36))
14
+ # @tmp_dir = Pathname.new(Dir.tmpdir).join("paperclip-document", instance.class.name, attachment.name.to_s, basename, Time.now.to_i.to_s(36) + "-" + rand(1_000_000).to_s(36))
15
+ # @tmp_dir = Rails.root.join("paperclip-document", instance.class.name, attachment.name.to_s, basename, Time.now.to_i.to_s(36) + "-" + rand(1_000_000).to_s(36))
16
+ @tmp_dir = Pathname.new(Dir.tmpdir).join("paperclip-document-" + rand(1_000_000_000).to_s(36) + "-" + rand(1_000_000).to_s(36) + "-" + Time.now.to_i.to_s(36) + "-" + rand(1_000_000).to_s(36))
15
17
  end
16
18
 
17
19
  def file_path
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-document
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
5
- prerelease:
4
+ version: 0.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brice Texier
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-16 00:00:00.000000000 Z
11
+ date: 2013-12-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: paperclip
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: docsplit
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: ruby-filemagic
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: bundler
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,49 +69,43 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rake
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
- name: activerecord
84
+ name: rails
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ~>
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '3.2'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ~>
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '3.2'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: sqlite3
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  description:
@@ -130,11 +115,8 @@ executables: []
130
115
  extensions: []
131
116
  extra_rdoc_files: []
132
117
  files:
133
- - .gitignore
134
- - Gemfile
135
118
  - LICENSE.txt
136
119
  - README.md
137
- - Rakefile
138
120
  - lib/paperclip/document.rb
139
121
  - lib/paperclip/document/processors.rb
140
122
  - lib/paperclip/document/processors/counter.rb
@@ -142,43 +124,28 @@ files:
142
124
  - lib/paperclip/document/processors/reader.rb
143
125
  - lib/paperclip/document/processors/sketcher.rb
144
126
  - lib/paperclip/document/version.rb
145
- - paperclip-document.gemspec
146
- - test/fixtures/example.docx
147
- - test/fixtures/example.odt
148
- - test/fixtures/example.pdf
149
- - test/helper.rb
150
- - test/schema.rb
151
- - test/test_processors.rb
152
127
  homepage: http://github.com/burisu/paperclip-document
153
128
  licenses:
154
129
  - MIT
130
+ metadata: {}
155
131
  post_install_message:
156
132
  rdoc_options: []
157
133
  require_paths:
158
134
  - lib
159
135
  required_ruby_version: !ruby/object:Gem::Requirement
160
- none: false
161
136
  requirements:
162
- - - ! '>='
137
+ - - '>='
163
138
  - !ruby/object:Gem::Version
164
139
  version: '0'
165
140
  required_rubygems_version: !ruby/object:Gem::Requirement
166
- none: false
167
141
  requirements:
168
- - - ! '>='
142
+ - - '>='
169
143
  - !ruby/object:Gem::Version
170
144
  version: '0'
171
145
  requirements: []
172
146
  rubyforge_project:
173
- rubygems_version: 1.8.23
147
+ rubygems_version: 2.0.14
174
148
  signing_key:
175
- specification_version: 3
149
+ specification_version: 4
176
150
  summary: Processors for paperclip
177
- test_files:
178
- - test/fixtures/example.docx
179
- - test/fixtures/example.odt
180
- - test/fixtures/example.pdf
181
- - test/helper.rb
182
- - test/schema.rb
183
- - test/test_processors.rb
184
- has_rdoc:
151
+ test_files: []
data/.gitignore DELETED
@@ -1,18 +0,0 @@
1
- *~
2
- *.gem
3
- *.rbc
4
- .bundle
5
- .config
6
- .yardoc
7
- Gemfile.lock
8
- InstalledFiles
9
- _yardoc
10
- coverage
11
- doc/
12
- lib/bundler/man
13
- pkg
14
- rdoc
15
- spec/reports
16
- test/tmp
17
- test/version_tmp
18
- tmp
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in paperclip-document.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- require 'rake/testtask'
4
- Rake::TestTask.new(:test) do |test|
5
- test.libs << 'lib' << 'test'
6
- test.pattern = 'test/**/test_*.rb'
7
- test.verbose = true
8
- end
9
-
10
- task :default => :test
@@ -1,27 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'paperclip/document/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "paperclip-document"
8
- spec.version = Paperclip::Document::VERSION
9
- spec.authors = ["Brice Texier"]
10
- spec.email = ["burisu@oneiros.fr"]
11
- spec.summary = %q{Processors for paperclip}
12
- spec.homepage = "http://github.com/burisu/paperclip-document"
13
- spec.license = "MIT"
14
-
15
- spec.files = `git ls-files`.split($/)
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
19
-
20
- spec.add_dependency "paperclip", "~> 3.1"
21
- spec.add_dependency "docsplit", "~> 0.7.2"
22
- spec.add_dependency "ruby-filemagic", "~> 0.4.2"
23
- spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rake"
25
- spec.add_development_dependency 'activerecord', "~> 3.2"
26
- spec.add_development_dependency 'sqlite3'
27
- end
Binary file
Binary file
Binary file
data/test/helper.rb DELETED
@@ -1,37 +0,0 @@
1
- require 'paperclip'
2
- require 'paperclip/railtie'
3
- require 'active_record'
4
- require 'pathname'
5
- require 'paperclip/document'
6
- require 'test/unit'
7
-
8
- # Connect to sqlite
9
- ActiveRecord::Base.establish_connection(
10
- "adapter" => "sqlite3",
11
- "database" => ":memory:"
12
- )
13
-
14
- ActiveRecord::Base.logger = Logger.new(nil)
15
- load(File.join(File.dirname(__FILE__), 'schema.rb'))
16
-
17
- Paperclip::Railtie.insert
18
-
19
- class Document < ActiveRecord::Base
20
- has_attached_file(:original,
21
- :storage => :filesystem,
22
- :path => "./tmp/documents/:id/:style.:extension",
23
- :url => "/tmp/:id.:extension",
24
- :styles => {
25
- :archive => {:clean => true, :format =>:pdf, :processors => [:reader, :counter, :freezer]},
26
- :thumbnail => {:processors => [:sketcher], :format => :jpg}
27
- })
28
- end
29
-
30
-
31
-
32
- class Paperclip::Document::TestCase < Test::Unit::TestCase
33
-
34
- def fixtures
35
- Pathname.new(__FILE__).dirname.join("fixtures")
36
- end
37
- end
data/test/schema.rb DELETED
@@ -1,11 +0,0 @@
1
- ActiveRecord::Schema.define :version => "001" do
2
- create_table "documents", :force => true do |t|
3
- t.string :name
4
- t.string :original_file_name
5
- t.string :original_content_type
6
- t.integer :original_updated_at
7
- t.integer :original_file_size
8
- t.text :original_content_text
9
- t.integer :original_pages_count
10
- end
11
- end
@@ -1,42 +0,0 @@
1
- # encoding: utf-8
2
- require 'helper'
3
-
4
- class TestProcessors < Paperclip::Document::TestCase
5
-
6
- def test_odt
7
- f = File.open(fixtures.join("example.odt"))
8
- document = Document.create!(:name => "My first document", :original => f)
9
- f.close
10
-
11
- document.reload
12
- assert_equal 1, document.original.pages_count
13
-
14
- assert !document.original.content_text.nil?
15
- assert document.original.content_text.match("This is an example.")
16
- end
17
-
18
- def test_pdf
19
- f = File.open(fixtures.join("example.pdf"))
20
- document = Document.create!(:name => "My second document", :original => f)
21
- f.close
22
-
23
- document.reload
24
- assert_equal 1, document.original.pages_count
25
-
26
- assert !document.original.content_text.nil?
27
- assert document.original.content_text.match("This is an example.")
28
- end
29
-
30
- def test_docx
31
- f = File.open(fixtures.join("example.docx"))
32
- document = Document.create!(:name => "My third document", :original => f)
33
- f.close
34
-
35
- document.reload
36
- assert_equal 1, document.original.pages_count
37
-
38
- assert !document.original.content_text.nil?
39
- assert document.original.content_text.match("This is an example.")
40
- end
41
-
42
- end