Permalink
Browse files

Fix loading rake tasks for non-rails applications

  • Loading branch information...
1 parent 052ee03 commit 3e3f21ee4d56a1a0aed991fd8ea34af0ece89af0 @janko-m committed Nov 13, 2012
Showing with 8 additions and 9 deletions.
  1. +1 −2 README.md
  2. +2 −3 Rakefile
  3. +1 −1 lib/paperclip/dropbox/railtie.rb
  4. +4 −3 lib/paperclip/dropbox/{tasks/authorize.rake → tasks.rake}
View
@@ -142,8 +142,7 @@ your `Rakefile`:
```ruby
# Rakefile
-require "rake"
-require "paperclip/dropbox/rake"
+load "paperclip/dropbox/tasks.rake"
```
## License
View
@@ -1,10 +1,9 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"
-require "paperclip/dropbox/rake"
-import 'lib/paperclip/dropbox/tasks/authorize.rake'
-
Bundler.setup
+load "paperclip/dropbox/tasks.rake"
+
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task default: :spec
@@ -2,7 +2,7 @@ module Paperclip
module Dropbox
class Railtie < Rails::Railtie
rake_tasks do
- load "paperclip/dropbox/tasks/authorize.rake"
+ load "paperclip/dropbox/tasks.rake"
end
end
end
@@ -1,12 +1,13 @@
-require "rake"
-require "paperclip/dropbox/rake" unless defined?(Paperclip::Dropbox::Rake)
+require "paperclip/dropbox/rake"
namespace :dropbox do
desc "Obtains your Dropbox credentials"
task :authorize do
if ENV["APP_KEY"].nil? or ENV["APP_SECRET"].nil?
- raise ArgumentError, "usage: `rake dropbox:authorize APP_KEY=your_app_key APP_SECRET=your_app_secret`"
+ puts "USAGE: `rake dropbox:authorize APP_KEY=your_app_key APP_SECRET=your_app_secret`"
+ exit
end
+
Paperclip::Dropbox::Rake.authorize(ENV["APP_KEY"], ENV["APP_SECRET"])
end
end

0 comments on commit 3e3f21e

Please sign in to comment.