capsaicin 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +29 -0
- data/VERSION.yml +2 -2
- data/lib/capsaicin/files/local.rb +36 -0
- data/lib/capsaicin/files/remote.rb +35 -1
- metadata +4 -4
data/Rakefile
CHANGED
@@ -14,6 +14,7 @@ begin
|
|
14
14
|
|
15
15
|
s.authors = ["Joe Khoobyar"]
|
16
16
|
s.email = "joe@ankhcraft.com"
|
17
|
+
s.rubyforge_project = "capsaicin"
|
17
18
|
|
18
19
|
s.add_dependency 'capistrano', ['>= 2.0']
|
19
20
|
s.add_dependency 'archive-tar-minitar', ['>= 0.5']
|
@@ -22,6 +23,34 @@ rescue LoadError
|
|
22
23
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
23
24
|
end
|
24
25
|
|
26
|
+
# These are new tasks
|
27
|
+
begin
|
28
|
+
require 'rake/contrib/sshpublisher'
|
29
|
+
namespace :rubyforge do
|
30
|
+
|
31
|
+
desc "Release gem and RDoc documentation to RubyForge"
|
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 = 'rdoc'
|
44
|
+
|
45
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
rescue LoadError
|
50
|
+
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
|
51
|
+
end
|
52
|
+
|
53
|
+
|
25
54
|
# --------- RDoc Documentation ---------
|
26
55
|
desc "Generate RDoc documentation"
|
27
56
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
data/VERSION.yml
CHANGED
@@ -42,6 +42,42 @@ module Capsaicin
|
|
42
42
|
cd dir
|
43
43
|
end
|
44
44
|
|
45
|
+
def tar_c(dest, src, options={}, &filter)
|
46
|
+
logger and
|
47
|
+
logger.trace "tar -cf #{dest} " + Array(src).map { |s| s.gsub ' ', '\\ ' }.join(' ')
|
48
|
+
_tar File.open(dest, 'wb'), src, v, &filter
|
49
|
+
end
|
50
|
+
|
51
|
+
def tar_cz(dest, src, options={}, &filter)
|
52
|
+
require 'zlib' unless defined? Zlib::GzipWriter
|
53
|
+
logger and
|
54
|
+
logger.trace "tar -czf #{dest} " + Array(src).map { |s| s.gsub ' ', '\\ ' }.join(' ')
|
55
|
+
_tar Zlib::GzipWriter.new(File.open(dest, 'wb')), src, options, &filter
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def _tar(os, src, options, &filter)
|
61
|
+
verbose = options[:v] || options[:verbose]
|
62
|
+
require 'find' unless defined? Find
|
63
|
+
unless defined? Archive::Tar::Minitar
|
64
|
+
require 'archive/tar/minitar'
|
65
|
+
end
|
66
|
+
minitar = Archive::Tar::Minitar
|
67
|
+
|
68
|
+
minitar::Output.open os do |outp|
|
69
|
+
Array(src).each do |path|
|
70
|
+
Find.find(path) do |entry|
|
71
|
+
if filter and filter[entry]
|
72
|
+
Find.prune if File.directory? entry
|
73
|
+
else
|
74
|
+
logger.trace " + #{entry}" if verbose
|
75
|
+
minitar.pack_file entry, outp
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
45
81
|
end
|
46
82
|
end
|
47
83
|
end
|
@@ -17,6 +17,25 @@ module Capsaicin
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def chmod(mode, list, options={})
|
21
|
+
_r 'chmod', Array(list).unshift(mode.to_s(8))
|
22
|
+
end
|
23
|
+
|
24
|
+
def chmod_R(mode, list, options={})
|
25
|
+
_r 'chmod -R', Array(list).unshift(mode.to_s(8))
|
26
|
+
end
|
27
|
+
|
28
|
+
def install(src, dest, options={})
|
29
|
+
src = Array(src)
|
30
|
+
case options[:mode]
|
31
|
+
when Fixnum
|
32
|
+
src << '-m' << options[:mode].to_s(8)
|
33
|
+
when String
|
34
|
+
src << '-m' << options[:mode]
|
35
|
+
end
|
36
|
+
_r 'install', src.push(dest)
|
37
|
+
end
|
38
|
+
|
20
39
|
FILE_TESTS.each do |m,t|
|
21
40
|
class_eval <<-EODEF
|
22
41
|
def #{m}(a, options={})
|
@@ -68,6 +87,21 @@ module Capsaicin
|
|
68
87
|
capture 'pwd', :via => _via
|
69
88
|
end
|
70
89
|
|
90
|
+
def tar_c(dest, src, options={}, &filter)
|
91
|
+
filter and abort "tar_c: remote mode does not support a filtering proc"
|
92
|
+
_r 'tar -cf', Array(src).unshift(dest)
|
93
|
+
end
|
94
|
+
|
95
|
+
def tar_cz(dest, src, options={}, &filter)
|
96
|
+
filter and abort "tar_cz: remote mode does not support a filtering proc"
|
97
|
+
_r 'tar -czf', Array(src).unshift(dest)
|
98
|
+
end
|
99
|
+
|
100
|
+
def tar_cj(dest, src, options={}, &filter)
|
101
|
+
filter and abort "tar_cj: remote mode does not support a filtering proc"
|
102
|
+
_r 'tar -cjf', Array(src).unshift(dest)
|
103
|
+
end
|
104
|
+
|
71
105
|
private
|
72
106
|
|
73
107
|
def _t(cmd, args=nil, min=nil)
|
@@ -103,7 +137,7 @@ module Capsaicin
|
|
103
137
|
end
|
104
138
|
|
105
139
|
def _q(*list)
|
106
|
-
list.map { |l| "'#{l.gsub("'", "\\'")}'" }.join ' '
|
140
|
+
list.map { |l| "'#{l.to_s.gsub("'", "\\'")}'" }.join ' '
|
107
141
|
end
|
108
142
|
|
109
143
|
def _via
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capsaicin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Khoobyar
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-29 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -82,8 +82,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version:
|
83
83
|
requirements: []
|
84
84
|
|
85
|
-
rubyforge_project:
|
86
|
-
rubygems_version: 1.3.
|
85
|
+
rubyforge_project: capsaicin
|
86
|
+
rubygems_version: 1.3.3
|
87
87
|
signing_key:
|
88
88
|
specification_version: 3
|
89
89
|
summary: Joe Khoobyar's spicy capistrano extensions
|