Skip to content

Commit

Permalink
Try and use what gemspec says should be exe dir
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Nov 7, 2018
1 parent d4fe4e0 commit 9d8b54f
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions lib/pom.rb
Expand Up @@ -192,17 +192,7 @@ def installer.ensure_required_ruby_version_met; end
FileUtils.chmod_R(0644, f)
end

# copy bin files if the gem has any
bin = File.join( gems, "#{gem_name}", 'bin' )
if File.exists? bin
Dir[ File.join( bin, '*' ) ].each do |f|
log "copy to bin: #{File.basename( f )}"
target = File.join( bin_stubs, f.sub( /#{gems}/, '' ) )
FileUtils.mkdir_p( File.dirname( target ) )
FileUtils.cp_r( f, target )
end
end

# get gemspec
specfile_wildcard = "#{gem_name}*.gemspec"
specfile = Dir[ File.join( specs, specfile_wildcard ) ].first

Expand All @@ -214,6 +204,18 @@ def installer.ensure_required_ruby_version_met; end
log "copy to specifications/default: #{specname}"

spec = Gem::Package.new( Dir[ File.join( cache, "#{gem_name}*.gem" ) ].first ).spec

# copy bin files if the gem has any
bin = File.join( gems, "#{gem_name}", spec.bindir || 'bin' )
if File.exists? bin
Dir[ File.join( bin, '*' ) ].each do |f|
log "copy to bin: #{File.basename( f )}"
target = File.join( bin_stubs, f.sub( /#{gems}/, '' ) )
FileUtils.mkdir_p( File.dirname( target ) )
FileUtils.cp_r( f, target )
end
end

File.open( File.join( default_specs, specname ), 'w' ) do |f|
f.print( spec.to_ruby )
end
Expand Down

0 comments on commit 9d8b54f

Please sign in to comment.