carrierwave-dropbox 1.2.1 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.credentials.yml +1 -0
  3. data/.travis.yml +19 -0
  4. data/CHANGELOG.md +14 -0
  5. data/README.md +38 -28
  6. data/Rakefile +23 -3
  7. data/carrierwave-dropbox.gemspec +8 -10
  8. data/lib/carrierwave/dropbox.rb +0 -6
  9. data/lib/carrierwave/dropbox/version.rb +1 -1
  10. data/lib/carrierwave/storage/dropbox.rb +23 -21
  11. data/test/carrierwave_uploader_base_test.rb +17 -0
  12. data/test/dummy_app.rb +43 -0
  13. data/test/file_upload_test.rb +29 -0
  14. data/{spec → test}/fixtures/rails.png +0 -0
  15. data/{spec → test}/fixtures/ruby.png +0 -0
  16. data/test/test_helper.rb +30 -0
  17. metadata +43 -173
  18. data/.rspec +0 -1
  19. data/lib/carrierwave/dropbox/authorize.rake +0 -13
  20. data/lib/carrierwave/dropbox/railtie.rb +0 -9
  21. data/lib/carrierwave/dropbox/rake.rb +0 -41
  22. data/spec/carrierwave-uploader-base_spec.rb +0 -18
  23. data/spec/dummy/.gitignore +0 -16
  24. data/spec/dummy/Gemfile +0 -10
  25. data/spec/dummy/Rakefile +0 -6
  26. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  27. data/spec/dummy/app/controllers/articles_controller.rb +0 -58
  28. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  29. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  30. data/spec/dummy/app/helpers/articles_helper.rb +0 -2
  31. data/spec/dummy/app/mailers/.keep +0 -0
  32. data/spec/dummy/app/models/.keep +0 -0
  33. data/spec/dummy/app/models/article.rb +0 -3
  34. data/spec/dummy/app/models/concerns/.keep +0 -0
  35. data/spec/dummy/app/uploaders/image_uploader.rb +0 -19
  36. data/spec/dummy/app/views/articles/_form.html.erb +0 -29
  37. data/spec/dummy/app/views/articles/edit.html.erb +0 -6
  38. data/spec/dummy/app/views/articles/index.html.erb +0 -31
  39. data/spec/dummy/app/views/articles/new.html.erb +0 -5
  40. data/spec/dummy/app/views/articles/show.html.erb +0 -1
  41. data/spec/dummy/app/views/layouts/application.html.erb +0 -12
  42. data/spec/dummy/bin/bundle +0 -3
  43. data/spec/dummy/bin/rails +0 -4
  44. data/spec/dummy/bin/rake +0 -4
  45. data/spec/dummy/config.ru +0 -4
  46. data/spec/dummy/config/application.rb +0 -23
  47. data/spec/dummy/config/boot.rb +0 -4
  48. data/spec/dummy/config/database.yml +0 -25
  49. data/spec/dummy/config/environment.rb +0 -5
  50. data/spec/dummy/config/environments/development.rb +0 -29
  51. data/spec/dummy/config/environments/production.rb +0 -80
  52. data/spec/dummy/config/environments/test.rb +0 -36
  53. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  54. data/spec/dummy/config/initializers/carrierwave.rb +0 -8
  55. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  56. data/spec/dummy/config/initializers/inflections.rb +0 -16
  57. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  58. data/spec/dummy/config/initializers/secret_token.rb +0 -12
  59. data/spec/dummy/config/initializers/session_store.rb +0 -3
  60. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  61. data/spec/dummy/config/locales/en.yml +0 -23
  62. data/spec/dummy/config/routes.rb +0 -58
  63. data/spec/dummy/db/migrate/20140224111953_create_articles.rb +0 -11
  64. data/spec/dummy/db/schema.rb +0 -24
  65. data/spec/dummy/db/seeds.rb +0 -7
  66. data/spec/dummy/public/404.html +0 -58
  67. data/spec/dummy/public/422.html +0 -58
  68. data/spec/dummy/public/500.html +0 -57
  69. data/spec/dummy/public/favicon.ico +0 -0
  70. data/spec/dummy/public/robots.txt +0 -5
  71. data/spec/features/upload_file_spec.rb +0 -46
  72. data/spec/spec_helper.rb +0 -16
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
@@ -1,13 +0,0 @@
1
- require "carrierwave/dropbox/rake"
2
-
3
- namespace :dropbox do
4
- desc "Obtains your Dropbox credentials"
5
- task :authorize do
6
- if ENV["APP_KEY"].nil? or ENV["APP_SECRET"].nil?
7
- puts "USAGE: `rake dropbox:authorize APP_KEY=your_app_key APP_SECRET=your_app_secret` ACCESS_TYPE=your_access_type"
8
- exit
9
- end
10
-
11
- CarrierWave::Dropbox::Rake.authorize(ENV["APP_KEY"], ENV["APP_SECRET"], ENV["ACCESS_TYPE"] || "dropbox")
12
- end
13
- end
@@ -1,9 +0,0 @@
1
- module CarrierWave
2
- module Dropbox
3
- class Railtie < Rails::Railtie
4
- rake_tasks do
5
- load "carrierwave/dropbox/authorize.rake"
6
- end
7
- end
8
- end
9
- end
@@ -1,41 +0,0 @@
1
- require "dropbox_sdk"
2
-
3
- # This code is directly extracted from this repository:
4
- # https://github.com/janko-m/paperclip-dropbox
5
- module CarrierWave
6
- module Dropbox
7
- module Rake
8
- extend self
9
-
10
- def authorize(app_key, app_secret, access_type)
11
- session = create_new_session(app_key, app_secret)
12
-
13
- puts "Visit this URL: #{session.get_authorize_url}"
14
- print "And after you approved the authorization confirm it here (y/n): "
15
-
16
- assert_answer!
17
- session.get_access_token
18
- dropbox_client = DropboxClient.new(session, access_type)
19
- account_info = dropbox_client.account_info
20
-
21
- puts <<-MESSAGE
22
-
23
- Authorization was successful. Here you go:
24
-
25
- access_token: #{session.access_token.key}
26
- access_token_secret: #{session.access_token.secret}
27
- user_id: #{account_info["uid"]}
28
- MESSAGE
29
- end
30
-
31
- def create_new_session(app_key, app_secret)
32
- DropboxSession.new(app_key, app_secret)
33
- end
34
-
35
- def assert_answer!
36
- answer = STDIN.gets.strip
37
- exit if answer == "n"
38
- end
39
- end
40
- end
41
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CarrierWave::Uploader::Base do
4
- it "has the dropbox storage" do
5
- described_class.configure do |c|
6
- c.storage_engines.should have_key(:dropbox)
7
- end
8
- end
9
-
10
- it "should respond to the different configuration methods" do
11
- described_class.should respond_to(:dropbox_app_key)
12
- described_class.should respond_to(:dropbox_app_secret)
13
- described_class.should respond_to(:dropbox_access_token)
14
- described_class.should respond_to(:dropbox_access_token_secret)
15
- described_class.should respond_to(:dropbox_user_id)
16
- described_class.should respond_to(:dropbox_access_type)
17
- end
18
- end
@@ -1,16 +0,0 @@
1
- # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
- #
3
- # If you find yourself ignoring temporary files generated by your text editor
4
- # or operating system, you probably want to add a global ignore instead:
5
- # git config --global core.excludesfile '~/.gitignore_global'
6
-
7
- # Ignore bundler config.
8
- /.bundle
9
-
10
- # Ignore the default SQLite database.
11
- /db/*.sqlite3
12
- /db/*.sqlite3-journal
13
-
14
- # Ignore all logfiles and tempfiles.
15
- /log/*.log
16
- /tmp
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org/'
2
-
3
- gem 'rails', '4.0.3'
4
-
5
- gem 'sqlite3'
6
-
7
- gem 'carrierwave', '~> 0.9'
8
- gem 'carrierwave-dropbox', path: "../../"
9
- gem 'mini_magick'
10
-
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Dummy::Application.load_tasks
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
@@ -1,58 +0,0 @@
1
- class ArticlesController < ApplicationController
2
- before_action :set_article, only: [:show, :edit, :update, :destroy]
3
-
4
- # GET /articles
5
- def index
6
- @articles = Article.all
7
- end
8
-
9
- # GET /articles/1
10
- def show
11
- end
12
-
13
- # GET /articles/new
14
- def new
15
- @article = Article.new
16
- end
17
-
18
- # GET /articles/1/edit
19
- def edit
20
- end
21
-
22
- # POST /articles
23
- def create
24
- @article = Article.new(article_params)
25
-
26
- if @article.save
27
- redirect_to @article, notice: 'Article was successfully created.'
28
- else
29
- render action: 'new'
30
- end
31
- end
32
-
33
- # PATCH/PUT /articles/1
34
- def update
35
- if @article.update(article_params)
36
- redirect_to @article, notice: 'Article was successfully updated.'
37
- else
38
- render action: 'edit'
39
- end
40
- end
41
-
42
- # DELETE /articles/1
43
- def destroy
44
- @article.destroy
45
- redirect_to articles_url, notice: 'Article was successfully destroyed.'
46
- end
47
-
48
- private
49
- # Use callbacks to share common setup or constraints between actions.
50
- def set_article
51
- @article = Article.find(params[:id])
52
- end
53
-
54
- # Only allow a trusted parameter "white list" through.
55
- def article_params
56
- params.require(:article).permit(:title, :body, :image)
57
- end
58
- end
File without changes
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,2 +0,0 @@
1
- module ArticlesHelper
2
- end
File without changes
File without changes
@@ -1,3 +0,0 @@
1
- class Article < ActiveRecord::Base
2
- mount_uploader :image, ImageUploader
3
- end
File without changes
@@ -1,19 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class ImageUploader < CarrierWave::Uploader::Base
4
- include CarrierWave::MiniMagick
5
-
6
- def store_dir
7
- "foo/#{model.class.to_s.pluralize.underscore}/#{mounted_as}/#{model.id}"
8
- end
9
-
10
- storage :dropbox
11
-
12
- version :thumbnail do
13
- process resize_to_fit: [300, 200]
14
- end
15
-
16
- def extension_white_list
17
- %w(jpg jpeg gif png)
18
- end
19
- end
@@ -1,29 +0,0 @@
1
- <%= form_for(@article) do |f| %>
2
- <% if @article.errors.any? %>
3
- <div id="error_explanation">
4
- <h2><%= pluralize(@article.errors.count, "error") %> prohibited this article from being saved:</h2>
5
-
6
- <ul>
7
- <% @article.errors.full_messages.each do |msg| %>
8
- <li><%= msg %></li>
9
- <% end %>
10
- </ul>
11
- </div>
12
- <% end %>
13
-
14
- <div class="field">
15
- <%= f.label :title %><br>
16
- <%= f.text_field :title %>
17
- </div>
18
- <div class="field">
19
- <%= f.label :body %><br>
20
- <%= f.text_area :body %>
21
- </div>
22
- <div class="field">
23
- <%= f.label :image %><br>
24
- <%= f.file_field :image %>
25
- </div>
26
- <div class="actions">
27
- <%= f.submit %>
28
- </div>
29
- <% end %>
@@ -1,6 +0,0 @@
1
- <h1>Editing article</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Show', @article %> |
6
- <%= link_to 'Back', articles_path %>
@@ -1,31 +0,0 @@
1
- <h1>Listing articles</h1>
2
-
3
- <table>
4
- <thead>
5
- <tr>
6
- <th>Title</th>
7
- <th>Body</th>
8
- <th>Image</th>
9
- <th></th>
10
- <th></th>
11
- <th></th>
12
- </tr>
13
- </thead>
14
-
15
- <tbody>
16
- <% @articles.each do |article| %>
17
- <tr>
18
- <td><%= article.title %></td>
19
- <td><%= article.body %></td>
20
- <td><%= article.image %></td>
21
- <td><%= link_to 'Show', article %></td>
22
- <td><%= link_to 'Edit', edit_article_path(article) %></td>
23
- <td><%= link_to 'Destroy', article, method: :delete, data: { confirm: 'Are you sure?' } %></td>
24
- </tr>
25
- <% end %>
26
- </tbody>
27
- </table>
28
-
29
- <br>
30
-
31
- <%= link_to 'New Article', new_article_path %>
@@ -1,5 +0,0 @@
1
- <h1>New article</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Back', articles_path %>
@@ -1 +0,0 @@
1
- <%= notice %>
@@ -1,12 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= csrf_meta_tags %>
6
- </head>
7
- <body>
8
-
9
- <%= yield %>
10
-
11
- </body>
12
- </html>
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Rails.application
@@ -1,23 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require 'rails/all'
4
-
5
- # Require the gems listed in Gemfile, including any gems
6
- # you've limited to :test, :development, or :production.
7
- Bundler.require(:default, Rails.env)
8
-
9
- module Dummy
10
- class Application < Rails::Application
11
- # Settings in config/environments/* take precedence over those specified here.
12
- # Application configuration should go into files in config/initializers
13
- # -- all .rb files in that directory are automatically loaded.
14
-
15
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
- # config.time_zone = 'Central Time (US & Canada)'
18
-
19
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
- # config.i18n.default_locale = :de
22
- end
23
- end
@@ -1,4 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
-
4
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,25 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
7
- adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
- test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
20
-
21
- production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the Rails application.
5
- Dummy::Application.initialize!
@@ -1,29 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Do not eager load code on boot.
10
- config.eager_load = false
11
-
12
- # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send.
17
- config.action_mailer.raise_delivery_errors = false
18
-
19
- # Print deprecation notices to the Rails logger.
20
- config.active_support.deprecation = :log
21
-
22
- # Raise an error on page load if there are pending migrations
23
- config.active_record.migration_error = :page_load
24
-
25
- # Debug mode disables concatenation and preprocessing of assets.
26
- # This option may cause significant delays in view rendering with a large
27
- # number of complex assets.
28
- config.assets.debug = true
29
- end