lib/maven/tools/dsl/gemspec.rb in maven-tools-1.0.8 vs lib/maven/tools/dsl/gemspec.rb in maven-tools-1.0.9
- old
+ new
@@ -95,13 +95,13 @@
end
def gem_specification( name )
path = File.expand_path( name )
spec_file = File.read( path )
- begin
+ if spec_file.start_with?( '--- !ruby/object:Gem::Specification' )
Gem::Specification.from_yaml( spec_file )
- rescue Exception
+ else
FileUtils.cd( @parent.basedir ) do
return eval( spec_file, nil, path )
end
end
end
@@ -140,10 +140,18 @@
def other_deps( spec )
spec.requirements.each do |req|
req.sub!( /#.*^/, '' )
method = req.sub(/\s.*$/, '' ).to_sym
line = req.sub(/^[^\s]*\s/, '' )
- send method, line
+ if respond_to? method
+ if spec.platform.to_s == 'java'
+ send method, line
+ else
+ warn "jar dependency found on non-java platform gem - ignoring: #{req}"
+ end
+ else
+ warn "unknown declaration: #{req}"
+ end
end
end
def maven_dependency( line )
coord = to_split_coordinate_with_scope( line )