sakura-cli 0.1.1 → 0.1.2

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: 8566975c821f240ec7db3c57603592a5e0fbe164
4
- data.tar.gz: 3c3790ea92f68174cb6e3fd3df38831919129138
3
+ metadata.gz: 70b4a24ef1c1453ac80352f25bf560218ed4afec
4
+ data.tar.gz: 1704d35e1999139f88a68499bc88b3938b2d56be
5
5
  SHA512:
6
- metadata.gz: 5773712c8dd30f04f68fe18e9c11ead53a75584788ce42dee5f0453e7ac2ede2d699081723a54786156f5e2149635d3b876f0f37719b429950ee9ab77f64b890
7
- data.tar.gz: e62355d238a16cf03fe4a80f11cf5fb7ffda1d9a0191577f63803ca8b6a8b9b8411deb3d86d5e73045e7342732f9923482ab29826dff395f99daba04cccdb586
6
+ metadata.gz: fa26f5bff9dda05a79d1d78a8f7e83eeaca2a4214b07c002115e25072c780ef9ea3d3d3cb7fa47c1a5ae12a567aa53a703a9fd4296c15d8282352c8d3602fa60
7
+ data.tar.gz: c221f8ebb169ee1649dac95f63b1ce0bbb82a6966733b7d4b9b678dac00463b66565048e4e25d43abdae491bd98d6d185994da6802ca9267562b014108d4068a
data/README.md CHANGED
@@ -19,6 +19,11 @@ Mac の場合は
19
19
 
20
20
  ```zsh
21
21
  brew install phantomjs
22
+
23
+ # Yosemite or newer
24
+ brew cask install phantomjs
25
+ brew install upx
26
+ upx -d /opt/homebrew-cask/Caskroom/phantomjs/2.0.0/phantomjs-2.0.0-macosx/bin/phantomjs
22
27
  ```
23
28
 
24
29
  でもインストールできます.
@@ -65,6 +70,7 @@ Commands:
65
70
  sakura mail password LOCAL_PART [PASSWORD] # Update password of a mail address
66
71
  sakura mail quota LOCAL_PART [VALUE] # Update or show quota of a mail address
67
72
  sakura mail scan LOCAL_PART [enable|disable] # Switch virus scan
73
+ sakura mail show LOCAL_PART # Display information about a mail address
68
74
  ```
69
75
 
70
76
  ### メールアドレス一覧
@@ -82,6 +88,18 @@ dummy002 true 6.28KB / 2GB
82
88
  postmaster true 0B / 2GB
83
89
  ```
84
90
 
91
+ ### メールアドレス詳細
92
+
93
+ ```sakura mail show``` コマンドで, あるメールアドレスの詳細を表示できます.
94
+
95
+ ```zsh
96
+ $ sakura mail show dummy
97
+ usage / quota: 379.13KB / 200MB
98
+ forward_to: foo@example.com
99
+ keep mail?: true
100
+ virus_scan?: false
101
+ ```
102
+
85
103
  ### メールアドレス作成
86
104
 
87
105
  ```sakura mail create``` コマンドで, メールアドレスを作成できます.
@@ -1,5 +1,5 @@
1
1
  module Sakura
2
2
  module Cli
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -32,7 +32,7 @@ module Sakura
32
32
  end
33
33
 
34
34
  def header
35
- str = tabularize('address', 'virus_scan', 'usage', 'quota')
35
+ str = tabularize('address', 'virus_scan', 'usage', 'quota', '%')
36
36
  "#{str}\n#{'-' * (str.size+1)}"
37
37
  end
38
38
 
@@ -40,7 +40,8 @@ module Sakura
40
40
  args[0].ljust(20) <<
41
41
  args[1].to_s.rjust(11) <<
42
42
  "#{args[2]} /".to_s.rjust(15) <<
43
- args[3].to_s.rjust(10)
43
+ args[3].to_s.rjust(10) <<
44
+ " (#{args[4].to_s.rjust(3)})"
44
45
  end
45
46
  end
46
47
 
@@ -158,18 +159,40 @@ module Sakura
158
159
  end
159
160
 
160
161
  def to_s
161
- self.class.tabularize(@address, @virus_scan, @usage, @quota)
162
+ self.class.tabularize(@address, @virus_scan, @usage, @quota, percentage(@usage, @quota))
162
163
  end
163
164
 
164
165
  def detail
165
166
  page = Client.current_session.get(MAIL_URL + @link)
166
167
 
167
168
  <<-EOS
168
- usage / quota: #{usage} / #{quota}
169
+ usage / quota: #{usage} / #{quota} (#{percentage(@usage, @quota)})
169
170
  forward_to: #{forward_list(page).join(' ')}
170
171
  keep mail?: #{keep(page)}
171
172
  virus_scan?: #{virus_scan}
172
173
  EOS
173
174
  end
175
+
176
+
177
+ private
178
+
179
+ def percentage(usage, quota)
180
+ usage, quota = [usage, quota].map {|i|
181
+ case i
182
+ when /([\d.]+)TB$/
183
+ $1.to_f * 1000000000000
184
+ when /([\d.]+)GB$/
185
+ $1.to_f * 1000000000
186
+ when /([\d.]+)MB$/
187
+ $1.to_f * 1000000
188
+ when /([\d.]+)KB$/
189
+ $1.to_f * 1000
190
+ when /([\d.]+)B$/
191
+ $1.to_i
192
+ end
193
+ }
194
+
195
+ "#{(usage*100/quota).to_i}%"
196
+ end
174
197
  end
175
198
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sakura-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shintaro Kojima
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-16 00:00:00.000000000 Z
11
+ date: 2016-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: poltergeist
@@ -108,9 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  requirements: []
110
110
  rubyforge_project:
111
- rubygems_version: 2.4.5
111
+ rubygems_version: 2.5.1
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Command-line tool for Sakura's Rental Server.
115
115
  test_files: []
116
- has_rdoc: