engineyard 1.4.7 → 1.4.8

Sign up to get free protection for your applications and to get access to all the features.
data/lib/engineyard.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  module EY
2
2
  require 'engineyard/ruby_ext'
3
3
  require 'engineyard/version'
4
+ require 'engineyard/error'
5
+ require 'engineyard/config'
4
6
 
5
7
  autoload :API, 'engineyard/api'
6
8
  autoload :Collection, 'engineyard/collection'
7
- autoload :Config, 'engineyard/config'
8
- autoload :Error, 'engineyard/error'
9
9
  autoload :Model, 'engineyard/model'
10
10
  autoload :Repo, 'engineyard/repo'
11
11
  autoload :Resolver, 'engineyard/resolver'
@@ -15,16 +15,15 @@ module EY
15
15
  def debug(*); end
16
16
  end
17
17
 
18
- class << self
19
- attr_accessor :ui
20
-
21
- def ui
22
- @ui ||= UI.new
23
- end
18
+ def self.ui
19
+ @ui ||= UI.new
20
+ end
24
21
 
25
- def config
26
- @config ||= EY::Config.new
27
- end
22
+ def self.ui=(ui)
23
+ @ui = ui
24
+ end
28
25
 
26
+ def self.config
27
+ @config ||= EY::Config.new
29
28
  end
30
29
  end
@@ -1,4 +1,9 @@
1
1
  require 'engineyard/model'
2
+ require 'yaml'
3
+ require 'rest_client'
4
+ require 'engineyard/rest_client_ext'
5
+ require 'json'
6
+ require 'engineyard/eyrc'
2
7
 
3
8
  module EY
4
9
  class API
@@ -7,8 +12,8 @@ module EY
7
12
  USER_AGENT_STRING = "EngineYardCLI/#{VERSION}"
8
13
 
9
14
  def initialize(token = nil)
10
- @token ||= token
11
- @token ||= self.class.read_token
15
+ @token = token
16
+ @token ||= EY::EYRC.load.api_token
12
17
  raise ArgumentError, "EY Cloud API token required" unless @token
13
18
  end
14
19
 
@@ -103,38 +108,9 @@ module EY
103
108
  def self.fetch_token(email, password)
104
109
  api_token = request("/authenticate", :method => "post",
105
110
  :params => { :email => email, :password => password })["api_token"]
106
- save_token(api_token)
111
+ EY::EYRC.load.api_token = api_token
107
112
  api_token
108
113
  end
109
114
 
110
- def self.read_token(file = nil)
111
- file ||= ENV['EYRC'] || File.expand_path("~/.eyrc")
112
- return false unless File.exists?(file)
113
-
114
- require 'yaml'
115
-
116
- data = YAML.load_file(file)
117
- if EY.config.default_endpoint?
118
- data["api_token"]
119
- else
120
- (data[EY.config.endpoint.to_s] || {})["api_token"]
121
- end
122
- end
123
-
124
- def self.save_token(token, file = nil)
125
- file ||= ENV['EYRC'] || File.expand_path("~/.eyrc")
126
- require 'yaml'
127
-
128
- data = File.exists?(file) ? YAML.load_file(file) : {}
129
- if EY.config.default_endpoint?
130
- data.merge!("api_token" => token)
131
- else
132
- data.merge!(EY.config.endpoint.to_s => {"api_token" => token})
133
- end
134
-
135
- File.open(file, "w"){|f| YAML.dump(data, f) }
136
- true
137
- end
138
-
139
115
  end # API
140
116
  end # EY
@@ -4,10 +4,10 @@ require 'engineyard/thor'
4
4
 
5
5
  module EY
6
6
  class CLI < EY::Thor
7
- autoload :API, 'engineyard/cli/api'
8
- autoload :UI, 'engineyard/cli/ui'
9
- autoload :Recipes, 'engineyard/cli/recipes'
10
- autoload :Web, 'engineyard/cli/web'
7
+ require 'engineyard/cli/recipes'
8
+ require 'engineyard/cli/web'
9
+ require 'engineyard/cli/api'
10
+ require 'engineyard/cli/ui'
11
11
 
12
12
  include Thor::Actions
13
13
 
@@ -1,10 +1,13 @@
1
+ require 'highline'
2
+ require 'engineyard/api'
3
+
1
4
  module EY
2
5
  class CLI
3
6
  class API < EY::API
4
7
 
5
8
  def initialize(token = nil)
6
9
  @token = token
7
- @token ||= self.class.read_token
10
+ @token ||= EY::EYRC.load.api_token
8
11
  @token ||= self.class.fetch_token
9
12
  raise EY::Error, "Sorry, we couldn't get your API token." unless @token
10
13
  end
@@ -1,7 +1,7 @@
1
1
  module EY
2
2
  module Collection
3
- autoload :Abstract, 'engineyard/collection/abstract'
4
- autoload :Environments, 'engineyard/collection/environments'
5
- autoload :Apps, 'engineyard/collection/apps'
3
+ require 'engineyard/collection/abstract'
4
+ require 'engineyard/collection/environments'
5
+ require 'engineyard/collection/apps'
6
6
  end
7
7
  end
@@ -1,4 +1,5 @@
1
1
  require 'uri'
2
+ require 'engineyard/error'
2
3
 
3
4
  module EY
4
5
  class Config
@@ -26,15 +27,7 @@ module EY
26
27
  end
27
28
 
28
29
  def endpoint
29
- @endpoint ||= env_var_endpoint ||
30
- config_file_endpoint ||
31
- default_endpoint
32
- end
33
-
34
- def config_file_endpoint
35
- if endpoint = @config["endpoint"]
36
- assert_valid_endpoint endpoint, @file
37
- end
30
+ @endpoint ||= env_var_endpoint || default_endpoint
38
31
  end
39
32
 
40
33
  def env_var_endpoint
@@ -0,0 +1,52 @@
1
+ module EY
2
+ class EYRC
3
+ attr_reader :path
4
+
5
+ DEFAULT_PATH = "~/.eyrc"
6
+
7
+ def self.load
8
+ new(ENV['EYRC'] || DEFAULT_PATH)
9
+ end
10
+
11
+ def initialize(path)
12
+ self.path = path
13
+ end
14
+
15
+ def exist?
16
+ path.exist?
17
+ end
18
+
19
+ def api_token
20
+ self['api_token']
21
+ end
22
+
23
+ def api_token=(token)
24
+ self['api_token'] = token
25
+ end
26
+
27
+ private
28
+
29
+ def path=(p)
30
+ @path = Pathname.new(p).expand_path
31
+ end
32
+
33
+ def [](key)
34
+ read_data[key.to_s]
35
+ end
36
+
37
+ def []=(key,val)
38
+ merge_and_write(key.to_s => val)
39
+ val
40
+ end
41
+
42
+ def read_data
43
+ exist? && YAML.load(path.read) || {}
44
+ end
45
+
46
+ def merge_and_write(new_data)
47
+ to_write = read_data.merge(new_data)
48
+ path.open("w") {|f| YAML.dump(to_write, f) }
49
+ end
50
+
51
+ end
52
+ end
@@ -1,12 +1,12 @@
1
1
  module EY
2
2
  module Model
3
- autoload :ApiStruct, 'engineyard/model/api_struct'
4
- autoload :Account, 'engineyard/model/account'
5
- autoload :App, 'engineyard/model/app'
6
- autoload :Deployment, 'engineyard/model/deployment'
7
- autoload :Environment, 'engineyard/model/environment'
8
- autoload :Log, 'engineyard/model/log'
9
- autoload :Instance, 'engineyard/model/instance'
10
- autoload :User, 'engineyard/model/user'
3
+ require 'engineyard/model/api_struct'
4
+ require 'engineyard/model/account'
5
+ require 'engineyard/model/app'
6
+ require 'engineyard/model/deployment'
7
+ require 'engineyard/model/environment'
8
+ require 'engineyard/model/log'
9
+ require 'engineyard/model/instance'
10
+ require 'engineyard/model/user'
11
11
  end
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module EY
2
- VERSION = '1.4.7'
2
+ VERSION = '1.4.8'
3
3
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe EY::API do
4
4
  it "gets the api token from ~/.eyrc if possible" do
5
- write_yaml({"api_token" => "asdf"}, '~/.eyrc')
5
+ write_eyrc({"api_token" => "asdf"})
6
6
  EY::API.new.should == EY::API.new("asdf")
7
7
  end
8
8
 
@@ -17,31 +17,7 @@ describe EY::API do
17
17
  end
18
18
 
19
19
  it "puts the api token into .eyrc" do
20
- read_yaml('~/.eyrc')["api_token"].should == "asdf"
21
- end
22
- end
23
-
24
- describe "saving the token" do
25
- context "without a custom endpoint" do
26
- it "saves the api token at the root of the data" do
27
- EY::API.save_token("asdf")
28
- read_yaml('~/.eyrc')["api_token"].should == "asdf"
29
- end
30
- end
31
-
32
- context "with a custom endpoint" do
33
- before(:each) do
34
- write_yaml({"endpoint" => "http://localhost/"}, 'ey.yml')
35
- EY::API.save_token("asdf")
36
- end
37
-
38
- it "saves the api token" do
39
- read_yaml('~/.eyrc').should == {"http://localhost/" => {"api_token" => "asdf"}}
40
- end
41
-
42
- it "reads the api token" do
43
- EY::API.read_token.should == "asdf"
44
- end
20
+ read_eyrc["api_token"].should == "asdf"
45
21
  end
46
22
  end
47
23
 
@@ -11,10 +11,7 @@ describe EY::CLI::API do
11
11
  end
12
12
 
13
13
  it "gets the api token from ~/.eyrc if possible" do
14
- File.open(File.expand_path("~/.eyrc"), "w") do |fp|
15
- YAML.dump({"api_token" => "asdf"}, fp)
16
- end
17
-
14
+ write_eyrc({"api_token" => "asdf"})
18
15
  EY::CLI::API.new.should == EY::CLI::API.new("asdf")
19
16
  end
20
17
 
@@ -26,7 +23,7 @@ describe EY::CLI::API do
26
23
  EY::CLI::UI::Prompter.backend.next_answer = "my@email.example.com"
27
24
  EY::CLI::UI::Prompter.backend.next_answer = "secret"
28
25
 
29
- @token = EY::CLI::API.new
26
+ @api = EY::CLI::API.new
30
27
  end
31
28
 
32
29
  it "asks you for your credentials" do
@@ -34,12 +31,12 @@ describe EY::CLI::API do
34
31
  end
35
32
 
36
33
  it "gets the api token" do
37
- @token.should == EY::CLI::API.new("asdf")
34
+ @api.should == EY::CLI::API.new("asdf")
38
35
  end
39
36
 
40
37
  it "saves the api token to ~/.eyrc" do
41
- YAML.load_file(File.expand_path("~/.eyrc")).should == {"api_token" => "asdf"}
38
+ read_eyrc.should == {"api_token" => "asdf"}
42
39
  end
43
40
  end
44
41
 
45
- end
42
+ end
@@ -3,13 +3,15 @@ require 'uri'
3
3
 
4
4
  describe EY::Config do
5
5
  describe "environments" do
6
+ after { File.unlink('ey.yml') if File.exist?('ey.yml') }
7
+
6
8
  it "get loaded from the config file" do
7
- write_yaml("environments" => {"production" => {"default" => true}})
9
+ write_yaml({"environments" => {"production" => {"default" => true}}}, 'ey.yml')
8
10
  EY::Config.new.environments["production"]["default"].should be_true
9
11
  end
10
12
 
11
13
  it "are present when the config file has no environments key" do
12
- write_yaml("endpoint" => "http://localhost/")
14
+ write_yaml({}, 'ey.yml')
13
15
  EY::Config.new.environments.should == {}
14
16
  end
15
17
  end
@@ -19,43 +21,38 @@ describe EY::Config do
19
21
  EY::Config.new.endpoint.should == EY::Config.new.default_endpoint
20
22
  end
21
23
 
22
- it "gets loaded from the config file" do
23
- write_yaml("endpoint" => "http://localhost/")
24
- EY::Config.new.endpoint.should == URI.parse("http://localhost/")
24
+ it "loads the endpoint from $CLOUD_URL" do
25
+ ENV['CLOUD_URL'] = "http://fake.local/"
26
+ EY::Config.new.endpoint.should == URI.parse('http://fake.local')
27
+ ENV.delete('CLOUD_URL')
25
28
  end
26
29
 
27
30
  it "raises on an invalid endpoint" do
28
- write_yaml("endpoint" => "non/absolute")
31
+ ENV['CLOUD_URL'] = "non/absolute"
29
32
  lambda { EY::Config.new.endpoint }.
30
33
  should raise_error(EY::Config::ConfigurationError)
34
+ ENV.delete('CLOUD_URL')
31
35
  end
32
36
  end
33
37
 
34
- it "provides default_endpoint?" do
35
- write_yaml("endpoint" => "http://localhost/")
36
- EY::Config.new.default_endpoint?.should_not be_true
37
- end
38
-
39
38
  describe "files" do
40
- before do
41
- FakeFS::FileSystem.add('config')
42
- end
43
-
44
39
  it "looks for config/ey.yml" do
45
- write_yaml({"endpoint" => "http://something/"}, "ey.yml")
46
- write_yaml({"endpoint" => "http://localhost/"}, "config/ey.yml")
47
- EY::Config.new.endpoint.should == URI.parse("http://localhost/")
40
+ FileUtils.mkdir_p('config')
41
+
42
+ write_yaml({"environments" => {"staging" => {"default" => true}}}, "ey.yml")
43
+ write_yaml({"environments" => {"production" => {"default" => true}}}, "config/ey.yml")
44
+ EY::Config.new.default_environment.should == "production"
45
+
46
+ File.unlink('config/ey.yml') if File.exist?('config/ey.yml')
47
+ File.unlink('ey.yml') if File.exist?('ey.yml')
48
48
  end
49
49
 
50
50
  it "looks for ey.yml" do
51
- write_yaml({"endpoint" => "http://foo/"}, "ey.yml")
52
- EY::Config.new.endpoint.should == URI.parse("http://foo/")
53
- end
51
+ write_yaml({"environments" => {"staging" => {"default" => true}}}, "ey.yml")
54
52
 
55
- it "looks for the file given" do
56
- write_yaml({"endpoint" => "http://bar/"}, "summat.yml")
57
- EY::Config.new("summat.yml").endpoint.should == URI.parse("http://bar/")
53
+ EY::Config.new.default_environment.should == "staging"
54
+
55
+ File.unlink('ey.yml') if File.exist?('ey.yml')
58
56
  end
59
57
  end
60
-
61
58
  end
@@ -0,0 +1,64 @@
1
+ require 'spec_helper'
2
+ require 'engineyard/eyrc'
3
+
4
+ describe EY::EYRC do
5
+ describe ".load" do
6
+ it "looks for .eyrc in $EYRC if set" do
7
+ EY::EYRC.load.path.should == Pathname.new(ENV['EYRC'])
8
+ end
9
+
10
+ it "looks for .eyrc in $HOME/.eyrc by default" do
11
+ ENV.delete('EYRC')
12
+ EY::EYRC.load.path.should == Pathname.new("~/.eyrc").expand_path
13
+ end
14
+ end
15
+
16
+ describe ".new" do
17
+ it "looks for eyrc in any passed file location" do
18
+ EY::EYRC.new('/tmp/neweyrc').path.should == Pathname.new('/tmp/neweyrc')
19
+ end
20
+ end
21
+
22
+ context "with a non-existing .eyrc file" do
23
+ it "has nil api_token" do
24
+ File.exists?("/tmp/nonexistant").should be_false
25
+ eyrc = EY::EYRC.new('/tmp/nonexistant')
26
+ eyrc.exist?.should be_false
27
+ eyrc.api_token.should be_nil
28
+ end
29
+ end
30
+
31
+ context "saving api token" do
32
+ before do
33
+ EY::EYRC.load.api_token = 'abcd'
34
+ end
35
+
36
+ it "exists" do
37
+ EY::EYRC.load.exist?.should be_true
38
+ end
39
+
40
+ it "recalls the api_token" do
41
+ EY::EYRC.load.api_token.should == 'abcd'
42
+ end
43
+
44
+ it "writes the api_token to api_token: .eyrc" do
45
+ read_yaml(ENV['EYRC']).should == {"api_token" => "abcd"}
46
+ end
47
+ end
48
+
49
+ context "file contains other random info" do
50
+ before do
51
+ # contains legacy endpoint behavior, no longer supported, but we won't be destructive.
52
+ write_yaml({"api_token" => "1234", "http://localhost/" => {"api_token" => "5678"}}, ENV['EYRC'])
53
+ EY::EYRC.load.api_token = 'abcd' # overwrites 1234
54
+ end
55
+
56
+ it "recalls the api_token" do
57
+ EY::EYRC.load.api_token.should == 'abcd'
58
+ end
59
+
60
+ it "maintains other random info in the file" do
61
+ read_yaml(ENV['EYRC']).should == {"api_token" => "abcd", "http://localhost/" => {"api_token" => "5678"}}
62
+ end
63
+ end
64
+ end
@@ -2,7 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe EY::Repo do
4
4
  before(:each) do
5
- FakeFS.deactivate!
6
5
  @path = Pathname.new("/tmp/ey-test/.git/")
7
6
  @path.mkpath
8
7
  @r = EY::Repo.new("/tmp/ey-test")
@@ -10,7 +9,6 @@ describe EY::Repo do
10
9
 
11
10
  after(:each) do
12
11
  clear_urls
13
- FakeFS.activate!
14
12
  end
15
13
 
16
14
  def set_head(head)
@@ -5,7 +5,6 @@ describe "ey deploy without an eyrc file" do
5
5
  given "integration without an eyrc file"
6
6
 
7
7
  before(:each) do
8
- FileUtils.rm_rf(ENV['EYRC'])
9
8
  api_scenario "one app, one environment"
10
9
  end
11
10
 
@@ -122,9 +121,7 @@ describe "ey deploy" do
122
121
  end
123
122
 
124
123
  context "customized in ey.yml" do
125
- before { write_yaml({"environments" => {"giblets" => {
126
- "migration_command" => 'thor fancy:migrate',
127
- }}}) }
124
+ before { write_yaml({"environments" => {"giblets" => { "migration_command" => 'thor fancy:migrate' }}}, 'ey.yml') }
128
125
  after { File.unlink 'ey.yml' }
129
126
 
130
127
  it "migrates with the custom command by default" do
@@ -134,7 +131,7 @@ describe "ey deploy" do
134
131
  end
135
132
 
136
133
  context "disabled in ey.yml" do
137
- before { write_yaml({"environments" => {"giblets" => {"migrate" => false}}}) }
134
+ before { write_yaml({"environments" => {"giblets" => {"migrate" => false}}}, 'ey.yml') }
138
135
  after { File.unlink 'ey.yml' }
139
136
 
140
137
  it "does not migrate by default" do
@@ -155,7 +152,7 @@ describe "ey deploy" do
155
152
  end
156
153
 
157
154
  context "explicitly enabled in ey.yml (the default)" do
158
- before { write_yaml({"environments" => {"giblets" => {"migrate" => true}}}) }
155
+ before { write_yaml({"environments" => {"giblets" => {"migrate" => true}}}, 'ey.yml') }
159
156
  after { File.unlink 'ey.yml' }
160
157
 
161
158
  it "migrates with the default" do
@@ -165,10 +162,7 @@ describe "ey deploy" do
165
162
  end
166
163
 
167
164
  context "customized and disabled in ey.yml" do
168
- before { write_yaml({"environments" => {"giblets" => {
169
- "migrate" => false,
170
- "migration_command" => "thor fancy:migrate",
171
- }}}) }
165
+ before { write_yaml({"environments" => {"giblets" => { "migrate" => false, "migration_command" => "thor fancy:migrate" }}}, 'ey.yml') }
172
166
  after { File.unlink 'ey.yml' }
173
167
 
174
168
  it "does not migrate by default" do
@@ -243,7 +237,7 @@ describe "ey deploy" do
243
237
 
244
238
  context "when there is extra configuration" do
245
239
  before(:each) do
246
- write_yaml({"environments" => {"giblets" => {"bert" => "ernie"}}})
240
+ write_yaml({"environments" => {"giblets" => {"bert" => "ernie"}}}, 'ey.yml')
247
241
  end
248
242
 
249
243
  after(:each) do
@@ -258,7 +252,7 @@ describe "ey deploy" do
258
252
 
259
253
  context "with a configured default branch" do
260
254
  before(:each) do
261
- write_yaml({"environments" => {"giblets" => {"branch" => "master"}}})
255
+ write_yaml({"environments" => {"giblets" => {"branch" => "master"}}}, 'ey.yml')
262
256
  end
263
257
 
264
258
  after(:each) do
@@ -315,7 +309,7 @@ describe "ey deploy" do
315
309
 
316
310
  context "when ey.yml is present" do
317
311
  before do
318
- write_yaml({"environments" => {"giblets" => {"beer" => "stout"}}})
312
+ write_yaml({"environments" => {"giblets" => {"beer" => "stout"}}}, 'ey.yml')
319
313
  end
320
314
 
321
315
  after { File.unlink("ey.yml") }
@@ -28,9 +28,9 @@ describe "ey environments" do
28
28
  end
29
29
 
30
30
  it "reports failure to find a git repo when not in one" do
31
- Dir.chdir("/tmp") do
31
+ Dir.chdir(Dir.tmpdir) do
32
32
  ey %w[environments], :expect_failure => true
33
- @err.should =~ /fatal: No git remotes found in .*\/tmp/
33
+ @err.should =~ /fatal: No git remotes found in .*#{Regexp.escape(Dir.tmpdir)}/
34
34
  @out.should_not =~ /no application configured/
35
35
  end
36
36
  end
@@ -49,7 +49,7 @@ describe "ey rollback" do
49
49
 
50
50
  context "when ey.yml is present" do
51
51
  before do
52
- write_yaml({"environments" => {"giblets" => {"beer" => "stout"}}})
52
+ write_yaml({"environments" => {"giblets" => {"beer" => "stout"}}}, 'ey.yml')
53
53
  end
54
54
 
55
55
  after { File.unlink("ey.yml") }
@@ -18,7 +18,6 @@ describe "ey whoami" do
18
18
  given "integration without an eyrc file"
19
19
 
20
20
  before(:each) do
21
- FileUtils.rm_rf(ENV['EYRC'])
22
21
  api_scenario "empty"
23
22
  end
24
23
 
data/spec/spec_helper.rb CHANGED
@@ -11,19 +11,6 @@ require 'net/ssh'
11
11
  # Bundled gems
12
12
  require 'fakeweb'
13
13
  require 'fakeweb_matcher'
14
- require 'fakefs/safe'
15
- module FakeFS
16
- def self.activated?
17
- Object.const_get(:Dir) == FakeFS::Dir
18
- end
19
-
20
- def self.without
21
- was_on = activated?
22
- deactivate!
23
- yield
24
- activate! if was_on
25
- end
26
- end
27
14
 
28
15
  require 'json'
29
16
 
@@ -31,9 +18,6 @@ require 'json'
31
18
  $LOAD_PATH.unshift(File.join(EY_ROOT, "lib"))
32
19
  require 'engineyard'
33
20
 
34
- #autoload hax
35
- EY::Error
36
-
37
21
  # Spec stuff
38
22
  require 'rspec'
39
23
  require 'tmpdir'
@@ -50,16 +34,22 @@ RSpec.configure do |config|
50
34
  config.extend SpecHelpers::Given
51
35
  config.extend SpecHelpers::Fixtures
52
36
 
37
+ def clean_eyrc
38
+ ENV['EYRC'] = File.join('/tmp','eyrc')
39
+ if ENV['EYRC'] && File.exist?(ENV['EYRC'])
40
+ File.unlink(ENV['EYRC'])
41
+ end
42
+ end
43
+
53
44
  config.before(:all) do
45
+ clean_eyrc
54
46
  FakeWeb.allow_net_connect = false
55
- FakeFS.activate!
56
47
  ENV["CLOUD_URL"] = nil
57
48
  ENV["NO_SSH"] = "true"
58
49
  end
59
50
 
60
51
  config.before(:each) do
61
- FakeFS::FileSystem.clear
62
- FakeFS::FileSystem.add(ENV['HOME'])
52
+ clean_eyrc
63
53
  EY.instance_eval{ @config = nil }
64
54
  end
65
55
  end
@@ -74,16 +64,12 @@ shared_examples_for "integration without an eyrc file" do
74
64
  use_git_repo('default')
75
65
 
76
66
  before(:all) do
77
- FakeFS.deactivate!
78
- ENV['EYRC'] = "/tmp/eyrc"
79
67
  FakeWeb.allow_net_connect = true
80
68
  ENV['CLOUD_URL'] = EY.fake_awsm
81
69
  end
82
70
 
83
71
  after(:all) do
84
72
  ENV.delete('CLOUD_URL')
85
- ENV.delete('EYRC')
86
- FakeFS.activate!
87
73
  FakeWeb.allow_net_connect = false
88
74
  end
89
75
  end
@@ -92,9 +78,7 @@ end
92
78
  shared_examples_for "integration" do
93
79
  given "integration without an eyrc file"
94
80
 
95
- before(:all) do
96
- token = { ENV['CLOUD_URL'] => {
97
- "api_token" => "f81a1706ddaeb148cfb6235ddecfc1cf"} }
98
- File.open(ENV['EYRC'], "w"){|f| YAML.dump(token, f) }
81
+ before(:each) do
82
+ write_eyrc({"api_token" => "f81a1706ddaeb148cfb6235ddecfc1cf"})
99
83
  end
100
84
  end
@@ -44,20 +44,18 @@ module SpecHelpers
44
44
  def define_git_repo(name, &setup)
45
45
  # EY's ivars don't get cleared between examples, so we can keep
46
46
  # a git repo around longer (and thus make our tests faster)
47
- FakeFS.without { EY.define_git_repo(name, &setup) }
47
+ EY.define_git_repo(name, &setup)
48
48
  end
49
49
 
50
50
  def use_git_repo(repo_name)
51
51
  before(:all) do
52
- FakeFS.without do
53
- @_original_wd ||= []
54
- @_original_wd << Dir.getwd
55
- Dir.chdir(EY.git_repo_dir(repo_name))
56
- end
52
+ @_original_wd ||= []
53
+ @_original_wd << Dir.getwd
54
+ Dir.chdir(EY.git_repo_dir(repo_name))
57
55
  end
58
56
 
59
57
  after(:all) do
60
- FakeFS.without { Dir.chdir(@_original_wd.pop) }
58
+ Dir.chdir(@_original_wd.pop)
61
59
  end
62
60
  end
63
61
  end
@@ -128,7 +126,12 @@ module SpecHelpers
128
126
  hide_err = options.has_key?(:hide_err) ? options[:hide_err] : options[:expect_failure]
129
127
  path_prepends = options[:prepend_to_path]
130
128
 
131
- ey_env = {'DEBUG' => 'true'}
129
+ ey_env = {
130
+ 'DEBUG' => 'true',
131
+ 'EYRC' => ENV['EYRC'],
132
+ 'CLOUD_URL' => ENV['CLOUD_URL'],
133
+ }
134
+
132
135
  if options.has_key?(:debug)
133
136
  ey_env['DEBUG'] = options[:debug] ? "true" : nil
134
137
  end
@@ -200,14 +203,22 @@ module SpecHelpers
200
203
  raise "Setting scenario failed: #{response.inspect}" unless response.code == 200
201
204
  end
202
205
 
203
- def read_yaml(file="ey.yml")
204
- YAML.load_file(File.expand_path(file))
206
+ def read_yaml(file)
207
+ YAML.load(File.read(File.expand_path(file)))
205
208
  end
206
209
 
207
- def write_yaml(data, file = "ey.yml")
210
+ def write_yaml(data, file)
208
211
  File.open(file, "w"){|f| YAML.dump(data, f) }
209
212
  end
210
213
 
214
+ def read_eyrc
215
+ read_yaml(ENV['EYRC'])
216
+ end
217
+
218
+ def write_eyrc(data)
219
+ write_yaml(data, ENV['EYRC'])
220
+ end
221
+
211
222
  def with_env(new_env_vars)
212
223
  raise ArgumentError, "with_env takes a block" unless block_given?
213
224
  old_env_vars = {}
metadata CHANGED
@@ -1,289 +1,200 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: engineyard
3
- version: !ruby/object:Gem::Version
4
- hash: 9
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.8
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 4
9
- - 7
10
- version: 1.4.7
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - EY Cloud Team
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-11-16 00:00:00 -05:00
19
- default_executable: ey
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2011-11-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: &70093946150160 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 43
29
- segments:
30
- - 0
31
- - 14
32
- - 6
20
+ - !ruby/object:Gem::Version
33
21
  version: 0.14.6
34
- name: thor
35
22
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70093946150160
25
+ - !ruby/object:Gem::Dependency
26
+ name: rest-client
27
+ requirement: &70093946148940 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
29
+ requirements:
42
30
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 15
45
- segments:
46
- - 1
47
- - 6
48
- - 0
31
+ - !ruby/object:Gem::Version
49
32
  version: 1.6.0
50
- name: rest-client
51
33
  type: :runtime
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
34
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70093946148940
36
+ - !ruby/object:Gem::Dependency
37
+ name: highline
38
+ requirement: &70093946148060 !ruby/object:Gem::Requirement
56
39
  none: false
57
- requirements:
40
+ requirements:
58
41
  - - ~>
59
- - !ruby/object:Gem::Version
60
- hash: 13
61
- segments:
62
- - 1
63
- - 6
64
- - 1
42
+ - !ruby/object:Gem::Version
65
43
  version: 1.6.1
66
- name: highline
67
44
  type: :runtime
68
- version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
70
45
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 3
77
- segments:
78
- - 0
79
- version: "0"
46
+ version_requirements: *70093946148060
47
+ - !ruby/object:Gem::Dependency
80
48
  name: json_pure
49
+ requirement: &70093946147400 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
81
55
  type: :runtime
82
- version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
56
  prerelease: false
85
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70093946147400
58
+ - !ruby/object:Gem::Dependency
59
+ name: escape
60
+ requirement: &70093946146440 !ruby/object:Gem::Requirement
86
61
  none: false
87
- requirements:
62
+ requirements:
88
63
  - - ~>
89
- - !ruby/object:Gem::Version
90
- hash: 23
91
- segments:
92
- - 0
93
- - 0
94
- - 4
64
+ - !ruby/object:Gem::Version
95
65
  version: 0.0.4
96
- name: escape
97
66
  type: :runtime
98
- version_requirements: *id005
99
- - !ruby/object:Gem::Dependency
100
67
  prerelease: false
101
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *70093946146440
69
+ - !ruby/object:Gem::Dependency
70
+ name: engineyard-serverside-adapter
71
+ requirement: &70093946145560 !ruby/object:Gem::Requirement
102
72
  none: false
103
- requirements:
104
- - - "="
105
- - !ruby/object:Gem::Version
106
- hash: 33
107
- segments:
108
- - 1
109
- - 5
110
- - 17
73
+ requirements:
74
+ - - =
75
+ - !ruby/object:Gem::Version
111
76
  version: 1.5.17
112
- name: engineyard-serverside-adapter
113
77
  type: :runtime
114
- version_requirements: *id006
115
- - !ruby/object:Gem::Dependency
116
78
  prerelease: false
117
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *70093946145560
80
+ - !ruby/object:Gem::Dependency
81
+ name: net-ssh
82
+ requirement: &70093946144940 !ruby/object:Gem::Requirement
118
83
  none: false
119
- requirements:
84
+ requirements:
120
85
  - - ~>
121
- - !ruby/object:Gem::Version
122
- hash: 11
123
- segments:
124
- - 2
125
- - 1
126
- - 0
86
+ - !ruby/object:Gem::Version
127
87
  version: 2.1.0
128
- name: net-ssh
129
88
  type: :runtime
130
- version_requirements: *id007
131
- - !ruby/object:Gem::Dependency
132
89
  prerelease: false
133
- requirement: &id008 !ruby/object:Gem::Requirement
90
+ version_requirements: *70093946144940
91
+ - !ruby/object:Gem::Dependency
92
+ name: launchy
93
+ requirement: &70093946144240 !ruby/object:Gem::Requirement
134
94
  none: false
135
- requirements:
136
- - - "="
137
- - !ruby/object:Gem::Version
138
- hash: 5
139
- segments:
140
- - 2
141
- - 0
142
- - 5
95
+ requirements:
96
+ - - =
97
+ - !ruby/object:Gem::Version
143
98
  version: 2.0.5
144
- name: launchy
145
99
  type: :runtime
146
- version_requirements: *id008
147
- - !ruby/object:Gem::Dependency
148
100
  prerelease: false
149
- requirement: &id009 !ruby/object:Gem::Requirement
101
+ version_requirements: *70093946144240
102
+ - !ruby/object:Gem::Dependency
103
+ name: rspec
104
+ requirement: &70093946159740 !ruby/object:Gem::Requirement
150
105
  none: false
151
- requirements:
106
+ requirements:
152
107
  - - ~>
153
- - !ruby/object:Gem::Version
154
- hash: 3
155
- segments:
156
- - 2
157
- - 0
158
- version: "2.0"
159
- name: rspec
108
+ - !ruby/object:Gem::Version
109
+ version: '2.0'
160
110
  type: :development
161
- version_requirements: *id009
162
- - !ruby/object:Gem::Dependency
163
111
  prerelease: false
164
- requirement: &id010 !ruby/object:Gem::Requirement
165
- none: false
166
- requirements:
167
- - - ">="
168
- - !ruby/object:Gem::Version
169
- hash: 3
170
- segments:
171
- - 0
172
- version: "0"
112
+ version_requirements: *70093946159740
113
+ - !ruby/object:Gem::Dependency
173
114
  name: rake
174
- type: :development
175
- version_requirements: *id010
176
- - !ruby/object:Gem::Dependency
177
- prerelease: false
178
- requirement: &id011 !ruby/object:Gem::Requirement
115
+ requirement: &70093946159020 !ruby/object:Gem::Requirement
179
116
  none: false
180
- requirements:
181
- - - ">="
182
- - !ruby/object:Gem::Version
183
- hash: 3
184
- segments:
185
- - 0
186
- version: "0"
187
- name: rdoc
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
188
121
  type: :development
189
- version_requirements: *id011
190
- - !ruby/object:Gem::Dependency
191
122
  prerelease: false
192
- requirement: &id012 !ruby/object:Gem::Requirement
123
+ version_requirements: *70093946159020
124
+ - !ruby/object:Gem::Dependency
125
+ name: rdoc
126
+ requirement: &70093946158180 !ruby/object:Gem::Requirement
193
127
  none: false
194
- requirements:
195
- - - ">="
196
- - !ruby/object:Gem::Version
197
- hash: 3
198
- segments:
199
- - 0
200
- version: "0"
201
- name: fakeweb
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
202
132
  type: :development
203
- version_requirements: *id012
204
- - !ruby/object:Gem::Dependency
205
133
  prerelease: false
206
- requirement: &id013 !ruby/object:Gem::Requirement
134
+ version_requirements: *70093946158180
135
+ - !ruby/object:Gem::Dependency
136
+ name: fakeweb
137
+ requirement: &70093946157240 !ruby/object:Gem::Requirement
207
138
  none: false
208
- requirements:
209
- - - ">="
210
- - !ruby/object:Gem::Version
211
- hash: 3
212
- segments:
213
- - 0
214
- version: "0"
215
- name: fakeweb-matcher
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
216
143
  type: :development
217
- version_requirements: *id013
218
- - !ruby/object:Gem::Dependency
219
144
  prerelease: false
220
- requirement: &id014 !ruby/object:Gem::Requirement
145
+ version_requirements: *70093946157240
146
+ - !ruby/object:Gem::Dependency
147
+ name: fakeweb-matcher
148
+ requirement: &70093946156400 !ruby/object:Gem::Requirement
221
149
  none: false
222
- requirements:
223
- - - ">="
224
- - !ruby/object:Gem::Version
225
- hash: 3
226
- segments:
227
- - 0
228
- version: "0"
229
- name: fakefs
150
+ requirements:
151
+ - - ! '>='
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
230
154
  type: :development
231
- version_requirements: *id014
232
- - !ruby/object:Gem::Dependency
233
155
  prerelease: false
234
- requirement: &id015 !ruby/object:Gem::Requirement
235
- none: false
236
- requirements:
237
- - - ">="
238
- - !ruby/object:Gem::Version
239
- hash: 3
240
- segments:
241
- - 0
242
- version: "0"
156
+ version_requirements: *70093946156400
157
+ - !ruby/object:Gem::Dependency
243
158
  name: sinatra
159
+ requirement: &70093946155720 !ruby/object:Gem::Requirement
160
+ none: false
161
+ requirements:
162
+ - - ! '>='
163
+ - !ruby/object:Gem::Version
164
+ version: '0'
244
165
  type: :development
245
- version_requirements: *id015
246
- - !ruby/object:Gem::Dependency
247
166
  prerelease: false
248
- requirement: &id016 !ruby/object:Gem::Requirement
167
+ version_requirements: *70093946155720
168
+ - !ruby/object:Gem::Dependency
169
+ name: realweb
170
+ requirement: &70093946154700 !ruby/object:Gem::Requirement
249
171
  none: false
250
- requirements:
172
+ requirements:
251
173
  - - ~>
252
- - !ruby/object:Gem::Version
253
- hash: 19
254
- segments:
255
- - 0
256
- - 2
257
- - 2
174
+ - !ruby/object:Gem::Version
258
175
  version: 0.2.2
259
- name: realweb
260
176
  type: :development
261
- version_requirements: *id016
262
- - !ruby/object:Gem::Dependency
263
177
  prerelease: false
264
- requirement: &id017 !ruby/object:Gem::Requirement
178
+ version_requirements: *70093946154700
179
+ - !ruby/object:Gem::Dependency
180
+ name: open4
181
+ requirement: &70093946153320 !ruby/object:Gem::Requirement
265
182
  none: false
266
- requirements:
183
+ requirements:
267
184
  - - ~>
268
- - !ruby/object:Gem::Version
269
- hash: 21
270
- segments:
271
- - 1
272
- - 0
273
- - 1
185
+ - !ruby/object:Gem::Version
274
186
  version: 1.0.1
275
- name: open4
276
187
  type: :development
277
- version_requirements: *id017
278
- description: This gem allows you to deploy your rails application to the Engine Yard cloud directly from the command line.
188
+ prerelease: false
189
+ version_requirements: *70093946153320
190
+ description: This gem allows you to deploy your rails application to the Engine Yard
191
+ cloud directly from the command line.
279
192
  email: cloud@engineyard.com
280
- executables:
193
+ executables:
281
194
  - ey
282
195
  extensions: []
283
-
284
196
  extra_rdoc_files: []
285
-
286
- files:
197
+ files:
287
198
  - bin/ey
288
199
  - lib/engineyard/api.rb
289
200
  - lib/engineyard/cli/api.rb
@@ -297,6 +208,7 @@ files:
297
208
  - lib/engineyard/collection.rb
298
209
  - lib/engineyard/config.rb
299
210
  - lib/engineyard/error.rb
211
+ - lib/engineyard/eyrc.rb
300
212
  - lib/engineyard/model/account.rb
301
213
  - lib/engineyard/model/api_struct.rb
302
214
  - lib/engineyard/model/app.rb
@@ -321,6 +233,7 @@ files:
321
233
  - spec/engineyard/collection/apps_spec.rb
322
234
  - spec/engineyard/collection/environments_spec.rb
323
235
  - spec/engineyard/config_spec.rb
236
+ - spec/engineyard/eyrc_spec.rb
324
237
  - spec/engineyard/model/api_struct_spec.rb
325
238
  - spec/engineyard/model/environment_spec.rb
326
239
  - spec/engineyard/model/instance_spec.rb
@@ -351,59 +264,48 @@ files:
351
264
  - spec/support/ruby_ext.rb
352
265
  - spec/support/scenarios.rb
353
266
  - spec/support/shared_behavior.rb
354
- has_rdoc: true
355
267
  homepage: http://github.com/engineyard/engineyard
356
268
  licenses: []
357
-
358
- post_install_message: |+
359
-
360
- Welcome to Engine Yard!
361
-
362
- Deploying for the first time? The Engine Yard Pandas want to help you!
363
-
364
- Email pandas@engineyard.com with your questions or queries.
365
- (Panda = 1. Polite Agent of Non-Destructive Assimilation; 2. Cute fluffy animal.)
366
-
367
- We wish you every success with your business!
368
-
369
- - The Pandas
370
-
269
+ post_install_message: ! "\nWelcome to Engine Yard!\n \nDeploying for the first time?
270
+ The Engine Yard Pandas want to help you! \n\nEmail pandas@engineyard.com with your
271
+ questions or queries. \n(Panda = 1. Polite Agent of Non-Destructive Assimilation;
272
+ 2. Cute fluffy animal.)\n \nWe wish you every success with your business!\n \n -
273
+ The Pandas\n\n"
371
274
  rdoc_options: []
372
-
373
- require_paths:
275
+ require_paths:
374
276
  - lib
375
- required_ruby_version: !ruby/object:Gem::Requirement
277
+ required_ruby_version: !ruby/object:Gem::Requirement
376
278
  none: false
377
- requirements:
378
- - - ">="
379
- - !ruby/object:Gem::Version
380
- hash: 3
381
- segments:
279
+ requirements:
280
+ - - ! '>='
281
+ - !ruby/object:Gem::Version
282
+ version: '0'
283
+ segments:
382
284
  - 0
383
- version: "0"
384
- required_rubygems_version: !ruby/object:Gem::Requirement
285
+ hash: -2199701072849870205
286
+ required_rubygems_version: !ruby/object:Gem::Requirement
385
287
  none: false
386
- requirements:
387
- - - ">="
388
- - !ruby/object:Gem::Version
389
- hash: 3
390
- segments:
288
+ requirements:
289
+ - - ! '>='
290
+ - !ruby/object:Gem::Version
291
+ version: '0'
292
+ segments:
391
293
  - 0
392
- version: "0"
294
+ hash: -2199701072849870205
393
295
  requirements: []
394
-
395
296
  rubyforge_project:
396
- rubygems_version: 1.5.2
297
+ rubygems_version: 1.8.10
397
298
  signing_key:
398
299
  specification_version: 3
399
300
  summary: Command-line deployment for the Engine Yard cloud
400
- test_files:
301
+ test_files:
401
302
  - spec/engineyard/api_spec.rb
402
303
  - spec/engineyard/cli/api_spec.rb
403
304
  - spec/engineyard/cli_spec.rb
404
305
  - spec/engineyard/collection/apps_spec.rb
405
306
  - spec/engineyard/collection/environments_spec.rb
406
307
  - spec/engineyard/config_spec.rb
308
+ - spec/engineyard/eyrc_spec.rb
407
309
  - spec/engineyard/model/api_struct_spec.rb
408
310
  - spec/engineyard/model/environment_spec.rb
409
311
  - spec/engineyard/model/instance_spec.rb