Class: Jars::Mima::ResolvedDependency
- Inherits:
-
Struct
- Object
- Struct
- Jars::Mima::ResolvedDependency
- Defined in:
- lib/jars/mima.rb
Overview
Structured result from dependency resolution.
Instance Attribute Summary collapse
-
#artifact_id ⇒ String
readonly
Maven artifact ID.
-
#classifier ⇒ String?
readonly
Maven classifier (e.g.
"sources","no_aop"). -
#file ⇒ String
readonly
Absolute path to the resolved artifact in the local repository.
-
#group_id ⇒ String
readonly
Maven group ID.
-
#scope ⇒ String
readonly
Maven scope (+"compile"+,
"runtime","test","provided","system"). -
#type ⇒ String
readonly
Artifact type/extension (e.g.
"jar","pom"). -
#version ⇒ String
readonly
Resolved version.
Instance Method Summary collapse
-
#gav ⇒ String
Colon-separated GAV string suitable for
require_jarcalls. -
#jar_path ⇒ String
Relative jar path for vendoring /
require_jar. -
#path ⇒ String
Maven repository layout path relative to repo root.
-
#runtime? ⇒ Boolean
True if scope is neither
testnorprovided. -
#system? ⇒ Boolean
True if scope is
system. -
#to_lock_entry ⇒ String
Formats a line suitable for the
Jars.lockfile.
Instance Attribute Details
#artifact_id ⇒ String (readonly)
Returns Maven artifact ID.
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/jars/mima.rb', line 322 ResolvedDependency = Struct.new(:group_id, :artifact_id, :version, :classifier, :type, :scope, :file) do # @return [Boolean] true if scope is neither +test+ nor +provided+ def runtime? scope != 'test' && scope != 'provided' end # @return [Boolean] true if scope is +system+ def system? scope == 'system' end # Maven repository layout path relative to repo root. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << ".#{type || 'jar'}" parts << filename File.join(parts) end # Formats a line suitable for the +Jars.lock+ file. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36:compile:"+ def to_lock_entry entry = +"#{group_id}:#{artifact_id}:" entry << "#{classifier}:" if classifier entry << "#{version}:#{scope}:" entry end # Colon-separated GAV string suitable for +require_jar+ calls. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36"+ def gav parts = [group_id, artifact_id] parts << classifier if classifier parts << version parts.join(':') end # Relative jar path for vendoring / +require_jar+. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def jar_path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << '.jar' parts << filename File.join(parts) end end |
#classifier ⇒ String? (readonly)
Returns Maven classifier (e.g. "sources", "no_aop").
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/jars/mima.rb', line 322 ResolvedDependency = Struct.new(:group_id, :artifact_id, :version, :classifier, :type, :scope, :file) do # @return [Boolean] true if scope is neither +test+ nor +provided+ def runtime? scope != 'test' && scope != 'provided' end # @return [Boolean] true if scope is +system+ def system? scope == 'system' end # Maven repository layout path relative to repo root. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << ".#{type || 'jar'}" parts << filename File.join(parts) end # Formats a line suitable for the +Jars.lock+ file. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36:compile:"+ def to_lock_entry entry = +"#{group_id}:#{artifact_id}:" entry << "#{classifier}:" if classifier entry << "#{version}:#{scope}:" entry end # Colon-separated GAV string suitable for +require_jar+ calls. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36"+ def gav parts = [group_id, artifact_id] parts << classifier if classifier parts << version parts.join(':') end # Relative jar path for vendoring / +require_jar+. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def jar_path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << '.jar' parts << filename File.join(parts) end end |
#file ⇒ String (readonly)
Returns absolute path to the resolved artifact in the local repository.
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/jars/mima.rb', line 322 ResolvedDependency = Struct.new(:group_id, :artifact_id, :version, :classifier, :type, :scope, :file) do # @return [Boolean] true if scope is neither +test+ nor +provided+ def runtime? scope != 'test' && scope != 'provided' end # @return [Boolean] true if scope is +system+ def system? scope == 'system' end # Maven repository layout path relative to repo root. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << ".#{type || 'jar'}" parts << filename File.join(parts) end # Formats a line suitable for the +Jars.lock+ file. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36:compile:"+ def to_lock_entry entry = +"#{group_id}:#{artifact_id}:" entry << "#{classifier}:" if classifier entry << "#{version}:#{scope}:" entry end # Colon-separated GAV string suitable for +require_jar+ calls. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36"+ def gav parts = [group_id, artifact_id] parts << classifier if classifier parts << version parts.join(':') end # Relative jar path for vendoring / +require_jar+. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def jar_path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << '.jar' parts << filename File.join(parts) end end |
#group_id ⇒ String (readonly)
Returns Maven group ID.
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/jars/mima.rb', line 322 ResolvedDependency = Struct.new(:group_id, :artifact_id, :version, :classifier, :type, :scope, :file) do # @return [Boolean] true if scope is neither +test+ nor +provided+ def runtime? scope != 'test' && scope != 'provided' end # @return [Boolean] true if scope is +system+ def system? scope == 'system' end # Maven repository layout path relative to repo root. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << ".#{type || 'jar'}" parts << filename File.join(parts) end # Formats a line suitable for the +Jars.lock+ file. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36:compile:"+ def to_lock_entry entry = +"#{group_id}:#{artifact_id}:" entry << "#{classifier}:" if classifier entry << "#{version}:#{scope}:" entry end # Colon-separated GAV string suitable for +require_jar+ calls. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36"+ def gav parts = [group_id, artifact_id] parts << classifier if classifier parts << version parts.join(':') end # Relative jar path for vendoring / +require_jar+. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def jar_path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << '.jar' parts << filename File.join(parts) end end |
#scope ⇒ String (readonly)
Returns Maven scope (+"compile"+, "runtime", "test", "provided", "system").
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/jars/mima.rb', line 322 ResolvedDependency = Struct.new(:group_id, :artifact_id, :version, :classifier, :type, :scope, :file) do # @return [Boolean] true if scope is neither +test+ nor +provided+ def runtime? scope != 'test' && scope != 'provided' end # @return [Boolean] true if scope is +system+ def system? scope == 'system' end # Maven repository layout path relative to repo root. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << ".#{type || 'jar'}" parts << filename File.join(parts) end # Formats a line suitable for the +Jars.lock+ file. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36:compile:"+ def to_lock_entry entry = +"#{group_id}:#{artifact_id}:" entry << "#{classifier}:" if classifier entry << "#{version}:#{scope}:" entry end # Colon-separated GAV string suitable for +require_jar+ calls. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36"+ def gav parts = [group_id, artifact_id] parts << classifier if classifier parts << version parts.join(':') end # Relative jar path for vendoring / +require_jar+. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def jar_path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << '.jar' parts << filename File.join(parts) end end |
#type ⇒ String (readonly)
Returns artifact type/extension (e.g. "jar", "pom").
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/jars/mima.rb', line 322 ResolvedDependency = Struct.new(:group_id, :artifact_id, :version, :classifier, :type, :scope, :file) do # @return [Boolean] true if scope is neither +test+ nor +provided+ def runtime? scope != 'test' && scope != 'provided' end # @return [Boolean] true if scope is +system+ def system? scope == 'system' end # Maven repository layout path relative to repo root. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << ".#{type || 'jar'}" parts << filename File.join(parts) end # Formats a line suitable for the +Jars.lock+ file. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36:compile:"+ def to_lock_entry entry = +"#{group_id}:#{artifact_id}:" entry << "#{classifier}:" if classifier entry << "#{version}:#{scope}:" entry end # Colon-separated GAV string suitable for +require_jar+ calls. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36"+ def gav parts = [group_id, artifact_id] parts << classifier if classifier parts << version parts.join(':') end # Relative jar path for vendoring / +require_jar+. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def jar_path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << '.jar' parts << filename File.join(parts) end end |
#version ⇒ String (readonly)
Returns resolved version.
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/jars/mima.rb', line 322 ResolvedDependency = Struct.new(:group_id, :artifact_id, :version, :classifier, :type, :scope, :file) do # @return [Boolean] true if scope is neither +test+ nor +provided+ def runtime? scope != 'test' && scope != 'provided' end # @return [Boolean] true if scope is +system+ def system? scope == 'system' end # Maven repository layout path relative to repo root. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << ".#{type || 'jar'}" parts << filename File.join(parts) end # Formats a line suitable for the +Jars.lock+ file. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36:compile:"+ def to_lock_entry entry = +"#{group_id}:#{artifact_id}:" entry << "#{classifier}:" if classifier entry << "#{version}:#{scope}:" entry end # Colon-separated GAV string suitable for +require_jar+ calls. # # @return [String] e.g. +"org.slf4j:slf4j-api:1.7.36"+ def gav parts = [group_id, artifact_id] parts << classifier if classifier parts << version parts.join(':') end # Relative jar path for vendoring / +require_jar+. # # @return [String] e.g. +"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar"+ def jar_path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << '.jar' parts << filename File.join(parts) end end |
Instance Method Details
#gav ⇒ String
Colon-separated GAV string suitable for require_jar calls.
360 361 362 363 364 365 |
# File 'lib/jars/mima.rb', line 360 def gav parts = [group_id, artifact_id] parts << classifier if classifier parts << version parts.join(':') end |
#jar_path ⇒ String
Relative jar path for vendoring / require_jar.
370 371 372 373 374 375 376 377 378 379 |
# File 'lib/jars/mima.rb', line 370 def jar_path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << '.jar' parts << filename File.join(parts) end |
#path ⇒ String
Maven repository layout path relative to repo root.
336 337 338 339 340 341 342 343 344 345 |
# File 'lib/jars/mima.rb', line 336 def path parts = group_id.split('.') parts << artifact_id parts << version filename = +"#{artifact_id}-#{version}" filename << "-#{classifier}" if classifier filename << ".#{type || 'jar'}" parts << filename File.join(parts) end |
#runtime? ⇒ Boolean
Returns true if scope is neither test nor provided.
324 325 326 |
# File 'lib/jars/mima.rb', line 324 def runtime? scope != 'test' && scope != 'provided' end |
#system? ⇒ Boolean
Returns true if scope is system.
329 330 331 |
# File 'lib/jars/mima.rb', line 329 def system? scope == 'system' end |
#to_lock_entry ⇒ String
Formats a line suitable for the Jars.lock file.
350 351 352 353 354 355 |
# File 'lib/jars/mima.rb', line 350 def to_lock_entry entry = +"#{group_id}:#{artifact_id}:" entry << "#{classifier}:" if classifier entry << "#{version}:#{scope}:" entry end |