-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from tungleduyxyz/jruby_9.4_fix_bugs
Error when build war file
- Loading branch information
Showing
2 changed files
with
28 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
module Warbler | ||
class Jar | ||
def add_init_file(config) | ||
return unless config.init_contents | ||
|
||
contents = +'' | ||
config.init_contents.each do |file| | ||
contents << if file.respond_to?(:read) | ||
file.read | ||
elsif File.extname(file) == '.erb' | ||
expand_erb(file, config).read | ||
else | ||
File.read(file) | ||
end | ||
end | ||
|
||
@files[config.init_filename] = StringIO.new(contents) | ||
return unless @files[config.init_filename] | ||
|
||
contents = @files[config.init_filename].read | ||
add_before = "require 'bundler/shared_helpers'" | ||
line_to_add = "Gem.paths = ENV\n" | ||
@files[config.init_filename] = StringIO.new(contents.gsub(add_before, "#{line_to_add}\\0")) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters