Skip to content

Commit

Permalink
Merge pull request #68 from tungleduyxyz/jruby_9.4_fix_bugs
Browse files Browse the repository at this point in the history
Error when build war file
  • Loading branch information
pierre authored Dec 24, 2023
2 parents 14e7c6d + c5fc4df commit b44d58c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
28 changes: 28 additions & 0 deletions config/initializers/warbler.rb
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
18 changes: 0 additions & 18 deletions config/warble.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,3 @@

config.jar_name = 'killbill-admin-ui-standalone'
end

module FixInit
def add_init_file(config)
super
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

module Warbler
class Jar
prepend FixInit
end
end

0 comments on commit b44d58c

Please sign in to comment.