capsaicin 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/README.rdoc +6 -0
- data/Rakefile +39 -28
- data/VERSION.yml +2 -1
- data/capsaicin.gemspec +71 -0
- data/lib/capistrano/recipes/deploy/strategy/local_copy.rb +67 -0
- data/lib/capsaicin.rb +4 -0
- data/lib/capsaicin/files/local.rb +4 -6
- data/lib/capsaicin/files/remote.rb +6 -7
- metadata +29 -13
data/README.rdoc
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
Joe Khoobyar's spicy capistrano extensions.
|
4
4
|
|
5
|
+
== Project website(s)
|
6
|
+
|
7
|
+
http://capsaicin.rubyforge.com
|
8
|
+
http://rubyforge.com/projects/capsaicin
|
9
|
+
http://github.com/joekhoobyar/capsaicin
|
10
|
+
|
5
11
|
== Copyright
|
6
12
|
|
7
13
|
Copyright (c) 2009 Joe Khoobyar. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'rake/rdoctask'
|
5
|
-
require 'rake/testtask'
|
6
5
|
|
7
6
|
begin
|
8
7
|
require 'jeweler'
|
@@ -23,34 +22,26 @@ rescue LoadError
|
|
23
22
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
24
23
|
end
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
33
|
-
|
34
|
-
namespace :release do
|
35
|
-
desc "Publish RDoc to RubyForge."
|
36
|
-
task :docs => [:rdoc] do
|
37
|
-
config = YAML.load(
|
38
|
-
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
39
|
-
)
|
40
|
-
|
41
|
-
host = "#{config['username']}@rubyforge.org"
|
42
|
-
remote_dir = "/var/www/gforge-projects/capsaicin/"
|
43
|
-
local_dir = 'doc'
|
25
|
+
require 'rake/testtask'
|
26
|
+
Rake::TestTask.new(:test) do |test|
|
27
|
+
test.libs << 'lib' << 'test'
|
28
|
+
test.pattern = 'test/**/*_test.rb'
|
29
|
+
test.verbose = true
|
30
|
+
end
|
44
31
|
|
45
|
-
|
46
|
-
|
47
|
-
|
32
|
+
begin
|
33
|
+
require 'rcov/rcovtask'
|
34
|
+
Rcov::RcovTask.new do |test|
|
35
|
+
test.libs << 'test'
|
36
|
+
test.pattern = 'test/**/*_test.rb'
|
37
|
+
test.verbose = true
|
48
38
|
end
|
49
39
|
rescue LoadError
|
50
|
-
|
40
|
+
task :rcov do
|
41
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
42
|
+
end
|
51
43
|
end
|
52
44
|
|
53
|
-
|
54
45
|
# --------- RDoc Documentation ---------
|
55
46
|
desc "Generate RDoc documentation"
|
56
47
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
@@ -63,10 +54,30 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
63
54
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
64
55
|
end
|
65
56
|
|
66
|
-
|
67
|
-
|
68
|
-
|
57
|
+
task :default => :build
|
58
|
+
|
59
|
+
Jeweler::GemcutterTasks.new
|
60
|
+
Jeweler::RubyforgeTasks.new do |rubyforge|
|
61
|
+
rubyforge.doc_task = "rdoc"
|
62
|
+
rubyforge.remote_doc_path = ''
|
69
63
|
end
|
70
64
|
|
71
|
-
task :default => :
|
65
|
+
task :default => :test
|
66
|
+
|
67
|
+
require 'rake/rdoctask'
|
68
|
+
Rake::RDocTask.new do |rdoc|
|
69
|
+
if File.exist?('VERSION.yml')
|
70
|
+
config = YAML.load(File.read('VERSION.yml'))
|
71
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
72
|
+
else
|
73
|
+
version = ""
|
74
|
+
end
|
75
|
+
rdoc.options << '--line-numbers' << '--inline-source' <<
|
76
|
+
'--main' << 'README.rdoc' <<
|
77
|
+
'--charset' << 'utf-8'
|
72
78
|
|
79
|
+
rdoc.rdoc_dir = 'rdoc'
|
80
|
+
rdoc.title = "Capsaicin #{version}"
|
81
|
+
rdoc.rdoc_files.include('README*')
|
82
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
83
|
+
end
|
data/VERSION.yml
CHANGED
data/capsaicin.gemspec
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{capsaicin}
|
8
|
+
s.version = "0.1.8"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Joe Khoobyar"]
|
12
|
+
s.date = %q{2010-05-03}
|
13
|
+
s.description = %q{Spicy capistrano extensions for various needs}
|
14
|
+
s.email = %q{joe@ankhcraft.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".gitignore",
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION.yml",
|
25
|
+
"capsaicin.gemspec",
|
26
|
+
"lib/capistrano/recipes/deploy/strategy/local_copy.rb",
|
27
|
+
"lib/capsaicin.rb",
|
28
|
+
"lib/capsaicin/bundle.rb",
|
29
|
+
"lib/capsaicin/files.rb",
|
30
|
+
"lib/capsaicin/files/local.rb",
|
31
|
+
"lib/capsaicin/files/remote.rb",
|
32
|
+
"lib/capsaicin/invocation.rb",
|
33
|
+
"lib/capsaicin/namespace.rb",
|
34
|
+
"lib/capsaicin/service.rb",
|
35
|
+
"lib/capsaicin/service/command.rb",
|
36
|
+
"lib/capsaicin/service/crm.rb",
|
37
|
+
"lib/capsaicin/service/lsb.rb",
|
38
|
+
"lib/capsaicin/service/windows.rb",
|
39
|
+
"lib/capsaicin/sys.rb",
|
40
|
+
"lib/capsaicin/ui.rb",
|
41
|
+
"test/helper.rb",
|
42
|
+
"test/test_local_files.rb"
|
43
|
+
]
|
44
|
+
s.homepage = %q{http://github.com/joekhoobyar/capsaicin}
|
45
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
46
|
+
s.require_paths = ["lib"]
|
47
|
+
s.rubyforge_project = %q{capsaicin}
|
48
|
+
s.rubygems_version = %q{1.3.6}
|
49
|
+
s.summary = %q{Joe Khoobyar's spicy capistrano extensions}
|
50
|
+
s.test_files = [
|
51
|
+
"test/helper.rb",
|
52
|
+
"test/test_local_files.rb"
|
53
|
+
]
|
54
|
+
|
55
|
+
if s.respond_to? :specification_version then
|
56
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
57
|
+
s.specification_version = 3
|
58
|
+
|
59
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
60
|
+
s.add_runtime_dependency(%q<capistrano>, [">= 2.0"])
|
61
|
+
s.add_runtime_dependency(%q<archive-tar-minitar>, [">= 0.5"])
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<capistrano>, [">= 2.0"])
|
64
|
+
s.add_dependency(%q<archive-tar-minitar>, [">= 0.5"])
|
65
|
+
end
|
66
|
+
else
|
67
|
+
s.add_dependency(%q<capistrano>, [">= 2.0"])
|
68
|
+
s.add_dependency(%q<archive-tar-minitar>, [">= 0.5"])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'capistrano/recipes/deploy/strategy/base'
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
module Capistrano
|
5
|
+
module Deploy
|
6
|
+
module Strategy
|
7
|
+
class LocalCopy < Base
|
8
|
+
|
9
|
+
def deploy!
|
10
|
+
logger.debug "compressing local copy to #{filename}"
|
11
|
+
local_files.tar_cz filename, '.', :verbose=>false do |item|
|
12
|
+
if (item=item[2..-1]) and item.length > 0
|
13
|
+
name = File.basename item
|
14
|
+
name == "." || name == ".." || copy_prune.include?(name) ||
|
15
|
+
copy_exclude.any?{|p| File.fnmatch(p, item, File::FNM_DOTMATCH)} ||
|
16
|
+
(! File.directory?(item) && copy_directory_only.any?{|p| item[0,p.length+1]==p+'/'})
|
17
|
+
end
|
18
|
+
end
|
19
|
+
files.upload filename, remote_filename
|
20
|
+
begin
|
21
|
+
files.mkdir_p configuration[:release_path]
|
22
|
+
files.tar_xz remote_filename, :chdir=>configuration[:release_path], :verbose=>true
|
23
|
+
ensure
|
24
|
+
files.rm_f remote_filename rescue nil
|
25
|
+
end
|
26
|
+
ensure
|
27
|
+
FileUtils.rm filename rescue nil
|
28
|
+
FileUtils.rm_rf destination rescue nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def check!
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def local_copy_dir
|
37
|
+
@local_copy_dir ||= configuration.fetch(:local_copy_dir, '.')
|
38
|
+
end
|
39
|
+
|
40
|
+
def copy_exclude
|
41
|
+
@copy_exclude ||= Array(configuration.fetch(:copy_exclude, %w(.*)))
|
42
|
+
end
|
43
|
+
|
44
|
+
def copy_prune
|
45
|
+
@copy_prune ||= Array(configuration.fetch(:copy_exclude, %w(.svn .git)))
|
46
|
+
end
|
47
|
+
|
48
|
+
def copy_directory_only
|
49
|
+
@copy_directory_only ||= Array(configuration.fetch(:copy_directory_only, %w(log tmp)))
|
50
|
+
end
|
51
|
+
|
52
|
+
def filename
|
53
|
+
@filename ||= File.join(Dir.tmpdir, "#{configuration.fetch(:application, 'local_copy')}.tgz")
|
54
|
+
end
|
55
|
+
|
56
|
+
def remote_dir
|
57
|
+
@remote_dir ||= configuration[:copy_remote_dir] || "/tmp"
|
58
|
+
end
|
59
|
+
|
60
|
+
def remote_filename
|
61
|
+
@remote_filename ||= File.join(remote_dir, File.basename(filename))
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/capsaicin.rb
CHANGED
@@ -3,6 +3,10 @@ unless Capistrano::Configuration.respond_to?(:instance)
|
|
3
3
|
end
|
4
4
|
require 'capistrano'
|
5
5
|
|
6
|
+
unless Symbol.method_defined? :intern
|
7
|
+
Symbol.class_eval { def intern; self end }
|
8
|
+
end
|
9
|
+
|
6
10
|
module Capsaicin; end
|
7
11
|
|
8
12
|
require File.join(File.dirname(__FILE__), %w(capsaicin sys))
|
@@ -47,15 +47,13 @@ module Capsaicin
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def tar_c(dest, src, options={}, &filter)
|
50
|
-
logger and
|
51
|
-
logger.trace "tar -cf #{dest} " + Array(src).map { |s| s.gsub ' ', '\\ ' }.join(' ')
|
50
|
+
logger and logger.trace "tar -cf #{dest} #{Array(src).map{|s| s.gsub ' ', '\\ '}.join(' ')}"
|
52
51
|
_tar File.open(dest, 'wb'), src, options, &filter
|
53
52
|
end
|
54
53
|
|
55
54
|
def tar_cz(dest, src, options={}, &filter)
|
56
55
|
require 'zlib' unless defined? Zlib::GzipWriter
|
57
|
-
logger and
|
58
|
-
logger.trace "tar -czf #{dest} " + Array(src).map { |s| s.gsub ' ', '\\ ' }.join(' ')
|
56
|
+
logger and logger.trace "tar -czf #{dest} #{Array(src).map{|s| s.gsub ' ', '\\ ' }.join(' ')}"
|
59
57
|
_tar Zlib::GzipWriter.new(File.open(dest, 'wb')), src, options, &filter
|
60
58
|
end
|
61
59
|
|
@@ -72,13 +70,13 @@ module Capsaicin
|
|
72
70
|
|
73
71
|
def tar_x(src, options={}, &block)
|
74
72
|
logger and logger.trace "tar -xf #{src}"
|
75
|
-
_untar File.open(src, 'wb'), options, &block
|
73
|
+
_untar File.open(src, 'wb'), options[:chdir]||'.', options, &block
|
76
74
|
end
|
77
75
|
|
78
76
|
def tar_xz(src, options={}, &block)
|
79
77
|
require 'zlib' unless defined? Zlib::GzipWriter
|
80
78
|
logger and logger.trace "tar -xzf #{src}"
|
81
|
-
_untar Zlib::GzipReader.new(File.open(src, 'rb')), options, &block
|
79
|
+
_untar Zlib::GzipReader.new(File.open(src, 'rb')), options[:chdir]||'.', options, &block
|
82
80
|
end
|
83
81
|
|
84
82
|
private
|
@@ -138,19 +138,19 @@ module Capsaicin
|
|
138
138
|
_r 'tar -cjf', Array(src).unshift(dest)
|
139
139
|
end
|
140
140
|
|
141
|
-
def tar_x(
|
141
|
+
def tar_x(src, options={}, &filter)
|
142
142
|
filter and abort "tar_x: remote mode does not support a filtering proc"
|
143
|
-
_r
|
143
|
+
_r "tar #{'-C '+_q(options[:chdir]) if options[:chdir]} -xf", [src]
|
144
144
|
end
|
145
145
|
|
146
|
-
def tar_xz(
|
146
|
+
def tar_xz(src, options={}, &filter)
|
147
147
|
filter and abort "tar_xz: remote mode does not support a filtering proc"
|
148
|
-
_r
|
148
|
+
_r "tar #{'-C '+_q(options[:chdir]) if options[:chdir]} -xzf", [src]
|
149
149
|
end
|
150
150
|
|
151
|
-
def tar_xj(
|
151
|
+
def tar_xj(src, options={}, &filter)
|
152
152
|
filter and abort "tar_xj: remote mode does not support a filtering proc"
|
153
|
-
_r
|
153
|
+
_r "tar #{'-C '+_q(options[:chdir]) if options[:chdir]} -xjf", [src]
|
154
154
|
end
|
155
155
|
|
156
156
|
def tar_t(src, options={}, &filter)
|
@@ -168,7 +168,6 @@ module Capsaicin
|
|
168
168
|
_t 'tar -tjf', [src]
|
169
169
|
end
|
170
170
|
|
171
|
-
|
172
171
|
private
|
173
172
|
|
174
173
|
def _t(cmd, args=nil, min=nil)
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capsaicin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 8
|
9
|
+
version: 0.1.8
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Joe Khoobyar
|
@@ -9,29 +14,35 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-05-03 00:00:00 -04:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: capistrano
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 2
|
29
|
+
- 0
|
23
30
|
version: "2.0"
|
24
|
-
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
25
33
|
- !ruby/object:Gem::Dependency
|
26
34
|
name: archive-tar-minitar
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
35
|
+
prerelease: false
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
37
|
requirements:
|
31
38
|
- - ">="
|
32
39
|
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 0
|
42
|
+
- 5
|
33
43
|
version: "0.5"
|
34
|
-
|
44
|
+
type: :runtime
|
45
|
+
version_requirements: *id002
|
35
46
|
description: Spicy capistrano extensions for various needs
|
36
47
|
email: joe@ankhcraft.com
|
37
48
|
executables: []
|
@@ -42,10 +53,13 @@ extra_rdoc_files:
|
|
42
53
|
- LICENSE
|
43
54
|
- README.rdoc
|
44
55
|
files:
|
56
|
+
- .gitignore
|
45
57
|
- LICENSE
|
46
58
|
- README.rdoc
|
47
59
|
- Rakefile
|
48
60
|
- VERSION.yml
|
61
|
+
- capsaicin.gemspec
|
62
|
+
- lib/capistrano/recipes/deploy/strategy/local_copy.rb
|
49
63
|
- lib/capsaicin.rb
|
50
64
|
- lib/capsaicin/bundle.rb
|
51
65
|
- lib/capsaicin/files.rb
|
@@ -75,18 +89,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
89
|
requirements:
|
76
90
|
- - ">="
|
77
91
|
- !ruby/object:Gem::Version
|
92
|
+
segments:
|
93
|
+
- 0
|
78
94
|
version: "0"
|
79
|
-
version:
|
80
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
96
|
requirements:
|
82
97
|
- - ">="
|
83
98
|
- !ruby/object:Gem::Version
|
99
|
+
segments:
|
100
|
+
- 0
|
84
101
|
version: "0"
|
85
|
-
version:
|
86
102
|
requirements: []
|
87
103
|
|
88
104
|
rubyforge_project: capsaicin
|
89
|
-
rubygems_version: 1.3.
|
105
|
+
rubygems_version: 1.3.6
|
90
106
|
signing_key:
|
91
107
|
specification_version: 3
|
92
108
|
summary: Joe Khoobyar's spicy capistrano extensions
|