ey-deploy 0.2.6 → 0.2.7

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.
@@ -13,6 +13,7 @@ module EY
13
13
  puts "~> Starting full deploy"
14
14
 
15
15
  copy_repository_cache
16
+ create_revision_file
16
17
  bundle
17
18
  symlink_configs
18
19
  migrate
@@ -183,4 +184,4 @@ module EY
183
184
  dep.send(opts["default_task"])
184
185
  end
185
186
  end
186
- end
187
+ end
@@ -1,7 +1,10 @@
1
1
  require 'open-uri'
2
+ require 'ey-deploy/verbose_system'
2
3
 
3
4
  module EY
4
5
  class Server < Struct.new(:hostname, :role, :name)
6
+ include VerboseSystem
7
+
5
8
  def self.config=(config)
6
9
  @@config = config
7
10
  end
@@ -1,22 +1,31 @@
1
+ require 'ey-deploy/verbose_system'
2
+
1
3
  module EY
2
4
  module Strategies
3
5
  class Git
4
6
  module Helpers
5
7
  def update_repository_cache
6
- klass = Module.nesting[1]
8
+ strategy.fetch
9
+ strategy.checkout
10
+ end
7
11
 
8
- strategy = klass.new(
12
+ def create_revision_file
13
+ strategy.create_revision_file(c.release_path)
14
+ end
15
+
16
+ def strategy
17
+ klass = Module.nesting[1]
18
+ klass.new(
9
19
  :repository_cache => c.repository_cache,
10
20
  :app => c.app,
11
21
  :repo => c.repo,
12
- :branch => c.branch
22
+ :ref => c.branch
13
23
  )
14
-
15
- strategy.fetch
16
- strategy.checkout
17
24
  end
18
25
  end
19
26
 
27
+ include VerboseSystem
28
+
20
29
  attr_reader :opts
21
30
 
22
31
  def initialize(opts)
@@ -26,14 +35,24 @@ module EY
26
35
 
27
36
  def fetch
28
37
  if File.directory?(File.join(opts[:repository_cache], ".git"))
29
- `#{git} fetch origin`
38
+ system("#{git} fetch origin")
30
39
  else
31
- `git clone #{opts[:repo]} #{opts[:repository_cache]}`
40
+ system("git clone #{opts[:repo]} #{opts[:repository_cache]}")
32
41
  end
33
42
  end
34
43
 
35
44
  def checkout
36
- `#{git} reset --hard origin/#{opts[:branch]}`
45
+ to_checkout = if branch?(opts[:ref])
46
+ "origin/#{opts[:ref]}"
47
+ else
48
+ opts[:ref]
49
+ end
50
+
51
+ system("#{git} checkout '#{to_checkout}'") || system("#{git} reset --hard '#{to_checkout}'")
52
+ end
53
+
54
+ def create_revision_file(dir)
55
+ `#{git} show --pretty=format:"%H" | head -1 > "#{dir}/REVISION"`
37
56
  end
38
57
 
39
58
  private
@@ -41,6 +60,10 @@ module EY
41
60
  "git --git-dir #{opts[:repository_cache]}/.git --work-tree #{opts[:repository_cache]}"
42
61
  end
43
62
 
63
+ def branch?(ref)
64
+ `#{git} branch -r`.map { |x| x.strip }.include?("origin/#{ref}")
65
+ end
66
+
44
67
  def set_up_git_ssh(app)
45
68
  # hold references to the tempfiles so they don't get finalized
46
69
  # unexpectedly; tempfile finalization unlinks the files
@@ -0,0 +1,12 @@
1
+ module EY
2
+ module VerboseSystem
3
+ def self.instance_id
4
+ @instance_id ||= `curl http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null`
5
+ end
6
+
7
+ def system(cmd)
8
+ puts ":: #{EY::VerboseSystem.instance_id} running #{cmd}"
9
+ super
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module EY
2
- VERSION = "0.2.6"
3
- end
2
+ VERSION = "0.2.7"
3
+ end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ey-deploy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 2
9
- - 6
10
- version: 0.2.6
8
+ - 7
9
+ version: 0.2.7
11
10
  platform: ruby
12
11
  authors:
13
12
  - EY Cloud Team
@@ -15,37 +14,33 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-04-28 00:00:00 -07:00
17
+ date: 2010-05-07 00:00:00 -07:00
19
18
  default_executable: eysd
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
- none: false
21
+ prerelease: false
22
+ name: rake
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- hash: 3
28
27
  segments:
29
28
  - 0
30
29
  version: "0"
31
- name: rake
32
- requirement: *id001
33
- prerelease: false
34
30
  type: :runtime
31
+ version_requirements: *id001
35
32
  - !ruby/object:Gem::Dependency
36
- version_requirements: &id002 !ruby/object:Gem::Requirement
37
- none: false
33
+ prerelease: false
34
+ name: json
35
+ requirement: &id002 !ruby/object:Gem::Requirement
38
36
  requirements:
39
37
  - - ">="
40
38
  - !ruby/object:Gem::Version
41
- hash: 3
42
39
  segments:
43
40
  - 0
44
41
  version: "0"
45
- name: json
46
- requirement: *id002
47
- prerelease: false
48
42
  type: :runtime
43
+ version_requirements: *id002
49
44
  description:
50
45
  email: cloud@engineyard.com
51
46
  executables:
@@ -63,6 +58,7 @@ files:
63
58
  - lib/ey-deploy/server.rb
64
59
  - lib/ey-deploy/strategies/git.rb
65
60
  - lib/ey-deploy/task.rb
61
+ - lib/ey-deploy/verbose_system.rb
66
62
  - lib/ey-deploy/version.rb
67
63
  - lib/ey-deploy.rb
68
64
  - lib/vendor/thor/bin/rake2thor
@@ -101,8 +97,6 @@ files:
101
97
  - lib/vendor/thor/Thorfile
102
98
  - LICENSE
103
99
  - README.rdoc
104
- - spec/ey-deploy_spec.rb
105
- - spec/spec_helper.rb
106
100
  has_rdoc: true
107
101
  homepage: http://engineyard.com
108
102
  licenses: []
@@ -113,27 +107,23 @@ rdoc_options: []
113
107
  require_paths:
114
108
  - lib
115
109
  required_ruby_version: !ruby/object:Gem::Requirement
116
- none: false
117
110
  requirements:
118
111
  - - ">="
119
112
  - !ruby/object:Gem::Version
120
- hash: 3
121
113
  segments:
122
114
  - 0
123
115
  version: "0"
124
116
  required_rubygems_version: !ruby/object:Gem::Requirement
125
- none: false
126
117
  requirements:
127
118
  - - ">="
128
119
  - !ruby/object:Gem::Version
129
- hash: 3
130
120
  segments:
131
121
  - 0
132
122
  version: "0"
133
123
  requirements: []
134
124
 
135
125
  rubyforge_project:
136
- rubygems_version: 1.3.7.pre.1
126
+ rubygems_version: 1.3.6
137
127
  signing_key:
138
128
  specification_version: 3
139
129
  summary: A gem that deploys ruby applications on EY Cloud instances