hobo_paperclip 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.
- data/.gitignore +7 -0
- data/.project +18 -0
- data/MIT-LICENSE +20 -0
- data/README.markdown +60 -0
- data/hobo_paperclip.gemspec +0 -0
- data/lib/hobo_paperclip/init.rb +21 -0
- data/lib/hobo_paperclip/railtie.rb +7 -0
- data/lib/hobo_paperclip/version.rb +3 -0
- data/lib/hobo_paperclip.rb +15 -0
- data/taglibs/hobo_paperclip.dryml +3 -0
- metadata +87 -0
data/.gitignore
ADDED
data/.project
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<projectDescription>
|
|
3
|
+
<name>hobo_paperclip</name>
|
|
4
|
+
<comment></comment>
|
|
5
|
+
<projects>
|
|
6
|
+
</projects>
|
|
7
|
+
<buildSpec>
|
|
8
|
+
<buildCommand>
|
|
9
|
+
<name>com.aptana.ide.core.unifiedBuilder</name>
|
|
10
|
+
<arguments>
|
|
11
|
+
</arguments>
|
|
12
|
+
</buildCommand>
|
|
13
|
+
</buildSpec>
|
|
14
|
+
<natures>
|
|
15
|
+
<nature>org.radrails.rails.core.railsnature</nature>
|
|
16
|
+
<nature>com.aptana.ruby.core.rubynature</nature>
|
|
17
|
+
</natures>
|
|
18
|
+
</projectDescription>
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2012 YOURNAME
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
This is a plugin for [Hobo](http://hobocentral.net).
|
|
2
|
+
This is a direct port of paperclip_with_hobo plugin to a GEM.
|
|
3
|
+
|
|
4
|
+
Install this plugin alongside [paperclip]
|
|
5
|
+
|
|
6
|
+
It adds two small things:
|
|
7
|
+
|
|
8
|
+
- Automatically declares the fields for you, so you can just add
|
|
9
|
+
|
|
10
|
+
has_attached_file :photo
|
|
11
|
+
|
|
12
|
+
to your model, and then run the migration generator. All options
|
|
13
|
+
are automatically passed on to paperclip's `has_attached_file`.
|
|
14
|
+
|
|
15
|
+
- Declares an input field
|
|
16
|
+
|
|
17
|
+
<def tag="input" for="Paperclip::Attachment">
|
|
18
|
+
<%= file_field_tag param_name_for_this, attributes %>
|
|
19
|
+
</def>
|
|
20
|
+
|
|
21
|
+
(to get this, you need `<include src="paperclip" plugin="paperclip_with_hobo"/>` in application.dryml)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Installation
|
|
25
|
+
|
|
26
|
+
Paperclip is required so add it to your gemfile if you don't have it alread
|
|
27
|
+
|
|
28
|
+
gem 'paperclip'
|
|
29
|
+
|
|
30
|
+
Add hobo_paperclip to your gemfile
|
|
31
|
+
|
|
32
|
+
gem 'hobo_paperclip', :git => "git://github.com/bsleys/hobo_paperclip.git", :branch => "master"
|
|
33
|
+
|
|
34
|
+
Update your bundle:
|
|
35
|
+
|
|
36
|
+
bundle install
|
|
37
|
+
|
|
38
|
+
Include the hobo_paperclip taglib in front_site.dryml
|
|
39
|
+
|
|
40
|
+
<include gem='hobo_paperclip'/>
|
|
41
|
+
|
|
42
|
+
Add paperclip to one of your models:
|
|
43
|
+
|
|
44
|
+
has_attached_file :photo
|
|
45
|
+
|
|
46
|
+
Your default form for the model will now include the four attributes
|
|
47
|
+
added by `has_attached_file`. To actually allow uploading, you will
|
|
48
|
+
need to manually add the attachment field (`photo` in the above example)
|
|
49
|
+
to your form, and don't forget to add the `multipart` attribute:
|
|
50
|
+
|
|
51
|
+
<extend tag="form" for="MyModel">
|
|
52
|
+
<old-form merge multipart>
|
|
53
|
+
<field-list: fields="photo, other-fields, ..."/>
|
|
54
|
+
</old-form>
|
|
55
|
+
</extend>
|
|
56
|
+
|
|
57
|
+
### License
|
|
58
|
+
|
|
59
|
+
See MIT-LICENSE
|
|
60
|
+
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module ::Paperclip
|
|
2
|
+
|
|
3
|
+
module ClassMethods
|
|
4
|
+
|
|
5
|
+
def has_attached_file_with_hobo(name, *args, &b)
|
|
6
|
+
has_attached_file_without_hobo(name, *args, &b)
|
|
7
|
+
|
|
8
|
+
fields do |f|
|
|
9
|
+
f.field "#{name}_file_name", :string
|
|
10
|
+
f.field "#{name}_content_type", :string
|
|
11
|
+
f.field "#{name}_file_size", :integer
|
|
12
|
+
f.field "#{name}_updated_at", :datetime
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
declare_attr_type name, ::Paperclip::Attachment
|
|
16
|
+
end
|
|
17
|
+
alias_method_chain :has_attached_file, :hobo
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module HoboPaperclip
|
|
2
|
+
|
|
3
|
+
@@root = Pathname.new File.expand_path('../..', __FILE__)
|
|
4
|
+
def self.root; @@root; end
|
|
5
|
+
|
|
6
|
+
EDIT_LINK_BASE = 'https://github.com/bsleys/hobo_paperclip/edit/master'
|
|
7
|
+
|
|
8
|
+
if defined?(Rails)
|
|
9
|
+
require 'hobo_paperclip/railtie'
|
|
10
|
+
require 'hobo_paperclip/init'
|
|
11
|
+
|
|
12
|
+
class Engine < ::Rails::Engine
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: hobo_paperclip
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.2
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Bob Sleys
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-11-09 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: hobo
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ! '>='
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ! '>='
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '0'
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: paperclip
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - ! '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
type: :runtime
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ! '>='
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
description: Add paperclip support to Hobo.
|
|
47
|
+
email:
|
|
48
|
+
- bsleys@gmail.com
|
|
49
|
+
executables: []
|
|
50
|
+
extensions: []
|
|
51
|
+
extra_rdoc_files: []
|
|
52
|
+
files:
|
|
53
|
+
- .gitignore
|
|
54
|
+
- .project
|
|
55
|
+
- MIT-LICENSE
|
|
56
|
+
- README.markdown
|
|
57
|
+
- hobo_paperclip.gemspec
|
|
58
|
+
- lib/hobo_paperclip.rb
|
|
59
|
+
- lib/hobo_paperclip/init.rb
|
|
60
|
+
- lib/hobo_paperclip/railtie.rb
|
|
61
|
+
- lib/hobo_paperclip/version.rb
|
|
62
|
+
- taglibs/hobo_paperclip.dryml
|
|
63
|
+
homepage: https://github.com/bsleys/hobo_paperclip
|
|
64
|
+
licenses: []
|
|
65
|
+
post_install_message:
|
|
66
|
+
rdoc_options: []
|
|
67
|
+
require_paths:
|
|
68
|
+
- lib
|
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
|
+
none: false
|
|
71
|
+
requirements:
|
|
72
|
+
- - ! '>='
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
|
+
none: false
|
|
77
|
+
requirements:
|
|
78
|
+
- - ! '>='
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: '0'
|
|
81
|
+
requirements: []
|
|
82
|
+
rubyforge_project:
|
|
83
|
+
rubygems_version: 1.8.24
|
|
84
|
+
signing_key:
|
|
85
|
+
specification_version: 3
|
|
86
|
+
summary: Add paperclip support to Hobo.
|
|
87
|
+
test_files: []
|