timestreamapp 0.0.4 → 0.0.5

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.
@@ -1,3 +1,3 @@
1
1
  module Timestream
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/timestream.rb CHANGED
@@ -70,20 +70,39 @@ module Timestream
70
70
  end
71
71
  end
72
72
 
73
+ def ask_password(statement, color=nil)
74
+ say("#{statement} ", color)
75
+ # Hide standard input
76
+ system "stty -echo"
77
+ password = $stdin.gets.strip
78
+ # Restore standard input
79
+ system "stty echo"
80
+ system "echo "
81
+ return password
82
+ end
83
+
84
+ end
85
+
86
+ desc "login2", "Login2"
87
+ def login2
88
+ password = ask_password "Password:"
89
+ puts password
73
90
  end
74
91
 
75
92
  desc "login", "Login to your TimeStream account"
76
93
  def login
77
94
  # Ask for credentials
78
95
  username = ask "Username:"
79
- password = ask "Password:"
96
+ # password = ask "Password:"
97
+ password = ask_password "Password:"
80
98
 
81
99
  # Hit the login API and capture the response
82
100
  response = HTTParty.post("https://timestreamapp.com/login.txt", :query => {:username => username, :password => password})
83
101
 
84
102
  if response.body == 'Success: Valid credentials'
85
103
  creds = {:username => username, :password => password}
86
- create_file "~/.tsconfig", JSON.pretty_generate(creds), :force => true
104
+ # create_file "~/.tsconfig", JSON.pretty_generate(creds), :force => true
105
+ create_file "~/.tsconfig", JSON.pretty_generate(creds), {:force => true, :verbose => false}
87
106
  say(response.body, :green)
88
107
  else
89
108
  say("Invalid credentials, please try again.", :red)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timestreamapp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ahmad Varoqua
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-29 00:00:00 Z
18
+ date: 2011-06-30 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: thor