engineyard-serverside 1.5.23.ruby19.8 → 1.5.23.ruby19.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/lib/engineyard-serverside.rb +3 -1
  2. data/lib/engineyard-serverside/cli.rb +11 -19
  3. data/lib/engineyard-serverside/deploy.rb +3 -3
  4. data/lib/engineyard-serverside/future.rb +33 -0
  5. data/lib/engineyard-serverside/futures/celluloid.rb +25 -0
  6. data/lib/engineyard-serverside/futures/dataflow.rb +25 -0
  7. data/lib/engineyard-serverside/logged_output.rb +8 -3
  8. data/lib/engineyard-serverside/task.rb +9 -12
  9. data/lib/engineyard-serverside/version.rb +1 -1
  10. data/lib/vendor/celluloid/lib/celluloid.rb +261 -0
  11. data/lib/vendor/celluloid/lib/celluloid/actor.rb +242 -0
  12. data/lib/vendor/celluloid/lib/celluloid/actor_pool.rb +54 -0
  13. data/lib/vendor/celluloid/lib/celluloid/actor_proxy.rb +75 -0
  14. data/lib/vendor/celluloid/lib/celluloid/application.rb +78 -0
  15. data/lib/vendor/celluloid/lib/celluloid/calls.rb +94 -0
  16. data/lib/vendor/celluloid/lib/celluloid/core_ext.rb +14 -0
  17. data/lib/vendor/celluloid/lib/celluloid/events.rb +14 -0
  18. data/lib/vendor/celluloid/lib/celluloid/fiber.rb +33 -0
  19. data/lib/vendor/celluloid/lib/celluloid/fsm.rb +141 -0
  20. data/lib/vendor/celluloid/lib/celluloid/future.rb +60 -0
  21. data/lib/vendor/celluloid/lib/celluloid/links.rb +61 -0
  22. data/lib/vendor/celluloid/lib/celluloid/logger.rb +32 -0
  23. data/lib/vendor/celluloid/lib/celluloid/mailbox.rb +124 -0
  24. data/lib/vendor/celluloid/lib/celluloid/receivers.rb +66 -0
  25. data/lib/vendor/celluloid/lib/celluloid/registry.rb +33 -0
  26. data/lib/vendor/celluloid/lib/celluloid/responses.rb +26 -0
  27. data/lib/vendor/celluloid/lib/celluloid/rspec.rb +2 -0
  28. data/lib/vendor/celluloid/lib/celluloid/signals.rb +50 -0
  29. data/lib/vendor/celluloid/lib/celluloid/supervisor.rb +57 -0
  30. data/lib/vendor/celluloid/lib/celluloid/task.rb +73 -0
  31. data/lib/vendor/celluloid/lib/celluloid/tcp_server.rb +33 -0
  32. data/lib/vendor/celluloid/lib/celluloid/timers.rb +109 -0
  33. data/lib/vendor/celluloid/lib/celluloid/version.rb +4 -0
  34. data/lib/vendor/dataflow/dataflow.rb +124 -0
  35. data/lib/vendor/dataflow/dataflow/actor.rb +22 -0
  36. data/lib/vendor/dataflow/dataflow/equality.rb +44 -0
  37. data/lib/vendor/dataflow/dataflow/future_queue.rb +24 -0
  38. data/lib/vendor/dataflow/dataflow/port.rb +54 -0
  39. data/lib/vendor/open4/lib/open4.rb +432 -0
  40. data/lib/vendor/thor/lib/thor.rb +244 -0
  41. data/lib/vendor/thor/lib/thor/actions.rb +275 -0
  42. data/lib/vendor/thor/lib/thor/actions/create_file.rb +103 -0
  43. data/lib/vendor/thor/lib/thor/actions/directory.rb +91 -0
  44. data/lib/vendor/thor/lib/thor/actions/empty_directory.rb +134 -0
  45. data/lib/vendor/thor/lib/thor/actions/file_manipulation.rb +223 -0
  46. data/lib/vendor/thor/lib/thor/actions/inject_into_file.rb +104 -0
  47. data/lib/vendor/thor/lib/thor/base.rb +540 -0
  48. data/lib/vendor/thor/lib/thor/core_ext/file_binary_read.rb +9 -0
  49. data/lib/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  50. data/lib/vendor/thor/lib/thor/core_ext/ordered_hash.rb +100 -0
  51. data/lib/vendor/thor/lib/thor/error.rb +30 -0
  52. data/lib/vendor/thor/lib/thor/group.rb +271 -0
  53. data/lib/vendor/thor/lib/thor/invocation.rb +180 -0
  54. data/lib/vendor/thor/lib/thor/parser.rb +4 -0
  55. data/lib/vendor/thor/lib/thor/parser/argument.rb +67 -0
  56. data/lib/vendor/thor/lib/thor/parser/arguments.rb +150 -0
  57. data/lib/vendor/thor/lib/thor/parser/option.rb +128 -0
  58. data/lib/vendor/thor/lib/thor/parser/options.rb +169 -0
  59. data/lib/vendor/thor/lib/thor/rake_compat.rb +66 -0
  60. data/lib/vendor/thor/lib/thor/runner.rb +314 -0
  61. data/lib/vendor/thor/lib/thor/shell.rb +83 -0
  62. data/lib/vendor/thor/lib/thor/shell/basic.rb +239 -0
  63. data/lib/vendor/thor/lib/thor/shell/color.rb +108 -0
  64. data/lib/vendor/thor/lib/thor/task.rb +102 -0
  65. data/lib/vendor/thor/lib/thor/util.rb +230 -0
  66. data/lib/vendor/thor/lib/thor/version.rb +3 -0
  67. metadata +70 -10
@@ -0,0 +1,230 @@
1
+ require 'rbconfig'
2
+
3
+ class Thor
4
+ module Sandbox #:nodoc:
5
+ end
6
+
7
+ # This module holds several utilities:
8
+ #
9
+ # 1) Methods to convert thor namespaces to constants and vice-versa.
10
+ #
11
+ # Thor::Utils.namespace_from_thor_class(Foo::Bar::Baz) #=> "foo:bar:baz"
12
+ #
13
+ # 2) Loading thor files and sandboxing:
14
+ #
15
+ # Thor::Utils.load_thorfile("~/.thor/foo")
16
+ #
17
+ module Util
18
+
19
+ # Receives a namespace and search for it in the Thor::Base subclasses.
20
+ #
21
+ # ==== Parameters
22
+ # namespace<String>:: The namespace to search for.
23
+ #
24
+ def self.find_by_namespace(namespace)
25
+ namespace = "default#{namespace}" if namespace.empty? || namespace =~ /^:/
26
+ Thor::Base.subclasses.find { |klass| klass.namespace == namespace }
27
+ end
28
+
29
+ # Receives a constant and converts it to a Thor namespace. Since Thor tasks
30
+ # can be added to a sandbox, this method is also responsable for removing
31
+ # the sandbox namespace.
32
+ #
33
+ # This method should not be used in general because it's used to deal with
34
+ # older versions of Thor. On current versions, if you need to get the
35
+ # namespace from a class, just call namespace on it.
36
+ #
37
+ # ==== Parameters
38
+ # constant<Object>:: The constant to be converted to the thor path.
39
+ #
40
+ # ==== Returns
41
+ # String:: If we receive Foo::Bar::Baz it returns "foo:bar:baz"
42
+ #
43
+ def self.namespace_from_thor_class(constant)
44
+ constant = constant.to_s.gsub(/^Thor::Sandbox::/, "")
45
+ constant = snake_case(constant).squeeze(":")
46
+ constant
47
+ end
48
+
49
+ # Given the contents, evaluate it inside the sandbox and returns the
50
+ # namespaces defined in the sandbox.
51
+ #
52
+ # ==== Parameters
53
+ # contents<String>
54
+ #
55
+ # ==== Returns
56
+ # Array[Object]
57
+ #
58
+ def self.namespaces_in_content(contents, file=__FILE__)
59
+ old_constants = Thor::Base.subclasses.dup
60
+ Thor::Base.subclasses.clear
61
+
62
+ load_thorfile(file, contents)
63
+
64
+ new_constants = Thor::Base.subclasses.dup
65
+ Thor::Base.subclasses.replace(old_constants)
66
+
67
+ new_constants.map!{ |c| c.namespace }
68
+ new_constants.compact!
69
+ new_constants
70
+ end
71
+
72
+ # Returns the thor classes declared inside the given class.
73
+ #
74
+ def self.thor_classes_in(klass)
75
+ stringfied_constants = klass.constants.map { |c| c.to_s }
76
+ Thor::Base.subclasses.select do |subclass|
77
+ next unless subclass.name
78
+ stringfied_constants.include?(subclass.name.gsub("#{klass.name}::", ''))
79
+ end
80
+ end
81
+
82
+ # Receives a string and convert it to snake case. SnakeCase returns snake_case.
83
+ #
84
+ # ==== Parameters
85
+ # String
86
+ #
87
+ # ==== Returns
88
+ # String
89
+ #
90
+ def self.snake_case(str)
91
+ return str.downcase if str =~ /^[A-Z_]+$/
92
+ str.gsub(/\B[A-Z]/, '_\&').squeeze('_') =~ /_*(.*)/
93
+ return $+.downcase
94
+ end
95
+
96
+ # Receives a string and convert it to camel case. camel_case returns CamelCase.
97
+ #
98
+ # ==== Parameters
99
+ # String
100
+ #
101
+ # ==== Returns
102
+ # String
103
+ #
104
+ def self.camel_case(str)
105
+ return str if str !~ /_/ && str =~ /[A-Z]+.*/
106
+ str.split('_').map { |i| i.capitalize }.join
107
+ end
108
+
109
+ # Receives a namespace and tries to retrieve a Thor or Thor::Group class
110
+ # from it. It first searches for a class using the all the given namespace,
111
+ # if it's not found, removes the highest entry and searches for the class
112
+ # again. If found, returns the highest entry as the class name.
113
+ #
114
+ # ==== Examples
115
+ #
116
+ # class Foo::Bar < Thor
117
+ # def baz
118
+ # end
119
+ # end
120
+ #
121
+ # class Baz::Foo < Thor::Group
122
+ # end
123
+ #
124
+ # Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default task
125
+ # Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil
126
+ # Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz"
127
+ #
128
+ # ==== Parameters
129
+ # namespace<String>
130
+ #
131
+ def self.find_class_and_task_by_namespace(namespace)
132
+ if namespace.include?(?:)
133
+ pieces = namespace.split(":")
134
+ task = pieces.pop
135
+ klass = Thor::Util.find_by_namespace(pieces.join(":"))
136
+ end
137
+
138
+ unless klass
139
+ klass, task = Thor::Util.find_by_namespace(namespace), nil
140
+ end
141
+
142
+ return klass, task
143
+ end
144
+
145
+ # The same as namespace_to_thor_class_and_task!, but raises an error if a klass
146
+ # could not be found.
147
+ def self.find_class_and_task_by_namespace!(namespace)
148
+ klass, task = find_class_and_task_by_namespace(namespace)
149
+ raise Error, "Could not find namespace or task #{namespace.inspect}." unless klass
150
+ return klass, task
151
+ end
152
+
153
+ # Receives a path and load the thor file in the path. The file is evaluated
154
+ # inside the sandbox to avoid namespacing conflicts.
155
+ #
156
+ def self.load_thorfile(path, content=nil)
157
+ content ||= File.binread(path)
158
+
159
+ begin
160
+ Thor::Sandbox.class_eval(content, path)
161
+ rescue Exception => e
162
+ $stderr.puts "WARNING: unable to load thorfile #{path.inspect}: #{e.message}"
163
+ end
164
+ end
165
+
166
+ def self.user_home
167
+ @@user_home ||= if ENV["HOME"]
168
+ ENV["HOME"]
169
+ elsif ENV["USERPROFILE"]
170
+ ENV["USERPROFILE"]
171
+ elsif ENV["HOMEDRIVE"] && ENV["HOMEPATH"]
172
+ File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"])
173
+ elsif ENV["APPDATA"]
174
+ ENV["APPDATA"]
175
+ else
176
+ begin
177
+ File.expand_path("~")
178
+ rescue
179
+ if File::ALT_SEPARATOR
180
+ "C:/"
181
+ else
182
+ "/"
183
+ end
184
+ end
185
+ end
186
+ end
187
+
188
+ # Returns the root where thor files are located, dependending on the OS.
189
+ #
190
+ def self.thor_root
191
+ File.join(user_home, ".thor").gsub(/\\/, '/')
192
+ end
193
+
194
+ # Returns the files in the thor root. On Windows thor_root will be something
195
+ # like this:
196
+ #
197
+ # C:\Documents and Settings\james\.thor
198
+ #
199
+ # If we don't #gsub the \ character, Dir.glob will fail.
200
+ #
201
+ def self.thor_root_glob
202
+ files = Dir["#{thor_root}/*"]
203
+
204
+ files.map! do |file|
205
+ File.directory?(file) ? File.join(file, "main.thor") : file
206
+ end
207
+ end
208
+
209
+ # Where to look for Thor files.
210
+ #
211
+ def self.globs_for(path)
212
+ ["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks/*.thor"]
213
+ end
214
+
215
+ # Return the path to the ruby interpreter taking into account multiple
216
+ # installations and windows extensions.
217
+ #
218
+ def self.ruby_command
219
+ @ruby_command ||= begin
220
+ ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
221
+ ruby << Config::CONFIG['EXEEXT']
222
+
223
+ # escape string in case path to ruby executable contain spaces.
224
+ ruby.sub!(/.*\s.*/m, '"\&"')
225
+ ruby
226
+ end
227
+ end
228
+
229
+ end
230
+ end
@@ -0,0 +1,3 @@
1
+ class Thor
2
+ VERSION = "0.13.3".freeze
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-serverside
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.23.ruby19.8
4
+ version: 1.5.23.ruby19.9
5
5
  prerelease: 7
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-04 00:00:00.000000000 Z
12
+ date: 2012-01-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: celluloid
16
- requirement: &2154819020 !ruby/object:Gem::Requirement
16
+ requirement: &2155342020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2154819020
24
+ version_requirements: *2155342020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &2154818520 !ruby/object:Gem::Requirement
27
+ requirement: &2155341520 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.13.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2154818520
35
+ version_requirements: *2155341520
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &2154818020 !ruby/object:Gem::Requirement
38
+ requirement: &2155341020 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.3.2
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2154818020
46
+ version_requirements: *2155341020
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &2154817560 !ruby/object:Gem::Requirement
49
+ requirement: &2155340560 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 0.9.2.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2154817560
57
+ version_requirements: *2155340560
58
58
  description:
59
59
  email: cloud@engineyard.com
60
60
  executables:
@@ -69,6 +69,9 @@ files:
69
69
  - lib/engineyard-serverside/deploy.rb
70
70
  - lib/engineyard-serverside/deploy_hook.rb
71
71
  - lib/engineyard-serverside/deprecation.rb
72
+ - lib/engineyard-serverside/future.rb
73
+ - lib/engineyard-serverside/futures/celluloid.rb
74
+ - lib/engineyard-serverside/futures/dataflow.rb
72
75
  - lib/engineyard-serverside/lockfile_parser.rb
73
76
  - lib/engineyard-serverside/logged_output.rb
74
77
  - lib/engineyard-serverside/rails_asset_support.rb
@@ -77,6 +80,35 @@ files:
77
80
  - lib/engineyard-serverside/task.rb
78
81
  - lib/engineyard-serverside/version.rb
79
82
  - lib/engineyard-serverside.rb
83
+ - lib/vendor/celluloid/lib/celluloid/actor.rb
84
+ - lib/vendor/celluloid/lib/celluloid/actor_pool.rb
85
+ - lib/vendor/celluloid/lib/celluloid/actor_proxy.rb
86
+ - lib/vendor/celluloid/lib/celluloid/application.rb
87
+ - lib/vendor/celluloid/lib/celluloid/calls.rb
88
+ - lib/vendor/celluloid/lib/celluloid/core_ext.rb
89
+ - lib/vendor/celluloid/lib/celluloid/events.rb
90
+ - lib/vendor/celluloid/lib/celluloid/fiber.rb
91
+ - lib/vendor/celluloid/lib/celluloid/fsm.rb
92
+ - lib/vendor/celluloid/lib/celluloid/future.rb
93
+ - lib/vendor/celluloid/lib/celluloid/links.rb
94
+ - lib/vendor/celluloid/lib/celluloid/logger.rb
95
+ - lib/vendor/celluloid/lib/celluloid/mailbox.rb
96
+ - lib/vendor/celluloid/lib/celluloid/receivers.rb
97
+ - lib/vendor/celluloid/lib/celluloid/registry.rb
98
+ - lib/vendor/celluloid/lib/celluloid/responses.rb
99
+ - lib/vendor/celluloid/lib/celluloid/rspec.rb
100
+ - lib/vendor/celluloid/lib/celluloid/signals.rb
101
+ - lib/vendor/celluloid/lib/celluloid/supervisor.rb
102
+ - lib/vendor/celluloid/lib/celluloid/task.rb
103
+ - lib/vendor/celluloid/lib/celluloid/tcp_server.rb
104
+ - lib/vendor/celluloid/lib/celluloid/timers.rb
105
+ - lib/vendor/celluloid/lib/celluloid/version.rb
106
+ - lib/vendor/celluloid/lib/celluloid.rb
107
+ - lib/vendor/dataflow/dataflow/actor.rb
108
+ - lib/vendor/dataflow/dataflow/equality.rb
109
+ - lib/vendor/dataflow/dataflow/future_queue.rb
110
+ - lib/vendor/dataflow/dataflow/port.rb
111
+ - lib/vendor/dataflow/dataflow.rb
80
112
  - lib/vendor/escape/lib/escape.rb
81
113
  - lib/vendor/json_pure/lib/json/add/core.rb
82
114
  - lib/vendor/json_pure/lib/json/add/rails.rb
@@ -97,6 +129,34 @@ files:
97
129
  - lib/vendor/json_pure/lib/json/TrueClass.xpm
98
130
  - lib/vendor/json_pure/lib/json/version.rb
99
131
  - lib/vendor/json_pure/lib/json.rb
132
+ - lib/vendor/open4/lib/open4.rb
133
+ - lib/vendor/thor/lib/thor/actions/create_file.rb
134
+ - lib/vendor/thor/lib/thor/actions/directory.rb
135
+ - lib/vendor/thor/lib/thor/actions/empty_directory.rb
136
+ - lib/vendor/thor/lib/thor/actions/file_manipulation.rb
137
+ - lib/vendor/thor/lib/thor/actions/inject_into_file.rb
138
+ - lib/vendor/thor/lib/thor/actions.rb
139
+ - lib/vendor/thor/lib/thor/base.rb
140
+ - lib/vendor/thor/lib/thor/core_ext/file_binary_read.rb
141
+ - lib/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb
142
+ - lib/vendor/thor/lib/thor/core_ext/ordered_hash.rb
143
+ - lib/vendor/thor/lib/thor/error.rb
144
+ - lib/vendor/thor/lib/thor/group.rb
145
+ - lib/vendor/thor/lib/thor/invocation.rb
146
+ - lib/vendor/thor/lib/thor/parser/argument.rb
147
+ - lib/vendor/thor/lib/thor/parser/arguments.rb
148
+ - lib/vendor/thor/lib/thor/parser/option.rb
149
+ - lib/vendor/thor/lib/thor/parser/options.rb
150
+ - lib/vendor/thor/lib/thor/parser.rb
151
+ - lib/vendor/thor/lib/thor/rake_compat.rb
152
+ - lib/vendor/thor/lib/thor/runner.rb
153
+ - lib/vendor/thor/lib/thor/shell/basic.rb
154
+ - lib/vendor/thor/lib/thor/shell/color.rb
155
+ - lib/vendor/thor/lib/thor/shell.rb
156
+ - lib/vendor/thor/lib/thor/task.rb
157
+ - lib/vendor/thor/lib/thor/util.rb
158
+ - lib/vendor/thor/lib/thor/version.rb
159
+ - lib/vendor/thor/lib/thor.rb
100
160
  - LICENSE
101
161
  - spec/basic_deploy_spec.rb
102
162
  - spec/bundler_deploy_spec.rb