everbox_client 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -5
- data/lib/everbox_client/runner.rb +3 -36
- data/lib/everbox_client/version.rb +1 -1
- data/spec/everbox_client/models/path_entry_spec.rb +30 -17
- metadata +98 -94
data/README.rdoc
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
== 安装
|
4
4
|
|
5
|
-
$ gem install everbox_client
|
5
|
+
$ gem install everbox_client
|
6
6
|
|
7
7
|
== 使用方法
|
8
8
|
|
@@ -31,8 +31,5 @@
|
|
31
31
|
$ everbox help login
|
32
32
|
Usage:
|
33
33
|
|
34
|
-
everbox login
|
34
|
+
everbox login
|
35
35
|
登录 everbox, 登录完成后的 token 保存在 $HOME/.everbox_client/config
|
36
|
-
|
37
|
-
everbox login --oauth
|
38
|
-
以 OAuth 方式登录
|
@@ -90,11 +90,8 @@ DOC
|
|
90
90
|
puts <<DOC
|
91
91
|
Usage:
|
92
92
|
|
93
|
-
everbox login
|
93
|
+
everbox login
|
94
94
|
登录 everbox, 登录完成后的 token 保存在 $HOME/.everbox_client/config
|
95
|
-
|
96
|
-
everbox login --oauth
|
97
|
-
以 OAuth 方式登录
|
98
95
|
DOC
|
99
96
|
when 'ls'
|
100
97
|
puts <<DOC
|
@@ -159,38 +156,8 @@ DOC
|
|
159
156
|
end
|
160
157
|
|
161
158
|
|
162
|
-
def login
|
163
|
-
|
164
|
-
return login_oauth
|
165
|
-
end
|
166
|
-
|
167
|
-
@username = args.shift
|
168
|
-
@password = args.shift
|
169
|
-
|
170
|
-
raise "too many arguments" unless args.empty?
|
171
|
-
|
172
|
-
if @username.nil?
|
173
|
-
@username = ask("Enter your username: ") { |q| q.echo = true }
|
174
|
-
end
|
175
|
-
if @password.nil?
|
176
|
-
@password = ask("Enter your password: ") { |q| q.echo = "*" }
|
177
|
-
end
|
178
|
-
|
179
|
-
response = consumer.request(:post, "/oauth/quick_token?login=#{CGI.escape @username}&password=#{CGI.escape @password}")
|
180
|
-
if response.code.to_i != 200
|
181
|
-
raise "login failed: #{response.body}"
|
182
|
-
end
|
183
|
-
|
184
|
-
d = CGI.parse(response.body).inject({}) do |h,(k,v)|
|
185
|
-
h[k.strip.to_sym] = v.first
|
186
|
-
h[k.strip] = v.first
|
187
|
-
h
|
188
|
-
end
|
189
|
-
|
190
|
-
access_token = OAuth::AccessToken.from_hash(self, d)
|
191
|
-
@options[:access_token] = access_token.token
|
192
|
-
@options[:access_secret] = access_token.secret
|
193
|
-
puts @options.inspect
|
159
|
+
def login
|
160
|
+
login_oauth
|
194
161
|
end
|
195
162
|
|
196
163
|
def ls(path = '.')
|
@@ -7,28 +7,41 @@ require 'everbox_client'
|
|
7
7
|
module EverboxClient
|
8
8
|
describe PathEntry do
|
9
9
|
context "path" do
|
10
|
-
|
10
|
+
before :each do
|
11
|
+
@entry_1 = %Q[{"editTime":"12898149764580000","ver":"MDAwMDAwMDAwMDAwMDAwOQ==","type":2,"path":"/home/foo","fileSize":"1932891"}]
|
12
|
+
@path_entry = PathEntry.new(JSON.parse(@entry_1))
|
13
|
+
end
|
11
14
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
subject { @path_entry }
|
16
|
+
it { should_not be_file }
|
17
|
+
it { should be_dir }
|
18
|
+
it { should_not be_deleted }
|
19
|
+
describe :basename do
|
20
|
+
subject { @path_entry.basename }
|
21
|
+
it { should == "foo" }
|
22
|
+
end
|
23
|
+
describe :to_line do
|
24
|
+
subject { @path_entry.to_line }
|
25
|
+
it { should == " 1932891\tfoo/\n" }
|
19
26
|
end
|
20
27
|
end
|
21
28
|
|
22
29
|
context "file" do
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
before :each do
|
31
|
+
@entry = %Q[{"editTime":"12898149764580000","ver":"MDAwMDAwMDAwMDAwMDAwOQ==","type":1,"path":"/home/foo","fileSize":"1932891"}]
|
32
|
+
@path_entry = PathEntry.new(JSON.parse(@entry))
|
33
|
+
end
|
34
|
+
subject { @path_entry }
|
35
|
+
it { should be_file }
|
36
|
+
it { should_not be_dir }
|
37
|
+
it { should_not be_deleted }
|
38
|
+
describe :basename do
|
39
|
+
subject { @path_entry.basename }
|
40
|
+
it { should == "foo" }
|
41
|
+
end
|
42
|
+
describe :to_line do
|
43
|
+
subject { @path_entry.to_line }
|
44
|
+
it { should == " 1932891\tfoo\n" }
|
32
45
|
end
|
33
46
|
end
|
34
47
|
end
|
metadata
CHANGED
@@ -1,151 +1,155 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: everbox_client
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.10
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.9
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- LI Daobing
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-02-14 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: oauth
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &19275280 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
25
22
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: highline
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: *19275280
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: highline
|
27
|
+
requirement: &19274860 !ruby/object:Gem::Requirement
|
31
28
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
36
33
|
type: :runtime
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: json_pure
|
40
34
|
prerelease: false
|
41
|
-
|
35
|
+
version_requirements: *19274860
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: json_pure
|
38
|
+
requirement: &19274420 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
47
44
|
type: :runtime
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: rest-client
|
51
45
|
prerelease: false
|
52
|
-
|
46
|
+
version_requirements: *19274420
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rest-client
|
49
|
+
requirement: &19274000 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
58
55
|
type: :runtime
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: launchy
|
62
56
|
prerelease: false
|
63
|
-
|
57
|
+
version_requirements: *19274000
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: launchy
|
60
|
+
requirement: &19273540 !ruby/object:Gem::Requirement
|
64
61
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version:
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
69
66
|
type: :runtime
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: rspec
|
73
67
|
prerelease: false
|
74
|
-
|
68
|
+
version_requirements: *19273540
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: &19273020 !ruby/object:Gem::Requirement
|
75
72
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version:
|
73
|
+
requirements:
|
74
|
+
- - =
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.8.7
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *19273020
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rspec
|
82
|
+
requirement: &19272600 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
80
88
|
type: :development
|
81
|
-
version_requirements: *id006
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: rdoc
|
84
89
|
prerelease: false
|
85
|
-
|
90
|
+
version_requirements: *19272600
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rdoc
|
93
|
+
requirement: &19272060 !ruby/object:Gem::Requirement
|
86
94
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version:
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
91
99
|
type: :development
|
92
|
-
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *19272060
|
93
102
|
description: EverBox Command Tool
|
94
|
-
email:
|
103
|
+
email:
|
95
104
|
- lidaobing@gmail.com
|
96
|
-
executables:
|
105
|
+
executables:
|
97
106
|
- everbox
|
98
107
|
extensions: []
|
99
|
-
|
100
|
-
extra_rdoc_files:
|
108
|
+
extra_rdoc_files:
|
101
109
|
- README.rdoc
|
102
110
|
- CHANGELOG.rdoc
|
103
|
-
files:
|
111
|
+
files:
|
104
112
|
- bin/everbox
|
105
|
-
- lib/everbox_client.rb
|
106
|
-
- lib/everbox_client/version.rb
|
107
|
-
- lib/everbox_client/models/path_entry.rb
|
108
113
|
- lib/everbox_client/models/account.rb
|
114
|
+
- lib/everbox_client/models/path_entry.rb
|
109
115
|
- lib/everbox_client/models/user.rb
|
110
|
-
- lib/everbox_client/
|
116
|
+
- lib/everbox_client/version.rb
|
111
117
|
- lib/everbox_client/cli.rb
|
118
|
+
- lib/everbox_client/runner.rb
|
112
119
|
- lib/everbox_client/exceptions.rb
|
113
|
-
-
|
114
|
-
- spec/spec_helper.rb
|
120
|
+
- lib/everbox_client.rb
|
115
121
|
- spec/everbox_client/models/path_entry_spec.rb
|
116
122
|
- spec/everbox_client/runner_spec.rb
|
123
|
+
- spec/spec_helper.rb
|
124
|
+
- spec/everbox_client_spec.rb
|
117
125
|
- README.rdoc
|
118
126
|
- CHANGELOG.rdoc
|
119
|
-
has_rdoc: true
|
120
127
|
homepage: http://www.everbox.com/
|
121
128
|
licenses: []
|
122
|
-
|
123
129
|
post_install_message:
|
124
130
|
rdoc_options: []
|
125
|
-
|
126
|
-
require_paths:
|
131
|
+
require_paths:
|
127
132
|
- lib
|
128
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
134
|
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version:
|
134
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
140
|
none: false
|
136
|
-
requirements:
|
137
|
-
- -
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version:
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
140
145
|
requirements: []
|
141
|
-
|
142
146
|
rubyforge_project:
|
143
|
-
rubygems_version: 1.
|
147
|
+
rubygems_version: 1.8.15
|
144
148
|
signing_key:
|
145
149
|
specification_version: 3
|
146
150
|
summary: EverBox Command Tool
|
147
|
-
test_files:
|
148
|
-
- spec/everbox_client_spec.rb
|
149
|
-
- spec/spec_helper.rb
|
151
|
+
test_files:
|
150
152
|
- spec/everbox_client/models/path_entry_spec.rb
|
151
153
|
- spec/everbox_client/runner_spec.rb
|
154
|
+
- spec/spec_helper.rb
|
155
|
+
- spec/everbox_client_spec.rb
|