capistrano-deploy-scm-passthrough 0.1.1
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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +80 -0
- data/Rakefile +1 -0
- data/capistrano-deploy-scm-passthrough.gemspec +18 -0
- data/lib/capistrano/recipes/deploy/scm/passthrough.rb +45 -0
- metadata +69 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Simo Kinnunen
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# capistrano-deploy-scm-passthrough
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
|
5
|
+
**capistrano-deploy-scm-passthrough** provides a simple passthrough SCM implementation for [Capistrano](https://github.com/capistrano/capistrano). This differs from the built-in `:none` SCM in the following ways:
|
6
|
+
|
7
|
+
* It uses your local files directly (i.e. a checkout is essentially a no-op). The `:none` SCM recursively copies the current folder to a temp directory.
|
8
|
+
* It can be used with remote strategies, such as [capistrano_rsync_with_remote_cache](https://github.com/vigetlabs/capistrano_rsync_with_remote_cache).
|
9
|
+
* **CAUTION:** the `:passthrough` SCM cannot be used with the `:copy` strategy, or any other strategy that relies on files being actually copied around.
|
10
|
+
|
11
|
+
You'll see the most benefit if you happen to be working with a large and/or binary-heavy repository deployed by a CI server. In fact it's a bad idea to use this gem if you are running the deploy command locally.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Simply install the gem and you're done:
|
16
|
+
|
17
|
+
gem install capistrano-deploy-scm-passthrough
|
18
|
+
|
19
|
+
No other setup is needed.
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Set your `:scm` as follows:
|
24
|
+
|
25
|
+
set :scm, :passthrough
|
26
|
+
set :repository, '.'
|
27
|
+
|
28
|
+
For a sligtly more complicated example (and perhaps to understand why this gem was made), consider a case where Capistrano is run by a CI server such as [Jenkins](http://jenkins-ci.org/). Jenkins will deal with the SCM, so there is no need for Capistrano to complicate things:
|
29
|
+
|
30
|
+
**deploy.rb**
|
31
|
+
|
32
|
+
# Jenkins manages the SCM.
|
33
|
+
set :scm, :passthrough
|
34
|
+
set :repository, '.'
|
35
|
+
set :revision, ENV['GIT_COMMIT'] || ENV['SVN_REVISION'] || Time.now
|
36
|
+
|
37
|
+
We are also using Jenkins' environment variables to set the `:revision` property, which will be written into Capistrano's REVISION file. This is not 100% necessary, but is good to have so that you can check what you have deployed if necessary.
|
38
|
+
|
39
|
+
The `:passthrough` strategy works especially well with [capistrano_rsync_with_remote_cache](https://github.com/vigetlabs/capistrano_rsync_with_remote_cache), allowing for quick deploys even with binary-heavy repositories. An example configuration might be:
|
40
|
+
|
41
|
+
**deploy.rb**
|
42
|
+
|
43
|
+
# Deploy configuration for the rsync_with_remote_cache strategy.
|
44
|
+
set :deploy_via, :rsync_with_remote_cache
|
45
|
+
set :rsync_options, '-azF --delete --delete-excluded'
|
46
|
+
set :local_cache, '.'
|
47
|
+
|
48
|
+
Note that we have set the `-F` option, which looks for include/exclude patterns in an `.rsync-filter` file. The following example works for a case where you'd only like to deploy the contents of a single folder (say, `public`) with the REVISION file, with everything else (including nested `.svn` folders) ignored.
|
49
|
+
|
50
|
+
**.rsync-filter**
|
51
|
+
|
52
|
+
- .svn
|
53
|
+
+ public/***
|
54
|
+
+ REVISION
|
55
|
+
- *
|
56
|
+
|
57
|
+
## License
|
58
|
+
|
59
|
+
Copyright (c) 2013 Simo Kinnunen
|
60
|
+
|
61
|
+
MIT License
|
62
|
+
|
63
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
64
|
+
a copy of this software and associated documentation files (the
|
65
|
+
"Software"), to deal in the Software without restriction, including
|
66
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
67
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
68
|
+
permit persons to whom the Software is furnished to do so, subject to
|
69
|
+
the following conditions:
|
70
|
+
|
71
|
+
The above copyright notice and this permission notice shall be
|
72
|
+
included in all copies or substantial portions of the Software.
|
73
|
+
|
74
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
75
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
76
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
77
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
78
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
79
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
80
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = "capistrano-deploy-scm-passthrough"
|
5
|
+
gem.version = "0.1.1"
|
6
|
+
gem.authors = ["Simo Kinnunen"]
|
7
|
+
gem.email = ["simo@shoqolate.com"]
|
8
|
+
gem.homepage = "https://github.com/sorccu/capistrano-deploy-scm-passthrough"
|
9
|
+
gem.summary = %q{Passthrough SCM for Capistrano.}
|
10
|
+
gem.description = %q{Provides a simple :passthrough SCM implementation for Capistrano. Like :none, but more compatible and never copies or modifies any files.}
|
11
|
+
|
12
|
+
gem.files = `git ls-files`.split($/)
|
13
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
14
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
|
17
|
+
gem.add_dependency('capistrano', '>=2.1.0')
|
18
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'capistrano/recipes/deploy/scm/base'
|
2
|
+
|
3
|
+
module Capistrano
|
4
|
+
module Deploy
|
5
|
+
module SCM
|
6
|
+
|
7
|
+
# An SCM even more trivial than :none. The basic idea is that everything
|
8
|
+
# is simply passed through. In general it's a bad idea to use it unless
|
9
|
+
# you've got something else such as Jenkins managing the real SCM.
|
10
|
+
#
|
11
|
+
# Note that strategies that expect files being copied don't work with
|
12
|
+
# the :passthrough SCM. Namely, :copy does not work.
|
13
|
+
class Passthrough < Base
|
14
|
+
# Satisfy dependency checks.
|
15
|
+
default_command 'true'
|
16
|
+
|
17
|
+
# No versioning, thus, no head. Returns the empty string.
|
18
|
+
def head
|
19
|
+
''
|
20
|
+
end
|
21
|
+
|
22
|
+
# Return a command that always succeeds and has no side effects.
|
23
|
+
# Whatever we are given we're just going to pass through.
|
24
|
+
def sync(revision, destination)
|
25
|
+
'true'
|
26
|
+
end
|
27
|
+
|
28
|
+
alias_method :checkout, :sync
|
29
|
+
alias_method :export, :checkout
|
30
|
+
|
31
|
+
# No versioning, so this just returns the argument, with no
|
32
|
+
# modification.
|
33
|
+
def query_revision(revision)
|
34
|
+
revision
|
35
|
+
end
|
36
|
+
|
37
|
+
def log(from="", to="")
|
38
|
+
"#{self.class.name}: #{from} - #{to}"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-deploy-scm-passthrough
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Simo Kinnunen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: capistrano
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.1.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.1.0
|
30
|
+
description: Provides a simple :passthrough SCM implementation for Capistrano. Like
|
31
|
+
:none, but more compatible and never copies or modifies any files.
|
32
|
+
email:
|
33
|
+
- simo@shoqolate.com
|
34
|
+
executables: []
|
35
|
+
extensions: []
|
36
|
+
extra_rdoc_files: []
|
37
|
+
files:
|
38
|
+
- .gitignore
|
39
|
+
- Gemfile
|
40
|
+
- LICENSE.txt
|
41
|
+
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- capistrano-deploy-scm-passthrough.gemspec
|
44
|
+
- lib/capistrano/recipes/deploy/scm/passthrough.rb
|
45
|
+
homepage: https://github.com/sorccu/capistrano-deploy-scm-passthrough
|
46
|
+
licenses: []
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.8.24
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: Passthrough SCM for Capistrano.
|
69
|
+
test_files: []
|