Skip to content

Commit

Permalink
init update
Browse files Browse the repository at this point in the history
  • Loading branch information
dmeremyanin committed Oct 31, 2011
1 parent ff6551b commit 5938ecd
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 106 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rdoc
@@ -1,3 +1,7 @@
== 0.0.3 (October 31, 2011)

* Added stage to tag name

== 0.0.1 (May 6, 2010)

* Inital Check-in
3 changes: 3 additions & 0 deletions Gemfile
@@ -0,0 +1,3 @@
source :gemcutter

gemspec
29 changes: 29 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,29 @@
PATH
remote: .
specs:
capistrano-tagging (0.0.3)
capistrano (>= 1.0.0)

GEM
remote: http://rubygems.org/
specs:
capistrano (2.9.0)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
highline (1.6.2)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
net-ssh (>= 2.0.9)
net-ssh (2.2.1)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)

PLATFORMS
ruby

DEPENDENCIES
capistrano-tagging!
5 changes: 0 additions & 5 deletions Manifest

This file was deleted.

24 changes: 0 additions & 24 deletions README.markdown

This file was deleted.

27 changes: 27 additions & 0 deletions README.md
@@ -0,0 +1,27 @@
Capistrano tagging
====

Automagically tag your current deployed release with capistrano

Install
----

gem install capistrano-tagging

Usage
----

in deploy.rb:

require 'capistrano/tagging'

set :tag_format, ':rails_env_:release' # by default, also available all of deploy variables

Original idea:
---

* [https://github.com/LeipeLeon/capistrano-git-tags](https://github.com/LeipeLeon/capistrano-git-tags)

* [http://wendbaar.nl/blog/2010/04/automagically-tagging-releases-in-github/](http://wendbaar.nl/blog/2010/04/automagically-tagging-releases-in-github/)

* [http://gist.github.com/381852](http://gist.github.com/381852)
24 changes: 0 additions & 24 deletions capistrano-git-tags.gemspec

This file was deleted.

26 changes: 26 additions & 0 deletions capistrano-tagging.gemspec
@@ -0,0 +1,26 @@
# encoding: utf-8
require File.expand_path("../lib/capistrano/tagging/version", __FILE__)

Gem::Specification.new do |s|
s.name = "capistrano-tagging"
s.platform = Gem::Platform::RUBY
s.version = Capistrano::Tagging::VERSION

s.authors = ["Leon Berenschot"]
s.email = ["LeonB@beriedata.nl"]

s.summary = "Tag your deployed commit to git"
s.description = <<-EOF
With every commit tag the local and remote branch with a tag
EOF

s.date = "2011-01-31"
s.homepage = "http://github.com/dimko/capistrano-tagging"

s.add_dependency "capistrano", ">= 1.0.0"

s.files = `git ls-files`.split("\n")
s.has_rdoc = false

s.require_path = 'lib'
end
53 changes: 0 additions & 53 deletions lib/capistrano/git/tags.rb

This file was deleted.

51 changes: 51 additions & 0 deletions lib/capistrano/tagging.rb
@@ -0,0 +1,51 @@
unless Capistrano::Configuration.respond_to?(:instance)
abort "capistrano/tagging requires Capistrano 2"
end

require 'capistrano'

Capistrano::Configuration.instance.load do

after "deploy:restart", "tagging:deploy"
before "deploy:cleanup", "tagging:cleanup"

namespace :tags do

def tag(options = {})
tag_format = (tag_format || ':rails_env_:release').gsub(/(:[a-z_]+)[^:]/i) do |match|
method = $1.to_sym
match = options[method] || send(method) || ''
end

tag_format
end

desc "Place release tag into Git and push it to server."
task :deploy do
user = `git config --get user.name`
email = `git config --get user.email`

puts `git tag #{tag(:release => release_name)} #{revision} -m "Deployed by #{user} <#{email}>"`
puts `git push --tags`
end

desc "Remove deleted release tag from Git and push it to server."
task :cleanup do
count = fetch(:keep_releases, 5).to_i
if count >= releases.length
logger.important "no old release tags to clean up"
else
logger.info "keeping #{count} of #{releases.length} release tags"

tags = (releases - releases.last(count)).map { |release| tag(:release => release) }

tags.each do |tag|
`git tag -d #{tag}`
`git push origin :refs/tags/#{tag}`
end
end
end

end

end
5 changes: 5 additions & 0 deletions lib/capistrano/tagging/version.rb
@@ -0,0 +1,5 @@
module Capistrano
class Tagging
VERSION = "0.0.3"
end
end

0 comments on commit 5938ecd

Please sign in to comment.