ey-deploy 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ey-deploy/deploy.rb +2 -1
- data/lib/ey-deploy/server.rb +3 -0
- data/lib/ey-deploy/strategies/git.rb +32 -9
- data/lib/ey-deploy/verbose_system.rb +12 -0
- data/lib/ey-deploy/version.rb +2 -2
- metadata +13 -23
data/lib/ey-deploy/deploy.rb
CHANGED
data/lib/ey-deploy/server.rb
CHANGED
@@ -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
|
-
|
8
|
+
strategy.fetch
|
9
|
+
strategy.checkout
|
10
|
+
end
|
7
11
|
|
8
|
-
|
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
|
-
:
|
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
|
-
|
38
|
+
system("#{git} fetch origin")
|
30
39
|
else
|
31
|
-
|
40
|
+
system("git clone #{opts[:repo]} #{opts[:repository_cache]}")
|
32
41
|
end
|
33
42
|
end
|
34
43
|
|
35
44
|
def checkout
|
36
|
-
|
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
|
data/lib/ey-deploy/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module EY
|
2
|
-
VERSION = "0.2.
|
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
|
-
-
|
10
|
-
version: 0.2.
|
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-
|
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
|
-
|
23
|
-
|
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
|
-
|
37
|
-
|
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.
|
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
|