Class: Ivy4r

Inherits:
Object
  • Object
show all
Defined in:
lib/ivy4r.rb

Overview

Simple wrapper that maps the ant ivy targets one to one to ruby. See the Apache Ivy for more informations about the parameters for a call. All ivy ant targets have the equivalent name in this class.

The standard parameters are provided as Hash, i.e.:

<ivy:configure file="settings.xml" settingsId="my.id" />

is

ivy4r.configure :file => "settings.xml", :settingsId => 'my.id'

You can use nested options via the nested attribute:

<ivy:buildlist reference="testpath">
  <fileset dir="target/p1" includes="buildfile" />
</ivy:buildlist>

is

@ivy4r.buildlist :reference => 'testpath', :nested => {
  :fileset => {:dir => 'target/p1', :includes => 'buildfile'}
}

you can nest more than on element of the same type using an array:

<ivy:buildlist reference="testpath">
  <fileset dir="target/sub" includes="**/buildfile" />
  <fileset dir="target/p1" includes="buildfile" />
</ivy:buildlist>

is

@ivy4r.buildlist :reference => 'testpath', :nested => {
  :fileset => [
    {:dir => 'target/sub', :includes => '**/buildfile'},
    {:dir => 'target/p1', :includes => 'buildfile'}
  ]
}

Constant Summary collapse

VERSION =
'0.7.2'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ant = nil) ⇒ Ivy4r

Initalizes ivy4r with optional ant wrapper object. Sets ant home dir and ivy lib dir to default values from Ivy4rJars gem.



57
58
59
60
61
62
# File 'lib/ivy4r.rb', line 57

def initialize(ant = nil)
  @ant_home = ::Ivy4rJars.ant_home_dir
  @lib_dir = ::Ivy4rJars.lib_dir
  @project_dir = @lib_dir
  @ant = ant
end

Instance Attribute Details

#antObject

Returns the __antwrap__ instance to use for all internal calls creates a default instance if no instance has been set before.



158
159
160
161
162
163
# File 'lib/ivy4r.rb', line 158

def ant
  @ant ||= ::Antwrap::AntProject.new(:ant_home => ant_home,
    :name => "ivy-ant", :basedir => Dir.pwd, :declarative => true)
  init(@ant) if should_init?
  @ant
end

#ant_homeObject

Set the ant home directory to load ant classes from if no custom __antwrap__ is provided and the default provided ant version 1.7.1 should not be used. Must be set before any call to method that uses the ivy is made.



43
44
45
# File 'lib/ivy4r.rb', line 43

def ant_home
  @ant_home
end

#lib_dirObject

Defines the directory to load ivy libs and its dependencies from



46
47
48
# File 'lib/ivy4r.rb', line 46

def lib_dir
  @lib_dir
end

#project_dirObject

Optional ant variable ivy.project.dir to add to ant environment before loading ivy defaults to the lib_dir



50
51
52
# File 'lib/ivy4r.rb', line 50

def project_dir
  @project_dir
end

Instance Method Details

#artifactproperty(*params) ⇒ Object

Calls the __artifactproperty__ ivy target with given parameters and returns map with all defined properties



128
129
130
# File 'lib/ivy4r.rb', line 128

def artifactproperty(*params)
  Ivy::Artifactproperty.new(ant).execute(*params)
end

#artifactreport(*params) ⇒ Object

Calls the __artifactreport__ ivy target with given parameters and returns the created xml.



140
141
142
# File 'lib/ivy4r.rb', line 140

def artifactreport(*params)
  Ivy::Artifactreport.new(ant).execute(*params)
end

#buildlist(*params) ⇒ Object

Calls the __buildlist__ ivy target with given parameters and returns the resulting buildlist



134
135
136
# File 'lib/ivy4r.rb', line 134

def buildlist(*params)
  Ivy::Buildlist.new(ant).execute(*params)
end

#buildnumber(*params) ⇒ Object

Calls the __buildnumber__ ivy target with given parameters and returns info as hash.



85
86
87
# File 'lib/ivy4r.rb', line 85

def buildnumber(*params)
  Ivy::Buildnumber.new(ant).execute(*params)
end

#cachepath(*params) ⇒ Object

Calls the __cachepath__ ivy target with given parameters and returns array containing absolute file paths to all artifacts contained in result



116
117
118
# File 'lib/ivy4r.rb', line 116

def cachepath(*params)
  Ivy::Cachepath.new(ant).execute(*params)
end

#cleancache(*params) ⇒ Object

Calls the __cleancache__ ivy target with given parameters.



65
66
67
# File 'lib/ivy4r.rb', line 65

def cleancache(*params)
  Ivy::Cleancache.new(ant).execute(*params)
end

#configure(*params) ⇒ Object

Calls the __configure__ ivy target with given parameters.



75
76
77
# File 'lib/ivy4r.rb', line 75

def configure(*params)
  Ivy::Configure.new(ant).execute(*params)
end

#findrevision(*params) ⇒ Object

Calls the __findrevision__ ivy target with given parameters and returns array containing absolute file paths to all artifacts contained in result



122
123
124
# File 'lib/ivy4r.rb', line 122

def findrevision(*params)
  Ivy::Findrevision.new(ant).execute(*params)
end

#info(*params) ⇒ Object

Calls the __info__ ivy target with given parameters and returns info as hash.



80
81
82
# File 'lib/ivy4r.rb', line 80

def info(*params)
  Ivy::Info.new(ant).execute(*params)
end

#listmodules(*params) ⇒ Object

Calls the __listmodules__ ivy target with given parameters and returns info as hash.



90
91
92
# File 'lib/ivy4r.rb', line 90

def listmodules(*params) #:nodoc:
  Ivy::Listmodules.new(ant).execute(*params)
end

#makepom(*params) ⇒ Object

Calls the __makepom__ ivy target with given parameters and returns pom content.



95
96
97
# File 'lib/ivy4r.rb', line 95

def makepom(*params)
  Ivy::Makepom.new(ant).execute(*params)
end

#propertyObject

Used to get or set ant properties.

set

property['name'] = value sets the ant property with name to given value no overwrite

get

property[matcher] gets property that is equal via case equality operator (===)



152
153
154
# File 'lib/ivy4r.rb', line 152

def property
  AntPropertyHelper.new(ant_properties)
end

#publish(*params) ⇒ Object

Calls the __publish__ ivy target with given parameters.



110
111
112
# File 'lib/ivy4r.rb', line 110

def publish(*params)
  Ivy::Publish.new(ant).execute(*params)
end

#report(*params) ⇒ Object

Calls the __report__ ivy target with given parameters



145
146
147
# File 'lib/ivy4r.rb', line 145

def report(*params)
  Ivy::Report.new(ant).execute(*params)
end

#resolve(*params) ⇒ Object

Calls the __resolve__ ivy target with given parameters and returns info as hash.



100
101
102
# File 'lib/ivy4r.rb', line 100

def resolve(*params)
  Ivy::Resolve.new(ant).execute(*params)
end

#retrieve(*params) ⇒ Object

Calls the __retrieve__ ivy target with given parameters.



105
106
107
# File 'lib/ivy4r.rb', line 105

def retrieve(*params)
  Ivy::Retrieve.new(ant).execute(*params)
end

#settings(*params) ⇒ Object

Calls the __settings__ ivy target with given parameters.



70
71
72
# File 'lib/ivy4r.rb', line 70

def settings(*params)
  Ivy::Settings.new(ant).execute(*params)
end