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 ) )
    self
  end
end

#jar(*args) ⇒ Object



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

def jar( *args )
  args << '[0,)' if args.size == 1
  artifacts << Artifact.from( :jar, *args )
end

#jruby(version = nil) ⇒ Object



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

def jruby( version = nil )
  @jruby = version if version
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



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

def pom( *args )
  args << '[0,)' if args.size == 1
  artifacts << Artifact.from( :pom, *args )
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



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

def repository( name, url = nil )
  if url.nil?
    url = name
  end
  repositories << { :name => name.to_s, :url => url }
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



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

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