wulffeld-capistrano 2.5.8 → 2.5.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -127,58 +127,54 @@ module Capistrano
127
127
  configuration[:remote] || 'origin'
128
128
  end
129
129
 
130
- # Performs a clone on the remote machine, then checkout on the branch
131
- # you want to deploy.
132
- # def checkout(revision, destination)
133
- # git = command
134
- # remote = origin
135
- #
136
- # args = []
137
- # args << "-o #{remote}" unless remote == 'origin'
138
- # if depth = configuration[:git_shallow_clone]
139
- # args << "--depth #{depth}"
140
- # end
141
- #
142
- # execute = []
143
- # if args.empty?
144
- # execute << "#{git} clone #{verbose} #{configuration[:repository]} #{destination}"
145
- # else
146
- # execute << "#{git} clone #{verbose} #{args.join(' ')} #{configuration[:repository]} #{destination}"
147
- # end
148
- #
149
- # # checkout into a local branch rather than a detached HEAD
150
- # execute << "cd #{destination} && #{git} checkout #{verbose} -b deploy #{revision}"
151
- #
152
- # if configuration[:git_enable_submodules]
153
- # execute << "#{git} submodule #{verbose} init"
154
- # execute << "#{git} submodule #{verbose} sync"
155
- # execute << "#{git} submodule #{verbose} update"
156
- # end
157
- # puts "EXECUTING #{execute.inspect}"
158
- # execute.join(" && ")
159
- # end
160
-
130
+ # Extend the checkout cmd. If options[:use_archive] is set then use 'git archive' to export.
131
+ #
161
132
  # Based on:
162
133
  # http://blog.crdlo.com/2009/01/git-project-deployment-with-capistrano.html
163
134
  # http://groups.google.com/group/capistrano/browse_thread/thread/4ef8718ef9539ef1/c5cfb7be7d152bb8
164
- #
165
- # Use git archive to export repository.
135
+
136
+ # Performs a clone on the remote machine, then checkout on the branch
137
+ # you want to deploy.
166
138
  def checkout(revision, destination)
167
139
  git = command
168
- execute = []
169
140
  args = []
141
+ execute = []
170
142
 
171
- args << "--remote=#{configuration[:repository]}"
172
- if project = configuration[:project]
173
- args << "#{revision}:#{project}"
143
+ if configuration[:use_archive]
144
+ args << "--remote=#{configuration[:repository]}"
145
+ if project = configuration[:project]
146
+ args << "#{revision}:#{project}"
147
+ else
148
+ args << revision
149
+ end
150
+
151
+ execute << "mkdir -p #{destination}"
152
+ execute << "cd #{destination}"
153
+ execute << "#{git} archive #{args.join(' ')} | tar xf -"
174
154
  else
175
- args << revision
155
+ raise
156
+ remote = origin
157
+
158
+ args << "-o #{remote}" unless remote == 'origin'
159
+ if depth = configuration[:git_shallow_clone]
160
+ args << "--depth #{depth}"
161
+ end
162
+
163
+ if args.empty?
164
+ execute << "#{git} clone #{verbose} #{configuration[:repository]} #{destination}"
165
+ else
166
+ execute << "#{git} clone #{verbose} #{args.join(' ')} #{configuration[:repository]} #{destination}"
167
+ end
168
+
169
+ # checkout into a local branch rather than a detached HEAD
170
+ execute << "cd #{destination} && #{git} checkout #{verbose} -b deploy #{revision}"
171
+
172
+ if configuration[:git_enable_submodules]
173
+ execute << "#{git} submodule #{verbose} init"
174
+ execute << "#{git} submodule #{verbose} sync"
175
+ execute << "#{git} submodule #{verbose} update"
176
+ end
176
177
  end
177
-
178
- execute << "mkdir -p #{destination}"
179
- execute << "cd #{destination}"
180
- execute << "#{git} archive #{args.join(' ')} | tar xf -"
181
-
182
178
  execute.join(" && ")
183
179
  end
184
180
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wulffeld-capistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.8
4
+ version: 2.5.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck