Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"undefined method `encode'" when creating installer #126

Open
nyuga opened this issue Sep 29, 2017 · 6 comments
Open

"undefined method `encode'" when creating installer #126

nyuga opened this issue Sep 29, 2017 · 6 comments

Comments

@nyuga
Copy link

nyuga commented Sep 29, 2017

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]

@shawn42
Copy link

shawn42 commented Oct 18, 2017

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

@kematy
Copy link

kematy commented Apr 9, 2020

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

@Jedoku
Copy link

Jedoku commented May 6, 2020

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

@Largo
Copy link

Largo commented Mar 22, 2021

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

@snascentef
Copy link

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?

@Largo
Copy link

Largo commented Apr 8, 2021

Which file you put this?

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants