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.9.3'

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.



61
62
63
64
65
66
67
# File 'lib/ivy4r.rb', line 61

def initialize(ant = nil)
  @ant_home = ::Ivy4rJars.ant_home_dir
  @lib_dir = ::Ivy4rJars.lib_dir
  @project_dir = @lib_dir
  @environment_property = 'env'
  @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.



163
164
165
166
167
168
# File 'lib/ivy4r.rb', line 163

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

#environment_propertyObject

The ant property name to use for references to environment properties in ant and ivy, defaults to ‘env’



54
55
56
# File 'lib/ivy4r.rb', line 54

def environment_property
  @environment_property
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



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

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.



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

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



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

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.



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

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



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

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

#cleancache(*params) ⇒ Object

Calls the __cleancache__ ivy target with given parameters.



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

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

#configure(*params) ⇒ Object

Calls the __configure__ ivy target with given parameters.



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

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



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

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.



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

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.



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

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.



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

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 (===)



157
158
159
# File 'lib/ivy4r.rb', line 157

def property
  AntPropertyHelper.new(ant_properties)
end

#publish(*params) ⇒ Object

Calls the __publish__ ivy target with given parameters.



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

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

#report(*params) ⇒ Object

Calls the __report__ ivy target with given parameters



150
151
152
# File 'lib/ivy4r.rb', line 150

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.



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

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

#retrieve(*params) ⇒ Object

Calls the __retrieve__ ivy target with given parameters.



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

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

#settings(*params) ⇒ Object

Calls the __settings__ ivy target with given parameters.



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

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