paperclipdropbox 1.0.6 → 1.0.7

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.
@@ -2,7 +2,6 @@ require 'paperclipdropbox'
2
2
  require 'rails'
3
3
  module Paperclipdropbox
4
4
  class Railtie < Rails::Railtie
5
- railtie_name :paperclipdropbox
6
5
 
7
6
  rake_tasks do
8
7
  load "tasks/paperclipdropbox.rake"
@@ -1,3 +1,3 @@
1
1
  module Paperclipdropbox
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
@@ -9,46 +9,55 @@ namespace :paperclipdropbox do
9
9
 
10
10
  SESSION_FILE = "#{Rails.root}/config/dropboxsession.yml"
11
11
 
12
- puts ""
13
- puts ""
14
- puts ""
15
-
16
- unless @dropboxsession == Paperclip::Storage::Dropboxstorage.dropbox_session
17
- if File.exists?("#{Rails.root}/config/paperclipdropbox.yml")
18
- @options = (YAML.load_file("#{Rails.root}/config/paperclipdropbox.yml")[Rails.env].symbolize_keys)
19
- end
20
-
12
+ puts ""
13
+ puts ""
14
+ puts ""
15
+
16
+ @dropboxsession = Paperclip::Storage::Dropboxstorage.dropbox_session
17
+
18
+ if @dropboxsession.blank?
19
+ if File.exists?("#{Rails.root}/config/paperclipdropbox.yml")
20
+ @options = (YAML.load_file("#{Rails.root}/config/paperclipdropbox.yml")[Rails.env].symbolize_keys)
21
+ end
22
+
21
23
  @dropbox_key = @options.blank? ? '8ti7qntpcysl91j' : @options[:dropbox_key]
22
24
  @dropbox_secret = @options.blank? ? 'i0tshr4cpd1pa4e' : @options[:dropbox_secret]
23
25
 
24
26
  @dropboxsession = Dropbox::Session.new(@dropbox_key, @dropbox_secret)
25
27
  @dropboxsession.mode = :dropbox
26
28
 
27
- puts "Visit #{@dropboxsession.authorize_url} to log in to Dropbox. Hit enter when you have done this."
29
+ puts "Visit #{@dropboxsession.authorize_url} to log in to Dropbox. Hit enter when you have done this."
28
30
 
29
- STDIN.gets
31
+ STDIN.gets
30
32
 
31
33
  end
32
34
 
33
35
  begin
34
36
  @dropboxsession.authorize
35
- puts ""
37
+ puts ""
36
38
  puts "Authorized - #{@dropboxsession.authorized?}"
37
39
  rescue
38
40
  begin
39
- puts ""
40
- puts "Please login to dropbox using this link : #{@dropboxsession.authorize_url}"
41
- puts "then run this rake task again."
41
+ puts ""
42
+ puts "Visit #{@dropboxsession.authorize_url} to log in to Dropbox. Hit enter when you have done this."
43
+
44
+ STDIN.gets
45
+ @dropboxsession.authorize
46
+ puts ""
47
+ puts "Authorized - #{@dropboxsession.authorized?}"
42
48
  rescue
43
- puts ""
44
- puts "Already Authorized - #{@dropboxsession.authorized?}"
49
+ puts ""
50
+ puts "Already Authorized - #{@dropboxsession.authorized?}" unless @dropboxsession.blank?
51
+ puts "Failed Authorization. Please try delete /config/dropboxsession.yml and try again." if @dropboxsession.blank?
45
52
  end
46
53
  end
47
54
 
48
55
  puts ""
49
56
  puts ""
50
- File.open(SESSION_FILE, "w") do |f|
51
- f.puts @dropboxsession.serialize
57
+ unless @dropboxsession.blank?
58
+ File.open(SESSION_FILE, "w") do |f|
59
+ f.puts @dropboxsession.serialize
60
+ end
52
61
  end
53
62
  end
54
63
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: paperclipdropbox
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.6
5
+ version: 1.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paul Ketelle
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-11-07 00:00:00 Z
13
+ date: 2012-01-09 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: paperclip