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_split_coordinate_with_scope, #to_version

Class Method Details

.eval_file(file) ⇒ Object



79
80
81
82
# File 'lib/maven/tools/jarfile.rb', line 79

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

Instance Method Details

#artifactsObject



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

def artifacts
  @artifacts ||= []
end

#eval_file(file) ⇒ Object



84
85
86
87
88
89
90
# File 'lib/maven/tools/jarfile.rb', line 84

def eval_file( file )
  warn "#{self.class} is deprecated"
  if ::File.exists?( file )
    eval( ::File.read( file ), nil, file )
    self
  end
end

#jar(*args) ⇒ Object



108
109
110
111
112
113
# File 'lib/maven/tools/jarfile.rb', line 108

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



138
139
140
141
142
143
144
145
146
147
148
# File 'lib/maven/tools/jarfile.rb', line 138

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



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

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

#pom(*args) ⇒ Object



115
116
117
118
119
120
# File 'lib/maven/tools/jarfile.rb', line 115

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

#repositoriesObject



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

def repositories
  @repositories ||= []
end

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



129
130
131
132
133
134
# File 'lib/maven/tools/jarfile.rb', line 129

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

#scope(scope) ⇒ Object



150
151
152
153
154
155
# File 'lib/maven/tools/jarfile.rb', line 150

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

#snapshot_repositoriesObject



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

def snapshot_repositories
  @snapshot_repositories ||= []
end

#snapshot_repository(name, url = nil) ⇒ Object



122
123
124
125
126
127
# File 'lib/maven/tools/jarfile.rb', line 122

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