Added: dev/buildr/1.5.4/site/rdoc/Rake/FileTask.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/Rake/FileTask.html (added) +++ dev/buildr/1.5.4/site/rdoc/Rake/FileTask.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,249 @@ + + + + + + +class Rake::FileTask - buildr + + + + + + + + + + + + + + +
+

+ class Rake::FileTask +

+ +
+ +
+ + + + +
+ + + + + + + + + +
+
+

Public Instance Methods

+
+ + +
+ + +
+ + contain?(pattern*) → boolean + + + click to toggle source + +
+ +
+ + contain?(file*) → boolean + + +
+ + + +
+ +

For a file, returns true if the file content matches against all the +arguments. An argument may be a string or regular expression.

+ +

For a directory, return true if the directory contains the specified files. +You can use relative file names and glob patterns (using *, **, etc).

+ + + + +
+
# File lib/buildr/core/checks.rb, line 234
+def contain?(*patterns)
+  if File.directory?(name)
+    patterns.map { |pattern| "#{name}/#{pattern}" }.all? { |pattern| !Dir[pattern].empty? }
+  else
+    contents = File.read(name)
+    patterns.map { |pattern| Regexp === pattern ? pattern : Regexp.new(Regexp.escape(pattern.to_s)) }.
+      all? { |pattern| contents =~ pattern }
+  end
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + empty?() → boolean + + + click to toggle source + +
+ + + +
+ +

Returns true if file/directory is empty.

+ + + + +
+
# File lib/buildr/core/checks.rb, line 221
+def empty?()
+  File.directory?(name) ? Dir.glob("#{name}/*").empty? : File.read(name).empty?
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + exist?() → boolean + + + click to toggle source + +
+ + + +
+ +

Returns true if this file exists.

+ + + + +
+
# File lib/buildr/core/checks.rb, line 213
+def exist?()
+  File.exist?(name)
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.4/site/rdoc/RbConfig.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/RbConfig.html (added) +++ dev/buildr/1.5.4/site/rdoc/RbConfig.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,95 @@ + + + + + + +module RbConfig - buildr + + + + + + + + + + + + + + +
+

+ module RbConfig +

+ +
+ +
+ + + + +
+ + + + + + + + + +
+
+ + + + Added: dev/buildr/1.5.4/site/rdoc/URI.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/URI.html (added) +++ dev/buildr/1.5.4/site/rdoc/URI.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,342 @@ + + + + + + +module URI - buildr + + + + + + + + + + + + + + +
+

+ module URI +

+ +
+ +

Not quite open-uri, but similar. Provides read and write methods for the +resource represented by the URI. Currently supports +reads for URI::HTTP and writes for URI::SFTP. Also provides convenience +methods for downloads and uploads.

+ +
+ + + + +
+ + + + + + + + + +
+
+

Public Class Methods

+
+ + +
+ + +
+ + download(uri, target, options?) + + + click to toggle source + +
+ + + +
+ +

Downloads the resource to the target.

+ +

The target may be a file name (string or task), in which case the file is +created from the resource. The target may also be any object that responds +to write, e.g. File, StringIO, Pipe.

+ +

Use the progress bar when running in verbose mode.

+ + + + +
+
# File lib/buildr/core/transports.rb, line 71
+def download(uri, target, options = nil)
+  uri = URI.parse(uri.to_s) unless URI === uri
+  uri.download target, options
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + read(uri, options?) → content + + + click to toggle source + +
+ +
+ + read(uri, options?) { |chunk| ... } + + +
+ + + +
+ +

Reads from the resource behind this URI. The first +form returns the content of the resource, the second form yields to the +block with each chunk of content (usually more than one).

+ +

For example:

+ +
File.open 'image.jpg', 'w' do |file|
+  URI.read('http://example.com/image.jpg') { |chunk| file.write chunk }
+end
+
+ +

Shorter version:

+ +
File.open('image.jpg', 'w') { |file| file.write URI.read('http://example.com/image.jpg') }
+
+ +

Supported options:

+
  • +

    :modified – Only download if file modified since this timestamp. Returns +nil if not modified.

    +
  • +

    :progress – Show the progress bar while reading.

    +
+ + + + +
+
# File lib/buildr/core/transports.rb, line 57
+def read(uri, options = nil, &block)
+  uri = URI.parse(uri.to_s) unless URI === uri
+  uri.read options, &block
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + upload(uri, source, options?) + + + click to toggle source + +
+ + + +
+ +

Uploads from source to the resource.

+ +

The source may be a file name (string or task), in which case the file is +uploaded to the resource. The source may also be any object that responds +to read (and optionally size), e.g. File, StringIO, Pipe.

+ +

Use the progress bar when running in verbose mode.

+ + + + +
+
# File lib/buildr/core/transports.rb, line 107
+def upload(uri, source, options = nil)
+  uri = URI.parse(uri.to_s) unless URI === uri
+  uri.upload source, options
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + write(uri, content, options?) + + + click to toggle source + +
+ +
+ + write(uri, options?) { |bytes| .. } + + +
+ + + +
+ +

Writes to the resource behind the URI. The first +form writes the content from a string or an object that responds to +read and optionally size. The second form writes +the content by yielding to the block. Each yield should return up to the +specified number of bytes, the last yield returns nil.

+ +

For example:

+ +
File.open 'killer-app.jar', 'rb' do |file|
+  write('sftp://localhost/jars/killer-app.jar') { |chunk| file.read(chunk) }
+end
+
+ +

Or:

+ +
write 'sftp://localhost/jars/killer-app.jar', File.read('killer-app.jar')
+
+ +

Supported options:

+
  • +

    :progress – Show the progress bar while reading.

    +
+ + + + +
+
# File lib/buildr/core/transports.rb, line 93
+def write(uri, *args, &block)
+  uri = URI.parse(uri.to_s) unless URI === uri
+  uri.write *args, &block
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.4/site/rdoc/URI/FILE.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/URI/FILE.html (added) +++ dev/buildr/1.5.4/site/rdoc/URI/FILE.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,327 @@ + + + + + + +class URI::FILE - buildr + + + + + + + + + + + + + + +
+

+ class URI::FILE +

+ +
+ +

File URL. Keep in mind that file URLs take the +form of file://host/path, although the host is not used, so +typically all you will see are three backslashes. This methods accept +common variants, like file:/path but always returns a valid +URL.

+ +
+ + + + +
+ + + + + +
+
+

Constants

+
+
+ +
COMPONENT + +
+ + +
+
+ + + + + +
+
+

Public Class Methods

+
+ + +
+ +
+ new(*args) + + click to toggle source + +
+ + +
+ + + + +
+ Calls superclass method + +
+ + + +
+
# File lib/buildr/core/transports.rb, line 499
+def initialize(*args)
+  super
+  # file:something (opaque) becomes file:///something
+  if path.nil?
+    set_path "/#{opaque}"
+    unless opaque.nil?
+      set_opaque nil
+      warn "#{caller[2]}: We'll accept this URL, but just so you know, it needs three slashes, as in: #{to_s}"
+    end
+  end
+  # Sadly, file://something really means file://something/ (something being server)
+  set_path '/' if path.empty?
+
+  # On windows, file://c:/something is not a valid URL, but people do it anyway, so if we see a drive-as-host,
+  # we'll just be nice enough to fix it. (URI actually strips the colon here)
+  if host =~ /^[a-zA-Z]$/
+    set_path "/#{host}:#{path}"
+    set_host nil
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+
+

Public Instance Methods

+
+ + +
+ +
+ read(options = nil, &block) + + click to toggle source + +
+ + +
+ +

See URI::Generic#read

+ + + + +
+
# File lib/buildr/core/transports.rb, line 521
+def read(options = nil, &block)
+  options ||= {}
+  raise ArgumentError, 'Either you\re attempting to read a file from another host (which we don\t support), or you used two slashes by mistake, where you should have file:///<path>.' if host
+
+  path = real_path
+  # TODO: complain about clunky URLs
+  raise NotFoundError, "Looking for #{self} and can't find it." unless File.exists?(path)
+  raise NotFoundError, "Looking for the file #{self}, and it happens to be a directory." if File.directory?(path)
+  File.open path, 'rb' do |input|
+    with_progress_bar options[:progress], path.split('/').last, input.stat.size do |progress|
+      block ? block.call(input.read) : input.read
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ to_s() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/core/transports.rb, line 536
+def to_s
+  "file://#{host}#{path}"
+end
+
+ +
+ + + + +
+ + +
+ +
+ upload(source, options = nil) + + click to toggle source + +
+ + +
+ + + + +
+ Calls superclass method + URI::Generic#upload +
+ + + +
+
# File lib/buildr/core/transports.rb, line 492
+def upload(source, options = nil)
+  super
+  if File === source then
+    File.chmod(source.stat.mode, real_path)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.4/site/rdoc/URI/Generic.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/URI/Generic.html (added) +++ dev/buildr/1.5.4/site/rdoc/URI/Generic.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,423 @@ + + + + + + +class URI::Generic - buildr + + + + + + + + + + + + + + +
+

+ class URI::Generic +

+ +
+ +
+ + + + +
+ + + + + + + + + +
+
+

Public Instance Methods

+
+ + +
+ + +
+ + download(target, options?) + + + click to toggle source + +
+ + + +
+ +

Downloads the resource to the target.

+ +

The target may be a file name (string or task), in which case the file is +created from the resource. The target may also be any object that responds +to write, e.g. File, StringIO, +Pipe.

+ +

Use the progress bar when running in verbose mode.

+ + + + +
+
# File lib/buildr/core/transports.rb, line 137
+def download(target, options = nil)
+  case target
+  when Rake::Task
+    download target.name, options
+  when String
+    # If download breaks we end up with a partial file which is
+    # worse than not having a file at all, so download to temporary
+    # file and then move over.
+    modified = File.stat(target).mtime if File.exist?(target)
+    temp = Tempfile.new(File.basename(target))
+    temp.binmode
+    written = false
+    read({:progress=>verbose}.merge(options || {}).merge(:modified=>modified)) { |chunk| written = true; temp.write chunk }
+    temp.close
+    mkpath File.dirname(target)
+    # Only attempt to override file if it was actually written to, i.e. "HTTP Not Modified" was not returned.
+    mv temp.path, target if written
+  when File
+    read({:progress=>verbose}.merge(options || {}).merge(:modified=>target.mtime)) { |chunk| target.write chunk }
+    target.flush
+  else
+    raise ArgumentError, 'Expecting a target that is either a file name (string, task) or object that responds to write (file, pipe).' unless target.respond_to?(:write)
+    read({:progress=>verbose}.merge(options || {})) { |chunk| target.write chunk }
+    target.flush
+  end
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + read(options?) → content + + + click to toggle source + +
+ +
+ + read(options?) { |chunk| ... } + + +
+ + + +
+ +

Reads from the resource behind this URI. The +first form returns the content of the resource, the second form yields to +the block with each chunk of content (usually more than one).

+ +

For options, see URI.read.

+ + + + +
+
# File lib/buildr/core/transports.rb, line 124
+def read(options = nil, &block)
+  fail 'This protocol doesn\t support reading (yet, how about helping by implementing it?)'
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + upload(source, options?) + + + click to toggle source + +
+ + + +
+ +

Uploads from source to the resource.

+ +

The source may be a file name (string or task), in which case the file is +uploaded to the resource. If the source is a directory, uploads all files +inside the directory (including nested directories). The source may also be +any object that responds to read (and optionally +size), e.g. File, StringIO, Pipe.

+ +

Use the progress bar when running in verbose mode.

+ + + + +
+
# File lib/buildr/core/transports.rb, line 199
+def upload(source, options = nil)
+  source = source.name if Rake::Task === source
+  options ||= {}
+  if String === source
+    raise NotFoundError, 'No source file/directory to upload.' unless File.exist?(source)
+    if File.directory?(source)
+      Dir.glob("#{source}/**/*").reject { |file| File.directory?(file) }.each do |file|
+        uri = self + (File.join(self.path, file.sub(source, '')))
+        uri.upload file, {:digests=>[]}.merge(options)
+      end
+    else
+      File.open(source, 'rb') { |input| upload input, options }
+    end
+  elsif source.respond_to?(:read)
+    digests = (options[:digests] || [:md5, :sha1]).
+      inject({}) { |hash, name| hash[name] = Digest.const_get(name.to_s.upcase).new ; hash }
+    size = source.stat.size rescue nil
+    write (options).merge(:progress=>verbose && size, :size=>size) do |bytes|
+      source.read(bytes).tap do |chunk|
+        digests.values.each { |digest| digest << chunk } if chunk
+      end
+    end
+    digests.each do |key, digest|
+      self.merge("#{self.path}.#{key}").write digest.hexdigest,
+        (options).merge(:progress=>false)
+    end
+  else
+    raise ArgumentError, 'Expecting source to be a file name (string, task) or any object that responds to read (file, pipe).'
+  end
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + write(content, options?) + + + click to toggle source + +
+ +
+ + write(options?) { |bytes| .. } + + +
+ + + +
+ +

Writes to the resource behind the URI. The first +form writes the content from a string or an object that responds to +read and optionally size. The second form writes +the content by yielding to the block. Each yield should return up to the +specified number of bytes, the last yield returns nil.

+ +

For options, see URI.write.

+ + + + +
+
# File lib/buildr/core/transports.rb, line 173
+def write(*args, &block)
+  options = args.pop if Hash === args.last
+  options ||= {}
+  if String === args.first
+    ios = StringIO.new(args.first, 'r')
+    write(options.merge(:size=>args.first.size)) { |bytes| ios.read(bytes) }
+  elsif args.first.respond_to?(:read)
+    size = args.first.size rescue nil
+    write({:size=>size}.merge(options)) { |bytes| args.first.read(bytes) }
+  elsif args.empty? && block
+    write_internal options, &block
+  else
+    raise ArgumentError, 'Either give me the content, or pass me a block, otherwise what would I upload?'
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+
+

Protected Instance Methods

+
+ + +
+ + +
+ + proxy_uri → URI? + + + click to toggle source + +
+ + + +
+ +

Returns the proxy server to use. Obtains the proxy from the relevant +environment variable (e.g. HTTP_PROXY). Supports exclusions based on host +name and port number from environment variable NO_PROXY.

+ + + + +
+
# File lib/buildr/core/transports.rb, line 254
+def proxy_uri
+  proxy = ENV["#{scheme.upcase}_PROXY"]
+  proxy = URI.parse(proxy) if String === proxy
+  excludes = ENV['NO_PROXY'].to_s.split(/\s*,\s*/).compact
+  excludes = excludes.map { |exclude| exclude =~ /:\d+$/ ? exclude : "#{exclude}:*" }
+  return proxy unless excludes.any? { |exclude| File.fnmatch(exclude, "#{host}:#{port}") }
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.4/site/rdoc/URI/NotFoundError.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/URI/NotFoundError.html (added) +++ dev/buildr/1.5.4/site/rdoc/URI/NotFoundError.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,104 @@ + + + + + + +class URI::NotFoundError - buildr + + + + + + + + + + + + + + +
+

+ class URI::NotFoundError +

+ +
+ +

Raised when trying to read/download a resource that doesn't exist.

+ +
+ + + + +
+ + + + + + + + + +
+
+ + + + Added: dev/buildr/1.5.4/site/rdoc/Zip.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/Zip.html (added) +++ dev/buildr/1.5.4/site/rdoc/Zip.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,95 @@ + + + + + + +module Zip - buildr + + + + + + + + + + + + + + +
+

+ module Zip +

+ +
+ +
+ + + + +
+ + + + + + + + + +
+
+ + + + Added: dev/buildr/1.5.4/site/rdoc/Zip/Entry.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/Zip/Entry.html (added) +++ dev/buildr/1.5.4/site/rdoc/Zip/Entry.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,235 @@ + + + + + + +class Zip::Entry - buildr + + + + + + + + + + + + + + +
+

+ class Zip::Entry +

+ +
+ +
+ + + + +
+ + + + + + + + + +
+
+

Public Instance Methods

+
+ + +
+ + +
+ + contain(patterns*) → boolean + + + click to toggle source + +
+ + + +
+ +

Returns true if this ZIP file entry matches against all the arguments. An +argument may be a string or regular expression.

+ + + + +
+
# File lib/buildr/packaging/zip.rb, line 79
+def contain?(*patterns)
+  content = File.open(zipfile) { |zip| zip.read(@name) }
+  patterns.map { |pattern| Regexp === pattern ? pattern : Regexp.new(Regexp.escape(pattern.to_s)) }.
+    all? { |pattern| content =~ pattern }
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + empty?() → boolean + + + click to toggle source + +
+ + + +
+ +

Returns true if this entry is empty.

+ + + + +
+
# File lib/buildr/packaging/zip.rb, line 70
+def empty?()
+  File.open(zipfile) { |zip| zip.read(@name) }.empty?
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + exist() → boolean + + + click to toggle source + +
+ + + +
+ +

Returns true if this entry exists.

+ + + + +
+
# File lib/buildr/packaging/zip.rb, line 62
+def exist?()
+  File.open(zipfile) { |zip| zip.exist?(@name) }
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.4/site/rdoc/Zip/File.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/Zip/File.html (added) +++ dev/buildr/1.5.4/site/rdoc/Zip/File.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,156 @@ + + + + + + +class Zip::File - buildr + + + + + + + + + + + + + + +
+

+ class Zip::File +

+ +
+ +
+ + + + +
+ + + + + + + + + +
+
+

Public Instance Methods

+
+ + +
+ + +
+ + exist() → boolean + + + click to toggle source + +
+ + + +
+ +

Returns true if this entry exists.

+ + + + +
+
# File lib/buildr/packaging/zip.rb, line 50
+def exist?(entry_name)
+  !!find_entry(entry_name)
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + +