cap-deploy-tagger 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5ab86cffdfc2b2682fee5ca4ca91313335ffdbfc
4
+ data.tar.gz: 1f243178f8a896ee16eb6c7394d1bd5a5212d9f8
5
+ SHA512:
6
+ metadata.gz: d2af7614492dd013e217d3d00144c6ad5fbdd9fe1d1e159935ed475f021d0e310c6a967b812991d76bf46f2cde63e16836619dd4a45063b15e1e9c21740fb8d7
7
+ data.tar.gz: 478df5ff36e8e8909e0144d684de1a2bf476324a139ae8097f1eec859aceee615b1b13f1c3cdd8e77ae3012d37b0afa70b17c3b737c48bc0d0308bfd71f22e4c
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cap-deploy-tagger.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Andy Sykes
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # cap-deploy-tagger
2
+
3
+ ## What does this do?
4
+
5
+ This gem allows you to automatically tag Git commits when you deploy with Capistrano.
6
+
7
+ ## Why would you tag on deploy?
8
+
9
+ One reason you would want to tag on deploy is to keep track of what commit is currently
10
+ in production (or in staging or some other stage). You may also want to track this
11
+ if you're using some kind of scaling process to deploy code - this will allow you to
12
+ deploy the same release that other servers are currently using.
13
+
14
+ ## Installation
15
+
16
+ Add this line to your application's Gemfile:
17
+
18
+ gem 'cap-deploy-tagger'
19
+
20
+ Since deploy only happens in development, you may want to wrap it in a Bundler group
21
+ so that it's not deployed to your production servers:
22
+
23
+ group :development do
24
+ gem 'cap-deploy-tagger'
25
+ end
26
+
27
+ Now add the gem to your Capistrano `Capfile`:
28
+
29
+ require 'cap-deploy-tagger'
30
+
31
+ ## Usage and configuration
32
+
33
+ ### Tag name
34
+
35
+ When you include the gem into your Capfile, it will tag each deploy you make to each stage.
36
+ It will assemble the tag name from the stage name like so: `deployed_stage`. For example,
37
+ when deploying to production it will create a tag called `deployed_production`, and when
38
+ deploying to staging it will create a tag called `deployed_staging`.
39
+
40
+ You can change the tag name by setting the Capistrano variable `:deploy_tag`:
41
+
42
+ set :deploy_tag, 'in_the_world'
43
+
44
+ This will create tags like `in_the_world_production`.
45
+
46
+ ### Skipping tagging
47
+
48
+ You may want to skip tagging in some instances - to do so, either set the Capistrano variable
49
+ `:skip_deploy_tagging` to `true`, or set the environment variable SKIP_DEPLOY_TAGGING to `'true'`:
50
+
51
+ # From the command line
52
+ SKIP_DEPLOY_TAGGING=true cap production deploy
53
+
54
+ # Inside your deploy.rb
55
+ set :skip_deploy_tagging, true
56
+
57
+ ## Contributing
58
+
59
+ 1. Fork it
60
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
61
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
62
+ 4. Push to the branch (`git push origin my-new-feature`)
63
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cap-deploy-tagger/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "cap-deploy-tagger"
8
+ spec.version = CapDeployTagger::VERSION
9
+ spec.authors = ["Andy Sykes"]
10
+ spec.email = ["github@tinycat.co.uk"]
11
+ spec.description = %q{Automatically tag Git commits when deploying with Capistrano}
12
+ spec.summary = %q{Automatically tag Git commits when deploying with Capistrano}
13
+ spec.homepage = "https://github.com/forward3d/cap-deploy-tagger"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,15 @@
1
+ namespace :deploy do
2
+
3
+ desc "Tag deployed release"
4
+ task :tag do
5
+ if ENV['SKIP_DEPLOY_TAGGING'] || fetch(:skip_deploy_tagging, false)
6
+ puts "Skipped deploy tagging"
7
+ else
8
+ tag = CapDeployTagger::Helper.tag(fetch(:deploy_tag, "deployed"), fetch(:stage))
9
+ puts "[cap-deploy-tagger] Tagged #{CapDeployTagger::Helper.latest_revision} with #{tag}"
10
+ end
11
+ end
12
+
13
+ after :cleanup, 'deploy:tag'
14
+
15
+ end
@@ -0,0 +1,3 @@
1
+ module CapDeployTagger
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,25 @@
1
+ # Ensure deploy tasks are loaded before we run
2
+ require 'capistrano/deploy'
3
+
4
+ # Load extra tasks into the deploy namespace
5
+ load File.expand_path("../cap-deploy-tagger/tasks/tagger.rake", __FILE__)
6
+
7
+ module CapDeployTagger
8
+ class Helper
9
+
10
+ def self.tag(tag, stage)
11
+ git "tag -f #{tag}_#{stage}"
12
+ git "push -f --tags"
13
+ "#{tag}_#{stage}"
14
+ end
15
+
16
+ def self.git(cmd)
17
+ `git #{cmd} 2>&1`.chomp
18
+ end
19
+
20
+ def self.latest_revision
21
+ git "rev-parse --short HEAD"
22
+ end
23
+
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cap-deploy-tagger
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Andy Sykes
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Automatically tag Git commits when deploying with Capistrano
42
+ email:
43
+ - github@tinycat.co.uk
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - cap-deploy-tagger.gemspec
54
+ - lib/cap-deploy-tagger.rb
55
+ - lib/cap-deploy-tagger/tasks/tagger.rake
56
+ - lib/cap-deploy-tagger/version.rb
57
+ homepage: https://github.com/forward3d/cap-deploy-tagger
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.1.10
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Automatically tag Git commits when deploying with Capistrano
81
+ test_files: []