Skip to content

Commit 5938ecd

Browse files
committed
init update
1 parent ff6551b commit 5938ecd

11 files changed

+145
-106
lines changed

CHANGELOG.rdoc

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
== 0.0.3 (October 31, 2011)
2+
3+
* Added stage to tag name
4+
15
== 0.0.1 (May 6, 2010)
26

37
* Inital Check-in

Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source :gemcutter
2+
3+
gemspec

Gemfile.lock

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
PATH
2+
remote: .
3+
specs:
4+
capistrano-tagging (0.0.3)
5+
capistrano (>= 1.0.0)
6+
7+
GEM
8+
remote: http://rubygems.org/
9+
specs:
10+
capistrano (2.9.0)
11+
highline
12+
net-scp (>= 1.0.0)
13+
net-sftp (>= 2.0.0)
14+
net-ssh (>= 2.0.14)
15+
net-ssh-gateway (>= 1.1.0)
16+
highline (1.6.2)
17+
net-scp (1.0.4)
18+
net-ssh (>= 1.99.1)
19+
net-sftp (2.0.5)
20+
net-ssh (>= 2.0.9)
21+
net-ssh (2.2.1)
22+
net-ssh-gateway (1.1.0)
23+
net-ssh (>= 1.99.1)
24+
25+
PLATFORMS
26+
ruby
27+
28+
DEPENDENCIES
29+
capistrano-tagging!

Manifest

-5
This file was deleted.

README.markdown

-24
This file was deleted.

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Capistrano tagging
2+
====
3+
4+
Automagically tag your current deployed release with capistrano
5+
6+
Install
7+
----
8+
9+
gem install capistrano-tagging
10+
11+
Usage
12+
----
13+
14+
in deploy.rb:
15+
16+
require 'capistrano/tagging'
17+
18+
set :tag_format, ':rails_env_:release' # by default, also available all of deploy variables
19+
20+
Original idea:
21+
---
22+
23+
* [https://github.com/LeipeLeon/capistrano-git-tags](https://github.com/LeipeLeon/capistrano-git-tags)
24+
25+
* [http://wendbaar.nl/blog/2010/04/automagically-tagging-releases-in-github/](http://wendbaar.nl/blog/2010/04/automagically-tagging-releases-in-github/)
26+
27+
* [http://gist.github.com/381852](http://gist.github.com/381852)

capistrano-git-tags.gemspec

-24
This file was deleted.

capistrano-tagging.gemspec

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# encoding: utf-8
2+
require File.expand_path("../lib/capistrano/tagging/version", __FILE__)
3+
4+
Gem::Specification.new do |s|
5+
s.name = "capistrano-tagging"
6+
s.platform = Gem::Platform::RUBY
7+
s.version = Capistrano::Tagging::VERSION
8+
9+
s.authors = ["Leon Berenschot"]
10+
s.email = ["[email protected]"]
11+
12+
s.summary = "Tag your deployed commit to git"
13+
s.description = <<-EOF
14+
With every commit tag the local and remote branch with a tag
15+
EOF
16+
17+
s.date = "2011-01-31"
18+
s.homepage = "http://github.com/dimko/capistrano-tagging"
19+
20+
s.add_dependency "capistrano", ">= 1.0.0"
21+
22+
s.files = `git ls-files`.split("\n")
23+
s.has_rdoc = false
24+
25+
s.require_path = 'lib'
26+
end

lib/capistrano/git/tags.rb

-53
This file was deleted.

lib/capistrano/tagging.rb

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
unless Capistrano::Configuration.respond_to?(:instance)
2+
abort "capistrano/tagging requires Capistrano 2"
3+
end
4+
5+
require 'capistrano'
6+
7+
Capistrano::Configuration.instance.load do
8+
9+
after "deploy:restart", "tagging:deploy"
10+
before "deploy:cleanup", "tagging:cleanup"
11+
12+
namespace :tags do
13+
14+
def tag(options = {})
15+
tag_format = (tag_format || ':rails_env_:release').gsub(/(:[a-z_]+)[^:]/i) do |match|
16+
method = $1.to_sym
17+
match = options[method] || send(method) || ''
18+
end
19+
20+
tag_format
21+
end
22+
23+
desc "Place release tag into Git and push it to server."
24+
task :deploy do
25+
user = `git config --get user.name`
26+
email = `git config --get user.email`
27+
28+
puts `git tag #{tag(:release => release_name)} #{revision} -m "Deployed by #{user} <#{email}>"`
29+
puts `git push --tags`
30+
end
31+
32+
desc "Remove deleted release tag from Git and push it to server."
33+
task :cleanup do
34+
count = fetch(:keep_releases, 5).to_i
35+
if count >= releases.length
36+
logger.important "no old release tags to clean up"
37+
else
38+
logger.info "keeping #{count} of #{releases.length} release tags"
39+
40+
tags = (releases - releases.last(count)).map { |release| tag(:release => release) }
41+
42+
tags.each do |tag|
43+
`git tag -d #{tag}`
44+
`git push origin :refs/tags/#{tag}`
45+
end
46+
end
47+
end
48+
49+
end
50+
51+
end

lib/capistrano/tagging/version.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Capistrano
2+
class Tagging
3+
VERSION = "0.0.3"
4+
end
5+
end

0 commit comments

Comments
 (0)