breadboard 1.1.0.rc1 → 1.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v1.1.0.rc2
2
+ fix bug so that site set in env block returns URI instance
1
3
  v1.1.0.rc1
2
4
  set user, password parameters with block instead of hash (see the README).
3
5
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- breadboard (1.0.2)
4
+ breadboard (1.1.0.rc2)
5
5
  activeresource (~> 3.0)
6
6
 
7
7
  GEM
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0.rc1
1
+ 1.1.0.rc2
@@ -131,6 +131,7 @@ Then /^I should be able to configure model with user, password$/ do
131
131
  end
132
132
  end
133
133
 
134
+ Venue.site.should be_kind_of URI
134
135
  Venue.site.to_s.should == "http://livesite"
135
136
  Venue.password.should == "secret"
136
137
  end
@@ -2,25 +2,32 @@ module Breadboard
2
2
  module Config
3
3
  # holds site, user, password values for an environment instance
4
4
  class EnvConfig
5
- def initialize
6
- @config = {}
5
+ def site(url=nil)
6
+ return @site unless url
7
+
8
+ if url.kind_of?(URI)
9
+ @site = url
10
+ else
11
+ @site = URI.parse url
12
+ end
7
13
  end
8
14
 
9
- def site=(url)
10
- @config[:site] = url
15
+ def user(username=nil)
16
+ return @user unless username
17
+ @user = username
11
18
  end
12
19
 
13
- def method_missing(method_name, *args, &block)
14
- return @config[method_name] if args.length == 0
15
- @config[method_name] = args.first
20
+ def password(pass=nil)
21
+ return @password unless pass
22
+ @password = pass
16
23
  end
17
24
 
18
25
  def to_s
19
- @config[:site].to_s
26
+ @site.to_s
20
27
  end
21
28
 
22
29
  def empty?
23
- @config.empty?
30
+ !(site || password || user)
24
31
  end
25
32
  end
26
33
  end
data/readme.md CHANGED
@@ -76,7 +76,7 @@ Now suppose you have a 'Book' model that needs to connect to a different service
76
76
  end
77
77
  end
78
78
 
79
- If you need to set user and password for a restful service, you can do so with a block
79
+ If you need to set user and password for a restful service, you can do so with a block (as of version 1.1.0.rc1)
80
80
 
81
81
  Breadboard.configure do
82
82
  model Book do
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breadboard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424039
4
+ hash: 15424033
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
9
  - 0
10
10
  - rc
11
- - 1
12
- version: 1.1.0.rc1
11
+ - 2
12
+ version: 1.1.0.rc2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Matt Parker