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 +1 -1
- data/CHANGELOG +4 -0
- data/Gemfile.lock +7 -7
- data/VERSION +1 -1
- data/features/configure.feature +6 -8
- data/features/step_definitions/configure_steps.rb +17 -0
- data/lib/breadboard/env_config.rb +10 -6
- data/readme.md +12 -0
- metadata +58 -75
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm gemset use breadboard
|
1
|
+
rvm gemset use breadboard --create
|
data/CHANGELOG
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
breadboard (1.1.0.
|
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
|
-
activesupport (= 3.0.
|
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.
|
15
|
-
activemodel (= 3.0.
|
16
|
-
activesupport (= 3.0.
|
17
|
-
activesupport (3.0.
|
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
|
1
|
+
1.1.0
|
data/features/configure.feature
CHANGED
@@ -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
|
-
|
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
|
-
|
7
|
-
|
8
|
-
if
|
9
|
-
|
10
|
-
|
11
|
-
@site
|
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
|
-
|
5
|
-
prerelease:
|
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
|
-
|
21
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
25
|
none: false
|
42
|
-
requirements:
|
26
|
+
requirements:
|
43
27
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
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
|
-
|
69
|
-
|
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
|
-
|
115
|
-
|
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
|
-
|
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.
|
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
|