pit 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +8 -2
- data/README +10 -1
- data/Rakefile +1 -1
- data/lib/pit.rb +9 -2
- metadata +1 -1
data/ChangeLog
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
|
1
|
+
2008-01-02 SATOH Hiroh <cho45@lowreal.net>
|
2
2
|
|
3
|
-
*
|
3
|
+
* Release 0.0.1:
|
4
|
+
* Release 0.0.2:
|
5
|
+
* change second argument of Pit.get
|
6
|
+
Pit.get("twitter.com", :require => {
|
7
|
+
"username" => "default value",
|
8
|
+
"password" => "default value"
|
9
|
+
})
|
4
10
|
|
data/README
CHANGED
@@ -38,7 +38,16 @@ ruby lib.
|
|
38
38
|
|
39
39
|
require "pit"
|
40
40
|
|
41
|
-
Pit.get("
|
41
|
+
config = Pit.get("twitter.com", :require => {
|
42
|
+
"username" => "default value",
|
43
|
+
"password" => "default value"
|
44
|
+
})
|
45
|
+
|
46
|
+
Pit.get("vox.com", :require => {
|
47
|
+
"username" => "default value",
|
48
|
+
"password" => "default value"
|
49
|
+
"nickname" => "default value"
|
50
|
+
})
|
42
51
|
|
43
52
|
== Copyright
|
44
53
|
|
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@ DESCRIPTION = "pit: account management tool"
|
|
17
17
|
RUBYFORGE_PROJECT = "lowreal"
|
18
18
|
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
19
19
|
BIN_FILES = %w( pit )
|
20
|
-
VERS = "0.0.
|
20
|
+
VERS = "0.0.2"
|
21
21
|
|
22
22
|
|
23
23
|
REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
data/lib/pit.rb
CHANGED
@@ -12,7 +12,7 @@ module Pit
|
|
12
12
|
if opts.key?(:data)
|
13
13
|
result = opts[:data]
|
14
14
|
else
|
15
|
-
c = self.get(name).to_yaml
|
15
|
+
c = (opts[:config] || self.get(name)).to_yaml
|
16
16
|
t = Tempfile.new("pit")
|
17
17
|
t << c
|
18
18
|
t.close
|
@@ -32,7 +32,14 @@ module Pit
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.get(name, opts={})
|
35
|
-
self.load[name] || {
|
35
|
+
ret = self.load[name] || {}
|
36
|
+
if opts[:require]
|
37
|
+
unless opts[:require].keys.all? {|k| ret[k] }
|
38
|
+
ret.update(opts[:require])
|
39
|
+
ret = self.set(name, :config => ret)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
ret || {"username"=>"", "password"=>""}
|
36
43
|
end
|
37
44
|
|
38
45
|
def self.switch(name, opts={})
|