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

+ class File +

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

Public Class Methods

+
+ + +
+ +
+ move(source, dest) + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/packaging/zip.rb, line 22
+def File.move(source, dest)
+  FileUtils.move source, dest
+end
+
+ +
+ + + + +
+ + +
+ +
+ rm_rf(path) + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/packaging/zip.rb, line 26
+def File.rm_rf(path)
+  FileUtils.rm_rf path
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.4/site/rdoc/FileUtils.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/FileUtils.html (added) +++ dev/buildr/1.5.4/site/rdoc/FileUtils.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,193 @@ + + + + + + +module FileUtils - buildr + + + + + + + + + + + + + + +
+

+ module FileUtils +

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

Public Instance Methods

+
+ + +
+ +
+ sh(*cmd, &block) + + click to toggle source + +
+ + +
+ +

code “borrowed” directly from Rake

+ + + + +
+
# File lib/buildr/core/util.rb, line 362
+def sh(*cmd, &block)
+  options = (Hash === cmd.last) ? cmd.pop : {}
+  unless block_given?
+    show_command = cmd.join(" ")
+    show_command = show_command[0,42] + "..."
+
+    block = lambda { |ok, status|
+      ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]"
+    }
+  end
+  if RakeFileUtils.verbose_flag == Rake::FileUtilsExt::DEFAULT
+    options[:verbose] = false
+  else
+    options[:verbose] ||= RakeFileUtils.verbose_flag
+  end
+  options[:noop]    ||= RakeFileUtils.nowrite_flag
+  rake_check_options options, :noop, :verbose
+  rake_output_message cmd.join(" ") if options[:verbose]
+  unless options[:noop]
+    if Buildr::Util.win_os?
+      # Ruby uses forward slashes regardless of platform,
+      # unfortunately cd c:/some/path fails on Windows
+      pwd = Dir.pwd.gsub(%r{/}, '\')
+      cd = "cd /d \"#{pwd}\" && "
+    else
+      cd = "cd '#{Dir.pwd}' && "
+    end
+    args = if cmd.size > 1 then cmd[1..cmd.size] else [] end
+
+    res = if Buildr::Util.win_os? && cmd.size == 1
+      __native_system__("#{cd} call #{cmd.first}")
+    else
+      arg_str = args.map { |a| "'#{a}'" }
+      __native_system__(cd + cmd.first + ' ' + arg_str.join(' '))
+    end
+    status = Buildr::ProcessStatus.new(0, res == 0, res)    # KLUDGE
+    block.call(res == 0, status)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.4/site/rdoc/FileUtils/FFI.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/FileUtils/FFI.html (added) +++ dev/buildr/1.5.4/site/rdoc/FileUtils/FFI.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,95 @@ + + + + + + +module FileUtils::FFI - buildr + + + + + + + + + + + + + + +
+

+ module FileUtils::FFI +

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

+ module FileUtils::FFI::Platform +

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

+ module Gem +

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

+ class Gem::Version +

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

Public Instance Methods

+
+ + +
+ +
+ version=(version) + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/packaging/version_requirement.rb, line 22
+def version=(version)
+  @version = version.to_s.strip
+
+  # re-prime @segments
+  @segments = nil
+  segments
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.4/site/rdoc/Hash.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/Hash.html (added) +++ dev/buildr/1.5.4/site/rdoc/Hash.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,317 @@ + + + + + + +class Hash - buildr + + + + + + + + + + + + + + +
+

+ class Hash +

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

Public Class Methods

+
+ + +
+ + +
+ + from_java_properties(string) + + + click to toggle source + +
+ + + +
+ +

Returns a hash from a string in the Java properties +file format. For example:

+ +
str = 'foo=bar\nbaz=fab'
+Hash.from_properties(str)
+=> { 'foo'=>'bar', 'baz'=>'fab' }.to_properties
+ + + + +
+
# File lib/buildr/core/util.rb, line 224
+def from_java_properties(string)
+  hash = {}
+  input_stream = Java.java.io.StringBufferInputStream.new(string)
+  java_properties = Java.java.util.Properties.new
+  java_properties.load input_stream
+  keys = java_properties.keySet.iterator
+  while keys.hasNext
+    # Calling key.next in JRuby returns a java.lang.String, behaving as a Ruby string and life is good.
+    # MRI, unfortunately, treats next() like the interface says returning an object that's not a String,
+    # and the Hash doesn't work the way we need it to.  Unfortunately, we can call toString on MRI's object,
+    # but not on the JRuby one; calling to_s on the JRuby object returns what we need, but ... you guessed it.
+    #  So this seems like the one hack to unite them both.
+    #key = Java.java.lang.String.valueOf(keys.next.to_s)
+    key = keys.next
+    key = key.toString unless String === key
+    hash[key] = java_properties.getProperty(key)
+  end
+  hash
+end
+
+ +
+ + + + +
+ + +
+ +
+
+

Public Instance Methods

+
+ + +
+ + +
+ + except(keys*) → hash + + + click to toggle source + +
+ + + +
+ +

Returns a new hash without the specified keys.

+ +

For example:

+ +
{ :a=>1, :b=>2, :c=>3, :d=>4 }.except(:a, :c)
+=> { :b=>2, :d=>4 }
+ + + + +
+
# File lib/buildr/core/util.rb, line 267
+def except(*keys)
+  (self.keys - keys).inject({}) { |hash, key| hash.merge(key=>self[key]) }
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + only(keys*) → hash + + + click to toggle source + +
+ + + +
+ +

Returns a new hash with only the specified keys.

+ +

For example:

+ +
{ :a=>1, :b=>2, :c=>3, :d=>4 }.only(:a, :c)
+=> { :a=>1, :c=>3 }
+ + + + +
+
# File lib/buildr/core/util.rb, line 254
+def only(*keys)
+  keys.inject({}) { |hash, key| has_key?(key) ? hash.merge(key=>self[key]) : hash }
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + to_java_properties → string + + + click to toggle source + +
+ + + +
+ +

Convert hash to string format used for Java +properties file. For example:

+ +
{ 'foo'=>'bar', 'baz'=>'fab' }.to_properties
+=> foo=bar
+   baz=fab
+ + + + +
+
# File lib/buildr/core/util.rb, line 278
+def to_java_properties
+  keys.sort.map { |key|
+    value = self[key].gsub(/[\t\r\n\f\]/) { |escape| "\\" + {"\t"=>"t", "\r"=>"r", "\n"=>"n", "\f"=>"f", "\
 \"=>"\\"}[escape] }
+    "#{key}=#{value}"
+  }.join("\n")
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.4/site/rdoc/Java.html ============================================================================== --- dev/buildr/1.5.4/site/rdoc/Java.html (added) +++ dev/buildr/1.5.4/site/rdoc/Java.html Sun Sep 24 21:59:16 2017 @@ -0,0 +1,398 @@ + + + + + + +module Java - buildr + + + + + + + + + + + + + + +
+

+ module Java +

+ +
+ +

Base module for all things Java.

+ +

Buildr runs along side a JVM, using either RJB or +JRuby. The Java module allows you to access Java classes and create Java +objects.

+ +

Java classes are accessed as static methods on the +Java module, for example:

+ +
str = Java.java.lang.String.new('hai!')
+str.toUpperCase
+=> 'HAI!'
+Java.java.lang.String.isInstance(str)
+=> true
+Java.com.sun.tools.javac.Main.compile(args)
+ +

The classpath attribute allows Buildr to add JARs +and directories to the classpath, for example, we use it to load Ant and +various Ant tasks, code generators, test frameworks, and so forth.

+ +

When using an artifact specification, Buildr will +automatically download and install the artifact before adding it to the +classpath.

+ +

For example, Ant is loaded as follows:

+ +
Java.classpath << 'org.apache.ant:ant:jar:1.7.0'
+
+ +

Artifacts can only be downloaded after the Buildfile has loaded, giving it +a chance to specify which remote repositories to use, so adding to +classpath does not by itself load any libraries. You must call ::load before accessing any Java classes to give Buildr +a chance to load the libraries specified in the classpath.

+ +

When building an extension, make sure to follow these rules:

+
  1. +

    Add to the classpath when the extension is loaded (i.e. in module or class +definition), so the first call to ::load anywhere in the code will include +the libraries you specify.

    +
  2. +

    Call ::load once before accessing any +Java classes, allowing Buildr to set up the classpath.

    +
  3. +

    Only call ::load when invoked, +otherwise you may end up loading the JVM with a partial classpath, or +before all remote repositories are listed.

    +
  4. +

    Check on a clean build with empty local repository.

    +
+ +

Buildr runs along side a JVM, using either RJB or +JRuby. The Java module allows you to access Java classes and create Java +objects.

+ +

Java classes are accessed as static methods on the +Java module, for example:

+ +
str = Java.java.lang.String.new('hai!')
+str.toUpperCase
+=> 'HAI!'
+Java.java.lang.String.isInstance(str)
+=> true
+Java.com.sun.tools.javac.Main.compile(args)
+ +

The classpath attribute allows Buildr to add JARs +and directories to the classpath, for example, we use it to load Ant and +various Ant tasks, code generators, test frameworks, and so forth.

+ +

When using an artifact specification, Buildr will +automatically download and install the artifact before adding it to the +classpath.

+ +

For example, Ant is loaded as follows:

+ +
Java.classpath << 'org.apache.ant:ant:jar:1.7.0'
+
+ +

Artifacts can only be downloaded after the Buildfile has loaded, giving it +a chance to specify which remote repositories to use, so adding to +classpath does not by itself load any libraries. You must call ::load before accessing any Java classes to give Buildr +a chance to load the libraries specified in the classpath.

+ +

When building an extension, make sure to follow these rules:

+
  1. +

    Add to the classpath when the extension is loaded (i.e. in module or class +definition), so the first call to ::load anywhere in the code will include +the libraries you specify.

    +
  2. +

    Call ::load once before accessing any +Java classes, allowing Buildr to set up the classpath.

    +
  3. +

    Only call ::load when invoked, +otherwise you may end up loading the JVM with a partial classpath, or +before all remote repositories are listed.

    +
  4. +

    Check on a clean build with empty local repository.

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

Constants

+
+
+ +
JRUBY_MIN_VERSION + +

This version is the minimal version Buildr will +support. Any older version of JRuby will raise an exception.

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

Public Class Methods

+
+ + +
+ +
+ classpath() + + click to toggle source + +
+ + +
+ +

Returns the classpath, an array listing directories, JAR files and +artifacts. Use when loading the extension to add any additional libraries +used by that extension.

+ +

For example, Ant is loaded as follows:

+ +
Java.classpath << 'org.apache.ant:ant:jar:1.7.0'
+
+ + + + +
+
# File lib/buildr/java/jruby.rb, line 74
+def classpath
+  @classpath ||= begin
+    classpath = []
+    class << classpath
+
+      def new_add(*args)
+        warn 'Java is already loaded' if Java.loaded?
+        send(:old_add, *args)
+      end
+
+      alias_method :old_add, :<<
+      alias_method :<<, :new_add
+    end
+    classpath
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ load() + + click to toggle source + +
+ + +
+ +

Loads the JVM and all the libraries listed on the classpath. Call this +method before accessing any Java class, but only +call it from methods used in the build, giving the Buildfile a chance to +load all extensions that append to the classpath and specify which remote +repositories to use.

+ + + + +
+
# File lib/buildr/java/jruby.rb, line 109
+def load
+  return self if @loaded
+
+  # Adding jars to the jruby's $CLASSPATH should be the correct thing, however it
+  # seems like some tools require their jars on system class loader (javadoc, junit, etc)
+  # cp.each { |path| $CLASSPATH << path }
+
+  # Use system ClassLoader to add classpath
+  sysloader = java.lang.ClassLoader.getSystemClassLoader
+  add_url_method = java.lang.Class.forName('java.net.URLClassLoader').
+    getDeclaredMethod('addURL', [java.net.URL.java_class].to_java(java.lang.Class))
+  add_url_method.setAccessible(true)
+  add_path = lambda { |path| add_url_method.invoke(sysloader, [java.io.File.new(path).toURI.toURL].to_java(java.net.URL)) }
+
+  # Most platforms requires tools.jar to be on the classpath.
+  add_path[tools_jar] if tools_jar
+
+  classpath.map! { |path| Proc === path ? path.call : path }
+  Buildr.artifacts(classpath).map(&:to_s).each do |path|
+    file(path).invoke
+    add_path[path]
+  end
+
+  @loaded = true
+  self
+end
+
+ +
+ + + + +
+ + +
+ +
+ loaded?() + + click to toggle source + +
+ + +
+ +

Returns true if the JVM is loaded with all the libraries loaded on the +classpath.

+ + + + +
+
# File lib/buildr/java/jruby.rb, line 92
+def loaded?
+  @loaded
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + +