capistrano-commons 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +34 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +4 -0
- data/capistrano-commons.gemspec +25 -0
- data/lib/capistrano/commons/recipes/branch.rb +5 -0
- data/lib/capistrano/commons/recipes/locks.rb +45 -0
- data/lib/capistrano/commons/recipes/tags.rb +45 -0
- data/lib/capistrano/commons/recipes/tmux.rb +17 -0
- data/lib/capistrano/commons/version.rb +5 -0
- data/lib/capistrano/commons.rb +7 -0
- data/lib/capistrano-commons.rb +1 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZjZjZjI3MzJiODY3ODVjMTE0OGM0OTU2YTRkYTVhM2Q4ODA4NjE5NA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NWJhYjFkYTAzYjZmYjE2ZGEyYzQzZmJmMTFmMmNlNTA2NGQ3NTgzZg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MjhhYWY4ZDFmZTJhODNlNjIwNGFkMzBjODNhZjRjN2UyZjQ2ZjFlM2E4NDg5
|
10
|
+
ODhkNjBlYmNkNWMyMzk3NWZlYWIzODZkNDA0NzFmNmQxYTMyZjljNDI1YWYx
|
11
|
+
NGNlYTQ1YmI0N2E3NTE1YzdmY2Y4MjRkOGVmZWIxMzQ4YjUxMTk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MTAzMDk1MjVmNjE4Y2UxY2Y4YjI3NzE4YTVmNWMyYWM3ZDQ4ZmI2YmNlN2Jl
|
14
|
+
MTRiMDA4ZmFmMTBmZjMzNGQ2NWRmMjc1MTkwNmNlNWVhOWVmOWZjYTBkMWJj
|
15
|
+
YTg1NGY5YjI2MTdhNjZmM2EzN2I3N2NjN2QzYzJjMjJhODViMWU=
|
data/.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
Gemfile.lock
|
30
|
+
.ruby-version
|
31
|
+
.ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Anthony Powles
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.unshift File.expand_path("../lib", __FILE__)
|
3
|
+
require 'capistrano/commons/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "capistrano-commons"
|
7
|
+
s.version = Capistrano::Commons::VERSION
|
8
|
+
s.authors = ["Anthony Powles"]
|
9
|
+
s.email = ["rubygems+capistrano-commons@idreamz.net"]
|
10
|
+
s.homepage = "https://github.com/yogin/capistrano-commons"
|
11
|
+
s.summary = %q{Capistrano Common Recipes}
|
12
|
+
s.description = %q{A collection of useful Capistrano recipes}
|
13
|
+
s.license = "MIT"
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split($/)
|
16
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
s.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
s.add_development_dependency "rake"
|
22
|
+
s.add_development_dependency "pry"
|
23
|
+
|
24
|
+
s.add_dependency "capistrano", ">= 2.14.2"
|
25
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
|
3
|
+
namespace :deploy do
|
4
|
+
|
5
|
+
desc "Lock deploys to prevent simultaneous deploys to the same stage"
|
6
|
+
task :lock, :roles => :app do
|
7
|
+
check_lock
|
8
|
+
|
9
|
+
now = Time.now.strftime("%c %Z")
|
10
|
+
message = ENV['MESSAGE'] || ENV['MSG'] || fetch(:lock_message, "Deploying application")
|
11
|
+
lock_message = "Deploy locked on #{stage} since #{now}: #{message}"
|
12
|
+
|
13
|
+
put lock_message, "#{shared_path}/deploy.lock", :mode => 0644
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Check for existing locks"
|
17
|
+
task :check_lock, :roles => :app do
|
18
|
+
# This also works when the lock file is missing :)
|
19
|
+
data = capture("cat #{shared_path}/deploy.lock 2>/dev/null ; echo").to_s.strip
|
20
|
+
|
21
|
+
if data.empty?
|
22
|
+
logger.info "No locks found for #{stage}"
|
23
|
+
else
|
24
|
+
logger.important "#{data}"
|
25
|
+
|
26
|
+
if ENV['FORCE_DEPLOY']
|
27
|
+
logger.important "You have forced the deploy lock on #{stage}!"
|
28
|
+
else
|
29
|
+
abort
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Remove deploy locks from a stage"
|
35
|
+
task :unlock, :roles => :app do
|
36
|
+
logger.info "Unlocking deploys on #{stage}!"
|
37
|
+
run "rm -f #{shared_path}/deploy.lock"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
before 'deploy', 'deploy:lock'
|
43
|
+
after 'deploy', 'deploy:unlock'
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
|
3
|
+
namespace :deploy do
|
4
|
+
|
5
|
+
desc "Tag the release"
|
6
|
+
task :tag_release do
|
7
|
+
if exists?(:tag_releases) && tag_releases
|
8
|
+
set :latest_git_tag, "#{tag_base}.#{deploys_today + 1}"
|
9
|
+
message = Shellwords.shellescape(deploy_message)
|
10
|
+
|
11
|
+
run_locally "git tag -a #{latest_git_tag} -m #{message} #{head_revision} && git push origin #{latest_git_tag}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
set(:tag_base) { "#{stage}.#{Time.now.utc.to_date}" }
|
18
|
+
set(:deploys_today) { run_locally("git tag -l '#{tag_base}*'").split.length }
|
19
|
+
set(:head_revision) { run_locally("git rev-parse HEAD").strip }
|
20
|
+
|
21
|
+
set(:release_authors) do
|
22
|
+
authors = run_locally "git log --pretty='%an' --no-merges #{current_revision}...#{head_revision}"
|
23
|
+
author_counts = authors.split("\n").counts
|
24
|
+
|
25
|
+
if author_counts.empty?
|
26
|
+
"\tNo commits since the last deploy!?"
|
27
|
+
else
|
28
|
+
author_counts.to_a.map(&:reverse).sort.reverse.map { |count, author| "\t#{author}: #{count} commits" }.join("\n")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
set(:deploy_message) do
|
33
|
+
message = []
|
34
|
+
message << "Deploying branch #{branch} to ##{stage}!"
|
35
|
+
message << ""
|
36
|
+
message << "Release contributors:"
|
37
|
+
message << release_authors
|
38
|
+
message << ""
|
39
|
+
message << "Permalink: #{github_compare_link(current_revision, head_revision)}"
|
40
|
+
message.join("\n")
|
41
|
+
end
|
42
|
+
|
43
|
+
before 'deploy:update', 'deploy:tag_release'
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
|
3
|
+
namespace :deploy do
|
4
|
+
|
5
|
+
desc "Check if we are running inside a tmux or screen session"
|
6
|
+
task :check_for_tmux do
|
7
|
+
if exists?(:tmux_required) && tmux_required && !(ENV['TMUX'] || ENV['STY'])
|
8
|
+
logger.important "You need to be in a tmux or screen session to deploy to #{stage}!"
|
9
|
+
abort
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
on :start, 'deploy:check_for_tmux'
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'capistrano/commons'
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-commons
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Anthony Powles
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-12 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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: capistrano
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.14.2
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.14.2
|
69
|
+
description: A collection of useful Capistrano recipes
|
70
|
+
email:
|
71
|
+
- rubygems+capistrano-commons@idreamz.net
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE
|
79
|
+
- README.md
|
80
|
+
- capistrano-commons.gemspec
|
81
|
+
- lib/capistrano-commons.rb
|
82
|
+
- lib/capistrano/commons.rb
|
83
|
+
- lib/capistrano/commons/recipes/branch.rb
|
84
|
+
- lib/capistrano/commons/recipes/locks.rb
|
85
|
+
- lib/capistrano/commons/recipes/tags.rb
|
86
|
+
- lib/capistrano/commons/recipes/tmux.rb
|
87
|
+
- lib/capistrano/commons/version.rb
|
88
|
+
homepage: https://github.com/yogin/capistrano-commons
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.2.2
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Capistrano Common Recipes
|
112
|
+
test_files: []
|