capistrano-tagging 0.0.9 → 0.1.0
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/CHANGELOG.rdoc +15 -2
- data/Gemfile.lock +5 -5
- data/MIT-LICENSE +1 -1
- data/README.md +12 -4
- data/Rakefile +1 -2
- data/capistrano-tagging.gemspec +9 -10
- data/lib/capistrano/tagging.rb +35 -26
- data/lib/capistrano/tagging/version.rb +1 -1
- metadata +13 -8
data/CHANGELOG.rdoc
CHANGED
@@ -1,6 +1,19 @@
|
|
1
|
-
== 0.0
|
1
|
+
== 0.1.0 (October 1, 2012)
|
2
2
|
|
3
|
-
*
|
3
|
+
* Refactored code
|
4
|
+
* Push only current deploy tag, not all
|
5
|
+
|
6
|
+
== 0.0.9 (October 31, 2011)
|
7
|
+
|
8
|
+
* Bundler ~> 1.1 support
|
9
|
+
|
10
|
+
== 0.0.8 (October 31, 2011)
|
11
|
+
|
12
|
+
* Minor changes and optimizations
|
13
|
+
|
14
|
+
== 0.0.7 (October 31, 2011)
|
15
|
+
|
16
|
+
* Added ability to specify tag's format
|
4
17
|
|
5
18
|
== 0.0.1 (May 6, 2010)
|
6
19
|
|
data/Gemfile.lock
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
capistrano-tagging (0.0
|
5
|
-
capistrano (
|
4
|
+
capistrano-tagging (0.1.0)
|
5
|
+
capistrano (~> 2.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
capistrano (2.
|
10
|
+
capistrano (2.12.0)
|
11
11
|
highline
|
12
12
|
net-scp (>= 1.0.0)
|
13
13
|
net-sftp (>= 2.0.0)
|
14
14
|
net-ssh (>= 2.0.14)
|
15
15
|
net-ssh-gateway (>= 1.1.0)
|
16
|
-
highline (1.6.
|
16
|
+
highline (1.6.13)
|
17
17
|
net-scp (1.0.4)
|
18
18
|
net-ssh (>= 1.99.1)
|
19
19
|
net-sftp (2.0.5)
|
20
20
|
net-ssh (>= 2.0.9)
|
21
|
-
net-ssh (2.2
|
21
|
+
net-ssh (2.5.2)
|
22
22
|
net-ssh-gateway (1.1.0)
|
23
23
|
net-ssh (>= 1.99.1)
|
24
24
|
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -6,16 +6,24 @@ Automagically tag your current deployed release with capistrano
|
|
6
6
|
Install
|
7
7
|
----
|
8
8
|
|
9
|
-
|
9
|
+
```bash
|
10
|
+
$ gem install capistrano-tagging
|
11
|
+
```
|
10
12
|
|
11
13
|
Usage
|
12
14
|
----
|
13
15
|
|
14
|
-
|
16
|
+
In `deploy.rb`:
|
15
17
|
|
16
|
-
|
18
|
+
```ruby
|
19
|
+
require 'capistrano/tagging'
|
20
|
+
```
|
17
21
|
|
18
|
-
|
22
|
+
That's it! You can specify format of tag:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
set :tagging_format, ':rails_env_:release' # default, also available all of deploy variables
|
26
|
+
```
|
19
27
|
|
20
28
|
Original idea:
|
21
29
|
---
|
data/Rakefile
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler::GemHelper.install_tasks
|
1
|
+
require 'bundler/gem_tasks'
|
data/capistrano-tagging.gemspec
CHANGED
@@ -1,26 +1,25 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require File.expand_path(
|
2
|
+
require File.expand_path('../lib/capistrano/tagging/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
|
-
s.name =
|
5
|
+
s.name = 'capistrano-tagging'
|
6
6
|
s.platform = Gem::Platform::RUBY
|
7
|
-
s.version = Capistrano::Tagging::VERSION
|
7
|
+
s.version = Capistrano::Tagging::VERSION.dup
|
8
8
|
|
9
|
-
s.authors = [
|
10
|
-
s.email = [
|
9
|
+
s.authors = ['Dimko', 'Leon Berenschot']
|
10
|
+
s.email = ['deemox@gmail.com', 'LeonB@beriedata.nl']
|
11
11
|
|
12
12
|
s.summary = "Tag your deployed commit to git"
|
13
13
|
s.description = <<-EOF
|
14
|
-
|
14
|
+
Create a tag in the local and remote repo on every deploy
|
15
15
|
EOF
|
16
16
|
|
17
|
-
s.
|
18
|
-
s.homepage = "http://github.com/dimko/capistrano-tagging"
|
17
|
+
s.homepage = 'http://github.com/dimko/capistrano-tagging'
|
19
18
|
|
20
|
-
s.add_dependency
|
19
|
+
s.add_dependency 'capistrano', '~> 2.0'
|
21
20
|
|
22
21
|
s.files = `git ls-files`.split("\n")
|
23
22
|
s.has_rdoc = false
|
24
23
|
|
25
|
-
s.
|
24
|
+
s.require_paths = ['lib']
|
26
25
|
end
|
data/lib/capistrano/tagging.rb
CHANGED
@@ -1,49 +1,58 @@
|
|
1
|
-
unless Capistrano::Configuration.respond_to?(:instance)
|
2
|
-
abort "capistrano/tagging requires Capistrano 2"
|
3
|
-
end
|
4
|
-
|
5
1
|
require 'capistrano'
|
6
2
|
|
7
3
|
Capistrano::Configuration.instance(:must_exist).load do
|
8
|
-
|
9
|
-
|
10
|
-
before "deploy:cleanup", "tagging:cleanup"
|
4
|
+
after 'deploy:restart', 'tagging:deploy'
|
5
|
+
before 'deploy:cleanup', 'tagging:cleanup'
|
11
6
|
|
12
7
|
namespace :tagging do
|
8
|
+
_cset(:tagging_format, ':rails_env_:release')
|
9
|
+
|
10
|
+
def fetch_or_send(method)
|
11
|
+
fetch method, respond_to?(method) ? send(method) : nil
|
12
|
+
end
|
13
13
|
|
14
14
|
def tag(options = {})
|
15
|
-
|
15
|
+
fetch(:tagging_format).gsub(/:([a-z_]+[^_:])/i) do |match|
|
16
16
|
method = $1.to_sym
|
17
|
-
|
17
|
+
options.fetch method, fetch_or_send(method)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
email = `git config --get user.email`
|
21
|
+
def user_name
|
22
|
+
`git config --get user.name`.chomp
|
23
|
+
end
|
25
24
|
|
26
|
-
|
27
|
-
|
25
|
+
def user_email
|
26
|
+
`git config --get user.email`.chomp
|
28
27
|
end
|
29
28
|
|
30
|
-
|
29
|
+
def create_tag(name)
|
30
|
+
puts `git tag #{name} #{revision} -m "Deployed by #{user_name} <#{user_email}>"`
|
31
|
+
puts `git push origin refs/tags/#{name}:refs/tags/#{name}`
|
32
|
+
end
|
33
|
+
|
34
|
+
def remove_tag(name)
|
35
|
+
puts `git tag -d #{name}`
|
36
|
+
puts `git push origin :refs/tags/#{name}`
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Create release tag in local and origin repo"
|
40
|
+
task :deploy do
|
41
|
+
create_tag tag(:release => release_name)
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "Remove release tag from local and origin repo"
|
31
45
|
task :cleanup do
|
32
46
|
count = fetch(:keep_releases, 5).to_i
|
33
|
-
|
47
|
+
|
48
|
+
if count >= releases.size
|
34
49
|
logger.important "no old release tags to clean up"
|
35
50
|
else
|
36
|
-
logger.info "keeping #{count} of #{releases.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
tags.each do |tag|
|
41
|
-
`git tag -d #{tag}`
|
42
|
-
`git push origin :refs/tags/#{tag}`
|
51
|
+
logger.info "keeping #{count} of #{releases.size} release tags"
|
52
|
+
releases.first(releases.size - count).map do |release|
|
53
|
+
remove_tag tag(:release => release)
|
43
54
|
end
|
44
55
|
end
|
45
56
|
end
|
46
|
-
|
47
57
|
end
|
48
|
-
|
49
58
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-tagging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,20 +10,25 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2012-10-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: capistrano
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: '2.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '2.0'
|
31
|
+
description: ! ' Create a tag in the local and remote repo on every deploy
|
27
32
|
|
28
33
|
'
|
29
34
|
email:
|
@@ -63,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
68
|
version: '0'
|
64
69
|
requirements: []
|
65
70
|
rubyforge_project:
|
66
|
-
rubygems_version: 1.8.
|
71
|
+
rubygems_version: 1.8.24
|
67
72
|
signing_key:
|
68
73
|
specification_version: 3
|
69
74
|
summary: Tag your deployed commit to git
|