minmb-capistrano 2.15.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/.gitignore +10 -0
  2. data/.travis.yml +7 -0
  3. data/CHANGELOG +1170 -0
  4. data/Gemfile +13 -0
  5. data/README.md +94 -0
  6. data/Rakefile +11 -0
  7. data/bin/cap +4 -0
  8. data/bin/capify +92 -0
  9. data/capistrano.gemspec +40 -0
  10. data/lib/capistrano.rb +5 -0
  11. data/lib/capistrano/callback.rb +45 -0
  12. data/lib/capistrano/cli.rb +47 -0
  13. data/lib/capistrano/cli/execute.rb +85 -0
  14. data/lib/capistrano/cli/help.rb +125 -0
  15. data/lib/capistrano/cli/help.txt +81 -0
  16. data/lib/capistrano/cli/options.rb +243 -0
  17. data/lib/capistrano/cli/ui.rb +40 -0
  18. data/lib/capistrano/command.rb +303 -0
  19. data/lib/capistrano/configuration.rb +57 -0
  20. data/lib/capistrano/configuration/actions/file_transfer.rb +50 -0
  21. data/lib/capistrano/configuration/actions/inspect.rb +46 -0
  22. data/lib/capistrano/configuration/actions/invocation.rb +329 -0
  23. data/lib/capistrano/configuration/alias_task.rb +26 -0
  24. data/lib/capistrano/configuration/callbacks.rb +147 -0
  25. data/lib/capistrano/configuration/connections.rb +237 -0
  26. data/lib/capistrano/configuration/execution.rb +142 -0
  27. data/lib/capistrano/configuration/loading.rb +205 -0
  28. data/lib/capistrano/configuration/log_formatters.rb +75 -0
  29. data/lib/capistrano/configuration/namespaces.rb +223 -0
  30. data/lib/capistrano/configuration/roles.rb +77 -0
  31. data/lib/capistrano/configuration/servers.rb +116 -0
  32. data/lib/capistrano/configuration/variables.rb +127 -0
  33. data/lib/capistrano/errors.rb +19 -0
  34. data/lib/capistrano/ext/multistage.rb +64 -0
  35. data/lib/capistrano/ext/string.rb +5 -0
  36. data/lib/capistrano/extensions.rb +57 -0
  37. data/lib/capistrano/fix_rake_deprecated_dsl.rb +8 -0
  38. data/lib/capistrano/logger.rb +166 -0
  39. data/lib/capistrano/processable.rb +57 -0
  40. data/lib/capistrano/recipes/compat.rb +32 -0
  41. data/lib/capistrano/recipes/deploy.rb +625 -0
  42. data/lib/capistrano/recipes/deploy/assets.rb +201 -0
  43. data/lib/capistrano/recipes/deploy/dependencies.rb +44 -0
  44. data/lib/capistrano/recipes/deploy/local_dependency.rb +54 -0
  45. data/lib/capistrano/recipes/deploy/remote_dependency.rb +117 -0
  46. data/lib/capistrano/recipes/deploy/scm.rb +19 -0
  47. data/lib/capistrano/recipes/deploy/scm/accurev.rb +169 -0
  48. data/lib/capistrano/recipes/deploy/scm/base.rb +200 -0
  49. data/lib/capistrano/recipes/deploy/scm/bzr.rb +86 -0
  50. data/lib/capistrano/recipes/deploy/scm/cvs.rb +153 -0
  51. data/lib/capistrano/recipes/deploy/scm/darcs.rb +96 -0
  52. data/lib/capistrano/recipes/deploy/scm/git.rb +293 -0
  53. data/lib/capistrano/recipes/deploy/scm/mercurial.rb +137 -0
  54. data/lib/capistrano/recipes/deploy/scm/none.rb +55 -0
  55. data/lib/capistrano/recipes/deploy/scm/perforce.rb +152 -0
  56. data/lib/capistrano/recipes/deploy/scm/subversion.rb +121 -0
  57. data/lib/capistrano/recipes/deploy/strategy.rb +19 -0
  58. data/lib/capistrano/recipes/deploy/strategy/base.rb +92 -0
  59. data/lib/capistrano/recipes/deploy/strategy/checkout.rb +20 -0
  60. data/lib/capistrano/recipes/deploy/strategy/copy.rb +338 -0
  61. data/lib/capistrano/recipes/deploy/strategy/export.rb +20 -0
  62. data/lib/capistrano/recipes/deploy/strategy/remote.rb +52 -0
  63. data/lib/capistrano/recipes/deploy/strategy/remote_cache.rb +57 -0
  64. data/lib/capistrano/recipes/deploy/strategy/unshared_remote_cache.rb +21 -0
  65. data/lib/capistrano/recipes/standard.rb +37 -0
  66. data/lib/capistrano/recipes/templates/maintenance.rhtml +53 -0
  67. data/lib/capistrano/role.rb +102 -0
  68. data/lib/capistrano/server_definition.rb +56 -0
  69. data/lib/capistrano/shell.rb +265 -0
  70. data/lib/capistrano/ssh.rb +95 -0
  71. data/lib/capistrano/task_definition.rb +77 -0
  72. data/lib/capistrano/transfer.rb +218 -0
  73. data/lib/capistrano/version.rb +11 -0
  74. data/test/cli/execute_test.rb +132 -0
  75. data/test/cli/help_test.rb +165 -0
  76. data/test/cli/options_test.rb +329 -0
  77. data/test/cli/ui_test.rb +28 -0
  78. data/test/cli_test.rb +17 -0
  79. data/test/command_test.rb +322 -0
  80. data/test/configuration/actions/file_transfer_test.rb +61 -0
  81. data/test/configuration/actions/inspect_test.rb +76 -0
  82. data/test/configuration/actions/invocation_test.rb +288 -0
  83. data/test/configuration/alias_task_test.rb +118 -0
  84. data/test/configuration/callbacks_test.rb +201 -0
  85. data/test/configuration/connections_test.rb +439 -0
  86. data/test/configuration/execution_test.rb +175 -0
  87. data/test/configuration/loading_test.rb +148 -0
  88. data/test/configuration/namespace_dsl_test.rb +332 -0
  89. data/test/configuration/roles_test.rb +157 -0
  90. data/test/configuration/servers_test.rb +183 -0
  91. data/test/configuration/variables_test.rb +190 -0
  92. data/test/configuration_test.rb +77 -0
  93. data/test/deploy/local_dependency_test.rb +76 -0
  94. data/test/deploy/remote_dependency_test.rb +146 -0
  95. data/test/deploy/scm/accurev_test.rb +23 -0
  96. data/test/deploy/scm/base_test.rb +55 -0
  97. data/test/deploy/scm/bzr_test.rb +51 -0
  98. data/test/deploy/scm/darcs_test.rb +37 -0
  99. data/test/deploy/scm/git_test.rb +221 -0
  100. data/test/deploy/scm/mercurial_test.rb +134 -0
  101. data/test/deploy/scm/none_test.rb +35 -0
  102. data/test/deploy/scm/perforce_test.rb +23 -0
  103. data/test/deploy/scm/subversion_test.rb +40 -0
  104. data/test/deploy/strategy/copy_test.rb +360 -0
  105. data/test/extensions_test.rb +69 -0
  106. data/test/fixtures/cli_integration.rb +5 -0
  107. data/test/fixtures/config.rb +5 -0
  108. data/test/fixtures/custom.rb +3 -0
  109. data/test/logger_formatting_test.rb +149 -0
  110. data/test/logger_test.rb +134 -0
  111. data/test/recipes_test.rb +25 -0
  112. data/test/role_test.rb +11 -0
  113. data/test/server_definition_test.rb +121 -0
  114. data/test/shell_test.rb +96 -0
  115. data/test/ssh_test.rb +113 -0
  116. data/test/task_definition_test.rb +117 -0
  117. data/test/transfer_test.rb +168 -0
  118. data/test/utils.rb +37 -0
  119. metadata +316 -0
@@ -0,0 +1,293 @@
1
+ require 'capistrano/recipes/deploy/scm/base'
2
+
3
+ module Capistrano
4
+ module Deploy
5
+ module SCM
6
+
7
+ # An SCM module for using Git as your source control tool with Capistrano
8
+ # 2.0. If you are using Capistrano 1.x, use this plugin instead:
9
+ #
10
+ # http://scie.nti.st/2007/3/16/capistrano-with-git-shared-repository
11
+ #
12
+ # Assumes you are using a shared Git repository.
13
+ #
14
+ # Parts of this plugin borrowed from Scott Chacon's version, which I
15
+ # found on the Capistrano mailing list but failed to be able to get
16
+ # working.
17
+ #
18
+ # FEATURES:
19
+ #
20
+ # * Very simple, only requiring 2 lines in your deploy.rb.
21
+ # * Can deploy different branches, tags, or any SHA1 easily.
22
+ # * Supports prompting for password / passphrase upon checkout.
23
+ # (I am amazed at how some plugins don't do this)
24
+ # * Supports :scm_command, :scm_password, :scm_passphrase Capistrano
25
+ # directives.
26
+ #
27
+ # CONFIGURATION
28
+ # -------------
29
+ #
30
+ # Use this plugin by adding the following line in your config/deploy.rb:
31
+ #
32
+ # set :scm, :git
33
+ #
34
+ # Set <tt>:repository</tt> to the path of your Git repo:
35
+ #
36
+ # set :repository, "someuser@somehost:/home/myproject"
37
+ #
38
+ # The above two options are required to be set, the ones below are
39
+ # optional.
40
+ #
41
+ # You may set <tt>:branch</tt>, which is the reference to the branch, tag,
42
+ # or any SHA1 you are deploying, for example:
43
+ #
44
+ # set :branch, "master"
45
+ #
46
+ # Otherwise, HEAD is assumed. I strongly suggest you set this. HEAD is
47
+ # not always the best assumption.
48
+ #
49
+ # You may also set <tt>:remote</tt>, which will be used as a name for remote
50
+ # tracking of repositories. This option is intended for use with the
51
+ # <tt>:remote_cache</tt> strategy in a distributed git environment.
52
+ #
53
+ # For example in the projects <tt>config/deploy.rb</tt>:
54
+ #
55
+ # set :repository, "#{scm_user}@somehost:~/projects/project.git"
56
+ # set :remote, "#{scm_user}"
57
+ #
58
+ # Then each person with deploy priveledges can add the following to their
59
+ # local <tt>~/.caprc</tt> file:
60
+ #
61
+ # set :scm_user, 'someuser'
62
+ #
63
+ # Now any time a person deploys the project, their repository will be
64
+ # setup as a remote git repository within the cached repository.
65
+ #
66
+ # The <tt>:scm_command</tt> configuration variable, if specified, will
67
+ # be used as the full path to the git executable on the *remote* machine:
68
+ #
69
+ # set :scm_command, "/opt/local/bin/git"
70
+ #
71
+ # For compatibility with deploy scripts that may have used the 1.x
72
+ # version of this plugin before upgrading, <tt>:git</tt> is still
73
+ # recognized as an alias for :scm_command.
74
+ #
75
+ # Set <tt>:scm_password</tt> to the password needed to clone your repo
76
+ # if you don't have password-less (public key) entry:
77
+ #
78
+ # set :scm_password, "my_secret'
79
+ #
80
+ # Otherwise, you will be prompted for a password.
81
+ #
82
+ # <tt>:scm_passphrase</tt> is also supported.
83
+ #
84
+ # The remote cache strategy is also supported.
85
+ #
86
+ # set :repository_cache, "git_master"
87
+ # set :deploy_via, :remote_cache
88
+ #
89
+ # For faster clone, you can also use shallow cloning. This will set the
90
+ # '--depth' flag using the depth specified. This *cannot* be used
91
+ # together with the :remote_cache strategy
92
+ #
93
+ # set :git_shallow_clone, 1
94
+ #
95
+ # For those that don't like to leave your entire repository on
96
+ # your production server you can:
97
+ #
98
+ # set :deploy_via, :export
99
+ #
100
+ # To deploy from a local repository:
101
+ #
102
+ # set :repository, "file://."
103
+ # set :deploy_via, :copy
104
+ #
105
+ # AUTHORS
106
+ # -------
107
+ #
108
+ # Garry Dolley http://scie.nti.st
109
+ # Contributions by Geoffrey Grosenbach http://topfunky.com
110
+ # Scott Chacon http://jointheconversation.org
111
+ # Alex Arnell http://twologic.com
112
+ # and Phillip Goldenburg
113
+
114
+ class Git < Base
115
+ # Sets the default command name for this SCM on your *local* machine.
116
+ # Users may override this by setting the :scm_command variable.
117
+ default_command "git"
118
+
119
+ # When referencing "head", use the branch we want to deploy or, by
120
+ # default, Git's reference of HEAD (the latest changeset in the default
121
+ # branch, usually called "master").
122
+ def head
123
+ variable(:branch) || 'HEAD'
124
+ end
125
+
126
+ def origin
127
+ variable(:remote) || 'origin'
128
+ end
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
+
138
+ # Add an option for the branch name so :git_shallow_clone works with branches
139
+ args << "-b #{variable(:branch)}" unless variable(:branch).nil?
140
+ args << "-o #{remote}" unless remote == 'origin'
141
+ if depth = variable(:git_shallow_clone)
142
+ args << "--depth #{depth}"
143
+ end
144
+
145
+ execute = []
146
+ execute << "#{git} clone #{verbose} #{args.join(' ')} #{variable(:repository)} #{destination}"
147
+
148
+ # checkout into a local branch rather than a detached HEAD
149
+ execute << "cd #{destination} && #{git} checkout #{verbose} -b deploy #{revision}"
150
+
151
+ if variable(:git_enable_submodules)
152
+ execute << "#{git} submodule #{verbose} init"
153
+ execute << "#{git} submodule #{verbose} sync"
154
+ if false == variable(:git_submodules_recursive)
155
+ execute << "#{git} submodule #{verbose} update --init"
156
+ else
157
+ execute << %Q(export GIT_RECURSIVE=$([ ! "`#{git} --version`" \\< "git version 1.6.5" ] && echo --recursive))
158
+ execute << "#{git} submodule #{verbose} update --init $GIT_RECURSIVE"
159
+ end
160
+ end
161
+
162
+ execute.compact.join(" && ").gsub(/\s+/, ' ')
163
+ end
164
+
165
+ # An expensive export. Performs a checkout as above, then
166
+ # removes the repo.
167
+ def export(revision, destination)
168
+ checkout(revision, destination) << " && rm -Rf #{destination}/.git"
169
+ end
170
+
171
+ # Merges the changes to 'head' since the last fetch, for remote_cache
172
+ # deployment strategy
173
+ def sync(revision, destination)
174
+ git = command
175
+ remote = origin
176
+
177
+ execute = []
178
+ execute << "cd #{destination}"
179
+
180
+ # Use git-config to setup a remote tracking branches. Could use
181
+ # git-remote but it complains when a remote of the same name already
182
+ # exists, git-config will just silenty overwrite the setting every
183
+ # time. This could cause wierd-ness in the remote cache if the url
184
+ # changes between calls, but as long as the repositories are all
185
+ # based from each other it should still work fine.
186
+ if remote != 'origin'
187
+ execute << "#{git} config remote.#{remote}.url #{variable(:repository)}"
188
+ execute << "#{git} config remote.#{remote}.fetch +refs/heads/*:refs/remotes/#{remote}/*"
189
+ end
190
+
191
+ # since we're in a local branch already, just reset to specified revision rather than merge
192
+ execute << "#{git} fetch #{verbose} #{remote} && #{git} fetch --tags #{verbose} #{remote} && #{git} reset #{verbose} --hard #{revision}"
193
+
194
+ if variable(:git_enable_submodules)
195
+ execute << "#{git} submodule #{verbose} init"
196
+ execute << "#{git} submodule #{verbose} sync"
197
+ if false == variable(:git_submodules_recursive)
198
+ execute << "#{git} submodule #{verbose} update --init"
199
+ else
200
+ execute << %Q(export GIT_RECURSIVE=$([ ! "`#{git} --version`" \\< "git version 1.6.5" ] && echo --recursive))
201
+ execute << "#{git} submodule #{verbose} update --init $GIT_RECURSIVE"
202
+ end
203
+ end
204
+
205
+ # Make sure there's nothing else lying around in the repository (for
206
+ # example, a submodule that has subsequently been removed).
207
+ execute << "#{git} clean #{verbose} -d -x -f"
208
+
209
+ execute.join(" && ")
210
+ end
211
+
212
+ # Returns a string of diffs between two revisions
213
+ def diff(from, to=nil)
214
+ return scm :diff, from unless to
215
+ scm :diff, "#{from}..#{to}"
216
+ end
217
+
218
+ # Returns a log of changes between the two revisions (inclusive).
219
+ def log(from, to=nil)
220
+ scm :log, "#{from}..#{to}"
221
+ end
222
+
223
+ # Getting the actual commit id, in case we were passed a tag
224
+ # or partial sha or something - it will return the sha if you pass a sha, too
225
+ def query_revision(revision)
226
+ raise ArgumentError, "Deploying remote branches is no longer supported. Specify the remote branch as a local branch for the git repository you're deploying from (ie: '#{revision.gsub('origin/', '')}' rather than '#{revision}')." if revision =~ /^origin\//
227
+ return revision if revision =~ /^[0-9a-f]{40}$/
228
+ command = scm('ls-remote', repository, revision)
229
+ result = yield(command)
230
+ revdata = result.split(/[\t\n]/)
231
+ newrev = nil
232
+ revdata.each_slice(2) do |refs|
233
+ rev, ref = *refs
234
+ if ref.sub(/refs\/.*?\//, '').strip == revision.to_s
235
+ newrev = rev
236
+ break
237
+ end
238
+ end
239
+ return newrev if newrev =~ /^[0-9a-f]{40}$/
240
+
241
+ # If sha is not found on remote, try expanding from local repository
242
+ command = scm('rev-parse --revs-only', revision)
243
+ newrev = yield(command).to_s.strip
244
+
245
+ raise "Unable to resolve revision for '#{revision}' on repository '#{repository}'." unless newrev =~ /^[0-9a-f]{40}$/
246
+ return newrev
247
+ end
248
+
249
+ def command
250
+ # For backwards compatibility with 1.x version of this module
251
+ variable(:git) || super
252
+ end
253
+
254
+ # Determines what the response should be for a particular bit of text
255
+ # from the SCM. Password prompts, connection requests, passphrases,
256
+ # etc. are handled here.
257
+ def handle_data(state, stream, text)
258
+ host = state[:channel][:host]
259
+ logger.info "[#{host} :: #{stream}] #{text}"
260
+ case text
261
+ when /\bpassword.*:/i
262
+ # git is prompting for a password
263
+ unless pass = variable(:scm_password)
264
+ pass = Capistrano::CLI.password_prompt
265
+ end
266
+ "#{pass}\n"
267
+ when %r{\(yes/no\)}
268
+ # git is asking whether or not to connect
269
+ "yes\n"
270
+ when /passphrase/i
271
+ # git is asking for the passphrase for the user's key
272
+ unless pass = variable(:scm_passphrase)
273
+ pass = Capistrano::CLI.password_prompt
274
+ end
275
+ "#{pass}\n"
276
+ when /accept \(t\)emporarily/
277
+ # git is asking whether to accept the certificate
278
+ "t\n"
279
+ end
280
+ end
281
+
282
+ private
283
+
284
+ # If verbose output is requested, return nil, otherwise return the
285
+ # command-line switch for "quiet" ("-q").
286
+ def verbose
287
+ variable(:scm_verbose) ? nil : "-q"
288
+ end
289
+ end
290
+ end
291
+ end
292
+ end
293
+
@@ -0,0 +1,137 @@
1
+ # Copyright 2007 Matthew Elder <sseses@gmail.com>
2
+ # based on work by Tobias Luetke
3
+
4
+ require 'capistrano/recipes/deploy/scm/base'
5
+
6
+ module Capistrano
7
+ module Deploy
8
+ module SCM
9
+
10
+ # Implements the Capistrano SCM interface for the Mercurial revision
11
+ # control system (http://www.selenic.com/mercurial/).
12
+ # Latest updates at http://tackletechnology.org/oss/cap2-mercurial
13
+ class Mercurial < Base
14
+ # Sets the default command name for this SCM. Users may override this
15
+ # by setting the :scm_command variable.
16
+ default_command "hg"
17
+
18
+ # For mercurial HEAD == tip except that it bases this assumption on what
19
+ # tip is in the current repository (so push before you deploy)
20
+ def head
21
+ variable(:branch) || "tip"
22
+ end
23
+
24
+ # Clone the repository and update to the specified changeset.
25
+ def checkout(changeset, destination)
26
+ clone(destination) + " && " + update(changeset, destination)
27
+ end
28
+
29
+ # Pull from the repository and update to the specified changeset.
30
+ def sync(changeset, destination)
31
+ pull(destination) + " && " + update(changeset, destination)
32
+ end
33
+
34
+ # One day we will have hg archive, although i think its not needed
35
+ def export(revision, destination)
36
+ raise NotImplementedError, "`diff' is not implemented by #{self.class.name}" +
37
+ "use checkout strategy"
38
+ end
39
+
40
+ # Compute the difference between the two changesets +from+ and +to+
41
+ # as a unified diff.
42
+ def diff(from, to=nil)
43
+ scm :diff,
44
+ "--rev #{from}",
45
+ (to ? "--rev #{to}" : nil)
46
+ end
47
+
48
+ # Return a log of all changes between the two specified changesets,
49
+ # +from+ and +to+, inclusive or the log for +from+ if +to+ is omitted.
50
+ def log(from, to=nil)
51
+ scm :log,
52
+ verbose,
53
+ "--rev #{from}" +
54
+ (to ? ":#{to}" : "")
55
+ end
56
+
57
+ # Translates a tag to a changeset if needed or just returns changeset.
58
+ def query_revision(changeset)
59
+ cmd = scm :log,
60
+ verbose,
61
+ "-r #{changeset}",
62
+ '--template "{node|short}"'
63
+ yield cmd
64
+ end
65
+
66
+ # Determine response for SCM prompts
67
+ # user/pass can come from ssh and http distribution methods
68
+ # yes/no is for when ssh asks you about fingerprints
69
+ def handle_data(state, stream, text)
70
+ host = state[:channel][:host]
71
+ logger.info "[#{host} :: #{stream}] #{text}"
72
+ case text
73
+ when /^user:/mi
74
+ # support :scm_user for backwards compatibility of this module
75
+ if user = variable(:scm_username) || variable(:scm_user)
76
+ "#{user}\n"
77
+ else
78
+ raise "No variable :scm_username specified and Mercurial asked!\n" +
79
+ "Prompt was: #{text}"
80
+ end
81
+ when /\bpassword:/mi
82
+ unless pass = scm_password_or_prompt
83
+ # fall back on old behavior of erroring out with msg
84
+ raise "No variable :scm_password specified and Mercurial asked!\n" +
85
+ "Prompt was: #{text}"
86
+ end
87
+ "#{pass}\n"
88
+ when /yes\/no/i
89
+ "yes\n"
90
+ end
91
+ end
92
+
93
+ private
94
+
95
+ # Fine grained mercurial commands
96
+ def clone(destination)
97
+ scm :clone,
98
+ verbose,
99
+ "--noupdate", # do not update to tip when cloning is done
100
+ repository, # clone which repository?
101
+ destination # and put the clone where?
102
+ end
103
+
104
+ def pull(destination)
105
+ scm :pull,
106
+ verbose,
107
+ "--repository #{destination}", # pull changes into what?
108
+ repository # and pull the changes from?
109
+ end
110
+
111
+ def update(changeset, destination)
112
+ scm :update,
113
+ verbose,
114
+ "--repository #{destination}", # update what?
115
+ "--clean", # ignore untracked changes
116
+ changeset # update to this changeset
117
+ end
118
+
119
+ # verbosity configuration grokking :)
120
+ def verbose
121
+ case variable(:scm_verbose)
122
+ when nil then nil
123
+ when false then "--quiet"
124
+ else "--verbose"
125
+ end
126
+ end
127
+
128
+ # honor Cap 2.1+'s :scm_prefer_prompt if present
129
+ def scm_password_or_prompt
130
+ @scm_password_or_prompt ||= variable(:scm_password) ||
131
+ (Capistrano::CLI.password_prompt("hg password: ") if variable(:scm_prefer_prompt))
132
+ end
133
+
134
+ end
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,55 @@
1
+ require 'capistrano/recipes/deploy/scm/base'
2
+
3
+ module Capistrano
4
+ module Deploy
5
+ module SCM
6
+
7
+ # A trivial SCM wrapper for representing the current working directory
8
+ # as a repository. Obviously, not all operations are available for this
9
+ # SCM, but it works sufficiently for use with the "copy" deployment
10
+ # strategy.
11
+ #
12
+ # Use of this module is _not_ recommended; in general, it is good
13
+ # practice to use some kind of source code management even for anything
14
+ # you are wanting to deploy. However, this module is provided in
15
+ # acknowledgement of the cases where trivial deployment of your current
16
+ # working directory is desired.
17
+ #
18
+ # set :repository, "."
19
+ # set :scm, :none
20
+ # set :deploy_via, :copy
21
+ #
22
+ # Dereference symbolic links. Copy files instead. Handy when you
23
+ # reference files and directory outside of your deployment root.
24
+ # set :copy_dereference_symlink, true
25
+
26
+ class None < Base
27
+ # No versioning, thus, no head. Returns the empty string.
28
+ def head
29
+ ""
30
+ end
31
+
32
+ # Simply does a copy from the :repository directory to the
33
+ # :destination directory.
34
+ def checkout(revision, destination)
35
+ !Capistrano::Deploy::LocalDependency.on_windows? ? "cp -R#{configuration[:copy_dereference_symlink]?'L':''} #{repository} #{destination}" : "xcopy #{repository} \"#{destination}\" /S/I/Y/Q/E"
36
+ end
37
+ alias_method :export, :checkout
38
+
39
+ # No versioning, so this just returns the argument, with no
40
+ # modification.
41
+ def query_revision(revision)
42
+ revision
43
+ end
44
+
45
+ # log: There's no log, so it just echos from and to.
46
+
47
+ def log(from="", to="")
48
+ "No SCM: #{from} - #{to}"
49
+ end
50
+
51
+ end
52
+
53
+ end
54
+ end
55
+ end