dropbox-utility 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bb9020d60f947358a58456726cf179c50b7752d
4
- data.tar.gz: 1cc8e9b5324dd465601a404f379ddd41fbc0fee4
3
+ metadata.gz: 5ba2d1640154141572756a848972f91deaaad8cc
4
+ data.tar.gz: 3590a01c6e11db2fd00d7d30a9f194d373a800d3
5
5
  SHA512:
6
- metadata.gz: 9f970f79a140e4575152e1b7fc48df8abc482945af9fa962a41e1597a798fb9580f49ee61e77c3cfe391aa95a6860de9fb50960fcdbd8b6bc07d6b584774a983
7
- data.tar.gz: a673106e754067f48d908f57df710709dfa2f444c4eda05ccedd84aec2eb2e394e87d04250bdbd6f4f88b840fe07703429b45d6c8782f4fb6bd0e282791699d0
6
+ metadata.gz: b09da79a29bcc9e7ea9d4ad9ce2b0159f7a9eaa344313de42474168a8971d6523ac7ab17ceecefeeb921c546138b99cdbacf248f92b5427cc7c0ca9336b569f8
7
+ data.tar.gz: 14fe43c63f52f45a8698ec2b0ae48d5e965e5bf917cc96814719449acbb308ff2c5a3eb25b3d42e7b0b90a416abfada044cdb6916fd51e1c1de30d1ef15b2e6a
data/README.md CHANGED
@@ -32,7 +32,12 @@ line on your machine.
32
32
  gem install dropbox-utility
33
33
  ```
34
34
 
35
- After the installation finishes, run <code>bundle
35
+ After the installation, you can then run the application from anywhere in the command line:
36
+
37
+ ```
38
+ dropbox-utility [options]
39
+ ```
40
+
36
41
  If you'd like to contribute, you can begin by cloning the repository or
37
42
  [downloading the zip archive](https://github.com/caseyscarborough/dropbox-utility/archive/master.zip) and
38
43
  extracting it.
@@ -53,7 +58,7 @@ After completing this, run <code>bundle install</code> and then the executable f
53
58
 
54
59
  ```
55
60
  $ bundle install
56
- $ ruby bin/dropbox-utility
61
+ $ ruby bin/dropbox-utility [options]
57
62
  ```
58
63
 
59
64
  The first time you run the application, you will need to authenticate the application by clicking 'Allow' in
@@ -3,9 +3,6 @@
3
3
  require 'optparse'
4
4
  require_relative '../lib/dropbox_utility'
5
5
 
6
-
7
- DropboxUtility::authenticate
8
-
9
6
  options = {}
10
7
  help = nil
11
8
 
@@ -14,8 +11,10 @@ OptionParser.new do |o|
14
11
 
15
12
  o.on('-i','--info','Displays user information') { |o| options[:user_info] = o }
16
13
  o.on('-u FILENAME','--upload FILENAME','Specifies filename to upload') { |o| options[:filename] = o }
17
- o.on('-l [PATH]','--list [PATH]', 'Lists contents of PATH specified.',
14
+ o.on('-l [PATH]','--list [PATH]', 'Lists contents of PATH specified',
18
15
  'Uses root directory if PATH not given.') { |o| options[:folder] = o ? o : '/' }
16
+ o.on('-d','Removes authentication file. Will require',
17
+ 're-authentication on next application start') { |o| options[:delete] = o }
19
18
 
20
19
  help = o.to_s
21
20
 
@@ -30,6 +29,10 @@ OptionParser.new do |o|
30
29
 
31
30
  end
32
31
 
32
+ if options[:delete] then DropboxUtility::delete_authentication_file; exit end
33
+
34
+ DropboxUtility::authenticate
35
+
33
36
  if options[:user_info] then DropboxUtility::client.get_info end
34
37
  if options[:filename] then DropboxUtility::Files::upload(options[:filename]) end
35
- if options[:folder] then DropboxUtility::Files::list(options[:folder]) end
38
+ if options[:folder] then DropboxUtility::Files::list(options[:folder]) end
@@ -6,7 +6,7 @@ rescue Exception => e
6
6
  abort e.message
7
7
  end
8
8
 
9
- require_relative'dropbox_utility/config'
9
+ require_relative 'dropbox_utility/config'
10
10
  require_relative 'dropbox_utility/version'
11
11
  require_relative 'dropbox_utility/session'
12
12
  require_relative 'dropbox_utility/client'
@@ -27,4 +27,8 @@ module DropboxUtility
27
27
  @@client
28
28
  end
29
29
 
30
+ def self.delete_authentication_file
31
+ Session.delete
32
+ end
33
+
30
34
  end
@@ -37,5 +37,18 @@ module DropboxUtility
37
37
  end
38
38
  end
39
39
 
40
+ def self.delete
41
+ if self.exists?
42
+ begin
43
+ File.delete(DropboxUtility::Config::AUTH_FILE)
44
+ puts "Authorization file successfully deleted."
45
+ rescue Exception => e
46
+ abort e.message
47
+ end
48
+ else
49
+ puts "Authentication file doesn't exist yet."
50
+ end
51
+ end
52
+
40
53
  end
41
54
  end
@@ -1,3 +1,3 @@
1
1
  module DropboxUtility
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dropbox-utility
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Casey Scarborough