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.
@@ -1,6 +1,19 @@
1
- == 0.0.3 (October 31, 2011)
1
+ == 0.1.0 (October 1, 2012)
2
2
 
3
- * Added stage to tag name
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
 
@@ -1,24 +1,24 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-tagging (0.0.3)
5
- capistrano (>= 1.0.0)
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.9.0)
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.2)
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.1)
21
+ net-ssh (2.5.2)
22
22
  net-ssh-gateway (1.1.0)
23
23
  net-ssh (>= 1.99.1)
24
24
 
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006 Jamis Buck, 2010 Leon Berenschot
1
+ Copyright (c) 2006 Jamis Buck, 2010 Leon Berenschot, 2012 Dimko
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -6,16 +6,24 @@ Automagically tag your current deployed release with capistrano
6
6
  Install
7
7
  ----
8
8
 
9
- gem install capistrano-tagging
9
+ ```bash
10
+ $ gem install capistrano-tagging
11
+ ```
10
12
 
11
13
  Usage
12
14
  ----
13
15
 
14
- in deploy.rb:
16
+ In `deploy.rb`:
15
17
 
16
- require 'capistrano/tagging'
18
+ ```ruby
19
+ require 'capistrano/tagging'
20
+ ```
17
21
 
18
- set :tag_format, ':rails_env_:release' # by default, also available all of deploy variables
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'
@@ -1,26 +1,25 @@
1
1
  # encoding: utf-8
2
- require File.expand_path("../lib/capistrano/tagging/version", __FILE__)
2
+ require File.expand_path('../lib/capistrano/tagging/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.name = "capistrano-tagging"
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 = ["Dimko", "Leon Berenschot"]
10
- s.email = ["deemox@gmail.com", "LeonB@beriedata.nl"]
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
- With every commit tag the local and remote branch with a tag
14
+ Create a tag in the local and remote repo on every deploy
15
15
  EOF
16
16
 
17
- s.date = "2011-01-31"
18
- s.homepage = "http://github.com/dimko/capistrano-tagging"
17
+ s.homepage = 'http://github.com/dimko/capistrano-tagging'
19
18
 
20
- s.add_dependency "capistrano", ">= 1.0.0"
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.require_path = 'lib'
24
+ s.require_paths = ['lib']
26
25
  end
@@ -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
- after "deploy:restart", "tagging:deploy"
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
- return fetch(:tag_format, ":rails_env_:release").gsub(/:([a-z_]+[^_:])/i) do |match|
15
+ fetch(:tagging_format).gsub(/:([a-z_]+[^_:])/i) do |match|
16
16
  method = $1.to_sym
17
- match = options[method] || fetch(method, false) || (send(method) rescue '')
17
+ options.fetch method, fetch_or_send(method)
18
18
  end
19
19
  end
20
20
 
21
- desc "Place release tag into Git and push it to server."
22
- task :deploy do
23
- user = `git config --get user.name`
24
- email = `git config --get user.email`
21
+ def user_name
22
+ `git config --get user.name`.chomp
23
+ end
25
24
 
26
- puts `git tag #{tag(:release => release_name)} #{revision} -m "Deployed by #{user} <#{email}>"`
27
- puts `git push --tags`
25
+ def user_email
26
+ `git config --get user.email`.chomp
28
27
  end
29
28
 
30
- desc "Remove deleted release tag from Git and push it to server."
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
- if count >= releases.length
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.length} release tags"
37
-
38
- tags = (releases - releases.last(count)).map { |release| tag(:release => release) }
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
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  class Tagging
3
- VERSION = "0.0.9"
3
+ VERSION = '0.1.0'.freeze
4
4
  end
5
5
  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.9
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: 2011-01-31 00:00:00.000000000 Z
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: &70175753252340 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
- - - ! '>='
20
+ - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: 1.0.0
22
+ version: '2.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70175753252340
26
- description: ! ' With every commit tag the local and remote branch with a tag
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.10
71
+ rubygems_version: 1.8.24
67
72
  signing_key:
68
73
  specification_version: 3
69
74
  summary: Tag your deployed commit to git