Class: Maven::Tools::Jarfile::DSL

Inherits:
Object
  • Object
show all
Includes:
Coordinate
Defined in:
lib/maven/tools/jarfile.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Coordinate

#gav, #group_artifact, #to_coordinate, #to_split_coordinate, #to_version

Class Method Details

.eval_file(file) ⇒ Object



76
77
78
79
# File 'lib/maven/tools/jarfile.rb', line 76

def self.eval_file( file )
  jarfile = self.new
  jarfile.eval_file( file )
end

Instance Method Details

#artifactsObject



88
89
90
# File 'lib/maven/tools/jarfile.rb', line 88

def artifacts
  @artifacts ||= []
end

#eval_file(file) ⇒ Object



81
82
83
84
85
86
# File 'lib/maven/tools/jarfile.rb', line 81

def eval_file( file )
  if ::File.exists?( file )
    eval( ::File.read( file ), nil, file )
    self
  end
end

#jar(*args) ⇒ Object



104
105
106
107
108
109
# File 'lib/maven/tools/jarfile.rb', line 104

def jar( *args )
  a = Artifact.from( :jar, *args )
  a[ :scope ] = @scope if @scope
  artifacts << a
  a
end

#jruby(version = nil, no_asm = false) ⇒ Object

TODO add flag to use repacked asm



134
135
136
137
138
139
140
141
142
143
144
# File 'lib/maven/tools/jarfile.rb', line 134

def jruby( version = nil, no_asm = false )
  if version
    @jruby = version 
    @jruby += '-no_asm' if no_asm
  end
  @scope = :provided
  yield if block_given?
  @jruby
ensure
  @scope = nil
end

#local(path) ⇒ Object



100
101
102
# File 'lib/maven/tools/jarfile.rb', line 100

def local( path )
  artifacts << Artifact.new_local( ::File.expand_path( path ), :jar )
end

#pom(*args) ⇒ Object



111
112
113
114
115
116
# File 'lib/maven/tools/jarfile.rb', line 111

def pom( *args )
  a = Artifact.from( :pom, *args )
  a[ :scope ] = @scope if @scope
  artifacts << a
  a
end

#repositoriesObject



92
93
94
# File 'lib/maven/tools/jarfile.rb', line 92

def repositories
  @repositories ||= []
end

#repository(name, url = nil) ⇒ Object Also known as: source



125
126
127
128
129
130
# File 'lib/maven/tools/jarfile.rb', line 125

def repository( name, url = nil )
  if url.nil?
    url = name
  end
  repositories << { :name => name.to_s, :url => url }
end

#scope(scope) ⇒ Object



146
147
148
149
150
151
# File 'lib/maven/tools/jarfile.rb', line 146

def scope( scope )
  @scope = scope
  yield if block_given?
ensure
  @scope = nil
end

#snapshot_repositoriesObject



96
97
98
# File 'lib/maven/tools/jarfile.rb', line 96

def snapshot_repositories
  @snapshot_repositories ||= []
end

#snapshot_repository(name, url = nil) ⇒ Object



118
119
120
121
122
123
# File 'lib/maven/tools/jarfile.rb', line 118

def snapshot_repository( name, url = nil )
  if url.nil?
    url = name
  end
  snapshot_repositories << { :name => name.to_s, :url => url }
end