rakecap 0.0.1 → 0.0.2
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.
- data/lib/rakecap/cap/git.rb +1 -7
- data/lib/rakecap/rake/git.rb +23 -0
- data/lib/rakecap/version.rb +1 -1
- metadata +4 -3
data/lib/rakecap/cap/git.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
Capistrano::Configuration.instance.load do
|
2
2
|
namespace :git do
|
3
3
|
|
4
|
+
desc "apply git tag based on currently deployed stage and a timestamp. Clears out old tags"
|
4
5
|
task :tag, :except => { :no_release => true } do
|
5
6
|
new_tag = "#{stage}_#{Time.now.strftime("%Y%m%d%H%M%S")}"
|
6
7
|
cmd = [
|
@@ -13,12 +14,5 @@ Capistrano::Configuration.instance.load do
|
|
13
14
|
`#{cmd}`
|
14
15
|
end
|
15
16
|
|
16
|
-
task :change_log do
|
17
|
-
last_commit_tag = `git tag -l '#{stage}*'`.split("\n").last
|
18
|
-
cmd = "git log --format=oneline --abbrev-commit #{last_commit_tag}..#{branch}"
|
19
|
-
commit_log = `#{cmd}`
|
20
|
-
Notifier.deliver_deploy_notification("Deployed #{branch} to #{stage}: commit log", commit_log)
|
21
|
-
end
|
22
|
-
|
23
17
|
end
|
24
18
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
def flush_tags(pattern, tags_to_keep = 5)
|
2
|
+
tags = `git tag -l #{pattern}`.split "\n"
|
3
|
+
to_delete = tags[0..-(tags_to_keep+1)]
|
4
|
+
`git tag -d #{to_delete.join(' ')}`
|
5
|
+
remote_tags_to_delete = to_delete.collect do |tag|
|
6
|
+
":refs/tags/#{tag}"
|
7
|
+
end.join(" ")
|
8
|
+
`git push origin #{remote_tags_to_delete}`
|
9
|
+
puts "#{pattern}: Deleted #{to_delete.count} tags, kept #{tags_to_keep} tags"
|
10
|
+
end
|
11
|
+
|
12
|
+
namespace :git do
|
13
|
+
|
14
|
+
namespace :tags do
|
15
|
+
task :flush do
|
16
|
+
flush_tags('sandbox*', 5)
|
17
|
+
flush_tags('staging*', 5)
|
18
|
+
flush_tags('production*', 10)
|
19
|
+
flush_tags('demo*', 0)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/lib/rakecap/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rakecap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sharad Jain
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- Rakefile
|
34
34
|
- lib/rakecap.rb
|
35
35
|
- lib/rakecap/cap/git.rb
|
36
|
+
- lib/rakecap/rake/git.rb
|
36
37
|
- lib/rakecap/version.rb
|
37
38
|
- rakecap.gemspec
|
38
39
|
homepage: ""
|