diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-04 12:31:31 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-04 12:31:31 +0000 |
commit | c4ee0df8ba2cf7cc6aaa785c8df20a91b1719021 (patch) | |
tree | 06beca468cce4a75a3e9890d18aa001ef2c41e54 /lib/rake/contrib | |
parent | 8c0b2a286080609613b6b007e030ff7c7adaa23c (diff) | |
download | ruby-c4ee0df8ba2cf7cc6aaa785c8df20a91b1719021.tar.gz |
* lib/rake/*: Gemify rake [fix GH-862][Feature #11025]
* test/rake/*: ditto.
* tool/rbinstall.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rake/contrib')
-rw-r--r-- | lib/rake/contrib/.document | 1 | ||||
-rw-r--r-- | lib/rake/contrib/compositepublisher.rb | 21 | ||||
-rw-r--r-- | lib/rake/contrib/ftptools.rb | 137 | ||||
-rw-r--r-- | lib/rake/contrib/publisher.rb | 81 | ||||
-rw-r--r-- | lib/rake/contrib/rubyforgepublisher.rb | 18 | ||||
-rw-r--r-- | lib/rake/contrib/sshpublisher.rb | 61 | ||||
-rw-r--r-- | lib/rake/contrib/sys.rb | 4 |
7 files changed, 0 insertions, 323 deletions
diff --git a/lib/rake/contrib/.document b/lib/rake/contrib/.document deleted file mode 100644 index 8b13789179..0000000000 --- a/lib/rake/contrib/.document +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lib/rake/contrib/compositepublisher.rb b/lib/rake/contrib/compositepublisher.rb deleted file mode 100644 index 69952a0808..0000000000 --- a/lib/rake/contrib/compositepublisher.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Rake - - # Manage several publishers as a single entity. - class CompositePublisher - def initialize - @publishers = [] - end - - # Add a publisher to the composite. - def add(pub) - @publishers << pub - end - - # Upload all the individual publishers. - def upload - @publishers.each { |p| p.upload } - end - end - -end - diff --git a/lib/rake/contrib/ftptools.rb b/lib/rake/contrib/ftptools.rb deleted file mode 100644 index b178523bc6..0000000000 --- a/lib/rake/contrib/ftptools.rb +++ /dev/null @@ -1,137 +0,0 @@ -# = Tools for FTP uploading. -# -# This file is still under development and is not released for general -# use. - -require 'date' -require 'net/ftp' -require 'rake/file_list' - -module Rake # :nodoc: - - class FtpFile # :nodoc: all - attr_reader :name, :size, :owner, :group, :time - - def self.date - @date_class ||= Date - end - - def self.time - @time_class ||= Time - end - - def initialize(path, entry) - @path = path - @mode, _, @owner, @group, size, d1, d2, d3, @name = entry.split(' ') - @size = size.to_i - @time = determine_time(d1, d2, d3) - end - - def path - File.join(@path, @name) - end - - def directory? - @mode[0] == ?d - end - - def mode - parse_mode(@mode) - end - - def symlink? - @mode[0] == ?l - end - - private # -------------------------------------------------------- - - def parse_mode(m) - result = 0 - (1..9).each do |i| - result = 2 * result + ((m[i] == ?-) ? 0 : 1) - end - result - end - - def determine_time(d1, d2, d3) - now = self.class.time.now - if /:/ !~ d3 - result = Time.parse("#{d1} #{d2} #{d3}") - else - result = Time.parse("#{d1} #{d2} #{now.year} #{d3}") - result = Time.parse("#{d1} #{d2} #{now.year - 1} #{d3}") if - result > now - end - result - end - end - - ## - # Manage the uploading of files to an FTP account. - class FtpUploader # :nodoc: - - # Log uploads to standard output when true. - attr_accessor :verbose - - class << FtpUploader - # Create an uploader and pass it to the given block as +up+. - # When the block is complete, close the uploader. - def connect(path, host, account, password) - up = self.new(path, host, account, password) - begin - yield(up) - ensure - up.close - end - end - end - - # Create an FTP uploader targeting the directory +path+ on +host+ - # using the given account and password. +path+ will be the root - # path of the uploader. - def initialize(path, host, account, password) - @created = Hash.new - @path = path - @ftp = Net::FTP.new(host, account, password) - makedirs(@path) - @ftp.chdir(@path) - end - - # Create the directory +path+ in the uploader root path. - def makedirs(path) - route = [] - File.split(path).each do |dir| - route << dir - current_dir = File.join(route) - if @created[current_dir].nil? - @created[current_dir] = true - $stderr.puts "Creating Directory #{current_dir}" if @verbose - @ftp.mkdir(current_dir) rescue nil - end - end - end - - # Upload all files matching +wildcard+ to the uploader's root - # path. - def upload_files(wildcard) - FileList.glob(wildcard).each do |fn| - upload(fn) - end - end - - # Close the uploader. - def close - @ftp.close - end - - private # -------------------------------------------------------- - - # Upload a single file to the uploader's root path. - def upload(file) - $stderr.puts "Uploading #{file}" if @verbose - dir = File.dirname(file) - makedirs(dir) - @ftp.putbinaryfile(file, file) unless File.directory?(file) - end - end -end diff --git a/lib/rake/contrib/publisher.rb b/lib/rake/contrib/publisher.rb deleted file mode 100644 index f4ee1abf86..0000000000 --- a/lib/rake/contrib/publisher.rb +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com) -# All rights reserved. - -# :stopdoc: - -# Configuration information about an upload host system. -# name :: Name of host system. -# webdir :: Base directory for the web information for the -# application. The application name (APP) is appended to -# this directory before using. -# pkgdir :: Directory on the host system where packages can be -# placed. -HostInfo = Struct.new(:name, :webdir, :pkgdir) - -# :startdoc: - -# TODO: Move to contrib/sshpublisher -#-- -# Manage several publishers as a single entity. -class CompositePublisher # :nodoc: - def initialize - @publishers = [] - end - - # Add a publisher to the composite. - def add(pub) - @publishers << pub - end - - # Upload all the individual publishers. - def upload - @publishers.each { |p| p.upload } - end -end - -# TODO: Remove in Rake 11, duplicated -#-- -# Publish an entire directory to an existing remote directory using -# SSH. -class SshDirPublisher # :nodoc: all - def initialize(host, remote_dir, local_dir) - @host = host - @remote_dir = remote_dir - @local_dir = local_dir - end - - def upload - run %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}} - end -end - -# TODO: Remove in Rake 11, duplicated -#-- -# Publish an entire directory to a fresh remote directory using SSH. -class SshFreshDirPublisher < SshDirPublisher # :nodoc: all - def upload - run %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil - run %{ssh #{@host} mkdir #{@remote_dir}} - super - end -end - -# TODO: Remove in Rake 11, duplicated -#-- -# Publish a list of files to an existing remote directory. -class SshFilePublisher # :nodoc: all - # Create a publisher using the give host information. - def initialize(host, remote_dir, local_dir, *files) - @host = host - @remote_dir = remote_dir - @local_dir = local_dir - @files = files - end - - # Upload the local directory to the remote directory. - def upload - @files.each do |fn| - run %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}} - end - end -end diff --git a/lib/rake/contrib/rubyforgepublisher.rb b/lib/rake/contrib/rubyforgepublisher.rb deleted file mode 100644 index 00889ad7b9..0000000000 --- a/lib/rake/contrib/rubyforgepublisher.rb +++ /dev/null @@ -1,18 +0,0 @@ -# TODO: Remove in Rake 11 - -require 'rake/contrib/sshpublisher' - -module Rake - - class RubyForgePublisher < SshDirPublisher # :nodoc: all - attr_reader :project, :proj_id, :user - - def initialize(projname, user) - super( - "#{user}@rubyforge.org", - "/var/www/gforge-projects/#{projname}", - "html") - end - end - -end diff --git a/lib/rake/contrib/sshpublisher.rb b/lib/rake/contrib/sshpublisher.rb deleted file mode 100644 index 64f577017c..0000000000 --- a/lib/rake/contrib/sshpublisher.rb +++ /dev/null @@ -1,61 +0,0 @@ -require 'rake/dsl_definition' -require 'rake/contrib/compositepublisher' - -module Rake - - # Publish an entire directory to an existing remote directory using - # SSH. - class SshDirPublisher - include Rake::DSL - - # Creates an SSH publisher which will scp all files in +local_dir+ to - # +remote_dir+ on +host+ - - def initialize(host, remote_dir, local_dir) - @host = host - @remote_dir = remote_dir - @local_dir = local_dir - end - - # Uploads the files - - def upload - sh "scp", "-rq", "#{@local_dir}/*", "#{@host}:#{@remote_dir}" - end - end - - # Publish an entire directory to a fresh remote directory using SSH. - class SshFreshDirPublisher < SshDirPublisher - - # Uploads the files after removing the existing remote directory. - - def upload - sh "ssh", @host, "rm", "-rf", @remote_dir rescue nil - sh "ssh", @host, "mkdir", @remote_dir - super - end - end - - # Publish a list of files to an existing remote directory. - class SshFilePublisher - include Rake::DSL - - # Creates an SSH publisher which will scp all +files+ in +local_dir+ to - # +remote_dir+ on +host+. - - def initialize(host, remote_dir, local_dir, *files) - @host = host - @remote_dir = remote_dir - @local_dir = local_dir - @files = files - end - - # Uploads the files - - def upload - @files.each do |fn| - sh "scp", "-q", "#{@local_dir}/#{fn}", "#{@host}:#{@remote_dir}" - end - end - end -end diff --git a/lib/rake/contrib/sys.rb b/lib/rake/contrib/sys.rb deleted file mode 100644 index 8d4c735434..0000000000 --- a/lib/rake/contrib/sys.rb +++ /dev/null @@ -1,4 +0,0 @@ -# TODO: Remove in Rake 11 - -fail "ERROR: 'rake/contrib/sys' is obsolete and no longer supported. " + - "Use 'FileUtils' instead." |