capistrano-tampon 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +20 -0
- data/LICENSE.txt +20 -0
- data/README.md +34 -0
- data/README.rdoc +74 -0
- data/VERSION +1 -0
- data/able.rc +20 -0
- data/capistrano-tampon.gemspec +121 -0
- data/lib/capistrano/tampon/configuration.rb +39 -0
- data/lib/capistrano/tampon/hooks.rb +1 -0
- data/lib/capistrano/tampon/tasks.rb +1 -0
- data/lib/capistrano/tampon/utilities.rb +95 -0
- data/lib/capistrano/tampon/version.rb +23 -0
- data/lib/capistrano/tampon.rb +19 -0
- data/lib/capistrano/tasks/hooks.cap +2 -0
- data/lib/capistrano/tasks/tampon.cap +82 -0
- data/lib/capistrano-tampon.rb +0 -0
- metadata +160 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fd070faaf5c7698943512e2f1a2f84e4ab7e2ed6
|
4
|
+
data.tar.gz: 089e8eea0fc3deb0e258fd73be7b1757db4bf621
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c8e9d77633962dae50f6b77ee828fc5a74bfc7430a69f520e25812a052d8b4857fc4a012a33a916f23273c267edf989b42c33424433e493881a0a18a76ea086
|
7
|
+
data.tar.gz: c2123786c1797b9ce4e473b965b15c8cc66f794daef16affe3efcb4574330916f99f208208518d024479f4698009760fcc6168072ba753a49f4b7805bcc62189
|
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem 'capistrano'
|
4
|
+
gem 'stringex'
|
5
|
+
gem 'hashie'
|
6
|
+
gem 'versionomy'
|
7
|
+
gem 'rainbow', '1.99.1'
|
8
|
+
gem "ablerc", "~> 0.2.0"
|
9
|
+
|
10
|
+
group :development do
|
11
|
+
gem "shoulda", "~> 3.0.0.beta2"
|
12
|
+
gem 'active_support'
|
13
|
+
gem 'i18n'
|
14
|
+
gem 'minitest-rg'
|
15
|
+
gem "cucumber", ">= 0"
|
16
|
+
gem "bundler"
|
17
|
+
gem "jeweler", "~> 1.6.4"
|
18
|
+
end
|
19
|
+
|
20
|
+
gemspec
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Spencer Markowski
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# tampon
|
2
|
+
|
3
|
+
,-------------.
|
4
|
+
(o) _ __ _____ )--.
|
5
|
+
`-------------' )
|
6
|
+
( /
|
7
|
+
`---'
|
8
|
+
|
9
|
+
Tampon provides Gitflow integration with Capistrano, without unessecary restrictions to the deploy process. Our goal with tampon was to improve on capistrano-gitflow by allowing you to tag a staging release (or not tag a staging release),
|
10
|
+
deploy from the HEAD of whatever branch you are on (feature, develop, hotfix, etc), and deploy to production from bonafide gitflow release tags.
|
11
|
+
|
12
|
+
|
13
|
+
Works *only* with Capistrano 3+.
|
14
|
+
|
15
|
+
### Installation
|
16
|
+
|
17
|
+
Add this to `Gemfile`:
|
18
|
+
|
19
|
+
group :development do
|
20
|
+
gem 'capistrano', '~> 3.1'
|
21
|
+
gem 'capistrano-tampon', '~> 1.0'
|
22
|
+
end
|
23
|
+
|
24
|
+
And then:
|
25
|
+
|
26
|
+
$ bundle install
|
27
|
+
|
28
|
+
### Setup and usage
|
29
|
+
|
30
|
+
Add this line to `Capfile`, after `require 'capistrano/rails/assets'`
|
31
|
+
|
32
|
+
require 'capistrano/capistrano_tampon'
|
33
|
+
|
34
|
+
|
data/README.rdoc
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
= tampon
|
2
|
+
|
3
|
+
,-------------.
|
4
|
+
(o) _ __ _____ )--.
|
5
|
+
`-------------' )
|
6
|
+
( /
|
7
|
+
`---'
|
8
|
+
|
9
|
+
Tampon provides Gitflow integration with Capistrano, without unessecary restrictions to the deploy process. Our goal with tampon was to improve on capistrano-gitflow by allowing you to tag a staging release (or not tag a staging release),
|
10
|
+
deploy from the HEAD of whatever branch you are on (feature, develop, hotfix, etc), and deploy to production from bonafide gitflow release tags.
|
11
|
+
|
12
|
+
== Installation
|
13
|
+
|
14
|
+
You can use the most recent tampon gem by adding it to your Gemfile:
|
15
|
+
|
16
|
+
gem 'tampon'
|
17
|
+
|
18
|
+
Or install it the old-fashioned way:
|
19
|
+
|
20
|
+
gem install tampon
|
21
|
+
|
22
|
+
|
23
|
+
== Capistrano Setup
|
24
|
+
|
25
|
+
Add this to `Capfile`, after `require
|
26
|
+
|
27
|
+
require 'capistrano/ext/multistage'
|
28
|
+
require 'capistrano/tampon'
|
29
|
+
|
30
|
+
That's all you need. Tampon will set the :branch variable and allow you deploy from any tag, branch or release whenever you wish.
|
31
|
+
|
32
|
+
== Optional Setup
|
33
|
+
|
34
|
+
If you're using the gitflow binary https://github.com/nvie/gitflow , tampon provides a nice helper to initialize your project using our favorite defaults:
|
35
|
+
|
36
|
+
rake gitflow:prepare
|
37
|
+
|
38
|
+
This will attempt to create a develop branch if one doesn't exist locally or remotely, track it and add the following defaults:
|
39
|
+
|
40
|
+
gitflow.branch.master = master
|
41
|
+
gitflow.branch.develop = develop
|
42
|
+
gtiflow.prefix.versiontag = v
|
43
|
+
|
44
|
+
=== Deploy to staging
|
45
|
+
|
46
|
+
To deploy what you're currently working on to staging:
|
47
|
+
|
48
|
+
cap staging deploy
|
49
|
+
|
50
|
+
Tampon will ask if you'd like to tag the release. The tag will include the date, who is deploying and a message. You will then be able to specify that tag as what you'd like to deploy.
|
51
|
+
|
52
|
+
=== Deploy to production
|
53
|
+
|
54
|
+
After you've finished a release branch, tampon will show you all the available releases to deploy from:
|
55
|
+
|
56
|
+
cap production deploy
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
== Contributing to tampon
|
61
|
+
|
62
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
63
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
64
|
+
* Fork the project
|
65
|
+
* Start a feature/bugfix branch
|
66
|
+
* Commit and push until you are happy with your contribution
|
67
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
68
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
69
|
+
|
70
|
+
== Copyright
|
71
|
+
|
72
|
+
Copyright (c) 2011 Spencer Markowski (The Able Few, LLC). See LICENSE.txt for
|
73
|
+
further details.
|
74
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.0
|
data/able.rc
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Ablerc.setup do
|
2
|
+
|
3
|
+
rc_file_name ".tamponrc"
|
4
|
+
|
5
|
+
scheme :user, :local
|
6
|
+
|
7
|
+
option :prude, :boolean => true
|
8
|
+
|
9
|
+
option :gitflow_master, :default => "master"
|
10
|
+
option :gitflow_develop, :default => "develop"
|
11
|
+
option :gitflow_feature, :default => "feature"
|
12
|
+
option :gitflow_release, :default => "release"
|
13
|
+
option :gitflow_version_tag, :default => "'v'"
|
14
|
+
|
15
|
+
option :deploy_production, :default => "production"
|
16
|
+
option :deploy_staging, :default => "[:staging, :qa]"
|
17
|
+
option :previous_releases, :default => '3'
|
18
|
+
option :allow_untagged_deply, :boolean => true
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "capistrano-tampon"
|
5
|
+
s.version = "3.0.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new("> 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Spencer Markowski"]
|
9
|
+
s.date = "2013-02-01"
|
10
|
+
s.description = "An unrestictive way to deploy using gitflow and capistrano"
|
11
|
+
s.email = "spencer@theablefew.com"
|
12
|
+
s.extra_rdoc_files = [
|
13
|
+
"LICENSE.txt",
|
14
|
+
"README.rdoc"
|
15
|
+
]
|
16
|
+
s.files = [
|
17
|
+
"Gemfile",
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.md",
|
20
|
+
"VERSION",
|
21
|
+
"able.rc",
|
22
|
+
"lib/capistrano-tampon.rb",
|
23
|
+
"lib/capistrano/tampon.rb",
|
24
|
+
"lib/capistrano/tampon/configuration.rb",
|
25
|
+
"lib/capistrano/tampon/version.rb",
|
26
|
+
"lib/capistrano/tampon/utilities.rb",
|
27
|
+
"lib/capistrano/tampon/hooks.rb",
|
28
|
+
"lib/capistrano/tampon/tasks.rb",
|
29
|
+
"lib/capistrano/tasks/hooks.cap",
|
30
|
+
"lib/capistrano/tasks/tampon.cap",
|
31
|
+
"capistrano-tampon.gemspec"
|
32
|
+
]
|
33
|
+
s.homepage = "http://github.com/esmarkowski/tampon"
|
34
|
+
s.licenses = ["MIT"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = "1.8.24"
|
37
|
+
s.summary = "Gitflow enabled capistrano"
|
38
|
+
|
39
|
+
s.post_install_message = <<-POSTINSTALL
|
40
|
+
Initialize Gitflow
|
41
|
+
|
42
|
+
git flow init -df'
|
43
|
+
git config gitflow.branch.develop "develop"
|
44
|
+
git config gitflow.branch.master "master"
|
45
|
+
git config gitflow.prefix.versiontag "v"
|
46
|
+
git config gitflow.prefix.feature "feature/"
|
47
|
+
git config gitflow.prefix.release "release/"
|
48
|
+
git config gitflow.prefix.hotfix "hotfix/"
|
49
|
+
git config gitflow.prefix.support "support/"
|
50
|
+
|
51
|
+
|
52
|
+
Then place this in your Rails root directory as .tamponrc
|
53
|
+
|
54
|
+
prude = 0
|
55
|
+
|
56
|
+
## gitflow_master
|
57
|
+
# Default: master
|
58
|
+
#gitflow_master = master
|
59
|
+
|
60
|
+
## gitflow_develop
|
61
|
+
# Default: develop
|
62
|
+
#gitflow_develop = develop
|
63
|
+
|
64
|
+
## gitflow_feature
|
65
|
+
# Default: feature
|
66
|
+
#gitflow_feature = feature
|
67
|
+
|
68
|
+
## gitflow_release
|
69
|
+
# Default: release
|
70
|
+
#gitflow_release = release
|
71
|
+
|
72
|
+
## gitflow_version_tag
|
73
|
+
# Default: v
|
74
|
+
#gitflow_version_tag = v
|
75
|
+
|
76
|
+
## deploy_production
|
77
|
+
# Default: production
|
78
|
+
#deploy_production = production
|
79
|
+
|
80
|
+
## deploy_staging
|
81
|
+
# Default: [:staging, :qa]
|
82
|
+
#deploy_staging = [:staging, :qa]
|
83
|
+
|
84
|
+
## previous_releases
|
85
|
+
# Default: 3
|
86
|
+
previous_releases = '8'
|
87
|
+
|
88
|
+
## allow_untagged_deply
|
89
|
+
allow_untagged_deply = true
|
90
|
+
|
91
|
+
POSTINSTALL
|
92
|
+
|
93
|
+
if s.respond_to? :specification_version then
|
94
|
+
s.specification_version = 3
|
95
|
+
|
96
|
+
if Gem::Version.new(Gem::VERSION) > Gem::Version.new('1.2.0') then
|
97
|
+
s.add_runtime_dependency(%q<capistrano>, [ "~> 3.0"])
|
98
|
+
s.add_runtime_dependency(%q<stringex>, [ "~> 1.3"])
|
99
|
+
s.add_runtime_dependency(%q<hashie>, [ "~> 1.2"])
|
100
|
+
s.add_runtime_dependency(%q<versionomy>, [ "~> 0.4.4"])
|
101
|
+
s.add_runtime_dependency(%q<rainbow>, [ "~> 1.1"])
|
102
|
+
s.add_runtime_dependency(%q<ablerc>, ["~> 0.2.0"])
|
103
|
+
|
104
|
+
else
|
105
|
+
s.add_dependency(%q<capistrano>, ["~> 3.0"])
|
106
|
+
s.add_dependency(%q<stringex>, ["~> 1.3"])
|
107
|
+
s.add_dependency(%q<hashie>, ["~> 1.2"])
|
108
|
+
s.add_dependency(%q<versionomy>, ["~> 0.4.4"])
|
109
|
+
s.add_dependency(%q<rainbow>, ["~> 1.1"])
|
110
|
+
s.add_dependency(%q<ablerc>, ["~> 0.2.0"])
|
111
|
+
end
|
112
|
+
else
|
113
|
+
s.add_dependency(%q<capistrano>, ["~> 3.0"])
|
114
|
+
s.add_dependency(%q<stringex>, ["~> 1.3"])
|
115
|
+
s.add_dependency(%q<hashie>, ["~> 1.2"])
|
116
|
+
s.add_dependency(%q<versionomy>, ["~> 0.4.4"])
|
117
|
+
s.add_dependency(%q<rainbow>, ["~> 1.1"])
|
118
|
+
s.add_dependency(%q<ablerc>, ["~> 0.2.0"])
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'ablerc'
|
3
|
+
|
4
|
+
module Capistrano
|
5
|
+
module Tampon
|
6
|
+
module Configuration
|
7
|
+
|
8
|
+
extend self
|
9
|
+
|
10
|
+
CONFIG_FILE_NAME = '.tamponrc'
|
11
|
+
GLOBAL_CONFIG_FILE = "#{Dir.home}/#{CONFIG_FILE_NAME}"
|
12
|
+
PROJECT_CONFIG_FILE = "#{Dir.pwd}/#{CONFIG_FILE_NAME}"
|
13
|
+
|
14
|
+
attr_reader :_config
|
15
|
+
@_ablerc
|
16
|
+
|
17
|
+
def ablerc
|
18
|
+
Ablerc
|
19
|
+
end
|
20
|
+
|
21
|
+
def load!(filename, options={})
|
22
|
+
@_ablerc ||= Ablerc.load! Tampon.root
|
23
|
+
end
|
24
|
+
|
25
|
+
def method_missing(name, *args, &block)
|
26
|
+
Ablerc.config.send(name.to_sym) || fail(NoMethodError, "unknown configuration root #{name}", caller)
|
27
|
+
end
|
28
|
+
|
29
|
+
def user_settings?
|
30
|
+
File.exists? GLOBAL_CONFIG_FILE
|
31
|
+
end
|
32
|
+
|
33
|
+
def project_settings?
|
34
|
+
File.exists? PROJECT_CONFIG_FILE
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../../tasks/hooks.cap', __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../../tasks/tampon.cap', __FILE__)
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'versionomy'
|
2
|
+
require 'stringex'
|
3
|
+
require 'rainbow'
|
4
|
+
require 'rainbow/ext/string'
|
5
|
+
|
6
|
+
module Capistrano
|
7
|
+
module Tampon
|
8
|
+
module Utilities
|
9
|
+
|
10
|
+
def who
|
11
|
+
identity = (`git config user.name` || `whoami`)
|
12
|
+
identity.chomp.to_url
|
13
|
+
end
|
14
|
+
|
15
|
+
def tags
|
16
|
+
`git tag`.split("\n").compact
|
17
|
+
end
|
18
|
+
|
19
|
+
def non_release_tags
|
20
|
+
tags - releases
|
21
|
+
end
|
22
|
+
|
23
|
+
def current_branch
|
24
|
+
branches.select{|b| b =~ /^\*\s/}.first.gsub(/^\*\s/,"")
|
25
|
+
end
|
26
|
+
|
27
|
+
def branches
|
28
|
+
`git branch --no-color`.split("\n")
|
29
|
+
end
|
30
|
+
|
31
|
+
def version_tag_prefix
|
32
|
+
`git config gitflow.prefix.versiontag`.split("\n").first
|
33
|
+
end
|
34
|
+
|
35
|
+
def releases
|
36
|
+
tags.select{|t| t =~ /^#{version_tag_prefix}(\d+)/}.collect{|version| Versionomy.parse(version) }.sort
|
37
|
+
end
|
38
|
+
|
39
|
+
def latest_release
|
40
|
+
releases.reverse.first.to_s
|
41
|
+
end
|
42
|
+
|
43
|
+
def available_tags
|
44
|
+
puts "Available Tags:".color :green
|
45
|
+
puts "#{releases.sort.reverse.take(Capistrano::Tampon::Configuration.previous_releases.to_i).join("\n")}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def available_releases
|
49
|
+
puts "\nAvailable Releases:".color :green
|
50
|
+
puts "#{releases.reverse.take(Capistrano::Tampon::Configuration.previous_releases.to_i).join("\n")}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def banner
|
54
|
+
|
55
|
+
<<-BANNER
|
56
|
+
\nTampon for Gitflow
|
57
|
+
,-------------.
|
58
|
+
(o) _ __ _____ )--.
|
59
|
+
`-------------' )
|
60
|
+
( /
|
61
|
+
`---'
|
62
|
+
BANNER
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
def deploy_from
|
68
|
+
puts banner unless Capistrano::Tampon::Configuration.prude.to_i == 1
|
69
|
+
if stage == :production
|
70
|
+
available_releases
|
71
|
+
from_destination = ask("\nRelease to deploy:".color(:yellow).bright, lastest_release)
|
72
|
+
else
|
73
|
+
create_tag = ask("Do you want to tag deployment? [y/N]".color(:yellow), 'N')
|
74
|
+
return next_tag if create_tag
|
75
|
+
available_tags
|
76
|
+
from_destination = ask "\nBranch, tag or release to deploy:".color(:yellow).bright, current_branch
|
77
|
+
end
|
78
|
+
return from_destination
|
79
|
+
end
|
80
|
+
|
81
|
+
def next_tag
|
82
|
+
hwhen = Date.today.to_s
|
83
|
+
what = ask("What does this release introduce? (this will be normalized and used in the tag for this release)".color(:yellow)).to_url
|
84
|
+
new_staging_tag = "#{hwhen}-#{who}-#{what}"
|
85
|
+
puts "Tagging current branch for deployment to staging as '#{new_staging_tag}'".color(:green)
|
86
|
+
system "git tag -a -m 'tagging current code for deployment to staging' #{new_staging_tag}"
|
87
|
+
return new_staging_tag
|
88
|
+
end
|
89
|
+
|
90
|
+
def using_git?
|
91
|
+
fetch(:scm, :git).to_sym == :git
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Tampon
|
2
|
+
module Version
|
3
|
+
|
4
|
+
extend self
|
5
|
+
|
6
|
+
attr_accessor :base_dir
|
7
|
+
|
8
|
+
def write_version( version )
|
9
|
+
File.open(File.join(Tampon::Version.base_dir, 'VERSION'), 'w') do |file|
|
10
|
+
file.write version.to_s
|
11
|
+
end
|
12
|
+
version
|
13
|
+
end
|
14
|
+
|
15
|
+
def load_version
|
16
|
+
Versionomy.parse File.read(File.join(Tampon::Version.base_dir, 'VERSION')).chomp
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_s
|
20
|
+
load_version.to_s
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative 'tampon/configuration'
|
2
|
+
require_relative 'tampon/version'
|
3
|
+
require_relative 'tampon/utilities'
|
4
|
+
require_relative 'tampon/tasks'
|
5
|
+
require_relative 'tampon/hooks'
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
module Capistrano
|
10
|
+
module Tampon
|
11
|
+
|
12
|
+
def self.root
|
13
|
+
File.expand_path '../../..', __FILE__
|
14
|
+
end
|
15
|
+
|
16
|
+
Capistrano::Tampon::Configuration.load! Capistrano::Tampon::Configuration::PROJECT_CONFIG_FILE if Capistrano::Tampon::Configuration.project_settings?
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
namespace :tampon do
|
2
|
+
|
3
|
+
include Capistrano::Tampon::Utilities
|
4
|
+
|
5
|
+
|
6
|
+
task :verify_up_to_date do
|
7
|
+
if using_git?
|
8
|
+
set :local_branch, `git branch --no-color 2> /dev/null | sed -e '/^[^*]/d'`.gsub(/\* /, '').chomp
|
9
|
+
set :local_sha, `git log --pretty=format:%H HEAD -1`.chomp
|
10
|
+
set :origin_sha, `git log --pretty=format:%H #{fetch(:local_branch)} -1`
|
11
|
+
unless fetch(:local_sha) == fetch(:origin_sha)
|
12
|
+
abort """
|
13
|
+
Your #{fetch(:local_branch)} branch is not up to date with origin/#{fetch(:local_branch)}.
|
14
|
+
Please make sure you have pulled and pushed all code before deploying:
|
15
|
+
|
16
|
+
git pull origin #{fetch(:local_branch)}
|
17
|
+
# run tests, etc
|
18
|
+
git push origin #{fetch(:local_branch)}
|
19
|
+
|
20
|
+
"""
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
task :calculate_tag do
|
26
|
+
if using_git?
|
27
|
+
# make sure we have any other deployment tags that have been pushed by others so our auto-increment code doesn't create conflicting tags
|
28
|
+
`git fetch`
|
29
|
+
if fetch(:stage) == :production
|
30
|
+
invoke 'tampon:tag_production'
|
31
|
+
else
|
32
|
+
invoke 'tampon:tag_staging'
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
system "git push --tags origin #{fetch(:local_branch)}"
|
37
|
+
if $? != 0
|
38
|
+
abort "git push failed"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
task :configuration do
|
45
|
+
puts "Gitflow"
|
46
|
+
Tampon::Configuration.ablerc.stub.generate :local
|
47
|
+
exit
|
48
|
+
end
|
49
|
+
|
50
|
+
task :tag_staging do
|
51
|
+
staging_destination = :deploy_from
|
52
|
+
|
53
|
+
set :branch, staging_destination
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "Show available releases"
|
57
|
+
task :releases do
|
58
|
+
available_releases
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
desc "Push the approved tag to production. Pass in tag to deploy with '-s tag=staging-YYYY-MM-DD-X-feature'."
|
63
|
+
task :tag_production do
|
64
|
+
|
65
|
+
production_destination = deploy_from
|
66
|
+
|
67
|
+
really_deploy = Capistrano::CLI.ui.ask("Do you really want to deploy #{production_destination}? [y/N]").to_url
|
68
|
+
|
69
|
+
exit(1) unless really_deploy =~ /^[Yy]$/
|
70
|
+
|
71
|
+
set :branch, production_destination
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
namespace :deploy do
|
76
|
+
namespace :pending do
|
77
|
+
task :compare do
|
78
|
+
#gitflow.commit_log
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-tampon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Spencer Markowski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-02-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capistrano
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: stringex
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: versionomy
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.4.4
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.4.4
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rainbow
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: ablerc
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.2.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.2.0
|
97
|
+
description: An unrestictive way to deploy using gitflow and capistrano
|
98
|
+
email: spencer@theablefew.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files:
|
102
|
+
- LICENSE.txt
|
103
|
+
- README.rdoc
|
104
|
+
files:
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE.txt
|
107
|
+
- README.md
|
108
|
+
- README.rdoc
|
109
|
+
- VERSION
|
110
|
+
- able.rc
|
111
|
+
- capistrano-tampon.gemspec
|
112
|
+
- lib/capistrano-tampon.rb
|
113
|
+
- lib/capistrano/tampon.rb
|
114
|
+
- lib/capistrano/tampon/configuration.rb
|
115
|
+
- lib/capistrano/tampon/hooks.rb
|
116
|
+
- lib/capistrano/tampon/tasks.rb
|
117
|
+
- lib/capistrano/tampon/utilities.rb
|
118
|
+
- lib/capistrano/tampon/version.rb
|
119
|
+
- lib/capistrano/tasks/hooks.cap
|
120
|
+
- lib/capistrano/tasks/tampon.cap
|
121
|
+
homepage: http://github.com/esmarkowski/tampon
|
122
|
+
licenses:
|
123
|
+
- MIT
|
124
|
+
metadata: {}
|
125
|
+
post_install_message: " Initialize Gitflow\n\n git flow init -df'\n git config
|
126
|
+
gitflow.branch.develop \"develop\"\n git config gitflow.branch.master \"master\"\n
|
127
|
+
\ git config gitflow.prefix.versiontag \"v\"\n git config gitflow.prefix.feature
|
128
|
+
\"feature/\"\n git config gitflow.prefix.release \"release/\"\n git config
|
129
|
+
gitflow.prefix.hotfix \"hotfix/\"\n git config gitflow.prefix.support \"support/\"\n\n\n
|
130
|
+
\ Then place this in your Rails root directory as .tamponrc\n\n prude = 0 \n\n
|
131
|
+
\ ## gitflow_master\n # Default: master\n #gitflow_master = master\n\n ##
|
132
|
+
gitflow_develop\n # Default: develop\n #gitflow_develop = develop\n\n ##
|
133
|
+
gitflow_feature\n # Default: feature\n #gitflow_feature = feature\n\n ##
|
134
|
+
gitflow_release\n # Default: release\n #gitflow_release = release\n\n ##
|
135
|
+
gitflow_version_tag\n # Default: v\n #gitflow_version_tag = v\n\n ## deploy_production\n
|
136
|
+
\ # Default: production\n #deploy_production = production\n\n ## deploy_staging\n
|
137
|
+
\ # Default: [:staging, :qa]\n #deploy_staging = [:staging, :qa]\n\n ##
|
138
|
+
previous_releases\n # Default: 3\n previous_releases = '8' \n\n ## allow_untagged_deply\n
|
139
|
+
\ allow_untagged_deply = true\n\n"
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
requirements: []
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 2.4.8
|
156
|
+
signing_key:
|
157
|
+
specification_version: 3
|
158
|
+
summary: Gitflow enabled capistrano
|
159
|
+
test_files: []
|
160
|
+
has_rdoc:
|