engineyard 2.0.0.pre1 → 2.0.0.pre2

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.
Files changed (43) hide show
  1. data/README.rdoc +39 -136
  2. data/bin/ey_perftools +12 -0
  3. data/lib/engineyard.rb +0 -2
  4. data/lib/engineyard/cli.rb +3 -4
  5. data/lib/engineyard/cli/api.rb +3 -2
  6. data/lib/engineyard/commands/deploy.rb +0 -0
  7. data/lib/engineyard/thor.rb +7 -3
  8. data/lib/engineyard/version.rb +1 -1
  9. data/spec/engineyard/cli/api_spec.rb +6 -0
  10. data/spec/ey/deploy_spec.rb +6 -0
  11. data/spec/ey/ssh_spec.rb +6 -6
  12. metadata +24 -37
  13. data/lib/vendor/thor/LICENSE.md +0 -20
  14. data/lib/vendor/thor/README.md +0 -26
  15. data/lib/vendor/thor/lib/thor.rb +0 -379
  16. data/lib/vendor/thor/lib/thor/actions.rb +0 -318
  17. data/lib/vendor/thor/lib/thor/actions/create_file.rb +0 -105
  18. data/lib/vendor/thor/lib/thor/actions/create_link.rb +0 -57
  19. data/lib/vendor/thor/lib/thor/actions/directory.rb +0 -97
  20. data/lib/vendor/thor/lib/thor/actions/empty_directory.rb +0 -153
  21. data/lib/vendor/thor/lib/thor/actions/file_manipulation.rb +0 -308
  22. data/lib/vendor/thor/lib/thor/actions/inject_into_file.rb +0 -109
  23. data/lib/vendor/thor/lib/thor/base.rb +0 -611
  24. data/lib/vendor/thor/lib/thor/core_ext/file_binary_read.rb +0 -9
  25. data/lib/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +0 -75
  26. data/lib/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -100
  27. data/lib/vendor/thor/lib/thor/error.rb +0 -35
  28. data/lib/vendor/thor/lib/thor/group.rb +0 -285
  29. data/lib/vendor/thor/lib/thor/invocation.rb +0 -170
  30. data/lib/vendor/thor/lib/thor/parser.rb +0 -4
  31. data/lib/vendor/thor/lib/thor/parser/argument.rb +0 -67
  32. data/lib/vendor/thor/lib/thor/parser/arguments.rb +0 -165
  33. data/lib/vendor/thor/lib/thor/parser/option.rb +0 -121
  34. data/lib/vendor/thor/lib/thor/parser/options.rb +0 -181
  35. data/lib/vendor/thor/lib/thor/rake_compat.rb +0 -71
  36. data/lib/vendor/thor/lib/thor/runner.rb +0 -321
  37. data/lib/vendor/thor/lib/thor/shell.rb +0 -88
  38. data/lib/vendor/thor/lib/thor/shell/basic.rb +0 -331
  39. data/lib/vendor/thor/lib/thor/shell/color.rb +0 -108
  40. data/lib/vendor/thor/lib/thor/shell/html.rb +0 -121
  41. data/lib/vendor/thor/lib/thor/task.rb +0 -132
  42. data/lib/vendor/thor/lib/thor/util.rb +0 -248
  43. data/lib/vendor/thor/lib/thor/version.rb +0 -3
@@ -1,9 +0,0 @@
1
- class File #:nodoc:
2
-
3
- unless File.respond_to?(:binread)
4
- def self.binread(file)
5
- File.open(file, 'rb') { |f| f.read }
6
- end
7
- end
8
-
9
- end
@@ -1,75 +0,0 @@
1
- class Thor
2
- module CoreExt #:nodoc:
3
-
4
- # A hash with indifferent access and magic predicates.
5
- #
6
- # hash = Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true
7
- #
8
- # hash[:foo] #=> 'bar'
9
- # hash['foo'] #=> 'bar'
10
- # hash.foo? #=> true
11
- #
12
- class HashWithIndifferentAccess < ::Hash #:nodoc:
13
-
14
- def initialize(hash={})
15
- super()
16
- hash.each do |key, value|
17
- self[convert_key(key)] = value
18
- end
19
- end
20
-
21
- def [](key)
22
- super(convert_key(key))
23
- end
24
-
25
- def []=(key, value)
26
- super(convert_key(key), value)
27
- end
28
-
29
- def delete(key)
30
- super(convert_key(key))
31
- end
32
-
33
- def values_at(*indices)
34
- indices.collect { |key| self[convert_key(key)] }
35
- end
36
-
37
- def merge(other)
38
- dup.merge!(other)
39
- end
40
-
41
- def merge!(other)
42
- other.each do |key, value|
43
- self[convert_key(key)] = value
44
- end
45
- self
46
- end
47
-
48
- protected
49
-
50
- def convert_key(key)
51
- key.is_a?(Symbol) ? key.to_s : key
52
- end
53
-
54
- # Magic predicates. For instance:
55
- #
56
- # options.force? # => !!options['force']
57
- # options.shebang # => "/usr/lib/local/ruby"
58
- # options.test_framework?(:rspec) # => options[:test_framework] == :rspec
59
- #
60
- def method_missing(method, *args, &block)
61
- method = method.to_s
62
- if method =~ /^(\w+)\?$/
63
- if args.empty?
64
- !!self[$1]
65
- else
66
- self[$1] == args.first
67
- end
68
- else
69
- self[method]
70
- end
71
- end
72
-
73
- end
74
- end
75
- end
@@ -1,100 +0,0 @@
1
- class Thor
2
- module CoreExt #:nodoc:
3
-
4
- if RUBY_VERSION >= '1.9'
5
- class OrderedHash < ::Hash
6
- end
7
- else
8
- # This class is based on the Ruby 1.9 ordered hashes.
9
- #
10
- # It keeps the semantics and most of the efficiency of normal hashes
11
- # while also keeping track of the order in which elements were set.
12
- #
13
- class OrderedHash #:nodoc:
14
- include Enumerable
15
-
16
- Node = Struct.new(:key, :value, :next, :prev)
17
-
18
- def initialize
19
- @hash = {}
20
- end
21
-
22
- def [](key)
23
- @hash[key] && @hash[key].value
24
- end
25
-
26
- def []=(key, value)
27
- if node = @hash[key]
28
- node.value = value
29
- else
30
- node = Node.new(key, value)
31
-
32
- if @first.nil?
33
- @first = @last = node
34
- else
35
- node.prev = @last
36
- @last.next = node
37
- @last = node
38
- end
39
- end
40
-
41
- @hash[key] = node
42
- value
43
- end
44
-
45
- def delete(key)
46
- if node = @hash[key]
47
- prev_node = node.prev
48
- next_node = node.next
49
-
50
- next_node.prev = prev_node if next_node
51
- prev_node.next = next_node if prev_node
52
-
53
- @first = next_node if @first == node
54
- @last = prev_node if @last == node
55
-
56
- value = node.value
57
- end
58
-
59
- @hash.delete(key)
60
- value
61
- end
62
-
63
- def keys
64
- self.map { |k, v| k }
65
- end
66
-
67
- def values
68
- self.map { |k, v| v }
69
- end
70
-
71
- def each
72
- return unless @first
73
- yield [@first.key, @first.value]
74
- node = @first
75
- yield [node.key, node.value] while node = node.next
76
- self
77
- end
78
-
79
- def merge(other)
80
- hash = self.class.new
81
-
82
- self.each do |key, value|
83
- hash[key] = value
84
- end
85
-
86
- other.each do |key, value|
87
- hash[key] = value
88
- end
89
-
90
- hash
91
- end
92
-
93
- def empty?
94
- @hash.empty?
95
- end
96
- end
97
- end
98
-
99
- end
100
- end
@@ -1,35 +0,0 @@
1
- class Thor
2
- # Thor::Error is raised when it's caused by wrong usage of thor classes. Those
3
- # errors have their backtrace suppressed and are nicely shown to the user.
4
- #
5
- # Errors that are caused by the developer, like declaring a method which
6
- # overwrites a thor keyword, it SHOULD NOT raise a Thor::Error. This way, we
7
- # ensure that developer errors are shown with full backtrace.
8
- #
9
- class Error < StandardError
10
- end
11
-
12
- # Raised when a task was not found.
13
- #
14
- class UndefinedTaskError < Error
15
- end
16
-
17
- # Raised when a task was found, but not invoked properly.
18
- #
19
- class InvocationError < Error
20
- end
21
-
22
- class UnknownArgumentError < Error
23
- end
24
-
25
- class RequiredArgumentMissingError < InvocationError
26
- end
27
-
28
- class MalformattedArgumentError < InvocationError
29
- end
30
-
31
- # Raised when a user tries to call a private method encoded in templated filename.
32
- #
33
- class PrivateMethodEncodedError < Error
34
- end
35
- end
@@ -1,285 +0,0 @@
1
- require 'thor/base'
2
-
3
- # Thor has a special class called Thor::Group. The main difference to Thor class
4
- # is that it invokes all tasks at once. It also include some methods that allows
5
- # invocations to be done at the class method, which are not available to Thor
6
- # tasks.
7
- class Thor::Group
8
- class << self
9
- # The description for this Thor::Group. If none is provided, but a source root
10
- # exists, tries to find the USAGE one folder above it, otherwise searches
11
- # in the superclass.
12
- #
13
- # ==== Parameters
14
- # description<String>:: The description for this Thor::Group.
15
- #
16
- def desc(description=nil)
17
- case description
18
- when nil
19
- @desc ||= from_superclass(:desc, nil)
20
- else
21
- @desc = description
22
- end
23
- end
24
-
25
- # Prints help information.
26
- #
27
- # ==== Options
28
- # short:: When true, shows only usage.
29
- #
30
- def help(shell)
31
- shell.say "Usage:"
32
- shell.say " #{banner}\n"
33
- shell.say
34
- class_options_help(shell)
35
- shell.say self.desc if self.desc
36
- end
37
-
38
- # Stores invocations for this class merging with superclass values.
39
- #
40
- def invocations #:nodoc:
41
- @invocations ||= from_superclass(:invocations, {})
42
- end
43
-
44
- # Stores invocation blocks used on invoke_from_option.
45
- #
46
- def invocation_blocks #:nodoc:
47
- @invocation_blocks ||= from_superclass(:invocation_blocks, {})
48
- end
49
-
50
- # Invoke the given namespace or class given. It adds an instance
51
- # method that will invoke the klass and task. You can give a block to
52
- # configure how it will be invoked.
53
- #
54
- # The namespace/class given will have its options showed on the help
55
- # usage. Check invoke_from_option for more information.
56
- #
57
- def invoke(*names, &block)
58
- options = names.last.is_a?(Hash) ? names.pop : {}
59
- verbose = options.fetch(:verbose, true)
60
-
61
- names.each do |name|
62
- invocations[name] = false
63
- invocation_blocks[name] = block if block_given?
64
-
65
- class_eval <<-METHOD, __FILE__, __LINE__
66
- def _invoke_#{name.to_s.gsub(/\W/, '_')}
67
- klass, task = self.class.prepare_for_invocation(nil, #{name.inspect})
68
-
69
- if klass
70
- say_status :invoke, #{name.inspect}, #{verbose.inspect}
71
- block = self.class.invocation_blocks[#{name.inspect}]
72
- _invoke_for_class_method klass, task, &block
73
- else
74
- say_status :error, %(#{name.inspect} [not found]), :red
75
- end
76
- end
77
- METHOD
78
- end
79
- end
80
-
81
- # Invoke a thor class based on the value supplied by the user to the
82
- # given option named "name". A class option must be created before this
83
- # method is invoked for each name given.
84
- #
85
- # ==== Examples
86
- #
87
- # class GemGenerator < Thor::Group
88
- # class_option :test_framework, :type => :string
89
- # invoke_from_option :test_framework
90
- # end
91
- #
92
- # ==== Boolean options
93
- #
94
- # In some cases, you want to invoke a thor class if some option is true or
95
- # false. This is automatically handled by invoke_from_option. Then the
96
- # option name is used to invoke the generator.
97
- #
98
- # ==== Preparing for invocation
99
- #
100
- # In some cases you want to customize how a specified hook is going to be
101
- # invoked. You can do that by overwriting the class method
102
- # prepare_for_invocation. The class method must necessarily return a klass
103
- # and an optional task.
104
- #
105
- # ==== Custom invocations
106
- #
107
- # You can also supply a block to customize how the option is going to be
108
- # invoked. The block receives two parameters, an instance of the current
109
- # class and the klass to be invoked.
110
- #
111
- def invoke_from_option(*names, &block)
112
- options = names.last.is_a?(Hash) ? names.pop : {}
113
- verbose = options.fetch(:verbose, :white)
114
-
115
- names.each do |name|
116
- unless class_options.key?(name)
117
- raise ArgumentError, "You have to define the option #{name.inspect} " <<
118
- "before setting invoke_from_option."
119
- end
120
-
121
- invocations[name] = true
122
- invocation_blocks[name] = block if block_given?
123
-
124
- class_eval <<-METHOD, __FILE__, __LINE__
125
- def _invoke_from_option_#{name.to_s.gsub(/\W/, '_')}
126
- return unless options[#{name.inspect}]
127
-
128
- value = options[#{name.inspect}]
129
- value = #{name.inspect} if TrueClass === value
130
- klass, task = self.class.prepare_for_invocation(#{name.inspect}, value)
131
-
132
- if klass
133
- say_status :invoke, value, #{verbose.inspect}
134
- block = self.class.invocation_blocks[#{name.inspect}]
135
- _invoke_for_class_method klass, task, &block
136
- else
137
- say_status :error, %(\#{value} [not found]), :red
138
- end
139
- end
140
- METHOD
141
- end
142
- end
143
-
144
- # Remove a previously added invocation.
145
- #
146
- # ==== Examples
147
- #
148
- # remove_invocation :test_framework
149
- #
150
- def remove_invocation(*names)
151
- names.each do |name|
152
- remove_task(name)
153
- remove_class_option(name)
154
- invocations.delete(name)
155
- invocation_blocks.delete(name)
156
- end
157
- end
158
-
159
- # Overwrite class options help to allow invoked generators options to be
160
- # shown recursively when invoking a generator.
161
- #
162
- def class_options_help(shell, groups={}) #:nodoc:
163
- get_options_from_invocations(groups, class_options) do |klass|
164
- klass.send(:get_options_from_invocations, groups, class_options)
165
- end
166
- super(shell, groups)
167
- end
168
-
169
- # Get invocations array and merge options from invocations. Those
170
- # options are added to group_options hash. Options that already exists
171
- # in base_options are not added twice.
172
- #
173
- def get_options_from_invocations(group_options, base_options) #:nodoc:
174
- invocations.each do |name, from_option|
175
- value = if from_option
176
- option = class_options[name]
177
- option.type == :boolean ? name : option.default
178
- else
179
- name
180
- end
181
- next unless value
182
-
183
- klass, task = prepare_for_invocation(name, value)
184
- next unless klass && klass.respond_to?(:class_options)
185
-
186
- value = value.to_s
187
- human_name = value.respond_to?(:classify) ? value.classify : value
188
-
189
- group_options[human_name] ||= []
190
- group_options[human_name] += klass.class_options.values.select do |class_option|
191
- base_options[class_option.name.to_sym].nil? && class_option.group.nil? &&
192
- !group_options.values.flatten.any? { |i| i.name == class_option.name }
193
- end
194
-
195
- yield klass if block_given?
196
- end
197
- end
198
-
199
- # Returns tasks ready to be printed.
200
- def printable_tasks(*)
201
- item = []
202
- item << banner
203
- item << (desc ? "# #{desc.gsub(/\s+/m,' ')}" : "")
204
- [item]
205
- end
206
-
207
- def handle_argument_error(task, error, arity=nil) #:nodoc:
208
- if arity > 0
209
- msg = "#{basename} #{task.name} takes #{arity} argument"
210
- msg << "s" if arity > 1
211
- msg << ", but it should not."
212
- else
213
- msg = "You should not pass arguments to #{basename} #{task.name}."
214
- end
215
-
216
- raise error, msg
217
- end
218
-
219
- protected
220
-
221
- # The method responsible for dispatching given the args.
222
- def dispatch(task, given_args, given_opts, config) #:nodoc:
223
- if Thor::HELP_MAPPINGS.include?(given_args.first)
224
- help(config[:shell])
225
- return
226
- end
227
-
228
- args, opts = Thor::Options.split(given_args)
229
- opts = given_opts || opts
230
-
231
- instance = new(args, opts, config)
232
- yield instance if block_given?
233
- args = instance.args
234
-
235
- if task
236
- instance.invoke_task(all_tasks[task])
237
- else
238
- instance.invoke_all
239
- end
240
- end
241
-
242
- # The banner for this class. You can customize it if you are invoking the
243
- # thor class by another ways which is not the Thor::Runner.
244
- def banner
245
- "#{basename} #{self_task.formatted_usage(self, false)}"
246
- end
247
-
248
- # Represents the whole class as a task.
249
- def self_task #:nodoc:
250
- Thor::DynamicTask.new(self.namespace, class_options)
251
- end
252
-
253
- def baseclass #:nodoc:
254
- Thor::Group
255
- end
256
-
257
- def create_task(meth) #:nodoc:
258
- tasks[meth.to_s] = Thor::Task.new(meth, nil, nil, nil, nil)
259
- true
260
- end
261
- end
262
-
263
- include Thor::Base
264
-
265
- protected
266
-
267
- # Shortcut to invoke with padding and block handling. Use internally by
268
- # invoke and invoke_from_option class methods.
269
- def _invoke_for_class_method(klass, task=nil, *args, &block) #:nodoc:
270
- with_padding do
271
- if block
272
- case block.arity
273
- when 3
274
- block.call(self, klass, task)
275
- when 2
276
- block.call(self, klass)
277
- when 1
278
- instance_exec(klass, &block)
279
- end
280
- else
281
- invoke klass, task, *args
282
- end
283
- end
284
- end
285
- end