pit 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/ChangeLog +8 -2
  2. data/README +10 -1
  3. data/Rakefile +1 -1
  4. data/lib/pit.rb +9 -2
  5. metadata +1 -1
data/ChangeLog CHANGED
@@ -1,4 +1,10 @@
1
- == 0.0.1 / 2008-01-02
1
+ 2008-01-02 SATOH Hiroh <cho45@lowreal.net>
2
2
 
3
- * initial release
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("foo")
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.1"
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] || {"username"=>"", "password"=>""}
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={})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - cho45