ocra icon indicating copy to clipboard operation
ocra copied to clipboard

"undefined method `encode'" when creating installer

Open nyuga opened this issue 8 years ago • 6 comments

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]

nyuga avatar Sep 29 '17 15:09 nyuga

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

shawn42 avatar Oct 18 '17 03:10 shawn42

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

kematy avatar Apr 09 '20 02:04 kematy

Когда я запускаю 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?

Jedoku avatar May 06 '20 19:05 Jedoku

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.)

Largo avatar Mar 22 '21 13:03 Largo

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?

snascentef avatar Apr 08 '21 16:04 snascentef

Which file you put this?

In my code. Just put it after require 'ocra'

Largo avatar Apr 08 '21 23:04 Largo