kech 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/kech +9 -8
- data/lib/kech/version.rb +1 -1
- metadata +2 -2
data/bin/kech
CHANGED
@@ -4,18 +4,19 @@ require 'yaml'
|
|
4
4
|
require 'catch'
|
5
5
|
|
6
6
|
class Kech < Thor
|
7
|
-
|
7
|
+
@@credentials_file_path = ENV["GEM_HOME"]
|
8
|
+
@@credentials_file = File.path(@@credentials_file_path + ".kech_config")
|
9
|
+
|
8
10
|
def self.get_credentials
|
9
|
-
if File.exists?(
|
10
|
-
credentials = YAML::load_file(
|
11
|
-
else
|
12
|
-
Kech.set_credentials('','')
|
11
|
+
if File.exists?(File.expand_path(@@credentials_file))
|
12
|
+
credentials = YAML::load_file(File.expand_path(@@credentials_file))
|
13
|
+
else
|
13
14
|
false
|
14
15
|
end
|
15
16
|
end
|
16
|
-
|
17
|
+
|
17
18
|
def self.set_credentials(user, pass)
|
18
|
-
credentials = File.open(
|
19
|
+
credentials = File.open(File.expand_path(@@credentials_file), 'w')
|
19
20
|
credentials.write(YAML::dump( { :user => user, :pass => pass }))
|
20
21
|
credentials.close
|
21
22
|
end
|
@@ -32,7 +33,7 @@ class Kech < Thor
|
|
32
33
|
|
33
34
|
desc "status", "output current auth status"
|
34
35
|
def status
|
35
|
-
puts "Logged in as " + Kech.get_credentials[:user]
|
36
|
+
puts "Logged in as " + ( Kech.get_credentials ? Kech.get_credentials[:user] : "Nobody" )
|
36
37
|
end
|
37
38
|
|
38
39
|
desc "note", "create a new note"
|
data/lib/kech/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: catch
|