Class: Rubydoop::Package
- Inherits:
-
Object
- Object
- Rubydoop::Package
- Defined in:
- lib/rubydoop/package.rb
Overview
Utility for making a job JAR that works with Hadoop.
Class Method Summary collapse
-
.create!(options = {}) ⇒ Object
A shortcut for ‘Package.new(options).create!`.
Instance Method Summary collapse
-
#create! ⇒ Object
Create the JAR package, see #initialize for configuration options.
-
#initialize(options = {}) ⇒ Package
constructor
A package has sane defaults that works in most situations, but almost everything can be changed.
- #method_missing(name, *args) ⇒ Object
- #respond_to?(name) ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Package
A package has sane defaults that works in most situations, but almost everything can be changed.
If you have extra JAR files that you need to make available for your job you can specify them with the ‘:lib_jars` option.
34 35 36 37 38 39 40 |
# File 'lib/rubydoop/package.rb', line 34 def initialize(={}) @options = .merge() @options[:project_name] ||= File.basename(@options[:project_base_dir]) @options[:build_dir] ||= File.join(@options[:project_base_dir], 'build') @options[:jruby_jar_path] ||= File.join(@options[:build_dir], "jruby-complete-#{@options[:jruby_version]}.jar") @options[:jar_path] ||= File.join(@options[:build_dir], "#{@options[:project_name]}.jar") end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
63 64 65 |
# File 'lib/rubydoop/package.rb', line 63 def method_missing(name, *args) @options[name] or super end |
Class Method Details
.create!(options = {}) ⇒ Object
A shortcut for ‘Package.new(options).create!`.
55 56 57 |
# File 'lib/rubydoop/package.rb', line 55 def self.create!(={}) new().create! end |
Instance Method Details
#create! ⇒ Object
Create the JAR package, see #initialize for configuration options.
On the first run a complete JRuby runtime JAR will be downloaded (‘jruby-complete.jar`) and locally cached, but if you already have a copy in a local Ivy or Maven repository that will be used instead.
47 48 49 50 51 52 |
# File 'lib/rubydoop/package.rb', line 47 def create! create_directories! fetch_jruby! find_gems! build_jar! end |
#respond_to?(name) ⇒ Boolean
59 60 61 |
# File 'lib/rubydoop/package.rb', line 59 def respond_to?(name) @options.key?(name) or super end |