cloud_door 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/Guardfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +204 -0
- data/Rakefile +11 -0
- data/bin/dropbox +133 -0
- data/bin/onedrive +133 -0
- data/cloud_door.gemspec +38 -0
- data/cloud_door_config.yml +12 -0
- data/data/.gitkeep +0 -0
- data/data/testlist +0 -0
- data/lib/cloud_door.rb +114 -0
- data/lib/cloud_door/account.rb +27 -0
- data/lib/cloud_door/cloud_storage.rb +294 -0
- data/lib/cloud_door/cloud_yaml.rb +45 -0
- data/lib/cloud_door/config.rb +61 -0
- data/lib/cloud_door/console.rb +334 -0
- data/lib/cloud_door/dropbox.rb +166 -0
- data/lib/cloud_door/exceptions.rb +153 -0
- data/lib/cloud_door/file_list.rb +164 -0
- data/lib/cloud_door/onedrive.rb +180 -0
- data/lib/cloud_door/onedrive_api.rb +169 -0
- data/lib/cloud_door/token.rb +67 -0
- data/lib/cloud_door/version.rb +3 -0
- data/log/.gitkeep +0 -0
- data/spec/cloud_door/account_spec.rb +96 -0
- data/spec/cloud_door/cloud_storage_spec.rb +10 -0
- data/spec/cloud_door/cloud_yaml_spec.rb +32 -0
- data/spec/cloud_door/config_spec.rb +95 -0
- data/spec/cloud_door/console_spec.rb +633 -0
- data/spec/cloud_door/dropbox_spec.rb +625 -0
- data/spec/cloud_door/file_list_spec.rb +451 -0
- data/spec/cloud_door/onedrive_api_spec.rb +256 -0
- data/spec/cloud_door/onedrive_spec.rb +652 -0
- data/spec/cloud_door/token_spec.rb +81 -0
- data/spec/fabricators/account_fabricator.rb +5 -0
- data/spec/fabricators/cloud_yaml_fabricator.rb +5 -0
- data/spec/fabricators/config_fabrication.rb +5 -0
- data/spec/fabricators/token_fabricator.rb +10 -0
- data/spec/spec_helper.rb +55 -0
- metadata +380 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: caf57815f0cdd5cd8a83a379407fa1025406ea4d
|
4
|
+
data.tar.gz: 0121e8b37b6bde073502bd932b1e8cd6abeb231f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d74ad868c208e4f83b075d7e163b9e211955a5836adc207e886d0c36c4e54f403f53f93f62cc08aa65c63b3d75bc6f64a58115dba634bb58b4e47d4c6ea3a020
|
7
|
+
data.tar.gz: e3dd3881346ddd873f9b04fdd98749c35d120326fa54f8be43aefcc72f3c8d89e821144d738dd0273cc792ea9d601fe2f2e1421c08c8f220507dbdac5b9168fe
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
*.swp
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
guard :rspec do
|
2
|
+
watch(%r{^spec/.+_spec\.rb$})
|
3
|
+
watch(%r{^spec/cloud_door_spec/.+_spec\.rb$})
|
4
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
5
|
+
watch(%r{^lib/cloud_door/(.+)\.rb$}) { |m| "spec/cloud_door/#{m[1]}_spec.rb" }
|
6
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
7
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 k-hibi
|
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/README.md
ADDED
@@ -0,0 +1,204 @@
|
|
1
|
+
# CloudDoor
|
2
|
+
|
3
|
+
This gem can access different cloud storage through same interface.
|
4
|
+
This gem supports OneDrive and Dropbox, now.
|
5
|
+
It will be supported also google drive in the future.
|
6
|
+
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'cloud_door'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install cloud_door
|
21
|
+
|
22
|
+
|
23
|
+
## usage
|
24
|
+
|
25
|
+
### prepare
|
26
|
+
|
27
|
+
This gem use cloud storage application setting.
|
28
|
+
Please create application on below url.
|
29
|
+
|
30
|
+
|storage|url|
|
31
|
+
|-------|---|
|
32
|
+
|OneDrive|https://account.live.com/developers/applications/index|
|
33
|
+
|Dropbox|https://www.dropbox.com/developers/apps/create|
|
34
|
+
|
35
|
+
### configuration
|
36
|
+
1. make "cloud_door_config.yml" on application root directory.
|
37
|
+
2. write application settings to "cloud_door_config.yml".
|
38
|
+
- all
|
39
|
+
- data_path
|
40
|
+
data_path is path to save data file.
|
41
|
+
application must have write permission to data_path.
|
42
|
+
- session_flg
|
43
|
+
Whether or not to switch the session for each user.
|
44
|
+
"0" is "no" and "1" is "yes".
|
45
|
+
must be a "1" in an environment where multiple users use application at same time.
|
46
|
+
- onedrive
|
47
|
+
- client_id
|
48
|
+
OneDrive's client id
|
49
|
+
- client_secret
|
50
|
+
OneDrive's client secret
|
51
|
+
- redirect_url
|
52
|
+
OneDrive's redirect url after login.
|
53
|
+
please set to "https://login.live.com/oauth20_desktop.srf" for desktop apps.
|
54
|
+
- dropbox
|
55
|
+
- client_id
|
56
|
+
Dropbox's client id
|
57
|
+
- client_secret
|
58
|
+
Dropbox's client secret
|
59
|
+
- redirect_url
|
60
|
+
Dropbox's redirect url after login.
|
61
|
+
please set to "https://localhost" for desktop apps.
|
62
|
+
|
63
|
+
example
|
64
|
+
```
|
65
|
+
all:
|
66
|
+
data_path : './data/'
|
67
|
+
web_app_flag: 0
|
68
|
+
onedrive:
|
69
|
+
client_id: onedrive
|
70
|
+
client_secret: onedrive_secret
|
71
|
+
redirect_url: https://login.live.com/oauth20_desktop.srf
|
72
|
+
dropbox:
|
73
|
+
client_id: dropbox
|
74
|
+
client_secret: dropbox_secret
|
75
|
+
redirect_url: http://localhost
|
76
|
+
```
|
77
|
+
|
78
|
+
|
79
|
+
### example
|
80
|
+
|
81
|
+
A.before login
|
82
|
+
```ruby
|
83
|
+
require 'cloud_door'
|
84
|
+
require 'pp'
|
85
|
+
|
86
|
+
# make an instance for connecting to Onedrive
|
87
|
+
storage = CloudDoor::CloudDoor.new(CloudDoor::OneDrive)
|
88
|
+
# make an instance for connecting to Dropbox
|
89
|
+
# storage = CloudDoor::CloudDoor.new(CloudDoor::Dropbox)
|
90
|
+
# login
|
91
|
+
storage.login('account', 'password')
|
92
|
+
# show files
|
93
|
+
files = storage.show_files
|
94
|
+
pp files
|
95
|
+
# upload file
|
96
|
+
storage.upload_file('README.md')
|
97
|
+
# download file
|
98
|
+
storage.download_file('README.md')
|
99
|
+
```
|
100
|
+
|
101
|
+
B.after login
|
102
|
+
```ruby
|
103
|
+
require 'cloud_door'
|
104
|
+
|
105
|
+
storage = CloudDoor::CloudDoor.new(CloudDoor::OneDrive)
|
106
|
+
# load_token calls the login information of previous
|
107
|
+
storage.load_token
|
108
|
+
```
|
109
|
+
|
110
|
+
C.if session_flag is "1"(using session ID)
|
111
|
+
```ruby
|
112
|
+
require 'cloud_door'
|
113
|
+
|
114
|
+
# login
|
115
|
+
storage = CloudDoor::CloudDoor.new(CloudDoor::OneDrive)
|
116
|
+
session_id = storage.login('account', 'password')
|
117
|
+
|
118
|
+
# load_token
|
119
|
+
storage = CloudDoor::CloudDoor.new(CloudDoor::OneDrive, session_id)
|
120
|
+
storage.load_token
|
121
|
+
|
122
|
+
```
|
123
|
+
|
124
|
+
|
125
|
+
### methods
|
126
|
+
You can use these methods as instance method.
|
127
|
+
these methods can operate current directory only.
|
128
|
+
- login(login_account, login_password)
|
129
|
+
- login cloud storage.
|
130
|
+
- return the session ID after logging in if "session_flag" is "1".
|
131
|
+
please hold session ID by use of uri/session
|
132
|
+
- load_token
|
133
|
+
- load login session.
|
134
|
+
- show_user
|
135
|
+
- return login user information as Hash.
|
136
|
+
- show_files(file_name = nil)
|
137
|
+
- if file_name is nil, return files on current directory as Hash.
|
138
|
+
- if file_name is not nil, return files on specified directory as Hash.
|
139
|
+
- raise error if specified file not found.
|
140
|
+
- change_directory(file_name)
|
141
|
+
- change current directory to specified directory.
|
142
|
+
- return files on specified directory as Hash.
|
143
|
+
- raise error if specified file not found.
|
144
|
+
- show_current_directory
|
145
|
+
- return path of current directory.
|
146
|
+
- show_property(file_name)
|
147
|
+
- return properties of specified file as Hash.
|
148
|
+
- raise error if specified file not found.
|
149
|
+
- delete_file(file_name)
|
150
|
+
- delete specified file from cloud storage.
|
151
|
+
- cannot delete a directory that has files.
|
152
|
+
- raise error if specified file not found.
|
153
|
+
- download_file(file_name)
|
154
|
+
- download specified file from cloud storage to local.
|
155
|
+
- cannot download directory.
|
156
|
+
- overwrite file if there is a file with the same name.
|
157
|
+
please check before if you do not want to overwrite.
|
158
|
+
- raise error if specified file not found.
|
159
|
+
- upload_file(file_name)
|
160
|
+
- upload specified file to cloud storage from local.
|
161
|
+
- if specified file is a directory, Upload by zip compression automatically.
|
162
|
+
- overwrite file if there is a file with the same name.
|
163
|
+
please check before if you do not want to overwrite.
|
164
|
+
- raise error if specified file not found.
|
165
|
+
- make_directory(mkdir_name)
|
166
|
+
- make specified directory on cloud storage.
|
167
|
+
- raise error if there is a file with the same name.
|
168
|
+
- file_exist?(file_name)
|
169
|
+
- make sure the specified file exists in current directory.
|
170
|
+
return true if the specified file exists.
|
171
|
+
- has_file?(file_name)
|
172
|
+
- make sure the specified directory has files.
|
173
|
+
return true if the specified file has files.
|
174
|
+
- file?(file_name)
|
175
|
+
- make sure the specified file is file or a directory.
|
176
|
+
return true if the specified file has files.
|
177
|
+
- check if a file or directory is the corresponding element.
|
178
|
+
return true if the specified file is a file.
|
179
|
+
- show_storage_name
|
180
|
+
- return storage name which "OneDrive" or "Dropbox".
|
181
|
+
- show_configuration
|
182
|
+
- return settings on "cloud_door_config.yml" as Hash.
|
183
|
+
- update_configuration(configs)
|
184
|
+
- update settings on "cloud_door_config.yml".
|
185
|
+
- configuration_init?
|
186
|
+
- check if is set "cloud_door_config.yml".
|
187
|
+
return true if "cloud_door_config.yml" is set.
|
188
|
+
- show_account
|
189
|
+
- return registered account as Hash.
|
190
|
+
- update_account(accounts)
|
191
|
+
- update account.
|
192
|
+
- iseset_account?
|
193
|
+
- check if is set account.
|
194
|
+
return true if account is set.
|
195
|
+
|
196
|
+
|
197
|
+
## Contributing
|
198
|
+
|
199
|
+
1. Fork it ( https://github.com/KotaroHibi/cloud_door/fork )
|
200
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
201
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
202
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
203
|
+
5. Create a new Pull Request
|
204
|
+
|
data/Rakefile
ADDED
data/bin/dropbox
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'commander/import'
|
5
|
+
require 'cloud_door'
|
6
|
+
|
7
|
+
program :version, '0.0.1'
|
8
|
+
program :description, 'access dropbox from CLI'
|
9
|
+
|
10
|
+
command :config do |c|
|
11
|
+
c.syntax = 'dropbox config'
|
12
|
+
c.summary = 'configure the dropbox connection'
|
13
|
+
c.description = 'configure the dropbox connection'
|
14
|
+
c.example 'description', 'dropbox config'
|
15
|
+
c.option '-l'
|
16
|
+
c.action do |args, options|
|
17
|
+
console = CloudDoor::Console.new(CloudDoor::Dropbox)
|
18
|
+
console.config(options.l)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
command :account do |c|
|
23
|
+
c.syntax = 'dropbox account'
|
24
|
+
c.summary = 'set account for the dropbox connection'
|
25
|
+
c.description = 'set account for the dropbox connection'
|
26
|
+
c.example 'description', 'dropbox accout'
|
27
|
+
# c.option '-b STR', String, 'Example of string'
|
28
|
+
c.option '-l'
|
29
|
+
c.action do |args, options|
|
30
|
+
console = CloudDoor::Console.new(CloudDoor::Dropbox)
|
31
|
+
console.account(options.l)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
command :login do |c|
|
36
|
+
c.syntax = 'dropbox login'
|
37
|
+
c.summary = 'authentication for dropbox'
|
38
|
+
c.description = 'authentication for dropbox'
|
39
|
+
c.example 'description', 'dropbox login'
|
40
|
+
c.option '-d'
|
41
|
+
c.action do |args, options|
|
42
|
+
console = CloudDoor::Console.new(CloudDoor::Dropbox)
|
43
|
+
console.login(options.d)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
command :ls do |c|
|
48
|
+
c.syntax = 'dropbox list [file_name]'
|
49
|
+
c.summary = 'list dropbox files'
|
50
|
+
c.description = 'list dropbox files'
|
51
|
+
c.example 'description', "dropbox list 'file'"
|
52
|
+
c.action do |args, options|
|
53
|
+
console = CloudDoor::Console.new(CloudDoor::Dropbox)
|
54
|
+
console.ls(args[0])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
command :cd do |c|
|
59
|
+
c.syntax = 'dropbox cd [file_name]'
|
60
|
+
c.summary = 'change directory on dropbox'
|
61
|
+
c.description = 'change directory on dropbox'
|
62
|
+
c.example 'description', "dropbox cd 'file'"
|
63
|
+
c.action do |args, options|
|
64
|
+
console = CloudDoor::Console.new(CloudDoor::Dropbox)
|
65
|
+
console.cd(args[0])
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
command :info do |c|
|
70
|
+
c.syntax = 'dropbox info [file_name]'
|
71
|
+
c.summary = 'show dropbox file information'
|
72
|
+
c.description = 'show dropbox file information'
|
73
|
+
c.example 'description', "dropbox info 'file'"
|
74
|
+
c.action do |args, options|
|
75
|
+
console = CloudDoor::Console.new(CloudDoor::Dropbox)
|
76
|
+
console.info(args[0])
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
command :pwd do |c|
|
81
|
+
c.syntax = 'dropbox pwd'
|
82
|
+
c.summary = 'show current directory'
|
83
|
+
c.description = 'show current directory'
|
84
|
+
c.example 'description', "dropbox pwd"
|
85
|
+
c.action do |args, options|
|
86
|
+
console = CloudDoor::Console.new(CloudDoor::Dropbox)
|
87
|
+
console.pwd
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
command :download do |c|
|
92
|
+
c.syntax = 'dropbox download [file_name]'
|
93
|
+
c.summary = 'download file from dropbox'
|
94
|
+
c.description = 'download file from dropbox'
|
95
|
+
c.example 'description', "dropbox download 'file'"
|
96
|
+
c.action do |args, options|
|
97
|
+
console = CloudDoor::Console.new(CloudDoor::Dropbox)
|
98
|
+
console.download(args[0])
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
command :upload do |c|
|
103
|
+
c.syntax = 'dropbox upload [file_name]'
|
104
|
+
c.summary = 'upload file to dropbox'
|
105
|
+
c.description = 'upload file to dropbox'
|
106
|
+
c.example 'description', "dropbox upload 'file'"
|
107
|
+
c.action do |args, options|
|
108
|
+
console = CloudDoor::Console.new(CloudDoor::Dropbox)
|
109
|
+
console.upload(args[0])
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
command :rm do |c|
|
114
|
+
c.syntax = 'dropbox delete [file_name]'
|
115
|
+
c.summary = 'delete file on dropbox'
|
116
|
+
c.description = 'delete file on dropbox'
|
117
|
+
c.example 'description', "dropbox delete 'file'"
|
118
|
+
c.action do |args, options|
|
119
|
+
console = CloudDoor::Console.new(CloudDoor::Dropbox)
|
120
|
+
console.rm(args[0])
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
command :mkdir do |c|
|
125
|
+
c.syntax = 'dropbox mkdir [folder_name]'
|
126
|
+
c.summary = 'make directory on dropbox'
|
127
|
+
c.description = 'make directory on dropbox'
|
128
|
+
c.example 'description', "dropbox mkdir 'folder'"
|
129
|
+
c.action do |args, options|
|
130
|
+
console = CloudDoor::Console.new(CloudDoor::Dropbox)
|
131
|
+
console.mkdir(args[0])
|
132
|
+
end
|
133
|
+
end
|
data/bin/onedrive
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'commander/import'
|
5
|
+
require 'cloud_door'
|
6
|
+
|
7
|
+
program :version, '0.0.1'
|
8
|
+
program :description, 'access onedrive from CLI'
|
9
|
+
|
10
|
+
command :config do |c|
|
11
|
+
c.syntax = 'onedrive config'
|
12
|
+
c.summary = 'configure the onedrive connection'
|
13
|
+
c.description = 'configure the onedrive connection'
|
14
|
+
c.example 'description', 'onedrive config'
|
15
|
+
c.option '-l'
|
16
|
+
c.action do |args, options|
|
17
|
+
console = CloudDoor::Console.new(CloudDoor::OneDrive)
|
18
|
+
console.config(options.l)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
command :account do |c|
|
23
|
+
c.syntax = 'onedrive account'
|
24
|
+
c.summary = 'set account for the onedrive connection'
|
25
|
+
c.description = 'set account for the onedrive connection'
|
26
|
+
c.example 'description', 'onedrive accout'
|
27
|
+
# c.option '-b STR', String, 'Example of string'
|
28
|
+
c.option '-l'
|
29
|
+
c.action do |args, options|
|
30
|
+
console = CloudDoor::Console.new(CloudDoor::OneDrive)
|
31
|
+
console.account(options.l)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
command :login do |c|
|
36
|
+
c.syntax = 'onedrive login'
|
37
|
+
c.summary = 'authentication for onedrive'
|
38
|
+
c.description = 'authentication for onedrive'
|
39
|
+
c.example 'description', 'onedrive login'
|
40
|
+
c.option '-d'
|
41
|
+
c.action do |args, options|
|
42
|
+
console = CloudDoor::Console.new(CloudDoor::OneDrive)
|
43
|
+
console.login(options.d)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
command :ls do |c|
|
48
|
+
c.syntax = 'onedrive list [file_name]'
|
49
|
+
c.summary = 'list onedrive files'
|
50
|
+
c.description = 'list onedrive files'
|
51
|
+
c.example 'description', "onedrive list 'file'"
|
52
|
+
c.action do |args, options|
|
53
|
+
console = CloudDoor::Console.new(CloudDoor::OneDrive)
|
54
|
+
console.ls(args[0])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
command :cd do |c|
|
59
|
+
c.syntax = 'onedrive cd [file_name]'
|
60
|
+
c.summary = 'change directory on onedrive'
|
61
|
+
c.description = 'change directory on onedrive'
|
62
|
+
c.example 'description', "onedrive cd 'file'"
|
63
|
+
c.action do |args, options|
|
64
|
+
console = CloudDoor::Console.new(CloudDoor::OneDrive)
|
65
|
+
console.cd(args[0])
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
command :info do |c|
|
70
|
+
c.syntax = 'onedrive info [file_name]'
|
71
|
+
c.summary = 'show onedrive file information'
|
72
|
+
c.description = 'show onedrive file information'
|
73
|
+
c.example 'description', "onedrive info 'file'"
|
74
|
+
c.action do |args, options|
|
75
|
+
console = CloudDoor::Console.new(CloudDoor::OneDrive)
|
76
|
+
console.info(args[0])
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
command :pwd do |c|
|
81
|
+
c.syntax = 'onedrive pwd'
|
82
|
+
c.summary = 'show current directory'
|
83
|
+
c.description = 'show current directory'
|
84
|
+
c.example 'description', "onedrive pwd"
|
85
|
+
c.action do |args, options|
|
86
|
+
console = CloudDoor::Console.new(CloudDoor::OneDrive)
|
87
|
+
console.pwd
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
command :download do |c|
|
92
|
+
c.syntax = 'onedrive download [file_name]'
|
93
|
+
c.summary = 'download file from onedrive'
|
94
|
+
c.description = 'download file from onedrive'
|
95
|
+
c.example 'description', "onedrive download 'file'"
|
96
|
+
c.action do |args, options|
|
97
|
+
console = CloudDoor::Console.new(CloudDoor::OneDrive)
|
98
|
+
console.download(args[0])
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
command :upload do |c|
|
103
|
+
c.syntax = 'onedrive upload [file_name]'
|
104
|
+
c.summary = 'upload file to onedrive'
|
105
|
+
c.description = 'upload file to onedrive'
|
106
|
+
c.example 'description', "onedrive upload 'file'"
|
107
|
+
c.action do |args, options|
|
108
|
+
console = CloudDoor::Console.new(CloudDoor::OneDrive)
|
109
|
+
console.upload(args[0])
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
command :rm do |c|
|
114
|
+
c.syntax = 'onedrive delete [file_name]'
|
115
|
+
c.summary = 'delete file on onedrive'
|
116
|
+
c.description = 'delete file on onedrive'
|
117
|
+
c.example 'description', "onedrive delete 'file'"
|
118
|
+
c.action do |args, options|
|
119
|
+
console = CloudDoor::Console.new(CloudDoor::OneDrive)
|
120
|
+
console.rm(args[0])
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
command :mkdir do |c|
|
125
|
+
c.syntax = 'onedrive mkdir [folder_name]'
|
126
|
+
c.summary = 'make directory on onedrive'
|
127
|
+
c.description = 'make directory on onedrive'
|
128
|
+
c.example 'description', "onedrive mkdir 'folder'"
|
129
|
+
c.action do |args, options|
|
130
|
+
console = CloudDoor::Console.new(CloudDoor::OneDrive)
|
131
|
+
console.mkdir(args[0])
|
132
|
+
end
|
133
|
+
end
|