engineyard-serverside 2.3.9 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +15 -0
  2. data/bin/engineyard-serverside-execute-hook +31 -0
  3. data/lib/engineyard-serverside/about.rb +3 -0
  4. data/lib/engineyard-serverside/cli.rb +3 -1
  5. data/lib/engineyard-serverside/configuration.rb +5 -0
  6. data/lib/engineyard-serverside/deploy.rb +25 -7
  7. data/lib/engineyard-serverside/maintenance.rb +14 -1
  8. data/lib/engineyard-serverside/paths.rb +4 -0
  9. data/lib/engineyard-serverside/server.rb +3 -2
  10. data/lib/engineyard-serverside/version.rb +1 -1
  11. data/spec/archive_deploy_spec.rb +4 -10
  12. data/spec/basic_deploy_spec.rb +3 -3
  13. data/spec/bundler_deploy_spec.rb +32 -32
  14. data/spec/configuration_spec.rb +42 -42
  15. data/spec/custom_deploy_spec.rb +9 -9
  16. data/spec/deploy_hook_spec.rb +103 -89
  17. data/spec/deprecation_spec.rb +3 -3
  18. data/spec/ey_yml_customized_deploy_spec.rb +21 -21
  19. data/spec/fixtures/repos/executable_hooks/README +1 -0
  20. data/spec/fixtures/repos/executable_hooks/deploy/before_restart +72 -0
  21. data/spec/fixtures/repos/public_system/Gemfile +4 -0
  22. data/spec/fixtures/repos/public_system/Gemfile.lock +12 -0
  23. data/spec/fixtures/repos/public_system/README +5 -0
  24. data/spec/fixtures/repos/public_system/ey.yml +3 -0
  25. data/spec/fixtures/repos/public_system/public/system/cant_touch_this.txt +3 -0
  26. data/spec/lockfile_parser_spec.rb +26 -26
  27. data/spec/multi_dependency_manager_spec.rb +3 -3
  28. data/spec/nodejs_deploy_spec.rb +2 -2
  29. data/spec/php_deploy_spec.rb +7 -7
  30. data/spec/rails31_deploy_spec.rb +56 -56
  31. data/spec/restart_spec.rb +3 -3
  32. data/spec/rollback_spec.rb +19 -19
  33. data/spec/server_spec.rb +16 -16
  34. data/spec/services_deploy_spec.rb +40 -40
  35. data/spec/shell_spec.rb +1 -1
  36. data/spec/source/archive_spec.rb +1 -1
  37. data/spec/source/git_spec.rb +1 -1
  38. data/spec/spec_helper.rb +0 -1
  39. data/spec/sqlite3_deploy_spec.rb +6 -6
  40. data/spec/symlink_spec.rb +15 -0
  41. metadata +139 -154
  42. data/lib/engineyard-serverside/source_strategy.rb +0 -77
@@ -1,77 +0,0 @@
1
- require 'pathname'
2
- require 'engineyard-serverside/spawner'
3
- require 'escape'
4
-
5
- class EY::Serverside::Source
6
- attr_reader :uri, :opts, :source_cache, :ref, :shell
7
- alias repository_cache source_cache
8
-
9
- class << self
10
- attr_reader :required_opts
11
- def require_opts(*names)
12
- @required_opts ||= []
13
- @required_opts += names
14
- end
15
-
16
- def for(type)
17
- const_get(type)
18
- end
19
- end
20
-
21
- def initialize(shell, opts={})
22
- @shell = shell
23
- @opts = opts
24
-
25
- if self.class.required_opts && !self.class.required_opts.all? {|name| @opts[name] }
26
- raise ArgumentError,
27
- "Missing required key(s) (#{self.class.required_opts.join(', ')} required)"
28
- end
29
-
30
- @ref = @opts[:ref]
31
- @uri = @opts[:uri].to_s if @opts[:uri]
32
- @source_cache = Pathname.new(@opts[:repository_cache]) if @opts[:repository_cache]
33
- end
34
-
35
- protected
36
-
37
- def in_source_cache(&block)
38
- raise ArgumentError, "Block required" unless block
39
- source_cache.mkpath
40
- Dir.chdir(source_cache, &block)
41
- end
42
-
43
- def escape(*shell_commands)
44
- Escape.shell_command(shell_commands)
45
- end
46
-
47
- def runner
48
- EY::Serverside::Spawner
49
- end
50
-
51
- # Internal: Run a command.
52
- #
53
- # cmd - A string command.
54
- #
55
- # Returns an instance of Spawner.
56
- def run(cmd)
57
- runner.run(cmd, shell, nil)
58
- end
59
-
60
- # Internal: Run a command and return the output.
61
- #
62
- # cmd - A string command.
63
- #
64
- # Returns the output of the command.
65
- def run_and_output(cmd)
66
- run(cmd).output
67
- end
68
-
69
- # Internal: Run a command and check if it was successful.
70
- #
71
- # cmd - A string command.
72
- #
73
- # Returns success.
74
- def run_and_success?(cmd)
75
- run(cmd).success?
76
- end
77
- end