capistrano-deploytags 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -1
- data/lib/capistrano/deploy_tags.rb +12 -10
- metadata +6 -6
data/README.md
CHANGED
@@ -46,10 +46,23 @@ clean checkout anyway, so in most cases this is not a restriction
|
|
46
46
|
on how you already do things. The plugin will check if your code
|
47
47
|
is clean and complain if it is not.
|
48
48
|
|
49
|
+
Helpful Git Config
|
50
|
+
------------------
|
51
|
+
You might find it useful to add this to your ~/.gitconfig in order
|
52
|
+
to get a nice history view of the commits and tags.
|
53
|
+
|
54
|
+
```
|
55
|
+
[alias]
|
56
|
+
lol = log --pretty=oneline --abbrev-commit --graph --decorate
|
57
|
+
```
|
58
|
+
|
59
|
+
You can then view the list by typing `git lol` from the checked out
|
60
|
+
code path.
|
61
|
+
|
49
62
|
Credits
|
50
63
|
-------
|
51
64
|
This software was written by [Karl Matthias](https://github.com/relistan)
|
52
|
-
with help from [Gavin Heavyside](https://github.com/
|
65
|
+
with help from [Gavin Heavyside](https://github.com/gavinheavyside) and the
|
53
66
|
support of [MyDrive Solutions Limited](http://mydrivesolutions.com).
|
54
67
|
|
55
68
|
License
|
@@ -4,19 +4,19 @@ module Capistrano
|
|
4
4
|
# Do we have any changes vs HEAD on deployment branch?
|
5
5
|
!(`git fetch && git diff #{branch} --shortstat`.strip.empty?)
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def git_tag_for(stage)
|
9
9
|
"#{stage}-#{Time.now.strftime("%Y.%m.%d-%H%M%S")}"
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def safe_run(*args)
|
13
13
|
raise "#{args.join(" ")} failed!" unless system(*args)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def validate_git_vars
|
17
17
|
unless exists?(:branch) && exists?(:stage)
|
18
18
|
logger.log Capistrano::Logger::IMPORTANT, "Capistrano Deploytags requires that :branch and :stage be defined."
|
19
|
-
raise 'define :branch
|
19
|
+
raise 'define :branch and :stage'
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -30,8 +30,10 @@ module Capistrano
|
|
30
30
|
|
31
31
|
def self.load_into(configuration)
|
32
32
|
configuration.load do
|
33
|
-
before
|
34
|
-
|
33
|
+
before "deploy", 'git:prepare_tree'
|
34
|
+
before "deploy:migrations", 'git:prepare_tree'
|
35
|
+
after "deploy", 'git:tagdeploy'
|
36
|
+
after "deploy:migrations", 'git:tagdeploy'
|
35
37
|
|
36
38
|
desc 'prepare git tree so we can tag on successful deployment'
|
37
39
|
namespace :git do
|
@@ -39,7 +41,7 @@ module Capistrano
|
|
39
41
|
cdt.validate_git_vars
|
40
42
|
|
41
43
|
logger.log Capistrano::Logger::IMPORTANT, "Preparing to deploy HEAD from branch '#{branch}' to '#{stage}'"
|
42
|
-
|
44
|
+
|
43
45
|
if cdt.pending_git_changes?
|
44
46
|
logger.log Capistrano::Logger::IMPORTANT, "Whoa there, partner. Dirty trees can't deploy. Git yerself clean first."
|
45
47
|
raise 'Dirty git tree'
|
@@ -48,17 +50,17 @@ module Capistrano
|
|
48
50
|
cdt.safe_run "git", "checkout", branch
|
49
51
|
cdt.safe_run "git", "pull", "origin", branch if cdt.has_remote?
|
50
52
|
end
|
51
|
-
|
53
|
+
|
52
54
|
desc 'add git tags for each successful deployment'
|
53
55
|
task :tagdeploy, :except => { :no_release => true } do
|
54
56
|
cdt.validate_git_vars
|
55
57
|
|
56
58
|
current_sha = `git rev-parse #{branch} HEAD`.strip[0..8]
|
57
59
|
logger.log Capistrano::Logger::INFO, "Tagging #{current_sha} for deployment"
|
58
|
-
|
60
|
+
|
59
61
|
tag_user = (ENV['USER'] || ENV['USERNAME']).strip
|
60
62
|
cdt.safe_run "git", "tag", "-a", cdt.git_tag_for(stage), "-m", "#{tag_user} deployed #{current_sha} to #{stage}"
|
61
|
-
|
63
|
+
|
62
64
|
cdt.safe_run "git", "push", "--tags" if cdt.has_remote?
|
63
65
|
end
|
64
66
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-deploytags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153587100 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153587100
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: capistrano-ext
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153586660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153586660
|
36
36
|
description: ! ' Capistrano Deploytags is a simple plugin to Capistrano that works
|
37
37
|
with your deployment framework to track your code releases. All you have to do is
|
38
38
|
require capistrano-deploytags and each deployment will add a new tag for that deployment,
|