breadboard 1.1.0.rc4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm gemset use breadboard
1
+ rvm gemset use breadboard --create
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v1.1.0
2
+
3
+ Supports blocks as configuration values. Will Read and Matt Parker.
4
+
1
5
  v1.1.0.rc2
2
6
  fix bug so that site set in env block returns URI instance
3
7
  v1.1.0.rc1
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- breadboard (1.1.0.rc3)
4
+ breadboard (1.1.0.rc4)
5
5
  activeresource (~> 3.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- activemodel (3.0.11)
11
- activesupport (= 3.0.11)
10
+ activemodel (3.0.20)
11
+ activesupport (= 3.0.20)
12
12
  builder (~> 2.1.2)
13
13
  i18n (~> 0.5.0)
14
- activeresource (3.0.11)
15
- activemodel (= 3.0.11)
16
- activesupport (= 3.0.11)
17
- activesupport (3.0.11)
14
+ activeresource (3.0.20)
15
+ activemodel (= 3.0.20)
16
+ activesupport (= 3.0.20)
17
+ activesupport (3.0.20)
18
18
  builder (2.1.2)
19
19
  cucumber (0.10.2)
20
20
  builder (>= 2.1.2)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0.rc4
1
+ 1.1.0
@@ -3,34 +3,32 @@ Feature: Configuring Breadboard
3
3
  I want to be able to configure breadboard in ruby (not YAML)
4
4
  So that my engines can each update the breadboard configuration
5
5
 
6
- Scenario: Configure Breadboard with Ruby, not YAML
6
+ Background:
7
7
  Given I have required breadboard
8
+
9
+ Scenario: Configure Breadboard with Ruby, not YAML
8
10
  Then I should be able to configure breadboard via Ruby blocks
9
11
 
10
12
  Scenario: default configuration
11
- Given I have required breadboard
12
13
  Then I should be able to create a default configuration via the "default" Config method
13
14
 
14
15
  Scenario: configuring a model by lowercase methods
15
- Given I have required breadboard
16
16
  Then I should be able to configure models via their lowercased, underscored method equivalents
17
17
 
18
18
  Scenario: configuring a model via the "model" method
19
- Given I have required breadboard
20
19
  Then I should be able to configure a model by passing the constant for the model to the "model" method
21
20
 
22
21
  Scenario: configuring multiple models via the "models" method
23
- Given I have required breadboard
24
22
  Then I should be able to configure multiple models simultaneously by passing their constants to the "models" method
25
23
 
26
24
  Scenario: configuring the method for determining the Rails environment
27
- Given I have required breadboard
28
25
  Then I should be able to override the default Rails.env environment retrieval in case I'm not in a rails app
29
26
 
30
27
  Scenario: Configure Breadboard with hash instead of url
31
- Given I have required breadboard
32
28
  Then I should be able to configure breadboard with hash
33
29
 
34
30
  Scenario: Configure model with user, password
35
- Given I have required breadboard
36
31
  Then I should be able to configure model with user, password
32
+
33
+ Scenario: Configure model with block
34
+ Then I should be able to configure a model with a block
@@ -136,3 +136,20 @@ Then /^I should be able to configure model with user, password$/ do
136
136
  Venue.password.should == "secret"
137
137
  end
138
138
 
139
+ Then /^I should be able to configure a model with a block$/ do
140
+ class ConfigWithBlockModel < ActiveResource::Base
141
+ end
142
+
143
+ Breadboard.configure do
144
+ env { "production" }
145
+
146
+ model ConfigWithBlockModel do
147
+ all do
148
+ site -> { "http://foobar" }
149
+ end
150
+ end
151
+ end
152
+
153
+ ConfigWithBlockModel.site.should be_kind_of URI
154
+ ConfigWithBlockModel.site.to_s.should == "http://foobar"
155
+ end
@@ -3,12 +3,16 @@ module Breadboard
3
3
  # holds site, user, password values for an environment instance
4
4
  class EnvConfig
5
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
6
+ @site = url if url
7
+
8
+ return @site if @site.kind_of?(URI)
9
+
10
+ if @site
11
+ if @site.respond_to? :call
12
+ URI.parse @site.call
13
+ else
14
+ URI.parse @site
15
+ end
12
16
  end
13
17
  end
14
18
 
data/readme.md CHANGED
@@ -142,3 +142,15 @@ via the `models` method:
142
142
  production "http://my.production.publishing.service.provider"
143
143
  end
144
144
  end
145
+
146
+ ### block values
147
+
148
+ If you want a lazily evaluated site attribute (for example, if you need to add parameters into your site url at runtime), then simply set the site as a block:
149
+
150
+ ```ruby
151
+ Breadboard.configure do
152
+ some_model do
153
+ all -> { "http://somewhere/parents/#{Parent.instance.id}" }
154
+ end
155
+ end
156
+ ```
metadata CHANGED
@@ -1,80 +1,72 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: breadboard
3
- version: !ruby/object:Gem::Version
4
- hash: 15424045
5
- prerelease: 6
6
- segments:
7
- - 1
8
- - 1
9
- - 0
10
- - rc
11
- - 4
12
- version: 1.1.0.rc4
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ prerelease:
13
6
  platform: ruby
14
- authors:
7
+ authors:
15
8
  - Matt Parker
16
9
  autorequire:
17
10
  bindir: bin
18
11
  cert_chain: []
19
-
20
- date: 2011-04-26 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
12
+ date: 2011-04-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
23
15
  name: activeresource
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
26
17
  none: false
27
- requirements:
18
+ requirements:
28
19
  - - ~>
29
- - !ruby/object:Gem::Version
30
- hash: 7
31
- segments:
32
- - 3
33
- - 0
34
- version: "3.0"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
35
22
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: cucumber
39
23
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
41
25
  none: false
42
- requirements:
26
+ requirements:
43
27
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 55
46
- segments:
47
- - 0
48
- - 10
49
- - 0
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: cucumber
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
50
37
  version: 0.10.0
51
38
  type: :development
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: rspec
55
39
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.10.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
57
49
  none: false
58
- requirements:
50
+ requirements:
59
51
  - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 31
62
- segments:
63
- - 2
64
- - 4
65
- - 0
52
+ - !ruby/object:Gem::Version
66
53
  version: 2.4.0
67
54
  type: :development
68
- version_requirements: *id003
69
- description: "Breadboard allows you to define what services your ActiveResource derived classes connect to based on your rails environment. "
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.4.0
62
+ description: ! 'Breadboard allows you to define what services your ActiveResource
63
+ derived classes connect to based on your rails environment. '
70
64
  email: moonmaster9000@gmail.com
71
65
  executables: []
72
-
73
66
  extensions: []
74
-
75
- extra_rdoc_files:
67
+ extra_rdoc_files:
76
68
  - readme.md
77
- files:
69
+ files:
78
70
  - .gitignore
79
71
  - .rvmrc
80
72
  - CHANGELOG
@@ -100,38 +92,29 @@ files:
100
92
  - readme.md
101
93
  homepage: http://github.com/moonmaster9000/breadboard
102
94
  licenses: []
103
-
104
95
  post_install_message:
105
96
  rdoc_options: []
106
-
107
- require_paths:
97
+ require_paths:
108
98
  - lib
109
- required_ruby_version: !ruby/object:Gem::Requirement
99
+ required_ruby_version: !ruby/object:Gem::Requirement
110
100
  none: false
111
- requirements:
112
- - - ">="
113
- - !ruby/object:Gem::Version
114
- hash: 3
115
- segments:
116
- - 0
117
- version: "0"
118
- required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
106
  none: false
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- hash: 3
124
- segments:
125
- - 0
126
- version: "0"
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
127
111
  requirements: []
128
-
129
112
  rubyforge_project:
130
- rubygems_version: 1.8.10
113
+ rubygems_version: 1.8.24
131
114
  signing_key:
132
115
  specification_version: 3
133
116
  summary: Simple, environment-based service provider configuration for ActiveResource
134
- test_files:
117
+ test_files:
135
118
  - features/active_resource.feature
136
119
  - features/configure.feature
137
120
  - features/reset.feature