engineyard 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,6 +35,7 @@ module EY
35
35
  end
36
36
 
37
37
  def apps_for_repo(repo)
38
+ raise NoRemotesError.new(repo.path) if repo.urls.empty?
38
39
  apps.find_all {|a| repo.urls.include?(a.repository_uri) }
39
40
  end
40
41
 
@@ -9,8 +9,6 @@ module EY
9
9
  autoload :Recipes, 'engineyard/cli/recipes'
10
10
  autoload :Web, 'engineyard/cli/web'
11
11
 
12
- check_unknown_options!
13
-
14
12
  include Thor::Actions
15
13
 
16
14
  def self.start(*)
@@ -3,6 +3,8 @@ require 'escape'
3
3
  module EY
4
4
  class Repo
5
5
 
6
+ attr_reader :path
7
+
6
8
  def initialize(path=File.expand_path('.'))
7
9
  @path = path
8
10
  end
@@ -26,7 +28,6 @@ module EY
26
28
 
27
29
  def urls
28
30
  lines = `git config -f #{Escape.shell_command([@path])}/.git/config --get-regexp 'remote.*.url'`.split(/\n/)
29
- raise NoRemotesError.new(@path) if lines.empty?
30
31
  lines.map { |c| c.split.last }
31
32
  end
32
33
 
@@ -99,7 +99,7 @@ module EY
99
99
  app_candidates = if options[:app_name]
100
100
  filter_candidates_by(:app_name, options, candidates)
101
101
  elsif options[:repo]
102
- candidates.select {|c| options[:repo].urls.include?(c[:repository_uri]) }
102
+ filter_by_repo(candidates, options[:repo])
103
103
  else
104
104
  candidates
105
105
  end
@@ -109,6 +109,18 @@ module EY
109
109
  [candidates, account_candidates, app_candidates, environment_candidates]
110
110
  end
111
111
 
112
+ def filter_by_repo(candidates, repo)
113
+ results = candidates.select do |c|
114
+ repo.urls.include?(c[:repository_uri])
115
+ end
116
+
117
+ if results.empty?
118
+ candidates
119
+ else
120
+ results
121
+ end
122
+ end
123
+
112
124
  def filter_candidates_by(type, options, candidates)
113
125
  if options[type] && candidates.any?{|c| c[type] == options[type] }
114
126
  candidates.select {|c| c[type] == options[type] }
@@ -44,6 +44,8 @@ module EY
44
44
  class Thor < ::Thor
45
45
  include UtilityMethods
46
46
 
47
+ check_unknown_options!
48
+
47
49
  no_tasks do
48
50
  def self.subcommand_help(cmd)
49
51
  desc "#{cmd} help [COMMAND]", "Describe all subcommands or one specific subcommand."
@@ -1,3 +1,3 @@
1
1
  module EY
2
- VERSION = '1.3.2'
2
+ VERSION = '1.3.3'
3
3
  end
@@ -32,11 +32,6 @@ describe EY::Repo do
32
32
  @r.urls.should include(other_url)
33
33
  end
34
34
 
35
- it "raises EY::NoRemotesError if there is no origin remote" do
36
- clear_urls
37
- lambda { @r.urls }.should raise_error(EY::NoRemotesError)
38
- end
39
-
40
35
  def config_path
41
36
  @path+"config"
42
37
  end
@@ -59,10 +59,6 @@ describe EY::Resolver do
59
59
  lambda { resolver.app_and_environment(:environment_name => 'app_duplicate', :app_name => 'smallapp') }.should raise_error(EY::InvalidAppError)
60
60
  end
61
61
 
62
- it "raises when the git repo does not match any apps" do
63
- lambda { resolver.app_and_environment(:environment_name => 'app_duplicate', :repo => repo("git://github.com/no-such/app.git")) }.should raise_error(EY::NoAppError)
64
- end
65
-
66
62
  it "raises when there is no environment match" do
67
63
  lambda { resolver.app_and_environment(:environment_name => 'gibberish', :app_name => 'app') }.should raise_error(EY::NoEnvironmentError)
68
64
  end
@@ -15,6 +15,11 @@ describe "ey recipes apply" do
15
15
  end
16
16
 
17
17
  it_should_behave_like "it takes an environment name and an account name"
18
+
19
+ it "fails when given a bad option" do
20
+ ey "web enable --lots --of --bogus --options", :expect_failure => true
21
+ @err.should include("Unknown switches")
22
+ end
18
23
  end
19
24
 
20
25
  describe "ey recipes apply with an ambiguous git repo" do
@@ -28,3 +28,50 @@ describe "ey recipes upload with an ambiguous git repo" do
28
28
  def command_to_run(_) "recipes upload" end
29
29
  it_should_behave_like "it requires an unambiguous git repo"
30
30
  end
31
+
32
+ describe "ey recipes upload from a separate cookbooks directory" do
33
+ given "integration"
34
+
35
+ context "without any git remotes" do
36
+ define_git_repo "only cookbooks, no remotes" do |git_dir|
37
+ `git --git-dir "#{git_dir}/.git" remote`.split("\n").each do |remote|
38
+ `git --git-dir "#{git_dir}/.git" remote rm #{remote}`
39
+ end
40
+
41
+ git_dir.join("cookbooks").mkdir
42
+ File.open(git_dir.join("cookbooks/file"), "w"){|f| f << "stuff" }
43
+ end
44
+
45
+ use_git_repo "only cookbooks, no remotes"
46
+
47
+ it "takes the environment specified by -e" do
48
+ api_scenario "one app, one environment"
49
+
50
+ ey "recipes upload -e giblets"
51
+ @out.should =~ /Recipes uploaded successfully/
52
+ end
53
+ end
54
+
55
+ context "with a git remote unrelated to any application" do
56
+ define_git_repo "only cookbooks, unrelated remotes" do |git_dir|
57
+ `git --git-dir "#{git_dir}/.git" remote`.split("\n").each do |remote|
58
+ `git --git-dir "#{git_dir}/.git" remote rm #{remote}`
59
+ end
60
+
61
+ `git remote add origin polly@pirate.example.com:wanna/cracker.git`
62
+
63
+ git_dir.join("cookbooks").mkdir
64
+ File.open(git_dir.join("cookbooks/file"), "w"){|f| f << "rawk" }
65
+ end
66
+
67
+ use_git_repo "only cookbooks, unrelated remotes"
68
+
69
+ it "takes the environment specified by -e" do
70
+ api_scenario "one app, one environment"
71
+
72
+ ey "recipes upload -e giblets"
73
+ @out.should =~ /Recipes uploaded successfully/
74
+ end
75
+
76
+ end
77
+ end
@@ -18,4 +18,9 @@ describe "ey web enable" do
18
18
 
19
19
  it_should_behave_like "it takes an environment name and an app name and an account name"
20
20
  it_should_behave_like "it invokes engineyard-serverside"
21
+
22
+ it "fails when given a bad option" do
23
+ ey "web enable --lots --of --bogus --options", :expect_failure => true
24
+ @err.should include("Unknown switches")
25
+ end
21
26
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 2
10
- version: 1.3.2
9
+ - 3
10
+ version: 1.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - EY Cloud Team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-15 00:00:00 -07:00
18
+ date: 2010-10-22 00:00:00 -07:00
19
19
  default_executable: ey
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -31,9 +31,9 @@ dependencies:
31
31
  - 3
32
32
  version: 0.14.3
33
33
  requirement: *id001
34
- type: :runtime
35
34
  name: thor
36
35
  prerelease: false
36
+ type: :runtime
37
37
  - !ruby/object:Gem::Dependency
38
38
  version_requirements: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
@@ -46,9 +46,9 @@ dependencies:
46
46
  - 4
47
47
  version: "1.4"
48
48
  requirement: *id002
49
- type: :runtime
50
49
  name: rest-client
51
50
  prerelease: false
51
+ type: :runtime
52
52
  - !ruby/object:Gem::Dependency
53
53
  version_requirements: &id003 !ruby/object:Gem::Requirement
54
54
  none: false
@@ -62,9 +62,9 @@ dependencies:
62
62
  - 2
63
63
  version: 1.5.2
64
64
  requirement: *id003
65
- type: :runtime
66
65
  name: highline
67
66
  prerelease: false
67
+ type: :runtime
68
68
  - !ruby/object:Gem::Dependency
69
69
  version_requirements: &id004 !ruby/object:Gem::Requirement
70
70
  none: false
@@ -76,9 +76,9 @@ dependencies:
76
76
  - 0
77
77
  version: "0"
78
78
  requirement: *id004
79
- type: :runtime
80
79
  name: json_pure
81
80
  prerelease: false
81
+ type: :runtime
82
82
  - !ruby/object:Gem::Dependency
83
83
  version_requirements: &id005 !ruby/object:Gem::Requirement
84
84
  none: false
@@ -92,9 +92,9 @@ dependencies:
92
92
  - 4
93
93
  version: 0.0.4
94
94
  requirement: *id005
95
- type: :runtime
96
95
  name: escape
97
96
  prerelease: false
97
+ type: :runtime
98
98
  - !ruby/object:Gem::Dependency
99
99
  version_requirements: &id006 !ruby/object:Gem::Requirement
100
100
  none: false
@@ -108,9 +108,9 @@ dependencies:
108
108
  - 5
109
109
  version: 1.3.5
110
110
  requirement: *id006
111
- type: :runtime
112
111
  name: engineyard-serverside-adapter
113
112
  prerelease: false
113
+ type: :runtime
114
114
  description: This gem allows you to deploy your rails application to the Engine Yard cloud directly from the command line.
115
115
  email: cloud@engineyard.com
116
116
  executables: