td 0.10.43 → 0.10.44

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.
data/ChangeLog CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ == 2012-09-04 version 0.10.44
3
+
4
+ * Added password:change subcommand
5
+
6
+
2
7
  == 2012-09-04 version 0.10.43
3
8
 
4
9
  * Updated user:password:change subcomamnd
@@ -269,6 +269,7 @@ module List
269
269
  add_list 'job:kill', %w[job_id], 'Kill or cancel a job', 'job:kill 1461'
270
270
 
271
271
  add_list 'account', %w[user_name?], 'Setup a Treasure Data account'
272
+ add_list 'password:change', %w[], 'Change password'
272
273
  add_list 'apikey:show', %w[], 'Show Treasure Data API key'
273
274
  add_list 'apikey:set', %w[apikey], 'Set Treasure Data API key'
274
275
 
@@ -0,0 +1,77 @@
1
+
2
+ module TreasureData
3
+ module Command
4
+
5
+ def password_change(op)
6
+ op.cmd_parse
7
+
8
+ old_password = nil
9
+ password = nil
10
+
11
+ begin
12
+ system "stty -echo" # TODO termios
13
+ print "Old password (typing will be hidden): "
14
+ old_password = STDIN.gets || ""
15
+ old_password = old_password[0..-2] # strip \n
16
+ rescue Interrupt
17
+ $stderr.print "\ncanceled."
18
+ exit 1
19
+ ensure
20
+ system "stty echo" # TODO termios
21
+ print "\n"
22
+ end
23
+
24
+ if old_password.empty?
25
+ $stderr.puts "canceled."
26
+ exit 0
27
+ end
28
+
29
+ 3.times do
30
+ begin
31
+ system "stty -echo" # TODO termios
32
+ print "New password (typing will be hidden): "
33
+ password = STDIN.gets || ""
34
+ password = password[0..-2] # strip \n
35
+ rescue Interrupt
36
+ $stderr.print "\ncanceled."
37
+ exit 1
38
+ ensure
39
+ system "stty echo" # TODO termios
40
+ print "\n"
41
+ end
42
+
43
+ if password.empty?
44
+ $stderr.puts "canceled."
45
+ exit 0
46
+ end
47
+
48
+ begin
49
+ system "stty -echo" # TODO termios
50
+ print "Retype new password: "
51
+ password2 = STDIN.gets || ""
52
+ password2 = password2[0..-2] # strip \n
53
+ rescue Interrupt
54
+ $stderr.print "\ncanceled."
55
+ exit 1
56
+ ensure
57
+ system "stty echo" # TODO termios
58
+ print "\n"
59
+ end
60
+
61
+ if password == password2
62
+ break
63
+ end
64
+
65
+ puts "Doesn't match."
66
+ end
67
+
68
+ client = get_client(:ssl => true)
69
+
70
+ client.change_my_password(old_password, password)
71
+
72
+ $stderr.puts "Password changed."
73
+ end
74
+
75
+ end
76
+ end
77
+
@@ -1,5 +1,5 @@
1
1
  module TreasureData
2
2
 
3
- VERSION = '0.10.43'
3
+ VERSION = '0.10.44'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.43
4
+ version: 0.10.44
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 0.8.24
69
+ version: 0.8.25
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 0.8.24
77
+ version: 0.8.25
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: td-logger
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -148,6 +148,7 @@ files:
148
148
  - lib/td/command/job.rb
149
149
  - lib/td/command/list.rb
150
150
  - lib/td/command/org.rb
151
+ - lib/td/command/password.rb
151
152
  - lib/td/command/query.rb
152
153
  - lib/td/command/result.rb
153
154
  - lib/td/command/role.rb