engineyard 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +7 -0
  3. data/bin/ey +14 -0
  4. data/lib/engineyard.rb +44 -0
  5. data/lib/engineyard/account.rb +78 -0
  6. data/lib/engineyard/api.rb +104 -0
  7. data/lib/engineyard/cli.rb +169 -0
  8. data/lib/engineyard/cli/api.rb +42 -0
  9. data/lib/engineyard/cli/error.rb +44 -0
  10. data/lib/engineyard/cli/ui.rb +96 -0
  11. data/lib/engineyard/config.rb +86 -0
  12. data/lib/engineyard/repo.rb +24 -0
  13. data/lib/vendor/thor.rb +244 -0
  14. data/lib/vendor/thor/actions.rb +275 -0
  15. data/lib/vendor/thor/actions/create_file.rb +103 -0
  16. data/lib/vendor/thor/actions/directory.rb +91 -0
  17. data/lib/vendor/thor/actions/empty_directory.rb +134 -0
  18. data/lib/vendor/thor/actions/file_manipulation.rb +223 -0
  19. data/lib/vendor/thor/actions/inject_into_file.rb +104 -0
  20. data/lib/vendor/thor/base.rb +540 -0
  21. data/lib/vendor/thor/core_ext/file_binary_read.rb +9 -0
  22. data/lib/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  23. data/lib/vendor/thor/core_ext/ordered_hash.rb +100 -0
  24. data/lib/vendor/thor/error.rb +30 -0
  25. data/lib/vendor/thor/group.rb +271 -0
  26. data/lib/vendor/thor/invocation.rb +180 -0
  27. data/lib/vendor/thor/parser.rb +4 -0
  28. data/lib/vendor/thor/parser/argument.rb +67 -0
  29. data/lib/vendor/thor/parser/arguments.rb +150 -0
  30. data/lib/vendor/thor/parser/option.rb +128 -0
  31. data/lib/vendor/thor/parser/options.rb +169 -0
  32. data/lib/vendor/thor/rake_compat.rb +66 -0
  33. data/lib/vendor/thor/runner.rb +314 -0
  34. data/lib/vendor/thor/shell.rb +83 -0
  35. data/lib/vendor/thor/shell/basic.rb +239 -0
  36. data/lib/vendor/thor/shell/color.rb +108 -0
  37. data/lib/vendor/thor/task.rb +102 -0
  38. data/lib/vendor/thor/util.rb +230 -0
  39. data/lib/vendor/thor/version.rb +3 -0
  40. data/spec/engineyard/api_spec.rb +56 -0
  41. data/spec/engineyard/cli/api_spec.rb +44 -0
  42. data/spec/engineyard/cli_spec.rb +20 -0
  43. data/spec/engineyard/config_spec.rb +57 -0
  44. data/spec/engineyard/repo_spec.rb +52 -0
  45. data/spec/engineyard_spec.rb +7 -0
  46. data/spec/ey/deploy_spec.rb +65 -0
  47. data/spec/ey/ey_spec.rb +16 -0
  48. data/spec/spec.opts +2 -0
  49. data/spec/spec_helper.rb +40 -0
  50. data/spec/support/bundled_ey +10 -0
  51. data/spec/support/helpers.rb +46 -0
  52. metadata +231 -0
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe EY do
4
+ it "provides EY errors" do
5
+ EY::Error.should be
6
+ end
7
+ end
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+
3
+ describe "ey deploy" do
4
+ before(:all) do
5
+ ENV['EYRC'] = "/tmp/eyrc"
6
+ ENV['CLOUD_URL'] = "http://localhost:4000"
7
+ FakeFS.deactivate!
8
+ end
9
+
10
+ after(:all) do
11
+ ENV['CLOUD_URL'] = nil
12
+ FakeFS.activate!
13
+ end
14
+
15
+ describe "without an eyrc file" do
16
+ before(:each) do
17
+ FileUtils.rm_rf(ENV['EYRC'])
18
+ end
19
+
20
+ it "prompts for authentication" do
21
+ ey("deploy") do |input|
22
+ input.puts("aarko@engineyard.com")
23
+ input.puts("reversal")
24
+ end
25
+ @out.should include("We need to fetch your API token, please login")
26
+ @out.should include("Email:")
27
+ @out.should include("Password:")
28
+ end
29
+ end
30
+
31
+ describe "with an eyrc file" do
32
+ before(:each) do
33
+ token = { ENV['CLOUD_URL'] => {
34
+ "api_token" => "f81a1706ddaeb148cfb6235ddecfc1cf"} }
35
+ File.open(ENV['EYRC'], "w"){|f| YAML.dump(token, f) }
36
+ end
37
+
38
+ it "complains when there is no app" do
39
+ return pending "this should not hit a live app"
40
+ ey "deploy", :hide_err => true
41
+ @err.should include %|no application configured|
42
+ end
43
+
44
+ it "complains when there is no environment" do
45
+ return pending
46
+ api_scenario :no_environments
47
+ ey "deploy"
48
+ @out.should match(/no environment/i)
49
+ end
50
+
51
+ it "runs when environment is known" do
52
+ return pending
53
+ api_scenario :one_environment
54
+ ey "deploy"
55
+ @out.should match(/deploying/i)
56
+ end
57
+
58
+ it "complains when environment is ambiguous" do
59
+ return pending
60
+ api_scenario :two_environments
61
+ ey "deploy"
62
+ @out.should match(/was called incorrectly/i)
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe "ey" do
4
+ context "run without arguments" do
5
+ it "prints usage information" do
6
+ ey.should include "Tasks:"
7
+ end
8
+ end
9
+
10
+ context "run with an argument that is not a command" do
11
+ it "tells the user that is not a command" do
12
+ ey "foobarbaz", :hide_err => true
13
+ @err.should include "Could not find task"
14
+ end
15
+ end
16
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format specdoc
@@ -0,0 +1,40 @@
1
+ begin
2
+ require File.expand_path('../../.bundle/environment', __FILE__)
3
+ rescue LoadError
4
+ require "rubygems"; require "bundler"; Bundler.setup
5
+ end
6
+
7
+ # Bundled gems
8
+ require 'fakeweb'
9
+ require 'fakefs/safe'
10
+
11
+ # Engineyard gem
12
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
13
+ require 'engineyard'
14
+
15
+ # Spec stuff
16
+ require 'spec/autorun'
17
+ require 'support/helpers'
18
+ require 'yaml'
19
+
20
+ Spec::Runner.configure do |config|
21
+ config.before(:all) do
22
+ FakeWeb.allow_net_connect = false
23
+ FakeFS.activate!
24
+ ENV["CLOUD_URL"] = nil
25
+ ENV["NO_SSH"] = "true"
26
+ end
27
+
28
+ config.before(:each) do
29
+ EY.config = nil
30
+ FakeFS::FileSystem.clear
31
+ end
32
+
33
+ def load_config(file="ey.yml")
34
+ YAML.load_file(File.expand_path(file))
35
+ end
36
+
37
+ def write_config(data, file = "ey.yml")
38
+ File.open(file, "w"){|f| YAML.dump(data, f) }
39
+ end
40
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require File.expand_path('../../../.bundle/environment', __FILE__)
4
+ rescue LoadError
5
+ ENV['BUNDLE_GEMFILE'] = File.expand_path('../../../Gemfile', __FILE__)
6
+ require "rubygems"; require "bundler"; Bundler.setup
7
+ end
8
+
9
+ $LOAD_PATH.unshift File.expand_path("../../../lib", __FILE__)
10
+ load File.expand_path('../../../bin/ey', __FILE__)
@@ -0,0 +1,46 @@
1
+ module Kernel
2
+ def capture_stdio(input = nil, &block)
3
+ require 'stringio'
4
+ org_stdin, $stdin = $stdin, StringIO.new(input) if input
5
+ org_stdout, $stdout = $stdout, StringIO.new
6
+ yield
7
+ return @out = $stdout.string
8
+ ensure
9
+ $stdout = org_stdout
10
+ $stdin = org_stdin
11
+ end
12
+ alias capture_stdout capture_stdio
13
+ end
14
+
15
+ class IO
16
+ def read_available_bytes(chunk_size = 1024, select_timeout = 5)
17
+ buffer = []
18
+
19
+ while self.class.select([self], nil, nil, select_timeout)
20
+ begin
21
+ buffer << self.readpartial(chunk_size)
22
+ rescue(EOFError)
23
+ break
24
+ end
25
+ end
26
+
27
+ return buffer.join
28
+ end
29
+ end
30
+
31
+ def ey(cmd = nil, options = {})
32
+ require "open3"
33
+ hide_err = options.delete(:hide_err)
34
+
35
+ args = options.map { |k,v| "--#{k} #{v}"}.join(" ")
36
+ eybin = File.expand_path('../bundled_ey', __FILE__)
37
+
38
+ @in, @out, @err = Open3.popen3("#{eybin} #{cmd} #{args}")
39
+
40
+ yield @in if block_given?
41
+ @err = @err.read_available_bytes
42
+ @out = @out.read_available_bytes
43
+
44
+ puts @err unless @err.empty? || hide_err
45
+ @out
46
+ end
metadata ADDED
@@ -0,0 +1,231 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: engineyard
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 7
9
+ version: 0.2.7
10
+ platform: ruby
11
+ authors:
12
+ - EY Cloud Team
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-04-16 00:00:00 -07:00
18
+ default_executable: ey
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ segments:
26
+ - 0
27
+ version: "0"
28
+ name: fakeweb
29
+ prerelease: false
30
+ requirement: *id001
31
+ type: :development
32
+ - !ruby/object:Gem::Dependency
33
+ version_requirements: &id002 !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ segments:
38
+ - 0
39
+ version: "0"
40
+ name: termios
41
+ prerelease: false
42
+ requirement: *id002
43
+ type: :runtime
44
+ - !ruby/object:Gem::Dependency
45
+ version_requirements: &id003 !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ segments:
50
+ - 0
51
+ version: "0"
52
+ name: fakefs
53
+ prerelease: false
54
+ requirement: *id003
55
+ type: :development
56
+ - !ruby/object:Gem::Dependency
57
+ version_requirements: &id004 !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ name: highline
65
+ prerelease: false
66
+ requirement: *id004
67
+ type: :runtime
68
+ - !ruby/object:Gem::Dependency
69
+ version_requirements: &id005 !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ name: rake
77
+ prerelease: false
78
+ requirement: *id005
79
+ type: :development
80
+ - !ruby/object:Gem::Dependency
81
+ version_requirements: &id006 !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ name: rspec
89
+ prerelease: false
90
+ requirement: *id006
91
+ type: :development
92
+ - !ruby/object:Gem::Dependency
93
+ version_requirements: &id007 !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ~>
96
+ - !ruby/object:Gem::Version
97
+ segments:
98
+ - 1
99
+ - 4
100
+ version: "1.4"
101
+ name: rest-client
102
+ prerelease: false
103
+ requirement: *id007
104
+ type: :runtime
105
+ - !ruby/object:Gem::Dependency
106
+ version_requirements: &id008 !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ segments:
111
+ - 0
112
+ version: "0"
113
+ name: json
114
+ prerelease: false
115
+ requirement: *id008
116
+ type: :runtime
117
+ - !ruby/object:Gem::Dependency
118
+ version_requirements: &id009 !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ segments:
123
+ - 0
124
+ version: "0"
125
+ name: jeweler
126
+ prerelease: false
127
+ requirement: *id009
128
+ type: :development
129
+ - !ruby/object:Gem::Dependency
130
+ version_requirements: &id010 !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ segments:
135
+ - 0
136
+ version: "0"
137
+ name: bundler
138
+ prerelease: false
139
+ requirement: *id010
140
+ type: :development
141
+ description: This gem allows you to deploy your rails application to the Engine Yard cloud directly from the command line.
142
+ email: cloud@engineyard.com
143
+ executables:
144
+ - ey
145
+ extensions: []
146
+
147
+ extra_rdoc_files: []
148
+
149
+ files:
150
+ - bin/ey
151
+ - lib/engineyard/account.rb
152
+ - lib/engineyard/api.rb
153
+ - lib/engineyard/cli/api.rb
154
+ - lib/engineyard/cli/error.rb
155
+ - lib/engineyard/cli/ui.rb
156
+ - lib/engineyard/cli.rb
157
+ - lib/engineyard/config.rb
158
+ - lib/engineyard/repo.rb
159
+ - lib/engineyard.rb
160
+ - lib/vendor/thor/actions/create_file.rb
161
+ - lib/vendor/thor/actions/directory.rb
162
+ - lib/vendor/thor/actions/empty_directory.rb
163
+ - lib/vendor/thor/actions/file_manipulation.rb
164
+ - lib/vendor/thor/actions/inject_into_file.rb
165
+ - lib/vendor/thor/actions.rb
166
+ - lib/vendor/thor/base.rb
167
+ - lib/vendor/thor/core_ext/file_binary_read.rb
168
+ - lib/vendor/thor/core_ext/hash_with_indifferent_access.rb
169
+ - lib/vendor/thor/core_ext/ordered_hash.rb
170
+ - lib/vendor/thor/error.rb
171
+ - lib/vendor/thor/group.rb
172
+ - lib/vendor/thor/invocation.rb
173
+ - lib/vendor/thor/parser/argument.rb
174
+ - lib/vendor/thor/parser/arguments.rb
175
+ - lib/vendor/thor/parser/option.rb
176
+ - lib/vendor/thor/parser/options.rb
177
+ - lib/vendor/thor/parser.rb
178
+ - lib/vendor/thor/rake_compat.rb
179
+ - lib/vendor/thor/runner.rb
180
+ - lib/vendor/thor/shell/basic.rb
181
+ - lib/vendor/thor/shell/color.rb
182
+ - lib/vendor/thor/shell.rb
183
+ - lib/vendor/thor/task.rb
184
+ - lib/vendor/thor/util.rb
185
+ - lib/vendor/thor/version.rb
186
+ - lib/vendor/thor.rb
187
+ - LICENSE
188
+ - README.rdoc
189
+ has_rdoc: true
190
+ homepage: http://engineyard.com
191
+ licenses: []
192
+
193
+ post_install_message:
194
+ rdoc_options: []
195
+
196
+ require_paths:
197
+ - lib
198
+ required_ruby_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ segments:
203
+ - 0
204
+ version: "0"
205
+ required_rubygems_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ segments:
210
+ - 0
211
+ version: "0"
212
+ requirements: []
213
+
214
+ rubyforge_project:
215
+ rubygems_version: 1.3.6
216
+ signing_key:
217
+ specification_version: 3
218
+ summary: Command-line deployment for the Engine Yard cloud
219
+ test_files:
220
+ - spec/engineyard/api_spec.rb
221
+ - spec/engineyard/cli/api_spec.rb
222
+ - spec/engineyard/cli_spec.rb
223
+ - spec/engineyard/config_spec.rb
224
+ - spec/engineyard/repo_spec.rb
225
+ - spec/engineyard_spec.rb
226
+ - spec/ey/deploy_spec.rb
227
+ - spec/ey/ey_spec.rb
228
+ - spec/spec.opts
229
+ - spec/spec_helper.rb
230
+ - spec/support/bundled_ey
231
+ - spec/support/helpers.rb