fileclip 0.2.2 → 0.2.3
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 +1 -1
- data/TODO.md +0 -8
- data/lib/fileclip.rb +10 -11
- data/lib/fileclip/engine.rb +4 -8
- data/lib/fileclip/railtie.rb +10 -5
- data/lib/fileclip/version.rb +1 -1
- data/spec/fileclip/railtie_spec.rb +1 -1
- metadata +1 -3
- data/spec/fileclip/engine_spec.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fa875e233d7b35eef0e879d87bfa59834b8c00d
|
4
|
+
data.tar.gz: ff60c7952f7a7e3647099d7afaf89cd7d9f32a3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e48638eb79dfcdfc0aec9cabb8ceb69994ce354426408f72d77389d3c813bf6318f76072d1f33f99b1eedfdbba522690d025884349e1e6bf68bd3c434b19e211
|
7
|
+
data.tar.gz: e2e0a1a28fd38252f03a15a5309900b19e337db40bbdbc7a2e906a59326607f9c0649df4cf1ca119f187c6200ffdf8dbfd2dc6e4f018136a455ec1ac4d3c2a17
|
data/Gemfile.lock
CHANGED
data/TODO.md
CHANGED
@@ -5,24 +5,16 @@ Backend:
|
|
5
5
|
* create generator for migration
|
6
6
|
* create generator for intializer
|
7
7
|
* Normalize filenames
|
8
|
-
* Change keys as an option. defaults to filepicker_url
|
9
8
|
|
10
9
|
Frontend:
|
11
|
-
* Allow overriding of filepicker options
|
12
|
-
* Fileclip link to automatically set fields and call it
|
13
|
-
* link should act like a normal link helper
|
14
|
-
* Minimal amount of JS
|
15
10
|
* Loader for filepicker js only if needed
|
16
11
|
* Eliminate need for jQuery
|
17
12
|
* make it a form builder function that can accept a different url name
|
18
13
|
|
19
14
|
Extra features:
|
20
|
-
* Work with Delayed Paperclip
|
21
|
-
* Work with Resque
|
22
15
|
* Work with DelayedJob
|
23
16
|
* Work with Sidekiq
|
24
17
|
* Fallback to filepicker url if paperclip url doesn't exist
|
25
18
|
* Filepicker converts to match paperclip styles
|
26
|
-
* Configure Filepicker options
|
27
19
|
* FilePicker droppane support
|
28
20
|
|
data/lib/fileclip.rb
CHANGED
@@ -7,26 +7,25 @@ require 'fileclip/jobs/resque'
|
|
7
7
|
require 'rest-client'
|
8
8
|
|
9
9
|
module FileClip
|
10
|
-
|
11
10
|
mattr_accessor :change_keys
|
12
11
|
|
13
|
-
|
14
|
-
@@change_keys ||= [:filepicker_url]
|
15
|
-
end
|
12
|
+
class << self
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
14
|
+
def process(klass, instance_id)
|
15
|
+
klass.constantize.find(instance_id).process_from_filepicker
|
16
|
+
end
|
21
17
|
|
22
|
-
|
18
|
+
# TODO: replace with checking for delayed options?
|
19
|
+
def delayed?
|
20
|
+
defined?(DelayedPaperclip)
|
21
|
+
end
|
23
22
|
|
24
23
|
def resque_enabled?
|
25
24
|
!!(defined? Resque)
|
26
25
|
end
|
27
26
|
|
28
|
-
def
|
29
|
-
|
27
|
+
def change_keys
|
28
|
+
@@change_keys ||= [:filepicker_url]
|
30
29
|
end
|
31
30
|
|
32
31
|
end
|
data/lib/fileclip/engine.rb
CHANGED
@@ -1,11 +1,7 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
# Necessary to load asset paths
|
1
4
|
module FileClip
|
2
|
-
|
3
|
-
class Engine < ::Rails::Engine
|
4
|
-
initializer 'fileclip.insert_into_active_record' do
|
5
|
-
::ActiveSupport.on_load :active_record do
|
6
|
-
FileClip::Railtie.insert
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
5
|
+
class Engine < ::Rails::Engine
|
10
6
|
end
|
11
7
|
end
|
data/lib/fileclip/railtie.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
# TODO: only include it in models that have paperclip attachments
|
4
|
+
# But will require restart of server for it to pick up the class on edit
|
1
5
|
module FileClip
|
2
|
-
class Railtie
|
3
|
-
|
4
|
-
|
5
|
-
# Will require restart of server for it to pick up the class on edit
|
6
|
-
def self.insert
|
6
|
+
class Railtie < ::Rails::Railtie
|
7
|
+
|
8
|
+
initializer "fileclip.model_methods" do
|
7
9
|
::ActiveRecord::Base.send(:include, FileClip::Glue)
|
10
|
+
end
|
11
|
+
|
12
|
+
initializer "fileclip.view_helpers" do
|
8
13
|
::ActionView::Base.send(:include, FileClip::ActionView::Helpers)
|
9
14
|
end
|
10
15
|
end
|
data/lib/fileclip/version.rb
CHANGED
@@ -5,7 +5,7 @@ describe FileClip::Railtie do
|
|
5
5
|
it "should include the glue" do
|
6
6
|
ActiveRecord::Base.should_receive(:send).with(:include, FileClip::Glue)
|
7
7
|
ActionView::Base.should_receive(:send).with(:include, FileClip::ActionView::Helpers)
|
8
|
-
FileClip::Railtie.
|
8
|
+
FileClip::Railtie.run_initializers
|
9
9
|
end
|
10
10
|
end
|
11
11
|
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.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Carleton
|
@@ -151,7 +151,6 @@ files:
|
|
151
151
|
- lib/fileclip/validators.rb
|
152
152
|
- lib/fileclip/version.rb
|
153
153
|
- spec/fileclip/configuration_spec.rb
|
154
|
-
- spec/fileclip/engine_spec.rb
|
155
154
|
- spec/fileclip/railtie_spec.rb
|
156
155
|
- spec/fileclip/validators_spec.rb
|
157
156
|
- spec/fileclip_spec.rb
|
@@ -184,7 +183,6 @@ specification_version: 4
|
|
184
183
|
summary: A FilePicker / PaperClip mashup.
|
185
184
|
test_files:
|
186
185
|
- spec/fileclip/configuration_spec.rb
|
187
|
-
- spec/fileclip/engine_spec.rb
|
188
186
|
- spec/fileclip/railtie_spec.rb
|
189
187
|
- spec/fileclip/validators_spec.rb
|
190
188
|
- spec/fileclip_spec.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'rails/initializable'
|
3
|
-
|
4
|
-
|
5
|
-
describe FileClip::Rails::Engine do
|
6
|
-
|
7
|
-
describe "include on initialzation" do
|
8
|
-
it "should insert fileclip and include view helpers on rails initialzation" do
|
9
|
-
pending
|
10
|
-
FileClip::Railtie.should_receive(:insert)
|
11
|
-
::ActionView::Base.should_receive(:send).with(:include, FileClip::ActionView::Helpers)
|
12
|
-
FileClip::Rails::Engine.run_initializers
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|