capistrano-tagging3 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/CHANGELOG.rdoc +24 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +30 -0
- data/MIT-LICENSE +20 -0
- data/README.md +36 -0
- data/Rakefile +1 -0
- data/capistrano-tagging3.gemspec +25 -0
- data/lib/capistrano/tagging3.rb +4 -0
- data/lib/capistrano/tagging3/version.rb +5 -0
- data/lib/capistrano/tasks/tagging3.rake +61 -0
- metadata +79 -0
data/.gitignore
ADDED
data/CHANGELOG.rdoc
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
== 1.0.0 (May 2017)
|
2
|
+
|
3
|
+
* Forked and upgraded to capistrano v3
|
4
|
+
|
5
|
+
== 0.1.0 (October 1, 2012)
|
6
|
+
|
7
|
+
* Refactored code
|
8
|
+
* Push only current deploy tag, not all
|
9
|
+
|
10
|
+
== 0.0.9 (October 31, 2011)
|
11
|
+
|
12
|
+
* Bundler ~> 1.1 support
|
13
|
+
|
14
|
+
== 0.0.8 (October 31, 2011)
|
15
|
+
|
16
|
+
* Minor changes and optimizations
|
17
|
+
|
18
|
+
== 0.0.7 (October 31, 2011)
|
19
|
+
|
20
|
+
* Added ability to specify tag's format
|
21
|
+
|
22
|
+
== 0.0.1 (May 6, 2010)
|
23
|
+
|
24
|
+
* Inital Check-in
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
capistrano-tagging3 (0.1.0)
|
5
|
+
capistrano (~> 3.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
capistrano (3.4.0)
|
11
|
+
i18n
|
12
|
+
rake (>= 10.0.0)
|
13
|
+
sshkit (~> 1.3)
|
14
|
+
i18n (0.7.0)
|
15
|
+
net-scp (1.2.1)
|
16
|
+
net-ssh (>= 2.6.5)
|
17
|
+
net-ssh (2.9.4)
|
18
|
+
rake (10.5.0)
|
19
|
+
sshkit (1.11.3)
|
20
|
+
net-scp (>= 1.1.2)
|
21
|
+
net-ssh (>= 2.8.0)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
ruby
|
25
|
+
|
26
|
+
DEPENDENCIES
|
27
|
+
capistrano-tagging3!
|
28
|
+
|
29
|
+
BUNDLED WITH
|
30
|
+
1.14.6
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2006 Jamis Buck, 2010 Leon Berenschot, 2012 Dimko
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
Capistrano tagging3
|
2
|
+
====
|
3
|
+
|
4
|
+
Automagically tag your current deployed release with capistrano v3
|
5
|
+
|
6
|
+
Install
|
7
|
+
----
|
8
|
+
|
9
|
+
```bash
|
10
|
+
$ gem install capistrano-tagging3
|
11
|
+
```
|
12
|
+
|
13
|
+
Usage
|
14
|
+
----
|
15
|
+
|
16
|
+
In `deploy.rb`:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
require 'capistrano/tagging3'
|
20
|
+
```
|
21
|
+
|
22
|
+
That's it! You can specify format of tag:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
set :tagging3_format, ':rails_env_:release' # default, also available all of deploy variables
|
26
|
+
```
|
27
|
+
|
28
|
+
Original idea:
|
29
|
+
---
|
30
|
+
|
31
|
+
* [https://github.com/dimko/capistrano-tagging](https://github.com/dimko/capistrano-tagging) - tagging for capistrano v2
|
32
|
+
* [https://github.com/LeipeLeon/capistrano-git-tags](https://github.com/LeipeLeon/capistrano-git-tags)
|
33
|
+
|
34
|
+
* [http://wendbaar.nl/blog/2010/04/automagically-tagging-releases-in-github/](http://wendbaar.nl/blog/2010/04/automagically-tagging-releases-in-github/)
|
35
|
+
|
36
|
+
* [http://gist.github.com/381852](http://gist.github.com/381852)
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path('../lib/capistrano/tagging3/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'capistrano-tagging3'
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
|
+
s.version = Capistrano::Tagging3::VERSION.dup
|
8
|
+
|
9
|
+
s.authors = ['Dimko', 'Leon Berenschot', 'Ian Heggie']
|
10
|
+
s.email = ['deemox@gmail.com', 'LeonB@beriedata.nl', 'ian@heggie.biz']
|
11
|
+
|
12
|
+
s.summary = "Tag your deployed commit to git"
|
13
|
+
s.description = <<-EOF
|
14
|
+
Create a tag in the local and remote repo on every deploy with capistrano v3
|
15
|
+
EOF
|
16
|
+
|
17
|
+
s.homepage = 'http://github.com/ianheggie/capistrano-tagging3'
|
18
|
+
|
19
|
+
s.add_dependency 'capistrano', '~> 3.0'
|
20
|
+
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
s.has_rdoc = false
|
23
|
+
|
24
|
+
s.require_paths = ['lib']
|
25
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
namespace :tagging3 do
|
2
|
+
set :tagging3_format, ':rails_env_:release'
|
3
|
+
|
4
|
+
def fetch_or_send(method)
|
5
|
+
fetch method, respond_to?(method) ? send(method) : nil
|
6
|
+
end
|
7
|
+
|
8
|
+
def tag(options = {})
|
9
|
+
fetch(:tagging3_format).gsub(/:([a-z_]+[^_:])/i) do |match|
|
10
|
+
method = $1.to_sym
|
11
|
+
options.fetch method, fetch_or_send(method)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def user_name
|
16
|
+
`git config --get user.name`.chomp
|
17
|
+
end
|
18
|
+
|
19
|
+
def user_email
|
20
|
+
`git config --get user.email`.chomp
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_tag(name)
|
24
|
+
puts `git tag #{name} #{fetch(:revision)} -m "Deployed by #{user_name} <#{user_email}>"`
|
25
|
+
puts `git push origin refs/tags/#{name}:refs/tags/#{name}`
|
26
|
+
end
|
27
|
+
|
28
|
+
def remove_tag(name)
|
29
|
+
puts `git tag -d #{name}`
|
30
|
+
puts `git push origin :refs/tags/#{name}`
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Create release tag in local and origin repo"
|
34
|
+
task :deploy do
|
35
|
+
create_tag tag(:release => fetch(:release_timestamp))
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Remove release tag from local and origin repo"
|
39
|
+
task :cleanup do
|
40
|
+
count = fetch(:keep_releases, 5).to_i
|
41
|
+
multiple_hosts = false
|
42
|
+
on roles(:all) do |host|
|
43
|
+
#puts "HOST: #{host.inspect}"
|
44
|
+
releases = capture(:ls, '-xtr', releases_path).split
|
45
|
+
|
46
|
+
if count >= releases.size
|
47
|
+
puts "no old release tags to clean up" unless multiple_hosts
|
48
|
+
else
|
49
|
+
puts "keeping #{count} of #{releases.size} release tags"
|
50
|
+
releases.first(releases.size - count).map do |release|
|
51
|
+
remove_tag tag(:release => release)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
multiple_hosts = true
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
after 'deploy:restart', 'tagging3:deploy'
|
60
|
+
before 'deploy:cleanup', 'tagging3:cleanup'
|
61
|
+
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-tagging3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dimko
|
9
|
+
- Leon Berenschot
|
10
|
+
- Ian Heggie
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2017-05-11 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: capistrano
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '3.0'
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ~>
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '3.0'
|
32
|
+
description: ! ' Create a tag in the local and remote repo on every deploy with
|
33
|
+
capistrano v3
|
34
|
+
|
35
|
+
'
|
36
|
+
email:
|
37
|
+
- deemox@gmail.com
|
38
|
+
- LeonB@beriedata.nl
|
39
|
+
- ian@heggie.biz
|
40
|
+
executables: []
|
41
|
+
extensions: []
|
42
|
+
extra_rdoc_files: []
|
43
|
+
files:
|
44
|
+
- .gitignore
|
45
|
+
- CHANGELOG.rdoc
|
46
|
+
- Gemfile
|
47
|
+
- Gemfile.lock
|
48
|
+
- MIT-LICENSE
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- capistrano-tagging3.gemspec
|
52
|
+
- lib/capistrano/tagging3.rb
|
53
|
+
- lib/capistrano/tagging3/version.rb
|
54
|
+
- lib/capistrano/tasks/tagging3.rake
|
55
|
+
homepage: http://github.com/ianheggie/capistrano-tagging3
|
56
|
+
licenses: []
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 1.8.23
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: Tag your deployed commit to git
|
79
|
+
test_files: []
|