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.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/jars/mima.rb', line 202 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”).
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/jars/mima.rb', line 202 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.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/jars/mima.rb', line 202 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.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/jars/mima.rb', line 202 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”).
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/jars/mima.rb', line 202 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”).
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/jars/mima.rb', line 202 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.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/jars/mima.rb', line 202 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.
240 241 242 243 244 245 |
# File 'lib/jars/mima.rb', line 240 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.
250 251 252 253 254 255 256 257 258 259 |
# File 'lib/jars/mima.rb', line 250 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.
216 217 218 219 220 221 222 223 224 225 |
# File 'lib/jars/mima.rb', line 216 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.
204 205 206 |
# File 'lib/jars/mima.rb', line 204 def runtime? scope != 'test' && scope != 'provided' end |
#system? ⇒ Boolean
Returns true if scope is system.
209 210 211 |
# File 'lib/jars/mima.rb', line 209 def system? scope == 'system' end |
#to_lock_entry ⇒ String
Formats a line suitable for the Jars.lock file.
230 231 232 233 234 235 |
# File 'lib/jars/mima.rb', line 230 def to_lock_entry entry = +"#{group_id}:#{artifact_id}:" entry << "#{classifier}:" if classifier entry << "#{version}:#{scope}:" entry end |