Class: Jars::MavenExec
- Inherits:
-
Object
- Object
- Jars::MavenExec
- Defined in:
- lib/jars/maven_exec.rb
Instance Attribute Summary collapse
-
#basedir ⇒ Object
readonly
Returns the value of attribute basedir.
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
-
#specfile ⇒ Object
readonly
Returns the value of attribute specfile.
Instance Method Summary collapse
-
#initialize(spec = nil) ⇒ MavenExec
constructor
A new instance of MavenExec.
- #resolve_dependencies_list(file) ⇒ Object
- #ruby_maven_install_options=(options) ⇒ Object
- #setup(spec = nil, allow_no_file = false) ⇒ Object
Constructor Details
#initialize(spec = nil) ⇒ MavenExec
Returns a new instance of MavenExec.
22 23 24 25 26 27 28 29 |
# File 'lib/jars/maven_exec.rb', line 22 def initialize( spec = nil ) @options = {} setup( spec ) rescue StandardError, LoadError => e # If spec load fails, skip looking for jar-dependencies warn "jar-dependencies: " + e.to_s warn e.backtrace.join( "\n" ) if Jars.verbose? end |
Instance Attribute Details
#basedir ⇒ Object (readonly)
Returns the value of attribute basedir.
20 21 22 |
# File 'lib/jars/maven_exec.rb', line 20 def basedir @basedir end |
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
20 21 22 |
# File 'lib/jars/maven_exec.rb', line 20 def spec @spec end |
#specfile ⇒ Object (readonly)
Returns the value of attribute specfile.
20 21 22 |
# File 'lib/jars/maven_exec.rb', line 20 def specfile @specfile end |
Instance Method Details
#resolve_dependencies_list(file) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/jars/maven_exec.rb', line 64 def resolve_dependencies_list( file ) factory = MavenFactory.new( @options ) maven = factory.maven_new( File.( '../gemspec_pom.rb', __FILE__ ) ) maven[ 'outputAbsoluteArtifactFilename' ] = 'true' maven[ 'includeTypes' ] = 'jar' maven[ 'outputScope' ] = 'true' maven[ 'useRepositoryLayout' ] = 'true' maven[ 'outputDirectory' ] = "#{Jars.home}" maven[ 'jars.specfile' ] = "#{@specfile}" maven[ 'outputFile' ] = "#{file}" maven.exec( 'dependency:copy-dependencies', 'dependency:list' ) end |
#ruby_maven_install_options=(options) ⇒ Object
60 61 62 |
# File 'lib/jars/maven_exec.rb', line 60 def ( ) @options = end |
#setup(spec = nil, allow_no_file = false) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/jars/maven_exec.rb', line 31 def setup( spec = nil, allow_no_file = false ) spec ||= find_spec( allow_no_file ) case spec when String @specfile = File.( spec ) @basedir = File.dirname( @specfile ) spec = Dir.chdir( File.dirname(@specfile) ) do eval( File.read( @specfile ) ) end when Gem::Specification if File.exists?( spec.spec_file ) @basedir = spec.gem_dir @specfile = spec.spec_file else # this happens with bundle and local gems # there the spec_file is "not installed" but inside # the gem_dir directory Dir.chdir( spec.gem_dir ) do setup( nil, true ) end end when NilClass else raise 'spec must be either String or Gem::Specification' end @spec = spec end |