capistrano-shared-helpers 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +25 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +52 -0
- data/Rakefile +38 -0
- data/VERSION +1 -0
- data/capistrano-shared-helpers.gemspec +63 -0
- data/lib/capistrano-shared-helpers.rb +2 -0
- data/lib/capistrano-shared-helpers/ext/remote_dependency.rb +12 -0
- data/lib/capistrano-shared-helpers/privates.rb +50 -0
- data/lib/capistrano-shared-helpers/shared.rb +51 -0
- metadata +142 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "shoulda", ">= 0"
|
10
|
+
gem "rdoc", "~> 3.12"
|
11
|
+
gem "bundler", "~> 1.0.0"
|
12
|
+
gem "jeweler", "~> 1.8.3"
|
13
|
+
gem "rcov", ">= 0"
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
jeweler (1.8.3)
|
6
|
+
bundler (~> 1.0)
|
7
|
+
git (>= 1.2.5)
|
8
|
+
rake
|
9
|
+
rdoc
|
10
|
+
json (1.7.3)
|
11
|
+
rake (0.9.2.2)
|
12
|
+
rcov (0.9.10)
|
13
|
+
rdoc (3.12)
|
14
|
+
json (~> 1.4)
|
15
|
+
shoulda (2.11.3)
|
16
|
+
|
17
|
+
PLATFORMS
|
18
|
+
ruby
|
19
|
+
|
20
|
+
DEPENDENCIES
|
21
|
+
bundler (~> 1.0.0)
|
22
|
+
jeweler (~> 1.8.3)
|
23
|
+
rcov
|
24
|
+
rdoc (~> 3.12)
|
25
|
+
shoulda
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Huiming Teo
|
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.rdoc
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
= capistrano-shared-helpers
|
2
|
+
Provides a set of helper tasks related to the shared directory.
|
3
|
+
|
4
|
+
== Install
|
5
|
+
gem install 'capistrano-shared-helpers'
|
6
|
+
|
7
|
+
For bundler, add it into your Gemfile
|
8
|
+
|
9
|
+
gem 'capistrano-shared-helpers'
|
10
|
+
|
11
|
+
== Usage
|
12
|
+
You can include all helpers in config/deploy.rb:
|
13
|
+
|
14
|
+
require 'capistrnao-shared-helpers' # includes all helper tasks
|
15
|
+
|
16
|
+
Or only include a specific helper:
|
17
|
+
|
18
|
+
require 'capistrano-ssh-helpers/privates'
|
19
|
+
|
20
|
+
== Helpers
|
21
|
+
|
22
|
+
=== shared
|
23
|
+
|
24
|
+
* Add checks to deploy:check to ensure file paths defined in :shared var exist on remote server.
|
25
|
+
* Create parent dirs for file paths defined in :shared, after deploy:setup.
|
26
|
+
* Provide a rake task to upload files/dirs defined in :shared. To use it, call:
|
27
|
+
|
28
|
+
cap deploy:shared:upload
|
29
|
+
|
30
|
+
=== privates
|
31
|
+
|
32
|
+
* Add checks to deploy:check to ensure file paths defined in :privates var exist on remote server.
|
33
|
+
* Create parent dirs for file paths defined in :privates, after deploy:setup.
|
34
|
+
* Provide a rake task to upload files/dirs defined in :privates to the private shared path. To use it, call:
|
35
|
+
|
36
|
+
cap deploy:privates:upload
|
37
|
+
|
38
|
+
== Contributing to capistrano-shared-helpers
|
39
|
+
|
40
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
41
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
42
|
+
* Fork the project.
|
43
|
+
* Start a feature/bugfix branch.
|
44
|
+
* Commit and push until you are happy with your contribution.
|
45
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
46
|
+
* 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.
|
47
|
+
|
48
|
+
== Copyright
|
49
|
+
|
50
|
+
Copyright (c) 2012 Huiming Teo. See LICENSE.txt for
|
51
|
+
further details.
|
52
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "capistrano-shared-helpers"
|
18
|
+
gem.homepage = "http://github.com/teohm/capistrano-shared-helpers"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Capistrano helper tasks related to shared directory.}
|
21
|
+
gem.description = %Q{Capistrano helper tasks related to shared directory.}
|
22
|
+
gem.email = "teohuiming@gmail.com"
|
23
|
+
gem.authors = ["Huiming Teo"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
task :default => :test
|
29
|
+
|
30
|
+
require 'rdoc/task'
|
31
|
+
Rake::RDocTask.new do |rdoc|
|
32
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
33
|
+
|
34
|
+
rdoc.rdoc_dir = 'rdoc'
|
35
|
+
rdoc.title = "capistrano-shared-helpers #{version}"
|
36
|
+
rdoc.rdoc_files.include('README*')
|
37
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
38
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "capistrano-shared-helpers"
|
8
|
+
s.version = "1.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Huiming Teo"]
|
12
|
+
s.date = "2012-06-05"
|
13
|
+
s.description = "Capistrano helper tasks related to shared directory."
|
14
|
+
s.email = "teohuiming@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"capistrano-shared-helpers.gemspec",
|
28
|
+
"lib/capistrano-shared-helpers.rb",
|
29
|
+
"lib/capistrano-shared-helpers/ext/remote_dependency.rb",
|
30
|
+
"lib/capistrano-shared-helpers/privates.rb",
|
31
|
+
"lib/capistrano-shared-helpers/shared.rb"
|
32
|
+
]
|
33
|
+
s.homepage = "http://github.com/teohm/capistrano-shared-helpers"
|
34
|
+
s.licenses = ["MIT"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = "1.8.24"
|
37
|
+
s.summary = "Capistrano helper tasks related to shared directory."
|
38
|
+
|
39
|
+
if s.respond_to? :specification_version then
|
40
|
+
s.specification_version = 3
|
41
|
+
|
42
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
43
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
44
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
45
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
46
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
47
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
48
|
+
else
|
49
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
50
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
51
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
52
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
53
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
54
|
+
end
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
57
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
58
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
59
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
60
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'capistrano/recipes/deploy/remote_dependency'
|
2
|
+
|
3
|
+
Capistrano::Deploy::RemoteDependency.class_eval do
|
4
|
+
|
5
|
+
# Test if the path exists on remote server.
|
6
|
+
def path(path, options={})
|
7
|
+
@message ||= "`#{path}' directory or file is missing"
|
8
|
+
try("test -e #{path}", options)
|
9
|
+
self
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
unless Capistrano::Configuration.respond_to?(:instance)
|
2
|
+
abort "capistrano-checks requires Capistrano 2"
|
3
|
+
end
|
4
|
+
|
5
|
+
require 'capistrano-shared-helpers/ext/remote_dependency'
|
6
|
+
|
7
|
+
Capistrano::Configuration.instance.load do
|
8
|
+
namespace :deploy do
|
9
|
+
namespace :privates do
|
10
|
+
|
11
|
+
desc <<-DESC
|
12
|
+
Add checks to ensure paths in :privates exist on remote server.
|
13
|
+
DESC
|
14
|
+
task :check, :except => { :no_release => true } do
|
15
|
+
fetch(:privates, []).each do |path|
|
16
|
+
depend :remote, :path, File.join(shared_path, 'private', path)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc <<-DESC
|
21
|
+
Create parent dirs for paths in :shared on remote server.
|
22
|
+
|
23
|
+
This task is run after deploy:setup.
|
24
|
+
DESC
|
25
|
+
task :setup, :except => { :no_release => true } do
|
26
|
+
dirs = fetch(:privates, []).map {|path| File.join(shared_path, 'private', File.dirname(path)) }
|
27
|
+
unless dirs.empty?
|
28
|
+
run "#{try_sudo} mkdir -p #{dirs.join(' ')}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
desc <<-DESC
|
33
|
+
Upload files/dirs in :shared from local to remote shared private path.
|
34
|
+
DESC
|
35
|
+
task :upload, :except => { :no_release => true } do
|
36
|
+
fetch(:privates, []).each do |path|
|
37
|
+
top.upload(path, File.join(shared_path, 'private', path),
|
38
|
+
:via => :scp, :recursive => true)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end # namespace :privates
|
43
|
+
end # namespace :deploy
|
44
|
+
|
45
|
+
before 'deploy:check', 'deploy:privates:check'
|
46
|
+
after 'deploy:setup', 'deploy:privates:setup'
|
47
|
+
before 'deploy:privates:upload', 'deploy:privates:setup'
|
48
|
+
|
49
|
+
end
|
50
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
unless Capistrano::Configuration.respond_to?(:instance)
|
2
|
+
abort "capistrano-checks requires Capistrano 2"
|
3
|
+
end
|
4
|
+
|
5
|
+
require 'capistrano-shared-helpers/ext/remote_dependency'
|
6
|
+
|
7
|
+
Capistrano::Configuration.instance.load do
|
8
|
+
namespace :deploy do
|
9
|
+
namespace :shared do
|
10
|
+
|
11
|
+
desc <<-DESC
|
12
|
+
Add checks to ensure paths in :shared exist on remote server.
|
13
|
+
DESC
|
14
|
+
task :check, :except => { :no_release => true } do
|
15
|
+
fetch(:shared, []).each do |path|
|
16
|
+
depend :remote, :path, File.join(shared_path, path)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc <<-DESC
|
21
|
+
Create parent dirs for paths in :shared on remote server.
|
22
|
+
|
23
|
+
This task is run after deploy:setup.
|
24
|
+
DESC
|
25
|
+
task :setup, :except => { :no_release => true } do
|
26
|
+
dirs = fetch(:shared, []).map {|path| File.join(shared_path, File.dirname(path)) }
|
27
|
+
unless dirs.empty?
|
28
|
+
run "#{try_sudo} mkdir -p #{dirs.join(' ')}"
|
29
|
+
run "#{try_sudo} chmod g+w #{dirs.join(' ')}" if fetch(:group_writable, true)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
desc <<-DESC
|
34
|
+
Upload files/dirs in :shared from local to remote shared path.
|
35
|
+
DESC
|
36
|
+
task :upload, :except => { :no_release => true } do
|
37
|
+
fetch(:shared, []).each do |path|
|
38
|
+
top.upload(path, File.join(shared_path, path),
|
39
|
+
:via => :scp, :recursive => true)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end # namespace :shared
|
44
|
+
end # namespace :deploy
|
45
|
+
|
46
|
+
before 'deploy:check', 'deploy:shared:check'
|
47
|
+
after 'deploy:setup', 'deploy:shared:setup'
|
48
|
+
before 'deploy:shared:upload', 'deploy:shared:setup'
|
49
|
+
|
50
|
+
end
|
51
|
+
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-shared-helpers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Huiming Teo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: shoulda
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rdoc
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.12'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.12'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.0.0
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: jeweler
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.8.3
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.8.3
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rcov
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: Capistrano helper tasks related to shared directory.
|
95
|
+
email: teohuiming@gmail.com
|
96
|
+
executables: []
|
97
|
+
extensions: []
|
98
|
+
extra_rdoc_files:
|
99
|
+
- LICENSE.txt
|
100
|
+
- README.rdoc
|
101
|
+
files:
|
102
|
+
- .document
|
103
|
+
- Gemfile
|
104
|
+
- Gemfile.lock
|
105
|
+
- LICENSE.txt
|
106
|
+
- README.rdoc
|
107
|
+
- Rakefile
|
108
|
+
- VERSION
|
109
|
+
- capistrano-shared-helpers.gemspec
|
110
|
+
- lib/capistrano-shared-helpers.rb
|
111
|
+
- lib/capistrano-shared-helpers/ext/remote_dependency.rb
|
112
|
+
- lib/capistrano-shared-helpers/privates.rb
|
113
|
+
- lib/capistrano-shared-helpers/shared.rb
|
114
|
+
homepage: http://github.com/teohm/capistrano-shared-helpers
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
segments:
|
128
|
+
- 0
|
129
|
+
hash: 999888310223245943
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 1.8.24
|
139
|
+
signing_key:
|
140
|
+
specification_version: 3
|
141
|
+
summary: Capistrano helper tasks related to shared directory.
|
142
|
+
test_files: []
|