engineyard-metadata 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/engineyard-metadata.gemspec +4 -4
- data/lib/engineyard-metadata/engine_yard_cloud_api.rb +1 -1
- data/lib/engineyard-metadata/metadata.rb +1 -1
- data/lib/engineyard-metadata/outsider.rb +5 -3
- data/spec/metadata_spec.rb +26 -14
- data/spec/spec_helper.rb +1 -1
- metadata +6 -6
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ begin
|
|
14
14
|
gem.add_dependency 'nap', '>=0.4'
|
15
15
|
gem.add_development_dependency "fakeweb"
|
16
16
|
gem.add_development_dependency "fakefs"
|
17
|
-
gem.add_development_dependency "rspec", "~>
|
17
|
+
gem.add_development_dependency "rspec", "~>2"
|
18
18
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
19
19
|
end
|
20
20
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/engineyard-metadata.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{engineyard-metadata}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Seamus Abshere"]
|
@@ -55,20 +55,20 @@ Gem::Specification.new do |s|
|
|
55
55
|
s.add_runtime_dependency(%q<nap>, [">= 0.4"])
|
56
56
|
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
57
57
|
s.add_development_dependency(%q<fakefs>, [">= 0"])
|
58
|
-
s.add_development_dependency(%q<rspec>, ["~>
|
58
|
+
s.add_development_dependency(%q<rspec>, ["~> 2"])
|
59
59
|
else
|
60
60
|
s.add_dependency(%q<activesupport>, [">= 2.3.4"])
|
61
61
|
s.add_dependency(%q<nap>, [">= 0.4"])
|
62
62
|
s.add_dependency(%q<fakeweb>, [">= 0"])
|
63
63
|
s.add_dependency(%q<fakefs>, [">= 0"])
|
64
|
-
s.add_dependency(%q<rspec>, ["~>
|
64
|
+
s.add_dependency(%q<rspec>, ["~> 2"])
|
65
65
|
end
|
66
66
|
else
|
67
67
|
s.add_dependency(%q<activesupport>, [">= 2.3.4"])
|
68
68
|
s.add_dependency(%q<nap>, [">= 0.4"])
|
69
69
|
s.add_dependency(%q<fakeweb>, [">= 0"])
|
70
70
|
s.add_dependency(%q<fakefs>, [">= 0"])
|
71
|
-
s.add_dependency(%q<rspec>, ["~>
|
71
|
+
s.add_dependency(%q<rspec>, ["~> 2"])
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -54,6 +54,8 @@ module EY
|
|
54
54
|
elsif ENV['EY_ENVIRONMENT_NAME']
|
55
55
|
ENV['EY_ENVIRONMENT_NAME']
|
56
56
|
end
|
57
|
+
raise RuntimeError, "[engineyard-metadata gem] You need to run this from the application repo, set EY::Metadata.environment_name= or set ENV['EY_ENVIRONMENT_NAME']" unless @environment_name.to_s.strip.length > 0
|
58
|
+
@environment_name
|
57
59
|
end
|
58
60
|
|
59
61
|
def ey_cloud_token=(str)
|
@@ -70,10 +72,10 @@ module EY
|
|
70
72
|
@ey_cloud_token = if ENV['EY_CLOUD_TOKEN']
|
71
73
|
ENV['EY_CLOUD_TOKEN']
|
72
74
|
elsif File.exist? eyrc_path
|
73
|
-
YAML.load(File.read(eyrc_path))['
|
74
|
-
else
|
75
|
-
raise RuntimeError, "[engineyard-metadata gem] You need to download #{eyrc_path} or set ENV['EY_CLOUD_TOKEN']"
|
75
|
+
YAML.load(File.read(eyrc_path))['api_token']
|
76
76
|
end
|
77
|
+
raise RuntimeError, "[engineyard-metadata gem] You need to have #{eyrc_path}, set EY::Metadata.ey_cloud_token= or set ENV['EY_CLOUD_TOKEN']" unless @ey_cloud_token.to_s.strip.length > 0
|
78
|
+
@ey_cloud_token
|
77
79
|
end
|
78
80
|
|
79
81
|
# The URL that EngineYard has on file for your application.
|
data/spec/metadata_spec.rb
CHANGED
@@ -118,31 +118,44 @@ end
|
|
118
118
|
|
119
119
|
describe 'EY::Metadata' do
|
120
120
|
describe "being executed from a developer/administrator's local machine" do
|
121
|
-
before
|
121
|
+
before do
|
122
122
|
pretend_we_are_on_a_developer_machine
|
123
|
-
# forcibly reload metadata.rb, so that it can extend itself based on its execution environment
|
124
123
|
load File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'engineyard-metadata', 'metadata.rb'))
|
124
|
+
EY::Metadata.clear
|
125
|
+
ENV.delete 'EY_CLOUD_TOKEN'
|
126
|
+
ENV.delete 'EY_ENVIRONMENT_NAME'
|
125
127
|
end
|
126
|
-
|
127
|
-
after
|
128
|
+
|
129
|
+
after do
|
128
130
|
stop_pretending
|
129
131
|
end
|
130
132
|
|
131
133
|
describe "controlled with environment variables" do
|
132
|
-
before
|
133
|
-
|
134
|
-
ENV['EY_CLOUD_TOKEN'] = FAKE_CLOUD_TOKEN
|
134
|
+
before do
|
135
|
+
ENV['EY_CLOUD_TOKEN'] = FAKE_CLOUD_TOKEN + 'aaa'
|
135
136
|
ENV['EY_ENVIRONMENT_NAME'] = FAKE_ENVIRONMENT_NAME
|
136
|
-
|
137
|
+
EY::Metadata.ey_cloud_token.should == FAKE_CLOUD_TOKEN + 'aaa' # sanity check
|
138
|
+
end
|
137
139
|
it_should_behave_like "all execution environments"
|
138
140
|
it_should_behave_like "execution outside the cloud"
|
139
141
|
end
|
140
142
|
|
141
143
|
describe "controlled with attr writers" do
|
142
|
-
before
|
143
|
-
EY::Metadata.
|
144
|
-
EY::Metadata.
|
144
|
+
before do
|
145
|
+
EY::Metadata.ey_cloud_token = FAKE_CLOUD_TOKEN + 'bbb'
|
146
|
+
EY::Metadata.environment_name = FAKE_ENVIRONMENT_NAME
|
147
|
+
EY::Metadata.ey_cloud_token.should == FAKE_CLOUD_TOKEN + 'bbb' # sanity check
|
148
|
+
end
|
149
|
+
it_should_behave_like "all execution environments"
|
150
|
+
it_should_behave_like "execution outside the cloud"
|
151
|
+
end
|
152
|
+
|
153
|
+
describe "depending on .eyrc" do
|
154
|
+
before do
|
155
|
+
FakeFS.activate!
|
156
|
+
File.open(EY::Metadata.eyrc_path, 'w') { |f| f.write({'api_token' => FAKE_CLOUD_TOKEN + 'ccc'}.to_yaml) }
|
145
157
|
EY::Metadata.environment_name = FAKE_ENVIRONMENT_NAME
|
158
|
+
EY::Metadata.ey_cloud_token.should == FAKE_CLOUD_TOKEN + 'ccc' # sanity check
|
146
159
|
end
|
147
160
|
it_should_behave_like "all execution environments"
|
148
161
|
it_should_behave_like "execution outside the cloud"
|
@@ -150,13 +163,12 @@ describe 'EY::Metadata' do
|
|
150
163
|
end
|
151
164
|
|
152
165
|
describe "being executed on an EngineYard AppCloud (i.e. Amazon EC2) instance" do
|
153
|
-
before
|
166
|
+
before do
|
154
167
|
pretend_we_are_on_an_engineyard_appcloud_ec2_instance
|
155
|
-
# forcibly reload metadata.rb, so that it can extend itself based on its execution environment
|
156
168
|
load File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'engineyard-metadata', 'metadata.rb'))
|
157
169
|
end
|
158
170
|
|
159
|
-
after
|
171
|
+
after do
|
160
172
|
stop_pretending
|
161
173
|
end
|
162
174
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard-metadata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Seamus Abshere
|
@@ -85,10 +85,10 @@ dependencies:
|
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
hash:
|
88
|
+
hash: 7
|
89
89
|
segments:
|
90
|
-
-
|
91
|
-
version: "
|
90
|
+
- 2
|
91
|
+
version: "2"
|
92
92
|
type: :development
|
93
93
|
version_requirements: *id005
|
94
94
|
description: Pulls metadata from EC2 and EngineYard so that your EngineYard AppCloud (Amazon EC2) instances know about each other.
|