echoe 3.1 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +1 -0
- data/Manifest +8 -0
- data/Rakefile +3 -3
- data/echoe.gemspec +7 -7
- data/lib/echoe.rb +4 -1
- data/lib/echoe/net.rb +7 -0
- data/vendor/rake/MIT-LICENSE +21 -0
- data/vendor/rake/lib/rake/contrib/compositepublisher.rb +24 -0
- data/vendor/rake/lib/rake/contrib/ftptools.rb +153 -0
- data/vendor/rake/lib/rake/contrib/publisher.rb +75 -0
- data/vendor/rake/lib/rake/contrib/rubyforgepublisher.rb +18 -0
- data/vendor/rake/lib/rake/contrib/sshpublisher.rb +43 -0
- data/vendor/rake/lib/rake/contrib/sys.rb +209 -0
- metadata +12 -3
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
data/Manifest
CHANGED
@@ -2,6 +2,7 @@ CHANGELOG
|
|
2
2
|
echoe.gemspec
|
3
3
|
lib/echoe/client.rb
|
4
4
|
lib/echoe/extensions.rb
|
5
|
+
lib/echoe/net.rb
|
5
6
|
lib/echoe/platform.rb
|
6
7
|
lib/echoe/rubygems.rb
|
7
8
|
lib/echoe.rb
|
@@ -11,3 +12,10 @@ MIT-LICENSE
|
|
11
12
|
Rakefile
|
12
13
|
README
|
13
14
|
TODO
|
15
|
+
vendor/rake/lib/rake/contrib/compositepublisher.rb
|
16
|
+
vendor/rake/lib/rake/contrib/ftptools.rb
|
17
|
+
vendor/rake/lib/rake/contrib/publisher.rb
|
18
|
+
vendor/rake/lib/rake/contrib/rubyforgepublisher.rb
|
19
|
+
vendor/rake/lib/rake/contrib/sshpublisher.rb
|
20
|
+
vendor/rake/lib/rake/contrib/sys.rb
|
21
|
+
vendor/rake/MIT-LICENSE
|
data/Rakefile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
require '
|
1
|
+
($:.unshift File.expand_path(File.join( File.dirname(__FILE__), 'lib' ))).uniq!
|
2
|
+
require 'echoe'
|
3
3
|
|
4
4
|
Echoe.new('echoe') do |p|
|
5
5
|
p.project = 'fauna'
|
@@ -7,7 +7,7 @@ Echoe.new('echoe') do |p|
|
|
7
7
|
p.summary = 'A Rubygems packaging tool that provides Rake tasks for documentation, extension compiling, testing, and deployment.'
|
8
8
|
p.url = 'http://blog.evanweaver.com/files/doc/fauna/echoe/'
|
9
9
|
p.docs_host = 'blog.evanweaver.com:~/www/bax/public/files/doc/'
|
10
|
-
p.runtime_dependencies = ['rubyforge >=1.0.
|
10
|
+
p.runtime_dependencies = ['rubyforge >=1.0.2', 'highline']
|
11
11
|
p.development_dependencies = []
|
12
12
|
p.retain_gemspec = true
|
13
13
|
p.require_signed = true
|
data/echoe.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{echoe}
|
5
|
-
s.version = "3.1"
|
5
|
+
s.version = "3.1.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Evan Weaver"]
|
9
9
|
s.cert_chain = ["/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-public_cert.pem"]
|
10
|
-
s.date = %q{2009-02-
|
10
|
+
s.date = %q{2009-02-20}
|
11
11
|
s.description = %q{A Rubygems packaging tool that provides Rake tasks for documentation, extension compiling, testing, and deployment.}
|
12
12
|
s.email = %q{}
|
13
|
-
s.extra_rdoc_files = ["CHANGELOG", "lib/echoe/client.rb", "lib/echoe/extensions.rb", "lib/echoe/platform.rb", "lib/echoe/rubygems.rb", "lib/echoe.rb", "LICENSE", "README", "TODO"]
|
14
|
-
s.files = ["CHANGELOG", "echoe.gemspec", "lib/echoe/client.rb", "lib/echoe/extensions.rb", "lib/echoe/platform.rb", "lib/echoe/rubygems.rb", "lib/echoe.rb", "LICENSE", "Manifest", "MIT-LICENSE", "Rakefile", "README", "TODO"]
|
13
|
+
s.extra_rdoc_files = ["CHANGELOG", "lib/echoe/client.rb", "lib/echoe/extensions.rb", "lib/echoe/net.rb", "lib/echoe/platform.rb", "lib/echoe/rubygems.rb", "lib/echoe.rb", "LICENSE", "README", "TODO"]
|
14
|
+
s.files = ["CHANGELOG", "echoe.gemspec", "lib/echoe/client.rb", "lib/echoe/extensions.rb", "lib/echoe/net.rb", "lib/echoe/platform.rb", "lib/echoe/rubygems.rb", "lib/echoe.rb", "LICENSE", "Manifest", "MIT-LICENSE", "Rakefile", "README", "TODO", "vendor/rake/lib/rake/contrib/compositepublisher.rb", "vendor/rake/lib/rake/contrib/ftptools.rb", "vendor/rake/lib/rake/contrib/publisher.rb", "vendor/rake/lib/rake/contrib/rubyforgepublisher.rb", "vendor/rake/lib/rake/contrib/sshpublisher.rb", "vendor/rake/lib/rake/contrib/sys.rb", "vendor/rake/MIT-LICENSE"]
|
15
15
|
s.has_rdoc = true
|
16
16
|
s.homepage = %q{http://blog.evanweaver.com/files/doc/fauna/echoe/}
|
17
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Echoe", "--main", "README"]
|
@@ -26,14 +26,14 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.specification_version = 2
|
27
27
|
|
28
28
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
29
|
-
s.add_runtime_dependency(%q<rubyforge>, [">= 1.0.
|
29
|
+
s.add_runtime_dependency(%q<rubyforge>, [">= 1.0.2"])
|
30
30
|
s.add_runtime_dependency(%q<highline>, [">= 0"])
|
31
31
|
else
|
32
|
-
s.add_dependency(%q<rubyforge>, [">= 1.0.
|
32
|
+
s.add_dependency(%q<rubyforge>, [">= 1.0.2"])
|
33
33
|
s.add_dependency(%q<highline>, [">= 0"])
|
34
34
|
end
|
35
35
|
else
|
36
|
-
s.add_dependency(%q<rubyforge>, [">= 1.0.
|
36
|
+
s.add_dependency(%q<rubyforge>, [">= 1.0.2"])
|
37
37
|
s.add_dependency(%q<highline>, [">= 0"])
|
38
38
|
end
|
39
39
|
end
|
data/lib/echoe.rb
CHANGED
@@ -5,7 +5,8 @@ require "#{$HERE}/echoe/extensions"
|
|
5
5
|
|
6
6
|
require 'rake'
|
7
7
|
require 'rake/clean'
|
8
|
-
require
|
8
|
+
require "#{$HERE}/../vendor/rake/lib/rake/contrib/compositepublisher"
|
9
|
+
require "#{$HERE}/../vendor/rake/lib/rake/contrib/sshpublisher"
|
9
10
|
require 'rake/gempackagetask'
|
10
11
|
require 'rake/rdoctask'
|
11
12
|
require 'rake/testtask'
|
@@ -13,9 +14,11 @@ require 'rbconfig'
|
|
13
14
|
require 'open-uri'
|
14
15
|
|
15
16
|
require 'rubygems'
|
17
|
+
require 'rubygems/specification'
|
16
18
|
require "#{$HERE}/echoe/rubygems"
|
17
19
|
|
18
20
|
require 'rubyforge'
|
21
|
+
require "#{$HERE}/echoe/net"
|
19
22
|
require "#{$HERE}/echoe/client"
|
20
23
|
|
21
24
|
require 'highline/import'
|
data/lib/echoe/net.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2003, 2004 Jim Weirich
|
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.
|
21
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
module Rake
|
4
|
+
|
5
|
+
# Manage several publishers as a single entity.
|
6
|
+
class CompositePublisher
|
7
|
+
def initialize
|
8
|
+
@publishers = []
|
9
|
+
end
|
10
|
+
|
11
|
+
# Add a publisher to the composite.
|
12
|
+
def add(pub)
|
13
|
+
@publishers << pub
|
14
|
+
end
|
15
|
+
|
16
|
+
# Upload all the individual publishers.
|
17
|
+
def upload
|
18
|
+
@publishers.each { |p| p.upload }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,153 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# = Tools for FTP uploading.
|
4
|
+
#
|
5
|
+
# This file is still under development and is not released for general
|
6
|
+
# use.
|
7
|
+
|
8
|
+
require 'date'
|
9
|
+
require 'net/ftp'
|
10
|
+
|
11
|
+
module Rake # :nodoc:
|
12
|
+
|
13
|
+
####################################################################
|
14
|
+
# <b>Note:</b> <em> Not released for general use.</em>
|
15
|
+
class FtpFile
|
16
|
+
attr_reader :name, :size, :owner, :group, :time
|
17
|
+
|
18
|
+
def self.date
|
19
|
+
@date_class ||= Date
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.time
|
23
|
+
@time_class ||= Time
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize(path, entry)
|
27
|
+
@path = path
|
28
|
+
@mode, line, @owner, @group, size, d1, d2, d3, @name = entry.split(' ')
|
29
|
+
@size = size.to_i
|
30
|
+
@time = determine_time(d1, d2, d3)
|
31
|
+
end
|
32
|
+
|
33
|
+
def path
|
34
|
+
File.join(@path, @name)
|
35
|
+
end
|
36
|
+
|
37
|
+
def directory?
|
38
|
+
@mode[0] == ?d
|
39
|
+
end
|
40
|
+
|
41
|
+
def mode
|
42
|
+
parse_mode(@mode)
|
43
|
+
end
|
44
|
+
|
45
|
+
def symlink?
|
46
|
+
@mode[0] == ?l
|
47
|
+
end
|
48
|
+
|
49
|
+
private # --------------------------------------------------------
|
50
|
+
|
51
|
+
def parse_mode(m)
|
52
|
+
result = 0
|
53
|
+
(1..9).each do |i|
|
54
|
+
result = 2*result + ((m[i]==?-) ? 0 : 1)
|
55
|
+
end
|
56
|
+
result
|
57
|
+
end
|
58
|
+
|
59
|
+
def determine_time(d1, d2, d3)
|
60
|
+
now = self.class.time.now
|
61
|
+
if /:/ =~ d3
|
62
|
+
h, m = d3.split(':')
|
63
|
+
result = Time.parse("#{d1} #{d2} #{now.year} #{d3}")
|
64
|
+
if result > now
|
65
|
+
result = Time.parse("#{d1} #{d2} #{now.year-1} #{d3}")
|
66
|
+
end
|
67
|
+
else
|
68
|
+
result = Time.parse("#{d1} #{d2} #{d3}")
|
69
|
+
end
|
70
|
+
result
|
71
|
+
# elements = ParseDate.parsedate("#{d1} #{d2} #{d3}")
|
72
|
+
# if elements[0].nil?
|
73
|
+
# today = self.class.date.today
|
74
|
+
# if elements[1] > today.month
|
75
|
+
# elements[0] = today.year - 1
|
76
|
+
# else
|
77
|
+
# elements[0] = today.year
|
78
|
+
# end
|
79
|
+
# end
|
80
|
+
# elements = elements.collect { |el| el.nil? ? 0 : el }
|
81
|
+
# Time.mktime(*elements[0,7])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
####################################################################
|
86
|
+
# Manage the uploading of files to an FTP account.
|
87
|
+
class FtpUploader
|
88
|
+
|
89
|
+
# Log uploads to standard output when true.
|
90
|
+
attr_accessor :verbose
|
91
|
+
|
92
|
+
class << FtpUploader
|
93
|
+
# Create an uploader and pass it to the given block as +up+.
|
94
|
+
# When the block is complete, close the uploader.
|
95
|
+
def connect(path, host, account, password)
|
96
|
+
up = self.new(path, host, account, password)
|
97
|
+
begin
|
98
|
+
yield(up)
|
99
|
+
ensure
|
100
|
+
up.close
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Create an FTP uploader targetting the directory +path+ on +host+
|
106
|
+
# using the given account and password. +path+ will be the root
|
107
|
+
# path of the uploader.
|
108
|
+
def initialize(path, host, account, password)
|
109
|
+
@created = Hash.new
|
110
|
+
@path = path
|
111
|
+
@ftp = Net::FTP.new(host, account, password)
|
112
|
+
makedirs(@path)
|
113
|
+
@ftp.chdir(@path)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Create the directory +path+ in the uploader root path.
|
117
|
+
def makedirs(path)
|
118
|
+
route = []
|
119
|
+
File.split(path).each do |dir|
|
120
|
+
route << dir
|
121
|
+
current_dir = File.join(route)
|
122
|
+
if @created[current_dir].nil?
|
123
|
+
@created[current_dir] = true
|
124
|
+
puts "Creating Directory #{current_dir}" if @verbose
|
125
|
+
@ftp.mkdir(current_dir) rescue nil
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# Upload all files matching +wildcard+ to the uploader's root
|
131
|
+
# path.
|
132
|
+
def upload_files(wildcard)
|
133
|
+
Dir[wildcard].each do |fn|
|
134
|
+
upload(fn)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# Close the uploader.
|
139
|
+
def close
|
140
|
+
@ftp.close
|
141
|
+
end
|
142
|
+
|
143
|
+
private # --------------------------------------------------------
|
144
|
+
|
145
|
+
# Upload a single file to the uploader's root path.
|
146
|
+
def upload(file)
|
147
|
+
puts "Uploading #{file}" if @verbose
|
148
|
+
dir = File.dirname(file)
|
149
|
+
makedirs(dir)
|
150
|
+
@ftp.putbinaryfile(file, file) unless File.directory?(file)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright 2003, 2004 by Jim Weirich (jim@weirichhouse.org)
|
4
|
+
# All rights reserved.
|
5
|
+
|
6
|
+
# Permission is granted for use, copying, modification, distribution,
|
7
|
+
# and distribution of modified versions of this work as long as the
|
8
|
+
# above copyright notice is included.
|
9
|
+
|
10
|
+
# Configuration information about an upload host system.
|
11
|
+
# * name :: Name of host system.
|
12
|
+
# * webdir :: Base directory for the web information for the
|
13
|
+
# application. The application name (APP) is appended to
|
14
|
+
# this directory before using.
|
15
|
+
# * pkgdir :: Directory on the host system where packages can be
|
16
|
+
# placed.
|
17
|
+
HostInfo = Struct.new(:name, :webdir, :pkgdir)
|
18
|
+
|
19
|
+
# Manage several publishers as a single entity.
|
20
|
+
class CompositePublisher
|
21
|
+
def initialize
|
22
|
+
@publishers = []
|
23
|
+
end
|
24
|
+
|
25
|
+
# Add a publisher to the composite.
|
26
|
+
def add(pub)
|
27
|
+
@publishers << pub
|
28
|
+
end
|
29
|
+
|
30
|
+
# Upload all the individual publishers.
|
31
|
+
def upload
|
32
|
+
@publishers.each { |p| p.upload }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Publish an entire directory to an existing remote directory using
|
37
|
+
# SSH.
|
38
|
+
class SshDirPublisher
|
39
|
+
def initialize(host, remote_dir, local_dir)
|
40
|
+
@host = host
|
41
|
+
@remote_dir = remote_dir
|
42
|
+
@local_dir = local_dir
|
43
|
+
end
|
44
|
+
|
45
|
+
def upload
|
46
|
+
run %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Publish an entire directory to a fresh remote directory using SSH.
|
51
|
+
class SshFreshDirPublisher < SshDirPublisher
|
52
|
+
def upload
|
53
|
+
run %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil
|
54
|
+
run %{ssh #{@host} mkdir #{@remote_dir}}
|
55
|
+
super
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Publish a list of files to an existing remote directory.
|
60
|
+
class SshFilePublisher
|
61
|
+
# Create a publisher using the give host information.
|
62
|
+
def initialize(host, remote_dir, local_dir, *files)
|
63
|
+
@host = host
|
64
|
+
@remote_dir = remote_dir
|
65
|
+
@local_dir = local_dir
|
66
|
+
@files = files
|
67
|
+
end
|
68
|
+
|
69
|
+
# Upload the local directory to the remote directory.
|
70
|
+
def upload
|
71
|
+
@files.each do |fn|
|
72
|
+
run %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rake/contrib/sshpublisher'
|
4
|
+
|
5
|
+
module Rake
|
6
|
+
|
7
|
+
class RubyForgePublisher < SshDirPublisher
|
8
|
+
attr_reader :project, :proj_id, :user
|
9
|
+
|
10
|
+
def initialize(projname, user)
|
11
|
+
super(
|
12
|
+
"#{user}@rubyforge.org",
|
13
|
+
"/var/www/gforge-projects/#{projname}",
|
14
|
+
"html")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Rake
|
2
|
+
|
3
|
+
# Publish an entire directory to an existing remote directory using
|
4
|
+
# SSH.
|
5
|
+
class SshDirPublisher
|
6
|
+
def initialize(host, remote_dir, local_dir)
|
7
|
+
@host = host
|
8
|
+
@remote_dir = remote_dir
|
9
|
+
@local_dir = local_dir
|
10
|
+
end
|
11
|
+
|
12
|
+
def upload
|
13
|
+
sh %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Publish an entire directory to a fresh remote directory using SSH.
|
18
|
+
class SshFreshDirPublisher < SshDirPublisher
|
19
|
+
def upload
|
20
|
+
sh %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil
|
21
|
+
sh %{ssh #{@host} mkdir #{@remote_dir}}
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Publish a list of files to an existing remote directory.
|
27
|
+
class SshFilePublisher
|
28
|
+
# Create a publisher using the give host information.
|
29
|
+
def initialize(host, remote_dir, local_dir, *files)
|
30
|
+
@host = host
|
31
|
+
@remote_dir = remote_dir
|
32
|
+
@local_dir = local_dir
|
33
|
+
@files = files
|
34
|
+
end
|
35
|
+
|
36
|
+
# Upload the local directory to the remote directory.
|
37
|
+
def upload
|
38
|
+
@files.each do |fn|
|
39
|
+
sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,209 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2003, 2004 Jim Weirich
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
#++
|
25
|
+
#
|
26
|
+
begin
|
27
|
+
require 'ftools'
|
28
|
+
rescue LoadError
|
29
|
+
end
|
30
|
+
require 'rbconfig'
|
31
|
+
|
32
|
+
######################################################################
|
33
|
+
# Sys provides a number of file manipulation tools for the convenience
|
34
|
+
# of writing Rakefiles. All commands in this module will announce
|
35
|
+
# their activity on standard output if the $verbose flag is set
|
36
|
+
# ($verbose = true is the default). You can control this by globally
|
37
|
+
# setting $verbose or by using the +verbose+ and +quiet+ methods.
|
38
|
+
#
|
39
|
+
# Sys has been deprecated in favor of the FileUtils module available
|
40
|
+
# in Ruby 1.8.
|
41
|
+
#
|
42
|
+
module Sys
|
43
|
+
RUBY = Config::CONFIG['ruby_install_name']
|
44
|
+
|
45
|
+
# Install all the files matching +wildcard+ into the +dest_dir+
|
46
|
+
# directory. The permission mode is set to +mode+.
|
47
|
+
def install(wildcard, dest_dir, mode)
|
48
|
+
Dir[wildcard].each do |fn|
|
49
|
+
File.install(fn, dest_dir, mode, $verbose)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Run the system command +cmd+.
|
54
|
+
def run(cmd)
|
55
|
+
log cmd
|
56
|
+
system(cmd) or fail "Command Failed: [#{cmd}]"
|
57
|
+
end
|
58
|
+
|
59
|
+
# Run a Ruby interpreter with the given arguments.
|
60
|
+
def ruby(*args)
|
61
|
+
run "#{RUBY} #{args.join(' ')}"
|
62
|
+
end
|
63
|
+
|
64
|
+
# Copy a single file from +file_name+ to +dest_file+.
|
65
|
+
def copy(file_name, dest_file)
|
66
|
+
log "Copying file #{file_name} to #{dest_file}"
|
67
|
+
File.copy(file_name, dest_file)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Copy all files matching +wildcard+ into the directory +dest_dir+.
|
71
|
+
def copy_files(wildcard, dest_dir)
|
72
|
+
for_matching_files(wildcard, dest_dir) { |from, to| copy(from, to) }
|
73
|
+
end
|
74
|
+
|
75
|
+
# Link +file_name+ to +dest_file+.
|
76
|
+
def link(file_name, dest_file)
|
77
|
+
log "Linking file #{file_name} to #{dest_file}"
|
78
|
+
File.link(file_name, dest_file)
|
79
|
+
end
|
80
|
+
|
81
|
+
# Link all files matching +wildcard+ into the directory +dest_dir+.
|
82
|
+
def link_files(wildcard, dest_dir)
|
83
|
+
for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }
|
84
|
+
end
|
85
|
+
|
86
|
+
# Symlink +file_name+ to +dest_file+.
|
87
|
+
def symlink(file_name, dest_file)
|
88
|
+
log "Symlinking file #{file_name} to #{dest_file}"
|
89
|
+
File.symlink(file_name, dest_file)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Symlink all files matching +wildcard+ into the directory +dest_dir+.
|
93
|
+
def symlink_files(wildcard, dest_dir)
|
94
|
+
for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }
|
95
|
+
end
|
96
|
+
|
97
|
+
# Remove all files matching +wildcard+. If a matching file is a
|
98
|
+
# directory, it must be empty to be removed. used +delete_all+ to
|
99
|
+
# recursively delete directories.
|
100
|
+
def delete(*wildcards)
|
101
|
+
wildcards.each do |wildcard|
|
102
|
+
Dir[wildcard].each do |fn|
|
103
|
+
if File.directory?(fn)
|
104
|
+
log "Deleting directory #{fn}"
|
105
|
+
Dir.delete(fn)
|
106
|
+
else
|
107
|
+
log "Deleting file #{fn}"
|
108
|
+
File.delete(fn)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# Recursively delete all files and directories matching +wildcard+.
|
115
|
+
def delete_all(*wildcards)
|
116
|
+
wildcards.each do |wildcard|
|
117
|
+
Dir[wildcard].each do |fn|
|
118
|
+
next if ! File.exist?(fn)
|
119
|
+
if File.directory?(fn)
|
120
|
+
Dir["#{fn}/*"].each do |subfn|
|
121
|
+
next if subfn=='.' || subfn=='..'
|
122
|
+
delete_all(subfn)
|
123
|
+
end
|
124
|
+
log "Deleting directory #{fn}"
|
125
|
+
Dir.delete(fn)
|
126
|
+
else
|
127
|
+
log "Deleting file #{fn}"
|
128
|
+
File.delete(fn)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# Make the directories given in +dirs+.
|
135
|
+
def makedirs(*dirs)
|
136
|
+
dirs.each do |fn|
|
137
|
+
log "Making directory #{fn}"
|
138
|
+
File.makedirs(fn)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# Make +dir+ the current working directory for the duration of
|
143
|
+
# executing the given block.
|
144
|
+
def indir(dir)
|
145
|
+
olddir = Dir.pwd
|
146
|
+
Dir.chdir(dir)
|
147
|
+
yield
|
148
|
+
ensure
|
149
|
+
Dir.chdir(olddir)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Split a file path into individual directory names.
|
153
|
+
#
|
154
|
+
# For example:
|
155
|
+
# split_all("a/b/c") => ['a', 'b', 'c']
|
156
|
+
def split_all(path)
|
157
|
+
head, tail = File.split(path)
|
158
|
+
return [tail] if head == '.' || tail == '/'
|
159
|
+
return [head, tail] if head == '/'
|
160
|
+
return split_all(head) + [tail]
|
161
|
+
end
|
162
|
+
|
163
|
+
# Write a message to standard out if $verbose is enabled.
|
164
|
+
def log(msg)
|
165
|
+
print " " if $trace && $verbose
|
166
|
+
puts msg if $verbose
|
167
|
+
end
|
168
|
+
|
169
|
+
# Perform a block with $verbose disabled.
|
170
|
+
def quiet(&block)
|
171
|
+
with_verbose(false, &block)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Perform a block with $verbose enabled.
|
175
|
+
def verbose(&block)
|
176
|
+
with_verbose(true, &block)
|
177
|
+
end
|
178
|
+
|
179
|
+
# Perform a block with each file matching a set of wildcards.
|
180
|
+
def for_files(*wildcards)
|
181
|
+
wildcards.each do |wildcard|
|
182
|
+
Dir[wildcard].each do |fn|
|
183
|
+
yield(fn)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
extend(self)
|
189
|
+
|
190
|
+
private # ----------------------------------------------------------
|
191
|
+
|
192
|
+
def for_matching_files(wildcard, dest_dir)
|
193
|
+
Dir[wildcard].each do |fn|
|
194
|
+
dest_file = File.join(dest_dir, fn)
|
195
|
+
parent = File.dirname(dest_file)
|
196
|
+
makedirs(parent) if ! File.directory?(parent)
|
197
|
+
yield(fn, dest_file)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
def with_verbose(v)
|
202
|
+
oldverbose = $verbose
|
203
|
+
$verbose = v
|
204
|
+
yield
|
205
|
+
ensure
|
206
|
+
$verbose = oldverbose
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: echoe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Weaver
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
yZ0=
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
|
33
|
-
date: 2009-02-
|
33
|
+
date: 2009-02-20 00:00:00 -08:00
|
34
34
|
default_executable:
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
requirements:
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: 1.0.
|
44
|
+
version: 1.0.2
|
45
45
|
version:
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: highline
|
@@ -63,6 +63,7 @@ extra_rdoc_files:
|
|
63
63
|
- CHANGELOG
|
64
64
|
- lib/echoe/client.rb
|
65
65
|
- lib/echoe/extensions.rb
|
66
|
+
- lib/echoe/net.rb
|
66
67
|
- lib/echoe/platform.rb
|
67
68
|
- lib/echoe/rubygems.rb
|
68
69
|
- lib/echoe.rb
|
@@ -74,6 +75,7 @@ files:
|
|
74
75
|
- echoe.gemspec
|
75
76
|
- lib/echoe/client.rb
|
76
77
|
- lib/echoe/extensions.rb
|
78
|
+
- lib/echoe/net.rb
|
77
79
|
- lib/echoe/platform.rb
|
78
80
|
- lib/echoe/rubygems.rb
|
79
81
|
- lib/echoe.rb
|
@@ -83,6 +85,13 @@ files:
|
|
83
85
|
- Rakefile
|
84
86
|
- README
|
85
87
|
- TODO
|
88
|
+
- vendor/rake/lib/rake/contrib/compositepublisher.rb
|
89
|
+
- vendor/rake/lib/rake/contrib/ftptools.rb
|
90
|
+
- vendor/rake/lib/rake/contrib/publisher.rb
|
91
|
+
- vendor/rake/lib/rake/contrib/rubyforgepublisher.rb
|
92
|
+
- vendor/rake/lib/rake/contrib/sshpublisher.rb
|
93
|
+
- vendor/rake/lib/rake/contrib/sys.rb
|
94
|
+
- vendor/rake/MIT-LICENSE
|
86
95
|
has_rdoc: true
|
87
96
|
homepage: http://blog.evanweaver.com/files/doc/fauna/echoe/
|
88
97
|
post_install_message:
|
metadata.gz.sig
CHANGED
Binary file
|