트러블슈팅(Trouble Shooting)

asciidoctor-pdf-cjk-kai_gen_gothic-install:34:in `initialize': No such file or directory @ rb_sysopen 해결하기

토끼C 2023. 6. 30. 20:27
반응형

asciidoctor-pdf-cjk-kai_gen_gothic-install을 실행했더니 다음과 같은 에러가 발생했다.

root@LYJ:/# asciidoctor-pdf-cjk-kai_gen_gothic-install
[1/20] Downloading KaiGenGothicCN-Bold-Italic.ttf
/usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:34:in `initialize': No such file or directory @ rb_sysopen - <https://github.com/chloerei/asciidoctor-pdf-cjk-kai_gen_gothic/releases/download/v0.1.0-fonts/KaiGenGothicCN-Bold-Italic.ttf> (Errno::ENOENT)
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:34:in `open'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:34:in `block (3 levels) in '
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:33:in `open'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:33:in `block (2 levels) in '
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:31:in `each'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:31:in `each_with_index'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:31:in `block in '
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:30:in `chdir'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:30:in `'
        from /usr/local/rvm/gems/ruby-3.0.0/bin/asciidoctor-pdf-cjk-kai_gen_gothic-install:23:in `load'
        from /usr/local/rvm/gems/ruby-3.0.0/bin/asciidoctor-pdf-cjk-kai_gen_gothic-install:23:in `
'

asciidoctor-pdf-cjk-kai_gen_gothic-install 파일을 열어서 확인해보니, 다음 내용이 있었다.

#!/usr/bin/env ruby

require 'open-uri'

FontsDir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'data', 'fonts'))

Fonts = %w(
  KaiGenGothicCN-Bold-Italic.ttf
  KaiGenGothicCN-Bold.ttf
  KaiGenGothicCN-Regular-Italic.ttf
  KaiGenGothicCN-Regular.ttf
  KaiGenGothicJP-Bold-Italic.ttf
  KaiGenGothicJP-Bold.ttf
  KaiGenGothicJP-Regular-Italic.ttf
  KaiGenGothicJP-Regular.ttf
  KaiGenGothicKR-Bold-Italic.ttf
  KaiGenGothicKR-Bold.ttf
  KaiGenGothicKR-Regular-Italic.ttf
  KaiGenGothicKR-Regular.ttf
  KaiGenGothicTW-Bold-Italic.ttf
  KaiGenGothicTW-Bold.ttf
  KaiGenGothicTW-Regular-Italic.ttf
  KaiGenGothicTW-Regular.ttf
  RobotoMono-Bold.ttf
  RobotoMono-BoldItalic.ttf
  RobotoMono-Italic.ttf
  RobotoMono-Regular.ttf
)

Dir.chdir(FontsDir) do
  Fonts.each_with_index do |name, index|
    puts "[#{index + 1}/#{Fonts.count}] Downloading #{name}"
    File.open(name, 'wb') do |file|
      file.write open("<https://github.com/chloerei/asciidoctor-pdf-cjk-kai_gen_gothic/releases/download/v0.1.0-fonts/#{name}>").read
    end
  end
end

puts "Done"

처음엔 https://github.com/chloerei/asciidoctor-pdf-cjk-kai_gen_gothic/releases/download/v0.1.0-fonts 해당 url이 잘못된 줄 알고

 

https://github.com/chloerei/asciidoctor-pdf-cjk-kai_gen_gothic/releases에 접속해서,

파일 주소를 확인해보았더니.. 너무나 딱 맞다.. 오타 하나 없이 정확하다.

 

 

그렇다면 File.open하는 부분의 문제로 보여서 다른 방법으로 File을 open하는 방법을 찾아 다음처럼 적용하였다.

#!/usr/bin/env ruby

require 'open-uri'

FontsDir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'data', 'fonts'))

Fonts = %w(
  KaiGenGothicCN-Bold-Italic.ttf
  KaiGenGothicCN-Bold.ttf
  KaiGenGothicCN-Regular-Italic.ttf
  KaiGenGothicCN-Regular.ttf
  KaiGenGothicJP-Bold-Italic.ttf
  KaiGenGothicJP-Bold.ttf
  KaiGenGothicJP-Regular-Italic.ttf
  KaiGenGothicJP-Regular.ttf
  KaiGenGothicKR-Bold-Italic.ttf
  KaiGenGothicKR-Bold.ttf
  KaiGenGothicKR-Regular-Italic.ttf
  KaiGenGothicKR-Regular.ttf
  KaiGenGothicTW-Bold-Italic.ttf
  KaiGenGothicTW-Bold.ttf
  KaiGenGothicTW-Regular-Italic.ttf
  KaiGenGothicTW-Regular.ttf
  RobotoMono-Bold.ttf
  RobotoMono-BoldItalic.ttf
  RobotoMono-Italic.ttf
  RobotoMono-Regular.ttf
)

Dir.chdir(FontsDir) do
  Fonts.each_with_index do |name, index|
    puts "[#{index + 1}/#{Fonts.count}] Downloading #{name}"
    File.open(name, 'wb') do |file|
      uri = "<https://github.com/chloerei/asciidoctor-pdf-cjk-kai_gen_gothic/releases/download/v0.1.0-fonts/#{name}>"
      filewrite= file.write URI.open(uri).read
#      file.write open("<https://github.com/chloerei/asciidoctor-pdf-cjk-kai_gen_gothic/releases/download/v0.1.0-fonts/#{name}>").read
    end
  end
end

puts "Done"

URI.open을 사용했고, uri주소를 바로 넣지 않고 uri라는 이름으로 정의해서 사용했다.

 

그 결과..

root@LYJ:/# asciidoctor-pdf-cjk-kai_gen_gothic-install
[1/20] Downloading KaiGenGothicCN-Bold-Italic.ttf
/usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:34:in `initialize': No such file or directory @ rb_sysopen - https://github.com/chloerei/asciidoctor-pdf-cjk-kai_gen_gothic/releases/download/v0.1.0-fonts/KaiGenGothicCN-Bold-Italic.ttf (Errno::ENOENT)
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:34:in `open'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:34:in `block (3 levels) in <top (required)>'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:33:in `open'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:33:in `block (2 levels) in <top (required)>'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:31:in `each'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:31:in `each_with_index'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:31:in `block in <top (required)>'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:30:in `chdir'
        from /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install:30:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-3.0.0/bin/asciidoctor-pdf-cjk-kai_gen_gothic-install:23:in `load'
        from /usr/local/rvm/gems/ruby-3.0.0/bin/asciidoctor-pdf-cjk-kai_gen_gothic-install:23:in `<main>'
root@po2120230622-yj:/# vi /usr/local/rvm/gems/ruby-3.0.0/gems/asciidoctor-pdf-cjk-kai_gen_gothic-0.1.1/exe/asciidoctor-pdf-cjk-kai_gen_gothic-install
root@po2120230622-yj:/# asciidoctor-pdf-cjk-kai_gen_gothic-install
[1/20] Downloading KaiGenGothicCN-Bold-Italic.ttf
[2/20] Downloading KaiGenGothicCN-Bold.ttf
[3/20] Downloading KaiGenGothicCN-Regular-Italic.ttf
[4/20] Downloading KaiGenGothicCN-Regular.ttf
[5/20] Downloading KaiGenGothicJP-Bold-Italic.ttf
[6/20] Downloading KaiGenGothicJP-Bold.ttf
[7/20] Downloading KaiGenGothicJP-Regular-Italic.ttf
[8/20] Downloading KaiGenGothicJP-Regular.ttf
[9/20] Downloading KaiGenGothicKR-Bold-Italic.ttf
[10/20] Downloading KaiGenGothicKR-Bold.ttf
[11/20] Downloading KaiGenGothicKR-Regular-Italic.ttf
[12/20] Downloading KaiGenGothicKR-Regular.ttf
[13/20] Downloading KaiGenGothicTW-Bold-Italic.ttf
[14/20] Downloading KaiGenGothicTW-Bold.ttf
[15/20] Downloading KaiGenGothicTW-Regular-Italic.ttf
[16/20] Downloading KaiGenGothicTW-Regular.ttf
[17/20] Downloading RobotoMono-Bold.ttf
[18/20] Downloading RobotoMono-BoldItalic.ttf
[19/20] Downloading RobotoMono-Italic.ttf
[20/20] Downloading RobotoMono-Regular.ttf
Done

성공적으로 설치가 완료되었다!!!

 

이제 adoc을 pdf로 변경하는 명령어는 adoc pdf로 변환하는 방법에 나와있다

반응형