fileclip 0.0.3 → 0.1.0

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: a311561e6048d53367ee57f3cb9165b36e41567e
4
- data.tar.gz: beb839f1783d207d72117ca7c7be8787f56ba80a
3
+ metadata.gz: 435bef9bd97c9e7a5a77ab0f26e68b2977d9cd48
4
+ data.tar.gz: 2ffee75c354221079689f99cb4f86e13af632e5d
5
5
  SHA512:
6
- metadata.gz: 0df75a25ec21f9abdf48960c62bcb7384cb1f6c47e004a52c9b4ff12ce59b8d2611349709123d2b5b72e51c66305e1cbb68a3a8d149c4f8a37d39a762ba03391
7
- data.tar.gz: 75aab020685e28fb4871a49b5cb43d3e8b95e6b185a69a1af68cb18ff31d256b246d91d5ba3a80f4e419b31ed263c40179695a55cf30f7c40974e9bdde0212d2
6
+ metadata.gz: 36ecf1b9637d0e5bd6e1a8bb88e12aede0e7bfc310b1283d473d2c8029ee804742a1d154033c0f0f93626d206ac4ca8050c8601c5e88304e4eec4f2c2edd7f92
7
+ data.tar.gz: cceec767215643332fe54b0f11fa0dbb538a8ffc21c5edf8a9f67d3d15ddc5a76d76d5b526444e052a3ac977306b6c69639bede4af1c0098ceb80fdeee3e09fb
data/Gemfile CHANGED
@@ -3,5 +3,4 @@ source "http://rubygems.org"
3
3
  gemspec
4
4
 
5
5
  gem 'rails', "3.2.14"
6
- gem 'byebug'
7
6
 
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fileclip (0.0.2)
4
+ fileclip (0.0.3)
5
5
  paperclip
6
6
  paperclip (>= 3.3.0)
7
7
  railties (>= 3.0)
8
+ rest-client
8
9
 
9
10
  GEM
10
11
  remote: http://rubygems.org/
@@ -38,15 +39,10 @@ GEM
38
39
  multi_json (~> 1.0)
39
40
  arel (3.0.2)
40
41
  builder (3.0.4)
41
- byebug (1.6.1)
42
- columnize (~> 0.3.6)
43
- debugger-linecache (~> 1.2.0)
44
42
  climate_control (0.0.3)
45
43
  activesupport (>= 3.0)
46
44
  cocaine (0.5.1)
47
45
  climate_control (>= 0.0.3, < 1.0)
48
- columnize (0.3.6)
49
- debugger-linecache (1.2.0)
50
46
  diff-lcs (1.2.4)
51
47
  erubis (2.7.0)
52
48
  hike (1.2.3)
@@ -116,10 +112,7 @@ PLATFORMS
116
112
  ruby
117
113
 
118
114
  DEPENDENCIES
119
- byebug
120
115
  fileclip!
121
- paperclip
122
116
  rails (= 3.2.14)
123
- rest-client
124
117
  rspec
125
118
  sqlite3
data/README.md CHANGED
@@ -1,36 +1,51 @@
1
- fileclip
1
+ FileClip
2
2
  ========
3
3
 
4
4
  A FilePicker / PaperClip mashup. Use Filepicker for uploads and paperclip to process them.
5
5
 
6
- TODO:
7
-
8
- Backend:
9
- * It should be unobtrusive. Normal paperclip uploads should work
10
- * If filepicker_url is present it should process it
11
- * If filepicker_url changes, it should process it
12
- * First version should be minimal
13
- * Handle skipping validations of attachment seamlessly
14
- * Configuration accepts config key
15
-
16
- Frontend:
17
- * Allow overriding of filepicker options
18
- * Fileclip link to automatically set fields and call it
19
- * link should act like a normal link helper
20
- * Minimal amount of JS
21
- * Loader for filepicker js if needed
22
- * Eliminate need for jQuery
23
-
24
- Extra features:
25
- * Work with Delayed Paperclip
26
- * Work with Resque
27
- * Work with DelayedJob
28
- * Work with Sidekiq
29
- * Handle multiple attachments on the same model
30
- * Fallback to filepicker url if paperclip url doesn't exist
31
- * Filepicker converts to match paperclip styles
32
- * Configure Filepicker options
33
- * FilePicker droppane support
6
+ ### What FileClip Does
7
+
8
+ FileClip saves a filepicker url to your image table which is then
9
+ processed by paperclip after the object is saved. This allows filepicker urls with paperclip styles while the image is being processed and the possibility for seamless image handling without having to process anything on your rails servers.
10
+
11
+ ## Minimum Viable Setup
12
+
13
+ ### Add to Paperclip table
14
+ ````
15
+ class AddFileClipToImages < ActiveRecord::Migration
16
+ def up
17
+ add_column :images, :filepicker_url, :string
18
+ end
19
+
20
+ def down
21
+ remove_column :images, :filepicker_url
22
+ end
23
+ end
24
+ ````
25
+
26
+ ### In Initializer
27
+ ````
28
+ # config/initializers/fileclip.rb
29
+ FileClip.configure do |config|
30
+ config.filepicker_key = 'XXXXXXXXXXXXXXXXXXX'
31
+ end
32
+ ````
33
+
34
+ ### In View
35
+ ````
36
+ # Loads Filepicker js, and FileClip js
37
+ <%= fileclip_js_include_tag %>
38
+
39
+ <%= form_for(Image.new) do |f| %>
40
+
41
+ # provides a link that can be styled any way you choose
42
+ # launches filepicker dialog and saves link to hidden field
43
+ <%= link_to_fileclip "Choose a File", f %>
44
+
45
+ <%= f.submit %>
46
+ <% end %>
47
+
48
+ ````
34
49
 
35
50
  #### Current FilePicker options hardcoded
36
51
  * mimetypes are image/*
data/fileclip.gemspec CHANGED
@@ -1,6 +1,9 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "fileclip/version"
3
+
1
4
  Gem::Specification.new do |s|
2
5
  s.name = "fileclip"
3
- s.version = "0.0.3"
6
+ s.version = FileClip::VERSION
4
7
 
5
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
9
  s.authors = ["Scott Carleton"]
@@ -29,12 +32,11 @@ Gem::Specification.new do |s|
29
32
  s.summary = "A FilePicker / PaperClip mashup."
30
33
 
31
34
  s.add_dependency 'paperclip', [">= 3.3.0"]
35
+ s.add_dependency 'rest-client'
32
36
 
33
37
  s.add_development_dependency "rspec"
34
38
  s.add_development_dependency 'sqlite3'
35
39
  s.add_development_dependency "rails"
36
- s.add_development_dependency "paperclip"
37
- s.add_development_dependency "rest-client"
38
40
  s.add_runtime_dependency(%q<railties>, [">= 3.0"])
39
41
 
40
42
  s.add_runtime_dependency "paperclip"
@@ -1,3 +1,3 @@
1
1
  module FileClip
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/fileclip.rb CHANGED
@@ -23,8 +23,9 @@
23
23
  # Add delayed aspect
24
24
  #
25
25
  # Queue job for image assignment
26
- require "fileclip/configuration"
26
+ require 'fileclip/configuration'
27
27
  require 'fileclip/action_view/helpers'
28
+ require 'fileclip/engine'
28
29
  require 'fileclip/railtie'
29
30
  require 'rest-client'
30
31
 
@@ -54,10 +55,12 @@ module FileClip
54
55
  end
55
56
 
56
57
  def paperclip_definitions
57
- @paperclip_definitions ||= if respond_to? :attachment_definitions
58
+ @paperclip_definitions ||= if Paperclip::VERSION.to_f < 3.5
58
59
  attachment_definitions
59
- else
60
+ elsif Paperclip::VERSION == "3.5.0"
60
61
  Paperclip::Tasks::Attachments.definitions_for(self)
62
+ else
63
+ Paperclip::AttachmentRegistry.definitions_for(self)
61
64
  end
62
65
  end
63
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fileclip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Carleton
@@ -25,27 +25,13 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.3.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: sqlite3
28
+ name: rest-client
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - '>='
46
32
  - !ruby/object:Gem::Version
47
33
  version: '0'
48
- type: :development
34
+ type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
@@ -53,7 +39,7 @@ dependencies:
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
- name: rails
42
+ name: rspec
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - '>='
@@ -67,7 +53,7 @@ dependencies:
67
53
  - !ruby/object:Gem::Version
68
54
  version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: paperclip
56
+ name: sqlite3
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - '>='
@@ -81,7 +67,7 @@ dependencies:
81
67
  - !ruby/object:Gem::Version
82
68
  version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
- name: rest-client
70
+ name: rails
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - '>='