paperclip-dropbox 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +73 -25
- data/UPGRADING +7 -0
- data/lib/paperclip/dropbox/railtie.rb +9 -0
- data/lib/paperclip/dropbox/rake.rb +38 -0
- data/lib/paperclip/dropbox/tasks/authorize.rake +9 -0
- data/lib/paperclip/dropbox.rb +2 -0
- data/lib/paperclip/storage/dropbox.rb +58 -60
- data/lib/paperclip-dropbox.rb +2 -2
- data/paperclip-dropbox.gemspec +21 -8
- metadata +157 -14
- data/.gitignore +0 -17
- data/Gemfile +0 -3
- data/LICENSE +0 -22
- data/Rakefile +0 -2
- data/lib/paperclip/storage/dropbox/railtie.rb +0 -11
- data/lib/tasks/paperclip-dropbox.rake +0 -16
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Put it in your `Gemfile`:
|
|
10
10
|
gem "paperclip-dropbox"
|
11
11
|
```
|
12
12
|
|
13
|
-
|
13
|
+
Ano run `bundle install`.
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
@@ -20,66 +20,114 @@ Example:
|
|
20
20
|
class User < ActiveRecord::Base
|
21
21
|
has_attached_file :avatar,
|
22
22
|
:storage => :dropbox,
|
23
|
-
:
|
23
|
+
:dropbox_credentials => "#{Rails.root}/config/dropbox.yml",
|
24
|
+
:dropbox_options => {...}
|
24
25
|
end
|
25
26
|
```
|
26
27
|
|
27
28
|
Valid options for `#has_attached_file` are:
|
28
29
|
|
29
|
-
- `:
|
30
|
+
- `:dropbox_credentials` – A Hash, a File, or a path to the file where your
|
30
31
|
Dropbox configuration is located
|
31
32
|
|
32
|
-
- `:dropbox_options` –
|
33
|
-
|
34
|
-
that are specific for that certain attribute)
|
33
|
+
- `:dropbox_options` – A Hash that accepts some Dropbox-specific options (they
|
34
|
+
are explained more below)
|
35
35
|
|
36
36
|
## Configuration
|
37
37
|
|
38
|
-
|
38
|
+
### The `:dropbox_credentials` option
|
39
|
+
|
40
|
+
It's best to put your Dropbox credentials into a `dropbox.yml`, and pass the path to
|
41
|
+
that file to `:dropbox_credentials`. One example of that YAML file:
|
39
42
|
|
40
43
|
```erb
|
41
44
|
app_key: <%= ENV["DROPBOX_APP_KEY"] %>
|
42
45
|
app_secret: <%= ENV["DROPBOX_APP_SECRET"] %>
|
43
46
|
access_token: <%= ENV["DROPBOX_ACCESS_TOKEN"] %>
|
44
47
|
access_token_secret: <%= ENV["DROPBOX_ACCESS_TOKEN_SECRET"] %>
|
48
|
+
user_id: <%= ENV["DROPBOX_USER_ID"] %>
|
45
49
|
```
|
46
50
|
|
47
|
-
|
51
|
+
This is a good practice; I didn't put my credentials directly in the YAML file, but I first
|
52
|
+
set them in my system's environment variables, and then embedded them here through ERB.
|
53
|
+
|
54
|
+
Note that all credentials mentioned here are required.
|
55
|
+
|
56
|
+
- If you don't have your app key and secret yet, go to your
|
57
|
+
[Dropbox apps](https://www.dropbox.com/developers/apps), and create a new app there, which
|
58
|
+
will then provide you the app key and secret. Note that your app has to have the
|
59
|
+
**Full Dropbox** access level (not the "App folder"). This is because the uploaded files
|
60
|
+
have to be stored in your `Public` directory, otherwise accessing their URLs
|
61
|
+
would be too slow.
|
62
|
+
|
63
|
+
- If you already have your app key and secret, you can obtain the rest of
|
64
|
+
the credentials through the `dropbox:authorize` rake task, which is described in
|
65
|
+
more detail at the bottom of the page.
|
66
|
+
|
67
|
+
You can also namespace your credentials in `development`, `testing` and `production` environments
|
48
68
|
(just like you do in your `database.yml`).
|
49
69
|
|
50
|
-
|
70
|
+
### The `:dropbox_options` option
|
51
71
|
|
52
|
-
|
53
|
-
- `:path` – Similar to Paperclip's `:path` option (defaults to `"<filename>"`)
|
54
|
-
- `:environment` – Here you can set your environment if you're in a non-Rails application
|
72
|
+
You can pass it 3 options:
|
55
73
|
|
56
|
-
|
74
|
+
- `:path` – A block, provides similar results as Paperclip's `:path` option
|
75
|
+
- `:environment` – If you namespaced you credentials with environments, here you
|
76
|
+
can set your environment if you're in a non-Rails application
|
77
|
+
- `:unique_filename` – Boolean
|
57
78
|
|
58
|
-
|
59
|
-
|
79
|
+
The `:path` option works in this way; you give it a block, and the return value
|
80
|
+
will be the path that the uploaded file will be saved to. The block yields the style (if any),
|
81
|
+
and is executed in the scope of the class' instance. For example, let's say you have
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
class User < ActiveRecord::Base
|
85
|
+
has_attached_file :avatar,
|
86
|
+
:storage => :dropbox,
|
87
|
+
:dropbox_credentials => "...",
|
88
|
+
:dropbox_options => {
|
89
|
+
:path => proc { |style| "#{style}/#{id}_#{avatar.original_filename}"}
|
90
|
+
},
|
91
|
+
:styles => { :medium => "300x300" }
|
92
|
+
end
|
93
|
+
```
|
94
|
+
|
95
|
+
Let's say now that a user is saved in the database, with a `photo.jpg` as his
|
96
|
+
avatar. The path where that files were saved could look something like this:
|
60
97
|
|
61
98
|
```
|
62
|
-
|
99
|
+
Public/original/23_photo.jpg
|
100
|
+
Public/medium/23_photo_medium.jpg
|
63
101
|
```
|
64
102
|
|
65
|
-
The
|
66
|
-
|
67
|
-
just prefix them with `record_` (like the `<record_id>` above).
|
103
|
+
The other file is called `photo_medium.jpg` because style names (other than `original`)
|
104
|
+
will always be appended to the filenames.
|
68
105
|
|
69
|
-
Files in Dropbox inside a certain folder have to have unique filenames
|
106
|
+
Files in Dropbox inside a certain folder have to have **unique filenames**, otherwise exception
|
70
107
|
`Paperclip::Storage::Dropbox::FileExists` is thrown. To help you with that, you
|
71
|
-
can pass in `:unique_filename => true` to
|
72
|
-
|
108
|
+
can pass in `:unique_filename => true` to `:dropbox_options`, and that will set
|
109
|
+
`:path` to something that will be unique.
|
73
110
|
|
74
|
-
###
|
111
|
+
### The `dropbox:authorize` rake task
|
75
112
|
|
76
|
-
|
113
|
+
You just provide it your app key and secret:
|
77
114
|
|
78
115
|
```
|
79
116
|
$ rake dropbox:authorize APP_KEY=your_app_key APP_SECRET=your_app_secret
|
80
117
|
```
|
81
118
|
|
82
|
-
|
119
|
+
It will provide you an authorization URL which you have to visit, and after that
|
120
|
+
it will output the rest of your credentials, which you just copy-paste wherever
|
121
|
+
you need to.
|
122
|
+
|
123
|
+
If you're in a non-Rails application, to get this task, you must require it in
|
124
|
+
your `Rakefile`:
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
# Rakefile
|
128
|
+
require "rake"
|
129
|
+
require "paperclip/dropbox/rake"
|
130
|
+
```
|
83
131
|
|
84
132
|
## License
|
85
133
|
|
data/UPGRADING
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
########################################
|
2
|
+
# NOTE FOR UPGRADING FROM 0.x VERSIONS #
|
3
|
+
########################################
|
4
|
+
|
5
|
+
paperclip-dropbox 1.0 is a rewrite of 0.x versions,
|
6
|
+
and it introduces a lot of non-backwards compatible changes.
|
7
|
+
It is suggested that you read the Readme again.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "dropbox_sdk"
|
2
|
+
|
3
|
+
module Paperclip
|
4
|
+
module Dropbox
|
5
|
+
module Rake
|
6
|
+
extend self
|
7
|
+
|
8
|
+
def authorize(app_key, app_secret)
|
9
|
+
session = create_new_session(app_key, app_secret)
|
10
|
+
puts "Visit this URL: #{session.get_authorize_url}"
|
11
|
+
print "And after you approved the authorization confirm it here (y/n): "
|
12
|
+
assert_answer!
|
13
|
+
session.get_access_token
|
14
|
+
dropbox_client = DropboxClient.new(session, "dropbox")
|
15
|
+
account_info = dropbox_client.account_info
|
16
|
+
|
17
|
+
puts <<-MESSAGE
|
18
|
+
Authorization was successful. Here you go:
|
19
|
+
|
20
|
+
access_token: #{session.access_token.key}
|
21
|
+
access_token_secret: #{session.access_token.secret}
|
22
|
+
user_id: #{account_info["uid"]}
|
23
|
+
MESSAGE
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_new_session(app_key, app_secret)
|
27
|
+
DropboxSession.new(app_key, app_secret)
|
28
|
+
end
|
29
|
+
|
30
|
+
def assert_answer!
|
31
|
+
answer = STDIN.gets.strip
|
32
|
+
exit if answer == "n"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
load "paperclip/dropbox/tasks/authorize.rake"
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'dropbox_sdk'
|
2
2
|
require 'active_support/core_ext/hash/keys'
|
3
|
+
require 'active_support/core_ext/hash/slice'
|
3
4
|
require 'active_support/inflector/methods'
|
4
5
|
require 'yaml'
|
5
6
|
require 'erb'
|
@@ -7,43 +8,24 @@ require 'erb'
|
|
7
8
|
module Paperclip
|
8
9
|
module Storage
|
9
10
|
module Dropbox
|
10
|
-
attr_reader :dropbox_client
|
11
|
-
|
12
11
|
def self.extended(base)
|
13
12
|
base.instance_eval do
|
14
|
-
@
|
15
|
-
@
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
@dropbox_client = DropboxClient.new(session, @dropbox_settings[:access_type] || :app_folder)
|
21
|
-
|
22
|
-
@dropbox_keywords = Hash.new do |hash, key|
|
23
|
-
if key =~ /^\<record_.+\>$/
|
24
|
-
attribute = key.match(/^\<record_(.+)\>$/)[1]
|
25
|
-
hash[key] = lambda { |style| instance.send(attribute) }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
@dropbox_keywords.update(
|
29
|
-
"<model_name>" => lambda { |style| instance.class.table_name.singularize },
|
30
|
-
"<table_name>" => lambda { |style| instance.class.table_name },
|
31
|
-
"<filename>" => lambda { |style| original_filename.match(/\.\w{3,4}$/).pre_match },
|
32
|
-
"<attachment_name>" => lambda { |style| name },
|
33
|
-
"<style>" => lambda { |style| style }
|
34
|
-
)
|
13
|
+
@dropbox_credentials = parse_credentials(@options[:dropbox_credentials] || {})
|
14
|
+
@dropbox_options = @options[:dropbox_options] || {}
|
15
|
+
environment = defined?(Rails) ? Rails.env : @dropbox_options[:environment].to_s
|
16
|
+
@dropbox_credentials = (@dropbox_credentials[environment] || @dropbox_credentials).symbolize_keys
|
17
|
+
dropbox_client # Force validations of credentials
|
35
18
|
end
|
36
19
|
end
|
37
20
|
|
38
21
|
def flush_writes
|
39
22
|
@queued_for_write.each do |style, file|
|
40
23
|
unless exists?(style)
|
41
|
-
|
24
|
+
dropbox_client.put_file(path(style), file.read)
|
42
25
|
else
|
43
|
-
raise FileExists, "\"#{path(style)}\" already exists on Dropbox"
|
26
|
+
raise FileExists, "file \"#{path(style)}\" already exists on Dropbox"
|
44
27
|
end
|
45
28
|
end
|
46
|
-
|
47
29
|
after_flush_writes
|
48
30
|
@queued_for_write = {}
|
49
31
|
end
|
@@ -56,7 +38,9 @@ module Paperclip
|
|
56
38
|
end
|
57
39
|
|
58
40
|
def exists?(style)
|
59
|
-
!!
|
41
|
+
!!dropbox_client.media(path(style))
|
42
|
+
rescue DropboxError
|
43
|
+
false
|
60
44
|
end
|
61
45
|
|
62
46
|
def url(*args)
|
@@ -64,23 +48,18 @@ module Paperclip
|
|
64
48
|
options = args.last.is_a?(Hash) ? args.last : {}
|
65
49
|
query = options[:download] ? "?dl=1" : ""
|
66
50
|
|
67
|
-
|
68
|
-
|
69
|
-
rescue DropboxError
|
70
|
-
nil
|
51
|
+
File.join("http://dl.dropbox.com/u/#{user_id}", path_for_url(style) + query)
|
71
52
|
end
|
72
53
|
|
73
54
|
def path(style)
|
74
|
-
|
75
|
-
|
76
|
-
file_path.scan(/\<\w+\>/).each do |keyword|
|
77
|
-
result.sub!(keyword, @dropbox_keywords[keyword].call(style).to_s)
|
78
|
-
end
|
79
|
-
style_suffix = style != default_style ? "_#{style}" : ""
|
80
|
-
result = "#{result}#{style_suffix}#{extension}"
|
55
|
+
File.join("Public", path_for_url(style))
|
56
|
+
end
|
81
57
|
|
82
|
-
|
83
|
-
|
58
|
+
def path_for_url(style)
|
59
|
+
result = instance.instance_exec(style, &file_path)
|
60
|
+
result += extension if result !~ /\.\w{3,4}$/
|
61
|
+
style_suffix = (style != default_style ? "_#{style}" : "")
|
62
|
+
result.sub(extension, "#{style_suffix}#{extension}")
|
84
63
|
end
|
85
64
|
|
86
65
|
def copy_to_local_file(style, destination_path)
|
@@ -91,37 +70,56 @@ module Paperclip
|
|
91
70
|
|
92
71
|
private
|
93
72
|
|
73
|
+
def extension
|
74
|
+
original_filename[/\.\w{3,4}$/]
|
75
|
+
end
|
76
|
+
|
77
|
+
def user_id
|
78
|
+
@dropbox_credentials[:user_id]
|
79
|
+
end
|
80
|
+
|
94
81
|
def file_path
|
95
|
-
return @
|
82
|
+
return @dropbox_options[:path] if @dropbox_options[:path]
|
96
83
|
|
97
|
-
if @
|
98
|
-
"
|
84
|
+
if @dropbox_options[:unique_filename]
|
85
|
+
eval %(proc { |style| "\#{self.class.model_name.underscore}_\#{id}_\#{#{name}.name}" })
|
99
86
|
else
|
100
|
-
|
87
|
+
eval %(proc { |style| #{name}.original_filename })
|
101
88
|
end
|
102
89
|
end
|
103
90
|
|
104
|
-
def
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
91
|
+
def dropbox_client
|
92
|
+
@dropbox_client ||= begin
|
93
|
+
assert_required_keys
|
94
|
+
session = DropboxSession.new(@dropbox_credentials[:app_key], @dropbox_credentials[:app_secret])
|
95
|
+
session.set_access_token(@dropbox_credentials[:access_token], @dropbox_credentials[:access_token_secret])
|
96
|
+
DropboxClient.new(session, "dropbox")
|
97
|
+
end
|
109
98
|
end
|
110
99
|
|
111
|
-
def
|
112
|
-
|
113
|
-
|
114
|
-
YAML.load(ERB.new(File.read(settings.path)).result)
|
115
|
-
when String, Pathname
|
116
|
-
YAML.load(ERB.new(File.read(settings)).result)
|
117
|
-
when Hash
|
118
|
-
settings
|
119
|
-
else
|
120
|
-
raise ArgumentError, "settings are not a path, file, or hash."
|
100
|
+
def assert_required_keys
|
101
|
+
[:app_key, :app_secret, :access_token, :access_token_secret, :user_id].each do |key|
|
102
|
+
@dropbox_credentials.fetch(key)
|
121
103
|
end
|
122
104
|
end
|
123
105
|
|
124
|
-
|
106
|
+
def parse_credentials(credentials)
|
107
|
+
result =
|
108
|
+
case credentials
|
109
|
+
when File
|
110
|
+
YAML.load(ERB.new(File.read(credentials.path)).result)
|
111
|
+
when String, Pathname
|
112
|
+
YAML.load(ERB.new(File.read(credentials)).result)
|
113
|
+
when Hash
|
114
|
+
credentials
|
115
|
+
else
|
116
|
+
raise ArgumentError, ":dropbox_credentials are not a path, file, nor a hash"
|
117
|
+
end
|
118
|
+
|
119
|
+
result.stringify_keys
|
120
|
+
end
|
121
|
+
|
122
|
+
class FileExists < ArgumentError
|
125
123
|
end
|
126
124
|
end
|
127
125
|
end
|
data/lib/paperclip-dropbox.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require "paperclip
|
2
|
-
require "paperclip/
|
1
|
+
require "paperclip"
|
2
|
+
require "paperclip/dropbox"
|
data/paperclip-dropbox.gemspec
CHANGED
@@ -2,18 +2,31 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "paperclip-dropbox"
|
5
|
-
gem.version = "0.0
|
5
|
+
gem.version = "1.0.0"
|
6
|
+
gem.platform = Gem::Platform::RUBY
|
6
7
|
|
7
|
-
gem.
|
8
|
-
gem.email = ["janko.marohnic@gmail.com"]
|
8
|
+
gem.homepage = "https://github.com/janko-m/paperclip-dropbox"
|
9
9
|
gem.description = %q{Extends Paperclip with Dropbox storage.}
|
10
10
|
gem.summary = gem.description
|
11
|
-
gem.
|
11
|
+
gem.authors = ["Janko Marohnić"]
|
12
|
+
gem.email = ["janko.marohnic@gmail.com"]
|
13
|
+
|
14
|
+
gem.files = Dir["lib/**/*"] + ["README.md", "UPGRADING", "paperclip-dropbox.gemspec"]
|
15
|
+
gem.require_path = "lib"
|
12
16
|
|
13
|
-
gem.
|
14
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
15
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
16
|
-
gem.require_paths = ["lib"]
|
17
|
+
gem.required_ruby_version = ">= 1.9.2"
|
17
18
|
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.post_install_message = File.read("UPGRADING")
|
21
|
+
|
22
|
+
gem.add_dependency "paperclip", "~> 3.1"
|
18
23
|
gem.add_dependency "dropbox-sdk", "~> 1.3"
|
24
|
+
|
25
|
+
gem.add_development_dependency "rake", "~> 0.9"
|
26
|
+
gem.add_development_dependency "rspec", "~> 2.11"
|
27
|
+
gem.add_development_dependency "vcr", "~> 2.2"
|
28
|
+
gem.add_development_dependency "fakeweb", "~> 1.3"
|
29
|
+
gem.add_development_dependency "activerecord", "~> 3.2"
|
30
|
+
gem.add_development_dependency "rack-test", "~> 0.6"
|
31
|
+
gem.add_development_dependency "sqlite3", "~> 1.3"
|
19
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip-dropbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: paperclip
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.1'
|
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: '3.1'
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: dropbox-sdk
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -27,6 +43,118 @@ dependencies:
|
|
27
43
|
- - ~>
|
28
44
|
- !ruby/object:Gem::Version
|
29
45
|
version: '1.3'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.9'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.9'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.11'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.11'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: vcr
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '2.2'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '2.2'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: fakeweb
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '1.3'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '1.3'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: activerecord
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.2'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '3.2'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rack-test
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ~>
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0.6'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0.6'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: sqlite3
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ~>
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '1.3'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ~>
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '1.3'
|
30
158
|
description: Extends Paperclip with Dropbox storage.
|
31
159
|
email:
|
32
160
|
- janko.marohnic@gmail.com
|
@@ -34,19 +162,32 @@ executables: []
|
|
34
162
|
extensions: []
|
35
163
|
extra_rdoc_files: []
|
36
164
|
files:
|
37
|
-
- .
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
- Rakefile
|
42
|
-
- lib/paperclip-dropbox.rb
|
165
|
+
- lib/paperclip/dropbox/railtie.rb
|
166
|
+
- lib/paperclip/dropbox/rake.rb
|
167
|
+
- lib/paperclip/dropbox/tasks/authorize.rake
|
168
|
+
- lib/paperclip/dropbox.rb
|
43
169
|
- lib/paperclip/storage/dropbox.rb
|
44
|
-
- lib/paperclip
|
45
|
-
-
|
170
|
+
- lib/paperclip-dropbox.rb
|
171
|
+
- README.md
|
172
|
+
- UPGRADING
|
46
173
|
- paperclip-dropbox.gemspec
|
47
174
|
homepage: https://github.com/janko-m/paperclip-dropbox
|
48
|
-
licenses:
|
49
|
-
|
175
|
+
licenses:
|
176
|
+
- MIT
|
177
|
+
post_install_message: ! '########################################
|
178
|
+
|
179
|
+
# NOTE FOR UPGRADING FROM 0.x VERSIONS #
|
180
|
+
|
181
|
+
########################################
|
182
|
+
|
183
|
+
|
184
|
+
paperclip-dropbox 1.0 is a rewrite of 0.x versions,
|
185
|
+
|
186
|
+
and it introduces a lot of non-backwards compatible changes.
|
187
|
+
|
188
|
+
It is suggested that you read the Readme again.
|
189
|
+
|
190
|
+
'
|
50
191
|
rdoc_options: []
|
51
192
|
require_paths:
|
52
193
|
- lib
|
@@ -55,13 +196,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
55
196
|
requirements:
|
56
197
|
- - ! '>='
|
57
198
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
199
|
+
version: 1.9.2
|
59
200
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
201
|
none: false
|
61
202
|
requirements:
|
62
203
|
- - ! '>='
|
63
204
|
- !ruby/object:Gem::Version
|
64
205
|
version: '0'
|
206
|
+
segments:
|
207
|
+
- 0
|
208
|
+
hash: -407876590355858584
|
65
209
|
requirements: []
|
66
210
|
rubyforge_project:
|
67
211
|
rubygems_version: 1.8.23
|
@@ -69,4 +213,3 @@ signing_key:
|
|
69
213
|
specification_version: 3
|
70
214
|
summary: Extends Paperclip with Dropbox storage.
|
71
215
|
test_files: []
|
72
|
-
has_rdoc:
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2012 Janko Marohnić
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'dropbox_sdk'
|
3
|
-
|
4
|
-
namespace :dropbox do
|
5
|
-
desc "Obtain your access token"
|
6
|
-
task :authorize do
|
7
|
-
session = DropboxSession.new(ENV["APP_KEY"], ENV["APP_SECRET"])
|
8
|
-
puts "Visit this URL: #{session.get_authorize_url}"
|
9
|
-
print "And after you approved the authorization confirm it here (y/n): "
|
10
|
-
answer = STDIN.gets.strip
|
11
|
-
exit if answer == "n"
|
12
|
-
session.get_access_token
|
13
|
-
puts "Access token: #{session.access_token.key}"
|
14
|
-
puts "Access token secret: #{session.access_token.secret}"
|
15
|
-
end
|
16
|
-
end
|