reap 4.3.4 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MANIFEST +424 -0
- data/ProjectInfo +4 -3
- data/README +83 -51
- data/Rakefile +118 -0
- data/bin/reap +2 -1
- data/data/reap/scaffold/standard/setup.rb +1568 -0
- data/data/reap/scaffold/subversion/trunk/setup.rb +1568 -0
- data/data/reap/setup.rb +4 -0
- data/doc/LATEST +24 -0
- data/lib/reap/bin/reap.rb +15 -8
- data/lib/reap/projectinfo.rb +100 -35
- data/lib/reap/rake.rb +16 -0
- data/lib/reap/rake/adapter.rb +50 -0
- data/lib/reap/rake/announce.rb +10 -0
- data/lib/reap/rake/doap.rb +10 -0
- data/lib/reap/rake/extest.rb +10 -0
- data/lib/reap/rake/info.rb +10 -0
- data/lib/reap/rake/install.rb +10 -0
- data/lib/reap/rake/manifest.rb +9 -0
- data/lib/reap/rake/package.rb +10 -0
- data/lib/reap/rake/publish.rb +10 -0
- data/lib/reap/rake/rdoc.rb +10 -0
- data/lib/reap/rake/release.rb +10 -0
- data/lib/reap/rake/test.rb +10 -0
- data/lib/reap/reap.rb +6 -5
- data/lib/reap/task.rb +47 -38
- data/lib/reap/task/announce.rb +81 -51
- data/lib/reap/task/doap.rb +12 -9
- data/lib/reap/task/{testext.rb → extest.rb} +30 -22
- data/lib/reap/task/fileperm.rb +8 -6
- data/lib/reap/task/info.rb +0 -4
- data/lib/reap/task/install.rb +11 -4
- data/lib/reap/task/manifest.rb +59 -0
- data/lib/reap/task/noop.rb +2 -3
- data/lib/reap/task/package.rb +22 -31
- data/lib/reap/task/publish.rb +113 -28
- data/lib/reap/task/rdoc.rb +30 -18
- data/lib/reap/task/release.rb +15 -16
- data/lib/reap/task/test.rb +22 -14
- metadata +26 -6
data/lib/reap/task/doap.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
|
2
2
|
module Reap
|
3
3
|
|
4
|
+
# = Doap task
|
5
|
+
#
|
6
|
+
# This task simply generates an XML DOAP project file.
|
7
|
+
# This file can be useful for RSS and Atom feeds to
|
8
|
+
# project tracking sites. The task utilizes as much
|
9
|
+
# information as it can from the ProjectInfo file.
|
10
|
+
#
|
11
|
+
|
4
12
|
class Doap < Task
|
5
13
|
|
6
14
|
task_desc %{Generate DOAP project file.}
|
@@ -16,17 +24,10 @@ module Reap
|
|
16
24
|
|
17
25
|
}
|
18
26
|
|
19
|
-
|
20
|
-
|
21
|
-
# Setup doap data
|
22
|
-
|
23
|
-
def init
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
# Generate doap file
|
27
|
+
alias_method :prj, :task
|
28
28
|
|
29
29
|
def run
|
30
|
+
|
30
31
|
puts "Generating doap.xml file..."
|
31
32
|
|
32
33
|
x = ''
|
@@ -60,8 +61,10 @@ module Reap
|
|
60
61
|
}.margin
|
61
62
|
|
62
63
|
File.open( "doap.xml", 'w' ) { |f| f << x }
|
64
|
+
|
63
65
|
end
|
64
66
|
|
65
67
|
end
|
66
68
|
|
67
69
|
end
|
70
|
+
|
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'reap/task'
|
4
4
|
require 'facet/string/margin'
|
5
5
|
|
6
|
+
require 'facet/progressbar'
|
7
|
+
|
6
8
|
# _____ _ ___ _ _____ _
|
7
9
|
# |_ _|__ __| |_ | __|_ _| |_ |_ _|_ _ __| |__
|
8
10
|
# | |/ -_|_-< _| | _|\ \ / _|_ | |/ _` (_-< / /
|
@@ -12,65 +14,69 @@ require 'facet/string/margin'
|
|
12
14
|
# = Test Extraction Task
|
13
15
|
#
|
14
16
|
# The Reap extract test task scans every package script
|
15
|
-
# looking for =begin
|
17
|
+
# looking for =begin test... =end sections.
|
16
18
|
# With appropriat headers, it copies these sections
|
17
19
|
# to files in the test dir, which then can be run
|
18
|
-
# using the Reap test
|
20
|
+
# using the Reap test task.
|
19
21
|
#
|
20
|
-
class Reap::
|
22
|
+
class Reap::ExTest < Reap::Task
|
21
23
|
|
22
|
-
task_desc "Extract unit
|
24
|
+
task_desc "Extract embedded unit tests from scripts."
|
23
25
|
|
24
26
|
task_help %{
|
25
27
|
|
26
|
-
reap
|
28
|
+
reap extest
|
27
29
|
|
28
30
|
Extracts embedded tests from program files and places them
|
29
31
|
in the test directory. The exact layout of files is reflected
|
30
32
|
in the test directory. You can then use Reap's test task to
|
31
33
|
run the tests.
|
32
34
|
|
33
|
-
dir Specify the test directory.
|
34
|
-
|
35
|
-
|
36
|
-
files Specify files to extract.
|
37
|
-
Default is 'lib/**/*.rb'.
|
35
|
+
dir Specify the test directory. Default is 'test'.
|
36
|
+
files Specify files to extract. Default is 'lib/**/*.rb'.
|
38
37
|
|
39
38
|
}
|
40
39
|
|
41
|
-
|
40
|
+
alias_method :tst, :task
|
41
|
+
|
42
|
+
def run
|
42
43
|
|
43
|
-
|
44
|
+
# setup
|
44
45
|
|
45
|
-
def init
|
46
46
|
tst.dir ||= 'test'
|
47
47
|
tst.files ||= [ 'lib/**/*.rb' ]
|
48
|
-
|
49
|
-
|
48
|
+
tst.files = [ tst.files ].flatten
|
49
|
+
#tst.options ?
|
50
|
+
|
51
|
+
# text extract
|
50
52
|
|
51
|
-
def run
|
52
53
|
#test_libs = tst.libs.join(':')
|
53
54
|
files = FileList.new
|
54
55
|
files.include(*tst.files)
|
55
56
|
if files.empty?
|
56
|
-
|
57
|
+
tell "No script files found."
|
57
58
|
return
|
58
59
|
end
|
59
|
-
|
60
|
+
|
61
|
+
tell "Reap is scanning and copying embedded tests..."
|
60
62
|
|
61
63
|
if tst.dir.strip.empty?
|
62
|
-
|
64
|
+
tell "Test directory must be specified."
|
63
65
|
return
|
64
66
|
end
|
65
67
|
|
66
68
|
unless File.directory?(tst.dir)
|
67
|
-
|
69
|
+
tell "Test directory doesn't exist: #{File.expand_path( tst.dir )}"
|
68
70
|
return
|
69
71
|
end
|
70
72
|
|
73
|
+
pbar = Console::ProgressBar.new( 'Extracting', files.size )
|
74
|
+
|
71
75
|
files.each { |file|
|
72
|
-
|
76
|
+
pbar.inc
|
77
|
+
|
73
78
|
testing = extract( file )
|
79
|
+
|
74
80
|
unless testing.strip.empty?
|
75
81
|
complete_test = create( testing, file )
|
76
82
|
libpath = File.dirname( file )
|
@@ -82,7 +88,9 @@ class Reap::TestExt < Reap::Task
|
|
82
88
|
File.open( fp, "w" ) { |fw| fw << complete_test }
|
83
89
|
end
|
84
90
|
}
|
85
|
-
|
91
|
+
|
92
|
+
pbar.finish
|
93
|
+
|
86
94
|
end
|
87
95
|
|
88
96
|
private
|
data/lib/reap/task/fileperm.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
|
2
|
+
# NOTE This task needs work!
|
3
|
+
# It needs to generalize more to give greater control
|
4
|
+
# over which files get what permissions.
|
5
|
+
# It also might be extended to do copyright tagging.
|
6
|
+
|
2
7
|
require 'reap/task'
|
3
8
|
|
4
9
|
# ___ _ _ _____ _
|
@@ -13,7 +18,7 @@ class Reap::Perm < Reap::Task
|
|
13
18
|
|
14
19
|
section_required true
|
15
20
|
|
16
|
-
task_desc "Normalize ownership and permissions of
|
21
|
+
task_desc "Normalize ownership and permissions of files."
|
17
22
|
|
18
23
|
task_help %{
|
19
24
|
|
@@ -26,17 +31,14 @@ class Reap::Perm < Reap::Task
|
|
26
31
|
|
27
32
|
}
|
28
33
|
|
29
|
-
|
34
|
+
alias_method :perm, :task
|
30
35
|
|
31
|
-
|
36
|
+
def run
|
32
37
|
|
33
|
-
def init
|
34
38
|
perm.group ||= perm.user
|
35
39
|
perm.filemod ||= 644
|
36
40
|
perm.dirmod ||= 755
|
37
|
-
end
|
38
41
|
|
39
|
-
def run
|
40
42
|
puts "Reap is shelling out work to chmod..."
|
41
43
|
|
42
44
|
# misc
|
data/lib/reap/task/info.rb
CHANGED
data/lib/reap/task/install.rb
CHANGED
@@ -14,12 +14,19 @@ class Reap::Install < Reap::Task
|
|
14
14
|
|
15
15
|
task_desc "Locally install package using built-in setup.rb."
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
task_help %{
|
18
|
+
|
19
|
+
reap install
|
20
|
+
|
21
|
+
This task manually installs a project using setup.rb.
|
22
|
+
If setup.rb doesn't exist it will be created.
|
23
|
+
|
24
|
+
}
|
21
25
|
|
22
26
|
def run
|
27
|
+
|
28
|
+
task.options ||= []
|
29
|
+
|
23
30
|
#exe = %w{ setup.rb install.rb }.find{ |f| File.exists?(f) }
|
24
31
|
#raise "setup.rb or install.rb not found" if exe == nil
|
25
32
|
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
require 'reap/task'
|
3
|
+
require 'digest/md5'
|
4
|
+
|
5
|
+
# __ __ _ __ _ _____ _
|
6
|
+
# | \/ |__ _ _ _ (_)/ _|___ __| |_ |_ _|_ _ __| |__
|
7
|
+
# | |\/| / _` | ' \| | _/ -_|_-< _| | |/ _` (_-< / /
|
8
|
+
# |_| |_\__,_|_||_|_|_| \___/__/\__| |_|\__,_/__/_\_\
|
9
|
+
#
|
10
|
+
|
11
|
+
# = Manifest Task
|
12
|
+
|
13
|
+
class Reap::Manifest < Reap::Task
|
14
|
+
|
15
|
+
MUST_EXCLUDE = [ 'InstalledFiles', '**/CVS/**/*', '**/*~', 'dist', 'pkg' ]
|
16
|
+
|
17
|
+
#section_required true
|
18
|
+
|
19
|
+
task_desc "Create a MANIFEST file for this package."
|
20
|
+
|
21
|
+
task_help %{
|
22
|
+
|
23
|
+
reap manifest
|
24
|
+
|
25
|
+
Creates a manifest file for the package.
|
26
|
+
|
27
|
+
include user name to use
|
28
|
+
exclude group name to use
|
29
|
+
|
30
|
+
}
|
31
|
+
|
32
|
+
alias_method :man, :task
|
33
|
+
|
34
|
+
def run
|
35
|
+
|
36
|
+
man.include ||= ['**/*']
|
37
|
+
|
38
|
+
man.exclude ||= []
|
39
|
+
man.exclude |= MUST_EXCLUDE
|
40
|
+
|
41
|
+
package_files = FileList.new
|
42
|
+
package_files.include(*man.include)
|
43
|
+
package_files.exclude(*man.exclude) if man.exclude and not man.exclude.empty?
|
44
|
+
|
45
|
+
File.open('MANIFEST', 'w+') do |f|
|
46
|
+
package_files.each do |pf|
|
47
|
+
f << "#{salt(pf)} #{pf}\n" if File.file?(pf)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
# support functions
|
54
|
+
def salt( file )
|
55
|
+
Digest::MD5.new( File.read( file ) ).hexdigest
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
data/lib/reap/task/noop.rb
CHANGED
data/lib/reap/task/package.rb
CHANGED
@@ -22,18 +22,18 @@ end
|
|
22
22
|
class Reap::Package < Reap::Task
|
23
23
|
|
24
24
|
MUST_EXCLUDE = [ 'InstalledFiles', '**/CVS/**/*', '**/*~', 'dist', 'pkg' ]
|
25
|
-
LOCATIONS = [ '
|
25
|
+
LOCATIONS = [ 'dist', 'pkg', '../packages', '../dist', '../pkg' ]
|
26
26
|
|
27
27
|
# Task line description
|
28
28
|
|
29
|
-
task_desc
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
task_desc "Create distribution packages."
|
30
|
+
# if master.package
|
31
|
+
# disttypes = master.package.distribute || master.distribute || [ 'gem', 'tar.bz2', 'zip' ]
|
32
|
+
# else
|
33
|
+
# disttypes = master.distribute || [ 'gem', 'tar.bz2', 'zip' ]
|
34
|
+
# end
|
35
|
+
# "Build distribution packages (#{disttypes.join(', ')})."
|
36
|
+
# end
|
37
37
|
|
38
38
|
# Help information
|
39
39
|
|
@@ -78,18 +78,15 @@ class Reap::Package < Reap::Task
|
|
78
78
|
|
79
79
|
# Alternate for task properties accessor.
|
80
80
|
|
81
|
-
|
81
|
+
alias_method :pkg, :task
|
82
82
|
|
83
|
-
|
83
|
+
def run
|
84
84
|
|
85
|
-
|
85
|
+
# setup package defaults
|
86
86
|
|
87
87
|
# Do not look in master information for this
|
88
|
-
|
89
88
|
pkg.dir = section.dir || LOCATIONS.find { |f| File.directory?(f) } || 'dist'
|
90
89
|
|
91
|
-
# Set defaults
|
92
|
-
|
93
90
|
pkg.status ||= 'beta/stable'
|
94
91
|
pkg.date ||= Time.now.strftime("%Y-%m-%d")
|
95
92
|
pkg.series ||= '1'
|
@@ -145,11 +142,7 @@ class Reap::Package < Reap::Task
|
|
145
142
|
#@autorequire
|
146
143
|
end
|
147
144
|
|
148
|
-
|
149
|
-
|
150
|
-
# Run package task.
|
151
|
-
|
152
|
-
def run
|
145
|
+
# package it up
|
153
146
|
|
154
147
|
group_dir_path = File.join( pkg.dir, pkg.package_name )
|
155
148
|
package_dir_path = File.join( pkg.dir, pkg.package_name, pkg.package_name )
|
@@ -217,7 +210,7 @@ class Reap::Package < Reap::Task
|
|
217
210
|
if defined?(::Gem)
|
218
211
|
run_gem
|
219
212
|
else
|
220
|
-
|
213
|
+
tell "Package .gem requested, but rubygems not found (skipped)."
|
221
214
|
end
|
222
215
|
end
|
223
216
|
|
@@ -227,7 +220,7 @@ class Reap::Package < Reap::Task
|
|
227
220
|
if true # TODO ensure required debian tools here
|
228
221
|
run_deb
|
229
222
|
else
|
230
|
-
|
223
|
+
tell "Package .deb requested, but debian tools not found (skipped)."
|
231
224
|
end
|
232
225
|
end
|
233
226
|
|
@@ -237,7 +230,7 @@ class Reap::Package < Reap::Task
|
|
237
230
|
if true # TODO ensure required tools here
|
238
231
|
run_pacman
|
239
232
|
else
|
240
|
-
|
233
|
+
tell "Pacman package requested, but required tools not found (skipped)."
|
241
234
|
end
|
242
235
|
end
|
243
236
|
|
@@ -291,14 +284,14 @@ private
|
|
291
284
|
s.has_rdoc = true
|
292
285
|
}
|
293
286
|
|
294
|
-
|
287
|
+
tell "Reap is shelling out work to the Gem Package Manager..."
|
295
288
|
Gem.manage_gems
|
296
289
|
Gem::Builder.new(spec).build
|
297
290
|
gems = Dir.glob( './*.gem' )
|
298
291
|
gems.each{ |f|
|
299
292
|
FileUtils.mv( f, File.join( pkg.dir, pkg.package_name ) )
|
300
293
|
}
|
301
|
-
|
294
|
+
puts
|
302
295
|
end
|
303
296
|
|
304
297
|
|
@@ -372,6 +365,7 @@ private
|
|
372
365
|
File.open( File.join(debdir, 'DEBIAN', 'control'), 'w') { |f| f << ctrl }
|
373
366
|
|
374
367
|
sh %{dpkg-deb -b #{debdir} #{debfile}}
|
368
|
+
puts
|
375
369
|
end
|
376
370
|
|
377
371
|
# This builds a pacman (archlinux) PKGBUILD script.
|
@@ -381,7 +375,7 @@ private
|
|
381
375
|
use_subsection :pacman
|
382
376
|
|
383
377
|
unless @source
|
384
|
-
|
378
|
+
tell "URL 'source' is require for proto package."
|
385
379
|
return nil
|
386
380
|
end
|
387
381
|
|
@@ -430,13 +424,10 @@ private
|
|
430
424
|
pacpacdir = File.join( pacdir, 'PACMAN' )
|
431
425
|
pacfile = File.join( pacdir, 'PKGBUILD' )
|
432
426
|
|
433
|
-
|
427
|
+
tell "Reap is shelling out work to the pacman..."
|
434
428
|
FileUtils.mkdir_p(pacdir)
|
435
|
-
#sh %{ruby setup.rb all --prefix=#{debdir}}
|
436
|
-
#FileUtils.mkdir_p(pacpacdir)
|
437
429
|
File.open( pacfile, 'w') { |f| f << proto }
|
438
|
-
|
439
|
-
|
430
|
+
puts
|
440
431
|
end
|
441
432
|
|
442
433
|
end
|
data/lib/reap/task/publish.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'reap/task'
|
4
|
+
require 'shellwords'
|
4
5
|
|
5
6
|
# ___ _ _ _ _ _____ _
|
6
7
|
# | _ \_ _| |__| (_)__| |_ |_ _|_ _ __| |__
|
@@ -14,60 +15,144 @@ class Reap::Publish < Reap::Task
|
|
14
15
|
|
15
16
|
section_required true
|
16
17
|
|
17
|
-
task_desc "Publish documents to the web."
|
18
|
+
task_desc "Publish documents to the web or host."
|
18
19
|
|
19
20
|
task_help %{
|
20
21
|
|
21
22
|
reap publish
|
22
23
|
|
23
|
-
Publish documents to hosting service.
|
24
|
-
|
25
|
-
|
24
|
+
Publish documents to hosting service. Three means of
|
25
|
+
publishing are current supported, ftp uploading, scp,
|
26
|
+
and web convenience option that recognizes particular
|
27
|
+
hosts (only RubyForge is currently supported).
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
project Project name.
|
29
|
+
type Type of publishing, 'web', 'scp' or 'ftp'.
|
30
|
+
host Host server, default is 'rubyforge.org'
|
30
31
|
username Username for host.
|
32
|
+
dir Directory of files to publish. Or,
|
33
|
+
copy Files to publish using from and to.
|
34
|
+
project Project name (used for Rubyforge)
|
35
|
+
|
36
|
+
If the type is 'scp' or 'ftp' you will also need to provide
|
37
|
+
the root directory parameter.
|
38
|
+
|
39
|
+
root Document root directory at host.
|
40
|
+
|
41
|
+
The dir parameter allows you to simply specify a local
|
42
|
+
directory, the contents of which will be published to
|
43
|
+
host's document root location (directory tree intact).
|
44
|
+
|
45
|
+
If you need more control over which files to publish
|
46
|
+
where, you can use the copy parameter instead. Provide
|
47
|
+
an array of pattern strings in the form of "{from} {to}".
|
48
|
+
If the desitination is the host's document root you do
|
49
|
+
not need to specify the {to} part. For example:
|
50
|
+
|
51
|
+
copy: [ 'web/*', 'doc/api/* doc/api' ]
|
52
|
+
|
53
|
+
The first copies the files under your project's web directory
|
54
|
+
to the host's document root. The second copies your projects
|
55
|
+
doc/api files to the doc/api location on the host.
|
56
|
+
|
57
|
+
When using the 'scp' type the internal template used for
|
58
|
+
the outbound destination is 'username@host:root/'.
|
31
59
|
|
32
60
|
}
|
33
61
|
|
34
62
|
#attr_accessor :host, :type, :dir, :project, :username
|
35
63
|
#attr_accessor :exclude # not using yet
|
36
64
|
|
37
|
-
|
65
|
+
alias_method :pub, :task
|
38
66
|
|
39
|
-
#
|
67
|
+
# Run the publishing task.
|
40
68
|
|
41
|
-
def
|
42
|
-
|
69
|
+
def run( target=nil, copy_from=nil, copy_to=nil )
|
70
|
+
|
71
|
+
return nil if target and target != pub.target
|
72
|
+
|
73
|
+
# setup
|
74
|
+
|
75
|
+
pub.type ||= 'web'
|
43
76
|
pub.host ||= 'rubyforge.org'
|
77
|
+
pub.root ||= 'var/www/gforge-projects/'
|
44
78
|
pub.project ||= master.rubyforge.project || master.name
|
45
79
|
pub.username ||= master.rubyforge.username
|
46
|
-
pub.
|
47
|
-
end
|
80
|
+
pub.copy ||= [ "#{pub.dir}/*" ]
|
48
81
|
|
49
|
-
|
82
|
+
if copy_from
|
83
|
+
pub.copy = [ "#{copy_from} #{copy_to}".strip ]
|
84
|
+
end
|
50
85
|
|
51
|
-
|
52
|
-
cmd = ''; skip = false
|
86
|
+
# validate
|
53
87
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
88
|
+
unless pub.project
|
89
|
+
puts "Project not specified." ; return nil
|
90
|
+
end
|
91
|
+
|
92
|
+
unless pub.username
|
93
|
+
puts "Username not specified." ; return nil
|
94
|
+
end
|
95
|
+
|
96
|
+
# publish
|
97
|
+
|
98
|
+
puts "Reap is shelling out publishing work..."
|
99
|
+
|
100
|
+
case pub.type
|
101
|
+
|
102
|
+
when 'web', 'www'
|
103
|
+
case pub.host
|
104
|
+
when 'rubyforge', 'rubyforge.org'
|
105
|
+
pub.host = "rubyforge.org"
|
106
|
+
pub.root = "/var/www/gforge-projects/#{pub.project}"
|
107
|
+
run_scp
|
59
108
|
else
|
60
|
-
puts %{Unrecognized publishing
|
61
|
-
|
109
|
+
puts %{Unrecognized publishing host '#{pub.host}'. Skipped.}
|
110
|
+
return nil
|
62
111
|
end
|
112
|
+
|
113
|
+
when 'scp'
|
114
|
+
run_scp
|
115
|
+
|
116
|
+
when 'ftp'
|
117
|
+
run_ftp
|
118
|
+
|
63
119
|
else
|
64
|
-
puts %{Unrecognized publishing
|
65
|
-
|
120
|
+
puts %{Unrecognized publishing type '#{pub.type}'. Skipped.}
|
121
|
+
return nil
|
66
122
|
end
|
67
123
|
|
68
|
-
|
69
|
-
|
70
|
-
|
124
|
+
end
|
125
|
+
|
126
|
+
private
|
127
|
+
|
128
|
+
def run_scp
|
129
|
+
pub.copy.each { |c|
|
130
|
+
from, to = *Shellwords.shellwords(c)
|
131
|
+
to = '' if to.nil?
|
132
|
+
to = to[1..-1] if to[0,1] == '/'
|
133
|
+
cmd = "scp -r #{from} #{pub.username}@#{pub.host}:#{pub.root}/#{to}"
|
134
|
+
sh( cmd )
|
135
|
+
}
|
136
|
+
end
|
137
|
+
|
138
|
+
def run_ftp
|
139
|
+
require 'net/ftp'
|
140
|
+
return if $PRETEND
|
141
|
+
Net::FTP.open( pub.host ) do |ftp|
|
142
|
+
ftp.login( pub.username )
|
143
|
+
ftp.chdir( pub.root )
|
144
|
+
|
145
|
+
pub.copy.each { |c|
|
146
|
+
from, to = *Shellwords.shellwords(c)
|
147
|
+
to = '' if to.nil?
|
148
|
+
to = to[1..-1] if to[0,1] == '/'
|
149
|
+
from.sub('*', '**/*') unless from =~ /\*\*/
|
150
|
+
files = FileList.new( from )
|
151
|
+
files.each { |f|
|
152
|
+
t = File.join( to, f.basename )
|
153
|
+
ftp.putbinaryfile( f, t, 1024 )
|
154
|
+
}
|
155
|
+
}
|
71
156
|
end
|
72
157
|
end
|
73
158
|
|