"undefined method `encode'" when creating installer
The error is ERROR: InnoSetup installer creation failed: undefined method `encode' for <Ocra::Pathname:0x000000041013d8 @path="src/xxx.rb">
I find it occur in line 1090 of the bin/ocra :
target_dir_escaped = Pathname.new(tgt).dirname.to_s.gsub('"', '""')
I change it to this:
target_dir_escaped = Pathname.new(File.dirname(tgt)).to_s.gsub('"', '""')
And then it works though I don't know why
Running on Windows 10, msys2 ,ruby 2.4.0p0 (2016-12-24 revision 57164) [x64-mingw32]
I fixed this by updating the initialize method in Pathname to check to see if it's being created with another Pathname as an arg. If so, it just copies the path variable to @path. YMMV
When I run ocra: ocra xlsx2dxf.rb --no-lzma --chdir-first --innosetup xlsx2dxf.iss --windows I got xlsx2dxf.iss: inno setup installer creation failed: undefined method encode for #<Ocra::Pathname:0x10e1dc88 @path="src/xlsx2dxf/xlsx2dxf.rb" #160 I want to know why and how solve it. Running on Windows 10, msys2 ,ruby 2.5.6 32
Когда я запускаю ocra: ocra xlsx2dxf.rb --no-lzma --chdir-first --innosetup xlsx2dxf.iss --windows Я получил xlsx2dxf.iss: установка установщика inno завершилась неудачно: код неопределенного метода для # <Ocra :: Pathname : 0x10e1dc88 @path = "src / xlsx2dxf / xlsx2dxf.rb" # 160 Я хочу знать, почему и как это решить. Работает на Windows 10, msys2, ruby 2.5.6 32
Did you find the way?
monkeypatch works for me. no guarantees:
if defined?(Ocra)
# Workaround Innosetup Ocra Bug
module Ocra
class Pathname
def encode(e)
to_s.encode(e)
end
end
end
end
(I also stumbled over .iss File Example, where everything was on one line which is wrong.)
monkeypatch works for me. no guarantees:
if defined?(Ocra) # Workaround Innosetup Ocra Bug module Ocra class Pathname def encode(e) to_s.encode(e) end end end end(I also stumbled over .iss File Example, where everything was on one line which is wrong.)
Which file you put this?
Which file you put this?
In my code. Just put it after require 'ocra'