engineyard-serverside 2.8.0.pre4 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (308) hide show
  1. checksums.yaml +13 -5
  2. data/features/hook/running-a-deploy-hook.feature +277 -0
  3. data/features/hook/step_definitions/running-a-deploy-hook-steps.rb +200 -0
  4. data/features/step_definitions/command_steps.rb +8 -0
  5. data/features/step_definitions/version_steps.rb +5 -0
  6. data/features/support/env.rb +63 -0
  7. data/features/support/error_codes.rb +17 -0
  8. data/features/support/fs_helpers.rb +82 -0
  9. data/features/support/output_helpers.rb +7 -0
  10. data/features/support/runner.rb +41 -0
  11. data/features/version.feature +7 -0
  12. data/lib/engineyard-serverside/cli/app.rb +6 -0
  13. data/lib/engineyard-serverside/configuration.rb +3 -3
  14. data/lib/engineyard-serverside/deploy.rb +2 -1
  15. data/lib/engineyard-serverside/propagator.rb +1 -1
  16. data/lib/engineyard-serverside/shell.rb +38 -10
  17. data/lib/engineyard-serverside/version.rb +1 -1
  18. data/lib/engineyard-serverside.rb +2 -5
  19. data/spec/engineyard-serverside/callbacks/collection/combined_spec.rb +232 -0
  20. data/spec/engineyard-serverside/callbacks/collection/deploy_hooks_spec.rb +170 -0
  21. data/spec/engineyard-serverside/callbacks/collection/service_hooks/collection_spec.rb +171 -0
  22. data/spec/engineyard-serverside/callbacks/collection/service_hooks/combined_spec.rb +174 -0
  23. data/spec/engineyard-serverside/callbacks/collection/service_hooks_spec.rb +31 -0
  24. data/spec/engineyard-serverside/callbacks/collection_spec.rb +49 -0
  25. data/spec/engineyard-serverside/callbacks/distributor/remote_spec.rb +135 -0
  26. data/spec/engineyard-serverside/callbacks/distributor/viability_filter_spec.rb +208 -0
  27. data/spec/engineyard-serverside/callbacks/distributor_spec.rb +43 -0
  28. data/spec/engineyard-serverside/callbacks/executor/executable_spec.rb +386 -0
  29. data/spec/engineyard-serverside/callbacks/executor/ruby/context_spec.rb +538 -0
  30. data/spec/engineyard-serverside/callbacks/executor/ruby/executor_spec.rb +313 -0
  31. data/spec/engineyard-serverside/callbacks/executor/ruby_spec.rb +35 -0
  32. data/spec/engineyard-serverside/callbacks/executor_spec.rb +45 -0
  33. data/spec/engineyard-serverside/callbacks_spec.rb +31 -0
  34. data/spec/engineyard-serverside/cli/workflows/base_spec.rb +237 -0
  35. data/spec/engineyard-serverside/cli/workflows/calling_deploy_hooks_spec.rb +65 -0
  36. data/spec/engineyard-serverside/cli/workflows/deploying_applications_spec.rb +61 -0
  37. data/spec/engineyard-serverside/cli/workflows/disabling_maintenance_spec.rb +61 -0
  38. data/spec/engineyard-serverside/cli/workflows/enabling_maintenance_spec.rb +61 -0
  39. data/spec/engineyard-serverside/cli/workflows/helpers_spec.rb +64 -0
  40. data/spec/engineyard-serverside/cli/workflows/rolling_back_applications_spec.rb +61 -0
  41. data/spec/engineyard-serverside/cli/workflows/showing_maintenance_status_spec.rb +60 -0
  42. data/spec/engineyard-serverside/cli/workflows_spec.rb +87 -0
  43. data/spec/engineyard-serverside/dependency_manager/base_spec.rb +139 -0
  44. data/spec/engineyard-serverside/paths_spec.rb +820 -0
  45. data/spec/engineyard-serverside/propagator_spec.rb +56 -0
  46. data/spec/engineyard-serverside/server_spec.rb +390 -0
  47. data/spec/engineyard-serverside/shell/helpers_spec.rb +98 -0
  48. data/spec/engineyard-serverside/shell/yieldio_spec.rb +33 -0
  49. data/spec/engineyard-serverside/shell_spec.rb +543 -0
  50. data/spec/engineyard-serverside/slug/distributor_spec.rb +199 -0
  51. data/spec/engineyard-serverside/slug/enabler_spec.rb +191 -0
  52. data/spec/engineyard-serverside/slug/failure_handler_spec.rb +114 -0
  53. data/spec/engineyard-serverside/slug/finalizer_spec.rb +191 -0
  54. data/spec/engineyard-serverside/slug/generator_spec.rb +82 -0
  55. data/spec/engineyard-serverside/slug/migrator_spec.rb +137 -0
  56. data/spec/engineyard-serverside/slug/restarter_spec.rb +226 -0
  57. data/spec/engineyard-serverside/slug/source/updater_spec.rb +710 -0
  58. data/spec/engineyard-serverside/slug/source_spec.rb +40 -0
  59. data/spec/engineyard-serverside/source_spec.rb +171 -0
  60. data/spec/railway_spec.rb +130 -0
  61. data/spec/result/failure_spec.rb +113 -0
  62. data/spec/result/success_spec.rb +109 -0
  63. data/spec/result_spec.rb +23 -0
  64. data/spec/spec_helper.rb +3 -349
  65. metadata +189 -490
  66. data/lib/vendor/json_pure/COPYING +0 -57
  67. data/lib/vendor/json_pure/GPL +0 -340
  68. data/lib/vendor/json_pure/README.rdoc +0 -358
  69. data/lib/vendor/json_pure/VERSION +0 -1
  70. data/lib/vendor/json_pure/lib/json/add/bigdecimal.rb +0 -28
  71. data/lib/vendor/json_pure/lib/json/add/complex.rb +0 -22
  72. data/lib/vendor/json_pure/lib/json/add/core.rb +0 -11
  73. data/lib/vendor/json_pure/lib/json/add/date.rb +0 -34
  74. data/lib/vendor/json_pure/lib/json/add/date_time.rb +0 -48
  75. data/lib/vendor/json_pure/lib/json/add/exception.rb +0 -31
  76. data/lib/vendor/json_pure/lib/json/add/ostruct.rb +0 -31
  77. data/lib/vendor/json_pure/lib/json/add/range.rb +0 -29
  78. data/lib/vendor/json_pure/lib/json/add/rational.rb +0 -22
  79. data/lib/vendor/json_pure/lib/json/add/regexp.rb +0 -30
  80. data/lib/vendor/json_pure/lib/json/add/struct.rb +0 -30
  81. data/lib/vendor/json_pure/lib/json/add/symbol.rb +0 -25
  82. data/lib/vendor/json_pure/lib/json/add/time.rb +0 -38
  83. data/lib/vendor/json_pure/lib/json/common.rb +0 -484
  84. data/lib/vendor/json_pure/lib/json/ext.rb +0 -21
  85. data/lib/vendor/json_pure/lib/json/generic_object.rb +0 -70
  86. data/lib/vendor/json_pure/lib/json/pure/generator.rb +0 -522
  87. data/lib/vendor/json_pure/lib/json/pure/parser.rb +0 -359
  88. data/lib/vendor/json_pure/lib/json/pure.rb +0 -21
  89. data/lib/vendor/json_pure/lib/json/version.rb +0 -8
  90. data/lib/vendor/json_pure/lib/json.rb +0 -62
  91. data/lib/vendor/multi_json/CHANGELOG.md +0 -121
  92. data/lib/vendor/multi_json/CONTRIBUTING.md +0 -46
  93. data/lib/vendor/multi_json/Gemfile +0 -31
  94. data/lib/vendor/multi_json/LICENSE.md +0 -20
  95. data/lib/vendor/multi_json/README.md +0 -105
  96. data/lib/vendor/multi_json/Rakefile +0 -12
  97. data/lib/vendor/multi_json/lib/multi_json/adapters/gson.rb +0 -20
  98. data/lib/vendor/multi_json/lib/multi_json/adapters/json_common.rb +0 -35
  99. data/lib/vendor/multi_json/lib/multi_json/adapters/json_gem.rb +0 -12
  100. data/lib/vendor/multi_json/lib/multi_json/adapters/json_pure.rb +0 -12
  101. data/lib/vendor/multi_json/lib/multi_json/adapters/nsjsonserialization.rb +0 -35
  102. data/lib/vendor/multi_json/lib/multi_json/adapters/oj.rb +0 -29
  103. data/lib/vendor/multi_json/lib/multi_json/adapters/ok_json.rb +0 -58
  104. data/lib/vendor/multi_json/lib/multi_json/adapters/yajl.rb +0 -20
  105. data/lib/vendor/multi_json/lib/multi_json/vendor/okjson.rb +0 -602
  106. data/lib/vendor/multi_json/lib/multi_json/version.rb +0 -3
  107. data/lib/vendor/multi_json/lib/multi_json.rb +0 -137
  108. data/lib/vendor/multi_json/spec/adapter_shared_example.rb +0 -162
  109. data/lib/vendor/multi_json/spec/helper.rb +0 -45
  110. data/lib/vendor/multi_json/spec/json_common_shared_example.rb +0 -36
  111. data/lib/vendor/multi_json/spec/multi_json_spec.rb +0 -151
  112. data/spec/archive_deploy_spec.rb +0 -53
  113. data/spec/basic_deploy_spec.rb +0 -26
  114. data/spec/bundler_deploy_spec.rb +0 -160
  115. data/spec/configuration_spec.rb +0 -206
  116. data/spec/custom_deploy_spec.rb +0 -128
  117. data/spec/deploy_hook_spec.rb +0 -378
  118. data/spec/deprecation_spec.rb +0 -23
  119. data/spec/ey_yml_customized_deploy_spec.rb +0 -99
  120. data/spec/fixtures/gitrepo.tar.gz +0 -0
  121. data/spec/fixtures/invalid_hook.rb +0 -1
  122. data/spec/fixtures/lockfiles/0.9-no-bundler +0 -111
  123. data/spec/fixtures/lockfiles/0.9-with-bundler +0 -117
  124. data/spec/fixtures/lockfiles/1.0-no-bundler +0 -54
  125. data/spec/fixtures/lockfiles/1.0.0.rc.1-with-bundler +0 -162
  126. data/spec/fixtures/lockfiles/1.0.18-do_mysql +0 -88
  127. data/spec/fixtures/lockfiles/1.0.18-do_postgres +0 -79
  128. data/spec/fixtures/lockfiles/1.0.18-mysql +0 -43
  129. data/spec/fixtures/lockfiles/1.0.18-mysql2 +0 -43
  130. data/spec/fixtures/lockfiles/1.0.18-pg +0 -43
  131. data/spec/fixtures/lockfiles/1.0.6-no-bundler +0 -51
  132. data/spec/fixtures/lockfiles/1.0.6-with-any-bundler +0 -52
  133. data/spec/fixtures/lockfiles/1.0.6-with-bundler +0 -52
  134. data/spec/fixtures/lockfiles/1.15.1-no-bundler +0 -51
  135. data/spec/fixtures/lockfiles/1.3.1-rails-3.2.13 +0 -112
  136. data/spec/fixtures/lockfiles/not-a-lockfile +0 -1
  137. data/spec/fixtures/repos/assets_detected/Gemfile +0 -5
  138. data/spec/fixtures/repos/assets_detected/Gemfile.lock +0 -88
  139. data/spec/fixtures/repos/assets_detected/README +0 -1
  140. data/spec/fixtures/repos/assets_detected/Rakefile +0 -5
  141. data/spec/fixtures/repos/assets_detected/app/assets/empty +0 -0
  142. data/spec/fixtures/repos/assets_detected/config/application.rb +0 -5
  143. data/spec/fixtures/repos/assets_detected/config/ey.yml +0 -3
  144. data/spec/fixtures/repos/assets_disabled/Gemfile +0 -5
  145. data/spec/fixtures/repos/assets_disabled/Gemfile.lock +0 -88
  146. data/spec/fixtures/repos/assets_disabled/README +0 -1
  147. data/spec/fixtures/repos/assets_disabled/Rakefile +0 -6
  148. data/spec/fixtures/repos/assets_disabled/app/assets/empty +0 -0
  149. data/spec/fixtures/repos/assets_disabled/config/application.rb +0 -5
  150. data/spec/fixtures/repos/assets_disabled/config/ey.yml +0 -3
  151. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile +0 -5
  152. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile.lock +0 -88
  153. data/spec/fixtures/repos/assets_disabled_in_ey_yml/README +0 -1
  154. data/spec/fixtures/repos/assets_disabled_in_ey_yml/Rakefile +0 -6
  155. data/spec/fixtures/repos/assets_disabled_in_ey_yml/app/assets/empty +0 -0
  156. data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/application.rb +0 -5
  157. data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/ey.yml +0 -5
  158. data/spec/fixtures/repos/assets_disabled_utf8/Gemfile +0 -5
  159. data/spec/fixtures/repos/assets_disabled_utf8/Gemfile.lock +0 -88
  160. data/spec/fixtures/repos/assets_disabled_utf8/README +0 -3
  161. data/spec/fixtures/repos/assets_disabled_utf8/Rakefile +0 -5
  162. data/spec/fixtures/repos/assets_disabled_utf8/app/assets/empty +0 -0
  163. data/spec/fixtures/repos/assets_disabled_utf8/config/application.rb +0 -7
  164. data/spec/fixtures/repos/assets_disabled_utf8/config/ey.yml +0 -3
  165. data/spec/fixtures/repos/assets_enabled_all/Gemfile +0 -5
  166. data/spec/fixtures/repos/assets_enabled_all/Gemfile.lock +0 -88
  167. data/spec/fixtures/repos/assets_enabled_all/README +0 -1
  168. data/spec/fixtures/repos/assets_enabled_all/app/assets/empty +0 -0
  169. data/spec/fixtures/repos/assets_enabled_all/config/application.rb +0 -5
  170. data/spec/fixtures/repos/assets_enabled_all/config/ey.yml +0 -6
  171. data/spec/fixtures/repos/assets_enabled_all/script/assets +0 -5
  172. data/spec/fixtures/repos/assets_enabled_all/tmp/obstruction +0 -1
  173. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile +0 -3
  174. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile.lock +0 -10
  175. data/spec/fixtures/repos/assets_enabled_in_ey_yml/README +0 -1
  176. data/spec/fixtures/repos/assets_enabled_in_ey_yml/Rakefile +0 -8
  177. data/spec/fixtures/repos/assets_enabled_in_ey_yml/config/ey.yml +0 -4
  178. data/spec/fixtures/repos/assets_enabled_util_only/Gemfile +0 -5
  179. data/spec/fixtures/repos/assets_enabled_util_only/Gemfile.lock +0 -88
  180. data/spec/fixtures/repos/assets_enabled_util_only/README +0 -1
  181. data/spec/fixtures/repos/assets_enabled_util_only/Rakefile +0 -6
  182. data/spec/fixtures/repos/assets_enabled_util_only/app/assets/empty +0 -0
  183. data/spec/fixtures/repos/assets_enabled_util_only/config/application.rb +0 -5
  184. data/spec/fixtures/repos/assets_enabled_util_only/config/ey.yml +0 -6
  185. data/spec/fixtures/repos/assets_error/Gemfile +0 -5
  186. data/spec/fixtures/repos/assets_error/Gemfile.lock +0 -88
  187. data/spec/fixtures/repos/assets_error/README +0 -1
  188. data/spec/fixtures/repos/assets_error/Rakefile +0 -4
  189. data/spec/fixtures/repos/assets_error/app/assets/empty +0 -0
  190. data/spec/fixtures/repos/assets_error/config/application.rb +0 -5
  191. data/spec/fixtures/repos/assets_error/config/ey.yml +0 -4
  192. data/spec/fixtures/repos/assets_in_hook/Gemfile +0 -5
  193. data/spec/fixtures/repos/assets_in_hook/Gemfile.lock +0 -88
  194. data/spec/fixtures/repos/assets_in_hook/README +0 -2
  195. data/spec/fixtures/repos/assets_in_hook/Rakefile +0 -5
  196. data/spec/fixtures/repos/assets_in_hook/app/assets/empty +0 -0
  197. data/spec/fixtures/repos/assets_in_hook/config/application.rb +0 -5
  198. data/spec/fixtures/repos/assets_in_hook/config/ey.yml +0 -3
  199. data/spec/fixtures/repos/assets_in_hook/deploy/before_compile_assets.rb +0 -2
  200. data/spec/fixtures/repos/bundle_fails/Gemfile +0 -1
  201. data/spec/fixtures/repos/bundle_fails/README +0 -1
  202. data/spec/fixtures/repos/bundle_fails/deploy/after_bundle.rb +0 -1
  203. data/spec/fixtures/repos/bundler_disabled/Gemfile +0 -4
  204. data/spec/fixtures/repos/bundler_disabled/Gemfile.lock +0 -12
  205. data/spec/fixtures/repos/bundler_disabled/README +0 -1
  206. data/spec/fixtures/repos/bundler_disabled/config/ey.yml +0 -2
  207. data/spec/fixtures/repos/bundler_disabled/deploy/after_bundle.rb +0 -1
  208. data/spec/fixtures/repos/bundler_disabled/deploy/before_bundle.rb +0 -1
  209. data/spec/fixtures/repos/bundler_old/Gemfile +0 -5
  210. data/spec/fixtures/repos/bundler_old/Gemfile.lock +0 -15
  211. data/spec/fixtures/repos/bundler_old/README +0 -1
  212. data/spec/fixtures/repos/default/Gemfile +0 -4
  213. data/spec/fixtures/repos/default/Gemfile.lock +0 -12
  214. data/spec/fixtures/repos/default/README +0 -5
  215. data/spec/fixtures/repos/default/ey.yml +0 -3
  216. data/spec/fixtures/repos/executable_hooks/README +0 -1
  217. data/spec/fixtures/repos/executable_hooks/deploy/before_restart +0 -72
  218. data/spec/fixtures/repos/executable_hooks_not_executable/README +0 -3
  219. data/spec/fixtures/repos/executable_hooks_not_executable/deploy/before_restart +0 -3
  220. data/spec/fixtures/repos/ey_yml/Gemfile +0 -4
  221. data/spec/fixtures/repos/ey_yml/Gemfile.lock +0 -12
  222. data/spec/fixtures/repos/ey_yml/README +0 -1
  223. data/spec/fixtures/repos/ey_yml/config/ey.yml +0 -18
  224. data/spec/fixtures/repos/ey_yml/deploy/before_migrate.rb +0 -6
  225. data/spec/fixtures/repos/ey_yml_alt/Gemfile +0 -4
  226. data/spec/fixtures/repos/ey_yml_alt/Gemfile.lock +0 -12
  227. data/spec/fixtures/repos/ey_yml_alt/README +0 -1
  228. data/spec/fixtures/repos/ey_yml_alt/deploy/before_migrate.rb +0 -6
  229. data/spec/fixtures/repos/ey_yml_alt/ey.yml +0 -12
  230. data/spec/fixtures/repos/hook_fails/README +0 -1
  231. data/spec/fixtures/repos/hook_fails/deploy/before_deploy.rb +0 -1
  232. data/spec/fixtures/repos/hooks/README +0 -1
  233. data/spec/fixtures/repos/hooks/deploy/after_bundle.rb +0 -1
  234. data/spec/fixtures/repos/hooks/deploy/after_compile_assets.rb +0 -1
  235. data/spec/fixtures/repos/hooks/deploy/after_deploy.rb +0 -1
  236. data/spec/fixtures/repos/hooks/deploy/after_migrate.rb +0 -1
  237. data/spec/fixtures/repos/hooks/deploy/after_restart.rb +0 -1
  238. data/spec/fixtures/repos/hooks/deploy/after_symlink.rb +0 -1
  239. data/spec/fixtures/repos/hooks/deploy/before_bundle.rb +0 -1
  240. data/spec/fixtures/repos/hooks/deploy/before_compile_assets.rb +0 -1
  241. data/spec/fixtures/repos/hooks/deploy/before_deploy.rb +0 -1
  242. data/spec/fixtures/repos/hooks/deploy/before_migrate.rb +0 -1
  243. data/spec/fixtures/repos/hooks/deploy/before_restart.rb +0 -1
  244. data/spec/fixtures/repos/hooks/deploy/before_symlink.rb +0 -1
  245. data/spec/fixtures/repos/multi_dep_manager/README +0 -1
  246. data/spec/fixtures/repos/multi_dep_manager/composer.json +0 -5
  247. data/spec/fixtures/repos/multi_dep_manager/composer.lock +0 -462
  248. data/spec/fixtures/repos/multi_dep_manager/package.json +0 -7
  249. data/spec/fixtures/repos/multi_dep_manager/public/index.php +0 -4
  250. data/spec/fixtures/repos/no_ey_config/Gemfile +0 -3
  251. data/spec/fixtures/repos/no_ey_config/Gemfile.lock +0 -10
  252. data/spec/fixtures/repos/no_ey_config/README +0 -1
  253. data/spec/fixtures/repos/no_ey_config/ey.yml +0 -3
  254. data/spec/fixtures/repos/no_ey_config_no_warning/Gemfile +0 -3
  255. data/spec/fixtures/repos/no_ey_config_no_warning/Gemfile.lock +0 -10
  256. data/spec/fixtures/repos/no_ey_config_no_warning/README +0 -1
  257. data/spec/fixtures/repos/no_ey_config_no_warning/ey.yml +0 -5
  258. data/spec/fixtures/repos/no_gemfile_lock/Gemfile +0 -4
  259. data/spec/fixtures/repos/no_gemfile_lock/README +0 -1
  260. data/spec/fixtures/repos/no_gemfile_lock/ey.yml +0 -3
  261. data/spec/fixtures/repos/nodejs/README +0 -1
  262. data/spec/fixtures/repos/nodejs/package.json +0 -7
  263. data/spec/fixtures/repos/not_bundled/README +0 -1
  264. data/spec/fixtures/repos/npm_disabled/README +0 -1
  265. data/spec/fixtures/repos/npm_disabled/config/ey.yml +0 -2
  266. data/spec/fixtures/repos/npm_disabled/package.json +0 -7
  267. data/spec/fixtures/repos/php_composer_disabled/README +0 -1
  268. data/spec/fixtures/repos/php_composer_disabled/composer.json +0 -5
  269. data/spec/fixtures/repos/php_composer_disabled/composer.lock +0 -462
  270. data/spec/fixtures/repos/php_composer_disabled/config/ey.yml +0 -2
  271. data/spec/fixtures/repos/php_composer_disabled/public/index.php +0 -4
  272. data/spec/fixtures/repos/php_composer_lock/README +0 -1
  273. data/spec/fixtures/repos/php_composer_lock/composer.json +0 -5
  274. data/spec/fixtures/repos/php_composer_lock/composer.lock +0 -462
  275. data/spec/fixtures/repos/php_composer_lock/public/index.php +0 -4
  276. data/spec/fixtures/repos/php_no_composer_lock/README +0 -1
  277. data/spec/fixtures/repos/php_no_composer_lock/composer.json +0 -21
  278. data/spec/fixtures/repos/php_no_composer_lock/public/index.php +0 -4
  279. data/spec/fixtures/repos/public_system/Gemfile +0 -4
  280. data/spec/fixtures/repos/public_system/Gemfile.lock +0 -12
  281. data/spec/fixtures/repos/public_system/README +0 -5
  282. data/spec/fixtures/repos/public_system/ey.yml +0 -3
  283. data/spec/fixtures/repos/public_system/public/system/cant_touch_this.txt +0 -3
  284. data/spec/fixtures/repos/sqlite3/Gemfile +0 -4
  285. data/spec/fixtures/repos/sqlite3/Gemfile.lock +0 -89
  286. data/spec/fixtures/repos/sqlite3/README +0 -1
  287. data/spec/fixtures/retwisj.war +0 -0
  288. data/spec/fixtures/valid_hook.rb +0 -1
  289. data/spec/git_strategy_spec.rb +0 -34
  290. data/spec/lockfile_parser_spec.rb +0 -126
  291. data/spec/maintenance_spec.rb +0 -44
  292. data/spec/multi_dependency_manager_spec.rb +0 -25
  293. data/spec/nodejs_deploy_spec.rb +0 -30
  294. data/spec/php_deploy_spec.rb +0 -81
  295. data/spec/platform_configure_spec.rb +0 -61
  296. data/spec/rails31_deploy_spec.rb +0 -172
  297. data/spec/restart_spec.rb +0 -43
  298. data/spec/rollback_spec.rb +0 -87
  299. data/spec/server_spec.rb +0 -70
  300. data/spec/services_deploy_spec.rb +0 -165
  301. data/spec/shell_spec.rb +0 -57
  302. data/spec/source/archive_spec.rb +0 -33
  303. data/spec/source/git_spec.rb +0 -44
  304. data/spec/sqlite3_deploy_spec.rb +0 -38
  305. data/spec/support/integration.rb +0 -103
  306. data/spec/support/source_doubles.rb +0 -28
  307. data/spec/support/timecop.rb +0 -5
  308. data/spec/symlink_spec.rb +0 -15
@@ -1,602 +0,0 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright 2011, 2012 Keith Rarick
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- # See https://github.com/kr/okjson for updates.
24
-
25
- require 'stringio'
26
-
27
- # Some parts adapted from
28
- # http://golang.org/src/pkg/json/decode.go and
29
- # http://golang.org/src/pkg/utf8/utf8.go
30
- module MultiJson
31
- module OkJson
32
- extend self
33
-
34
-
35
- # Decodes a json document in string s and
36
- # returns the corresponding ruby value.
37
- # String s must be valid UTF-8. If you have
38
- # a string in some other encoding, convert
39
- # it first.
40
- #
41
- # String values in the resulting structure
42
- # will be UTF-8.
43
- def decode(s)
44
- ts = lex(s)
45
- v, ts = textparse(ts)
46
- if ts.length > 0
47
- raise Error, 'trailing garbage'
48
- end
49
- v
50
- end
51
-
52
-
53
- # Parses a "json text" in the sense of RFC 4627.
54
- # Returns the parsed value and any trailing tokens.
55
- # Note: this is almost the same as valparse,
56
- # except that it does not accept atomic values.
57
- def textparse(ts)
58
- if ts.length < 0
59
- raise Error, 'empty'
60
- end
61
-
62
- typ, _, val = ts[0]
63
- case typ
64
- when '{' then objparse(ts)
65
- when '[' then arrparse(ts)
66
- else
67
- raise Error, "unexpected #{val.inspect}"
68
- end
69
- end
70
-
71
-
72
- # Parses a "value" in the sense of RFC 4627.
73
- # Returns the parsed value and any trailing tokens.
74
- def valparse(ts)
75
- if ts.length < 0
76
- raise Error, 'empty'
77
- end
78
-
79
- typ, _, val = ts[0]
80
- case typ
81
- when '{' then objparse(ts)
82
- when '[' then arrparse(ts)
83
- when :val,:str then [val, ts[1..-1]]
84
- else
85
- raise Error, "unexpected #{val.inspect}"
86
- end
87
- end
88
-
89
-
90
- # Parses an "object" in the sense of RFC 4627.
91
- # Returns the parsed value and any trailing tokens.
92
- def objparse(ts)
93
- ts = eat('{', ts)
94
- obj = {}
95
-
96
- if ts[0][0] == '}'
97
- return obj, ts[1..-1]
98
- end
99
-
100
- k, v, ts = pairparse(ts)
101
- obj[k] = v
102
-
103
- if ts[0][0] == '}'
104
- return obj, ts[1..-1]
105
- end
106
-
107
- loop do
108
- ts = eat(',', ts)
109
-
110
- k, v, ts = pairparse(ts)
111
- obj[k] = v
112
-
113
- if ts[0][0] == '}'
114
- return obj, ts[1..-1]
115
- end
116
- end
117
- end
118
-
119
-
120
- # Parses a "member" in the sense of RFC 4627.
121
- # Returns the parsed values and any trailing tokens.
122
- def pairparse(ts)
123
- (typ, _, k), ts = ts[0], ts[1..-1]
124
- if typ != :str
125
- raise Error, "unexpected #{k.inspect}"
126
- end
127
- ts = eat(':', ts)
128
- v, ts = valparse(ts)
129
- [k, v, ts]
130
- end
131
-
132
-
133
- # Parses an "array" in the sense of RFC 4627.
134
- # Returns the parsed value and any trailing tokens.
135
- def arrparse(ts)
136
- ts = eat('[', ts)
137
- arr = []
138
-
139
- if ts[0][0] == ']'
140
- return arr, ts[1..-1]
141
- end
142
-
143
- v, ts = valparse(ts)
144
- arr << v
145
-
146
- if ts[0][0] == ']'
147
- return arr, ts[1..-1]
148
- end
149
-
150
- loop do
151
- ts = eat(',', ts)
152
-
153
- v, ts = valparse(ts)
154
- arr << v
155
-
156
- if ts[0][0] == ']'
157
- return arr, ts[1..-1]
158
- end
159
- end
160
- end
161
-
162
-
163
- def eat(typ, ts)
164
- if ts[0][0] != typ
165
- raise Error, "expected #{typ} (got #{ts[0].inspect})"
166
- end
167
- ts[1..-1]
168
- end
169
-
170
-
171
- # Scans s and returns a list of json tokens,
172
- # excluding white space (as defined in RFC 4627).
173
- def lex(s)
174
- ts = []
175
- while s.length > 0
176
- typ, lexeme, val = tok(s)
177
- if typ == nil
178
- raise Error, "invalid character at #{s[0,10].inspect}"
179
- end
180
- if typ != :space
181
- ts << [typ, lexeme, val]
182
- end
183
- s = s[lexeme.length..-1]
184
- end
185
- ts
186
- end
187
-
188
-
189
- # Scans the first token in s and
190
- # returns a 3-element list, or nil
191
- # if s does not begin with a valid token.
192
- #
193
- # The first list element is one of
194
- # '{', '}', ':', ',', '[', ']',
195
- # :val, :str, and :space.
196
- #
197
- # The second element is the lexeme.
198
- #
199
- # The third element is the value of the
200
- # token for :val and :str, otherwise
201
- # it is the lexeme.
202
- def tok(s)
203
- case s[0]
204
- when ?{ then ['{', s[0,1], s[0,1]]
205
- when ?} then ['}', s[0,1], s[0,1]]
206
- when ?: then [':', s[0,1], s[0,1]]
207
- when ?, then [',', s[0,1], s[0,1]]
208
- when ?[ then ['[', s[0,1], s[0,1]]
209
- when ?] then [']', s[0,1], s[0,1]]
210
- when ?n then nulltok(s)
211
- when ?t then truetok(s)
212
- when ?f then falsetok(s)
213
- when ?" then strtok(s)
214
- when Spc then [:space, s[0,1], s[0,1]]
215
- when ?\t then [:space, s[0,1], s[0,1]]
216
- when ?\n then [:space, s[0,1], s[0,1]]
217
- when ?\r then [:space, s[0,1], s[0,1]]
218
- else numtok(s)
219
- end
220
- end
221
-
222
-
223
- def nulltok(s); s[0,4] == 'null' ? [:val, 'null', nil] : [] end
224
- def truetok(s); s[0,4] == 'true' ? [:val, 'true', true] : [] end
225
- def falsetok(s); s[0,5] == 'false' ? [:val, 'false', false] : [] end
226
-
227
-
228
- def numtok(s)
229
- m = /-?([1-9][0-9]+|[0-9])([.][0-9]+)?([eE][+-]?[0-9]+)?/.match(s)
230
- if m && m.begin(0) == 0
231
- if m[3] && !m[2]
232
- [:val, m[0], Integer(m[1])*(10**Integer(m[3][1..-1]))]
233
- elsif m[2]
234
- [:val, m[0], Float(m[0])]
235
- else
236
- [:val, m[0], Integer(m[0])]
237
- end
238
- else
239
- []
240
- end
241
- end
242
-
243
-
244
- def strtok(s)
245
- m = /"([^"\\]|\\["\/\\bfnrt]|\\u[0-9a-fA-F]{4})*"/.match(s)
246
- if ! m
247
- raise Error, "invalid string literal at #{abbrev(s)}"
248
- end
249
- [:str, m[0], unquote(m[0])]
250
- end
251
-
252
-
253
- def abbrev(s)
254
- t = s[0,10]
255
- p = t['`']
256
- t = t[0,p] if p
257
- t = t + '...' if t.length < s.length
258
- '`' + t + '`'
259
- end
260
-
261
-
262
- # Converts a quoted json string literal q into a UTF-8-encoded string.
263
- # The rules are different than for Ruby, so we cannot use eval.
264
- # Unquote will raise an error if q contains control characters.
265
- def unquote(q)
266
- q = q[1...-1]
267
- a = q.dup # allocate a big enough string
268
- rubydoesenc = false
269
- # In ruby >= 1.9, a[w] is a codepoint, not a byte.
270
- if a.class.method_defined?(:force_encoding)
271
- a.force_encoding('UTF-8')
272
- rubydoesenc = true
273
- end
274
- r, w = 0, 0
275
- while r < q.length
276
- c = q[r]
277
- case true
278
- when c == ?\\
279
- r += 1
280
- if r >= q.length
281
- raise Error, "string literal ends with a \"\\\": \"#{q}\""
282
- end
283
-
284
- case q[r]
285
- when ?",?\\,?/,?'
286
- a[w] = q[r]
287
- r += 1
288
- w += 1
289
- when ?b,?f,?n,?r,?t
290
- a[w] = Unesc[q[r]]
291
- r += 1
292
- w += 1
293
- when ?u
294
- r += 1
295
- uchar = begin
296
- hexdec4(q[r,4])
297
- rescue RuntimeError => e
298
- raise Error, "invalid escape sequence \\u#{q[r,4]}: #{e}"
299
- end
300
- r += 4
301
- if surrogate? uchar
302
- if q.length >= r+6
303
- uchar1 = hexdec4(q[r+2,4])
304
- uchar = subst(uchar, uchar1)
305
- if uchar != Ucharerr
306
- # A valid pair; consume.
307
- r += 6
308
- end
309
- end
310
- end
311
- if rubydoesenc
312
- a[w] = '' << uchar
313
- w += 1
314
- else
315
- w += ucharenc(a, w, uchar)
316
- end
317
- else
318
- raise Error, "invalid escape char #{q[r]} in \"#{q}\""
319
- end
320
- when c == ?", c < Spc
321
- raise Error, "invalid character in string literal \"#{q}\""
322
- else
323
- # Copy anything else byte-for-byte.
324
- # Valid UTF-8 will remain valid UTF-8.
325
- # Invalid UTF-8 will remain invalid UTF-8.
326
- # In ruby >= 1.9, c is a codepoint, not a byte,
327
- # in which case this is still what we want.
328
- a[w] = c
329
- r += 1
330
- w += 1
331
- end
332
- end
333
- a[0,w]
334
- end
335
-
336
-
337
- # Encodes unicode character u as UTF-8
338
- # bytes in string a at position i.
339
- # Returns the number of bytes written.
340
- def ucharenc(a, i, u)
341
- case true
342
- when u <= Uchar1max
343
- a[i] = (u & 0xff).chr
344
- 1
345
- when u <= Uchar2max
346
- a[i+0] = (Utag2 | ((u>>6)&0xff)).chr
347
- a[i+1] = (Utagx | (u&Umaskx)).chr
348
- 2
349
- when u <= Uchar3max
350
- a[i+0] = (Utag3 | ((u>>12)&0xff)).chr
351
- a[i+1] = (Utagx | ((u>>6)&Umaskx)).chr
352
- a[i+2] = (Utagx | (u&Umaskx)).chr
353
- 3
354
- else
355
- a[i+0] = (Utag4 | ((u>>18)&0xff)).chr
356
- a[i+1] = (Utagx | ((u>>12)&Umaskx)).chr
357
- a[i+2] = (Utagx | ((u>>6)&Umaskx)).chr
358
- a[i+3] = (Utagx | (u&Umaskx)).chr
359
- 4
360
- end
361
- end
362
-
363
-
364
- def hexdec4(s)
365
- if s.length != 4
366
- raise Error, 'short'
367
- end
368
- (nibble(s[0])<<12) | (nibble(s[1])<<8) | (nibble(s[2])<<4) | nibble(s[3])
369
- end
370
-
371
-
372
- def subst(u1, u2)
373
- if Usurr1 <= u1 && u1 < Usurr2 && Usurr2 <= u2 && u2 < Usurr3
374
- return ((u1-Usurr1)<<10) | (u2-Usurr2) + Usurrself
375
- end
376
- return Ucharerr
377
- end
378
-
379
-
380
- def surrogate?(u)
381
- Usurr1 <= u && u < Usurr3
382
- end
383
-
384
-
385
- def nibble(c)
386
- case true
387
- when ?0 <= c && c <= ?9 then c.ord - ?0.ord
388
- when ?a <= c && c <= ?z then c.ord - ?a.ord + 10
389
- when ?A <= c && c <= ?Z then c.ord - ?A.ord + 10
390
- else
391
- raise Error, "invalid hex code #{c}"
392
- end
393
- end
394
-
395
-
396
- # Encodes x into a json text. It may contain only
397
- # Array, Hash, String, Numeric, true, false, nil.
398
- # (Note, this list excludes Symbol.)
399
- # X itself must be an Array or a Hash.
400
- # No other value can be encoded, and an error will
401
- # be raised if x contains any other value, such as
402
- # Nan, Infinity, Symbol, and Proc, or if a Hash key
403
- # is not a String.
404
- # Strings contained in x must be valid UTF-8.
405
- def encode(x)
406
- case x
407
- when Hash then objenc(x)
408
- when Array then arrenc(x)
409
- else
410
- raise Error, 'root value must be an Array or a Hash'
411
- end
412
- end
413
-
414
-
415
- def valenc(x)
416
- case x
417
- when Hash then objenc(x)
418
- when Array then arrenc(x)
419
- when String then strenc(x)
420
- when Numeric then numenc(x)
421
- when true then "true"
422
- when false then "false"
423
- when nil then "null"
424
- else
425
- if x.respond_to?(:to_json)
426
- x.to_json
427
- else
428
- raise Error, "cannot encode #{x.class}: #{x.inspect}"
429
- end
430
- end
431
- end
432
-
433
-
434
- def objenc(x)
435
- '{' + x.map{|k,v| keyenc(k) + ':' + valenc(v)}.join(',') + '}'
436
- end
437
-
438
-
439
- def arrenc(a)
440
- '[' + a.map{|x| valenc(x)}.join(',') + ']'
441
- end
442
-
443
-
444
- def keyenc(k)
445
- case k
446
- when String then strenc(k)
447
- else
448
- raise Error, "Hash key is not a string: #{k.inspect}"
449
- end
450
- end
451
-
452
-
453
- def strenc(s)
454
- t = StringIO.new
455
- t.putc(?")
456
- r = 0
457
-
458
- # In ruby >= 1.9, s[r] is a codepoint, not a byte.
459
- rubydoesenc = s.class.method_defined?(:encoding)
460
-
461
- while r < s.length
462
- case s[r]
463
- when ?" then t.print('\\"')
464
- when ?\\ then t.print('\\\\')
465
- when ?\b then t.print('\\b')
466
- when ?\f then t.print('\\f')
467
- when ?\n then t.print('\\n')
468
- when ?\r then t.print('\\r')
469
- when ?\t then t.print('\\t')
470
- else
471
- c = s[r]
472
- case true
473
- when rubydoesenc
474
- begin
475
- c.ord # will raise an error if c is invalid UTF-8
476
- t.write(c)
477
- rescue
478
- t.write(Ustrerr)
479
- end
480
- when Spc <= c && c <= ?~
481
- t.putc(c)
482
- else
483
- n = ucharcopy(t, s, r) # ensure valid UTF-8 output
484
- r += n - 1 # r is incremented below
485
- end
486
- end
487
- r += 1
488
- end
489
- t.putc(?")
490
- t.string
491
- end
492
-
493
-
494
- def numenc(x)
495
- if ((x.nan? || x.infinite?) rescue false)
496
- raise Error, "Numeric cannot be represented: #{x}"
497
- end
498
- "#{x}"
499
- end
500
-
501
-
502
- # Copies the valid UTF-8 bytes of a single character
503
- # from string s at position i to I/O object t, and
504
- # returns the number of bytes copied.
505
- # If no valid UTF-8 char exists at position i,
506
- # ucharcopy writes Ustrerr and returns 1.
507
- def ucharcopy(t, s, i)
508
- n = s.length - i
509
- raise Utf8Error if n < 1
510
-
511
- c0 = s[i].ord
512
-
513
- # 1-byte, 7-bit sequence?
514
- if c0 < Utagx
515
- t.putc(c0)
516
- return 1
517
- end
518
-
519
- raise Utf8Error if c0 < Utag2 # unexpected continuation byte?
520
-
521
- raise Utf8Error if n < 2 # need continuation byte
522
- c1 = s[i+1].ord
523
- raise Utf8Error if c1 < Utagx || Utag2 <= c1
524
-
525
- # 2-byte, 11-bit sequence?
526
- if c0 < Utag3
527
- raise Utf8Error if ((c0&Umask2)<<6 | (c1&Umaskx)) <= Uchar1max
528
- t.putc(c0)
529
- t.putc(c1)
530
- return 2
531
- end
532
-
533
- # need second continuation byte
534
- raise Utf8Error if n < 3
535
-
536
- c2 = s[i+2].ord
537
- raise Utf8Error if c2 < Utagx || Utag2 <= c2
538
-
539
- # 3-byte, 16-bit sequence?
540
- if c0 < Utag4
541
- u = (c0&Umask3)<<12 | (c1&Umaskx)<<6 | (c2&Umaskx)
542
- raise Utf8Error if u <= Uchar2max
543
- t.putc(c0)
544
- t.putc(c1)
545
- t.putc(c2)
546
- return 3
547
- end
548
-
549
- # need third continuation byte
550
- raise Utf8Error if n < 4
551
- c3 = s[i+3].ord
552
- raise Utf8Error if c3 < Utagx || Utag2 <= c3
553
-
554
- # 4-byte, 21-bit sequence?
555
- if c0 < Utag5
556
- u = (c0&Umask4)<<18 | (c1&Umaskx)<<12 | (c2&Umaskx)<<6 | (c3&Umaskx)
557
- raise Utf8Error if u <= Uchar3max
558
- t.putc(c0)
559
- t.putc(c1)
560
- t.putc(c2)
561
- t.putc(c3)
562
- return 4
563
- end
564
-
565
- raise Utf8Error
566
- rescue Utf8Error
567
- t.write(Ustrerr)
568
- return 1
569
- end
570
-
571
-
572
- class Utf8Error < ::StandardError
573
- end
574
-
575
-
576
- class Error < ::StandardError
577
- end
578
-
579
-
580
- Utagx = 0x80 # 1000 0000
581
- Utag2 = 0xc0 # 1100 0000
582
- Utag3 = 0xe0 # 1110 0000
583
- Utag4 = 0xf0 # 1111 0000
584
- Utag5 = 0xF8 # 1111 1000
585
- Umaskx = 0x3f # 0011 1111
586
- Umask2 = 0x1f # 0001 1111
587
- Umask3 = 0x0f # 0000 1111
588
- Umask4 = 0x07 # 0000 0111
589
- Uchar1max = (1<<7) - 1
590
- Uchar2max = (1<<11) - 1
591
- Uchar3max = (1<<16) - 1
592
- Ucharerr = 0xFFFD # unicode "replacement char"
593
- Ustrerr = "\xef\xbf\xbd" # unicode "replacement char"
594
- Usurrself = 0x10000
595
- Usurr1 = 0xd800
596
- Usurr2 = 0xdc00
597
- Usurr3 = 0xe000
598
-
599
- Spc = ' '[0]
600
- Unesc = {?b=>?\b, ?f=>?\f, ?n=>?\n, ?r=>?\r, ?t=>?\t}
601
- end
602
- end
@@ -1,3 +0,0 @@
1
- module MultiJson
2
- VERSION = "1.6.1" unless defined?(MultiJson::VERSION)
3
- end