everbox_client 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,23 +1,36 @@
1
- == 0.0.9 (2011-04-22)
1
+ ## 0.0.12 (2012-03-29)
2
+
3
+ * BUG: not honor http_proxy env when put file. https://github.com/everbox/everbox-client-ruby/issues/3
4
+
5
+ ## 0.0.11 (2012-02-16)
6
+
7
+ * honor http_proxy env.
8
+
9
+ ## 0.0.10 (2012-02-13)
10
+
11
+ * use oauth login by default.
12
+
13
+ ## 0.0.9 (2011-04-22)
14
+
2
15
  * now works under ruby 1.9.
3
16
  * now works under Windows.
4
17
  * everbox cat use stream download (0.0.8 will print it to stdout after all data
5
18
  downloaded).
6
19
 
7
- == 0.0.8 (2011-04-22)
20
+ ## 0.0.8 (2011-04-22)
8
21
 
9
22
  * everbox help and everbox cat works.
10
23
 
11
- == 0.0.7 (2011-01-21)
24
+ ## 0.0.7 (2011-01-21)
12
25
 
13
26
  * everbox prepare_put works
14
27
 
15
- == 0.0.6 (2011-01-06)
28
+ ## 0.0.6 (2011-01-06)
16
29
 
17
30
  * everbox ls support argument as path
18
31
  * everbox config (print config or set config)
19
32
 
20
- == 0.0.5 (2010-12-02)
33
+ ## 0.0.5 (2010-12-02)
21
34
 
22
35
  * OAuth login: "everbox login --oauth"
23
36
  * show user info and space info: "everbox info"
@@ -1,12 +1,13 @@
1
- = everbox_client - EverBox 命令行及调试工具
1
+ # everbox_client - EverBox 命令行及调试工具
2
2
 
3
- == 安装
3
+ ## 安装
4
4
 
5
5
  $ gem install everbox_client
6
6
 
7
- == 使用方法
7
+ ## 使用方法
8
+
9
+ ### 列出全部可用命令
8
10
 
9
- === 列出全部可用命令
10
11
  $ everbox
11
12
  Usage: everbox [options] <command>
12
13
 
@@ -27,13 +28,14 @@
27
28
  pwd print working dir
28
29
  rm delete file or directory
29
30
 
30
- === 显示单个命令的帮助
31
+ ### 显示单个命令的帮助
32
+
31
33
  $ everbox help login
32
34
  Usage:
33
35
 
34
36
  everbox login
35
37
  登录 everbox, 登录完成后的 token 保存在 $HOME/.everbox_client/config
36
38
 
37
- === 环境变量
39
+ ### 环境变量
38
40
 
39
41
  http_proxy: 用于设置代理,比如 export http_proxy="http://192.168.2.1:3128"
@@ -1,5 +1,7 @@
1
1
  require 'pp'
2
2
 
3
+ require 'restclient'
4
+
3
5
  require 'everbox_client/runner'
4
6
 
5
7
  module EverboxClient
@@ -45,6 +47,7 @@ module EverboxClient
45
47
  @stdin = stdin
46
48
  @stderr = stderr
47
49
  extract_command_and_parse_options(arguments)
50
+ parse_env
48
51
 
49
52
  if valid_command?
50
53
  begin
@@ -60,23 +63,20 @@ module EverboxClient
60
63
  usage
61
64
  end
62
65
  end
63
- protected
64
66
 
67
+ protected
68
+ def parse_env
69
+ RestClient.proxy = ENV['http_proxy'] if ENV['http_proxy']
70
+ end
65
71
 
66
72
  def extract_command_and_parse_options(arguments)
67
73
  parse_options(arguments)
68
74
  @command, *@args = ARGV
69
75
  end
76
+
70
77
  def option_parser(arguments = "")
71
78
  option_parser = OptionParser.new do |opts|
72
79
  opts.banner = "Usage: #{File.basename($0)} [options] <command>"
73
-
74
- ## Common Options
75
-
76
-
77
- #opts.on("--scope SCOPE", "Specifies the scope (Google-specific).") do |v|
78
- # options[:scope] = v
79
- #end
80
80
  end
81
81
  end
82
82
 
@@ -88,7 +88,7 @@ module EverboxClient
88
88
  escaped_pairs = options[:params].collect do |pair|
89
89
  if pair =~ /:/
90
90
  Hash[*pair.split(":", 2)].collect do |k,v|
91
- [CGI.escape(k.strip), CGI.escape(v.strip)] * "="
91
+ [CGI.escape(k.strip), CGI.escape(v.strip)] * "="
92
92
  end
93
93
  else
94
94
  pair
@@ -1,3 +1,3 @@
1
1
  module EverboxClient
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ require 'everbox_client/cli'
4
+
5
+ module EverboxClient
6
+ describe CLI do
7
+ context "#parse_env" do
8
+ before do
9
+ @cli = CLI.new
10
+ end
11
+
12
+ it "when ENV['http_proxy'] set" do
13
+ ENV['http_proxy'] = 'http://1.2.3.4:3128'
14
+ @cli.send :parse_env
15
+ RestClient.proxy.should == ENV['http_proxy']
16
+ RestClient.proxy = nil
17
+ ENV['http_proxy'] = nil
18
+ end
19
+
20
+
21
+ it "when ENV['http_proxy'] not set" do
22
+ ENV['http_proxy'] = nil
23
+ @cli.send :parse_env
24
+ RestClient.proxy.should be_nil
25
+ end
26
+ end
27
+ end
28
+ end
@@ -16,14 +16,8 @@ module EverboxClient
16
16
  it { should_not be_file }
17
17
  it { should be_dir }
18
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" }
26
- end
19
+ its(:basename) { should == "foo" }
20
+ its(:to_line) { should == " 1932891\tfoo/\n" }
27
21
  end
28
22
 
29
23
  context "file" do
@@ -35,14 +29,8 @@ module EverboxClient
35
29
  it { should be_file }
36
30
  it { should_not be_dir }
37
31
  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" }
45
- end
32
+ its(:basename) { should == "foo" }
33
+ its(:to_line) { should == " 1932891\tfoo\n" }
46
34
  end
47
35
  end
48
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: everbox_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-17 00:00:00.000000000Z
12
+ date: 2012-03-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth
16
- requirement: &7721640 !ruby/object:Gem::Requirement
16
+ requirement: &9762900 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *7721640
24
+ version_requirements: *9762900
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: highline
27
- requirement: &7720400 !ruby/object:Gem::Requirement
27
+ requirement: &9762480 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *7720400
35
+ version_requirements: *9762480
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json_pure
38
- requirement: &7719960 !ruby/object:Gem::Requirement
38
+ requirement: &9762060 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *7719960
46
+ version_requirements: *9762060
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rest-client
49
- requirement: &7719540 !ruby/object:Gem::Requirement
49
+ requirement: &9761640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *7719540
57
+ version_requirements: *9761640
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: launchy
60
- requirement: &7719120 !ruby/object:Gem::Requirement
60
+ requirement: &9761220 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *7719120
68
+ version_requirements: *9761220
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
- requirement: &7718620 !ruby/object:Gem::Requirement
71
+ requirement: &9760720 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - =
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.8.7
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *7718620
79
+ version_requirements: *9760720
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &7718200 !ruby/object:Gem::Requirement
82
+ requirement: &9760300 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *7718200
90
+ version_requirements: *9760300
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rdoc
93
- requirement: &7717680 !ruby/object:Gem::Requirement
93
+ requirement: &9759840 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,16 +98,14 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *7717680
101
+ version_requirements: *9759840
102
102
  description: EverBox Command Tool
103
103
  email:
104
104
  - lidaobing@gmail.com
105
105
  executables:
106
106
  - everbox
107
107
  extensions: []
108
- extra_rdoc_files:
109
- - README.rdoc
110
- - CHANGELOG.rdoc
108
+ extra_rdoc_files: []
111
109
  files:
112
110
  - bin/everbox
113
111
  - lib/everbox_client/models/account.rb
@@ -120,10 +118,11 @@ files:
120
118
  - lib/everbox_client.rb
121
119
  - spec/everbox_client/models/path_entry_spec.rb
122
120
  - spec/everbox_client/runner_spec.rb
121
+ - spec/everbox_client/cli_spec.rb
123
122
  - spec/spec_helper.rb
124
123
  - spec/everbox_client_spec.rb
125
- - README.rdoc
126
- - CHANGELOG.rdoc
124
+ - README.md
125
+ - NEWS.md
127
126
  homepage: http://www.everbox.com/
128
127
  licenses: []
129
128
  post_install_message:
@@ -151,5 +150,6 @@ summary: EverBox Command Tool
151
150
  test_files:
152
151
  - spec/everbox_client/models/path_entry_spec.rb
153
152
  - spec/everbox_client/runner_spec.rb
153
+ - spec/everbox_client/cli_spec.rb
154
154
  - spec/spec_helper.rb
155
155
  - spec/everbox_client_spec.rb