fromStep3above.rubydk.rbinittogenerat" />

日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

如何確認Devkit是否安裝成功

系統(tǒng) 2219 0

昨天在安裝了Ruby 1.9.2 ,并且將其路徑加入到 Devkit config.yml 中,并且使用 ruby dk.rb install 安裝(不幸的是,沒注意安裝信息)。。但是依然無法構(gòu)建native gem。于是重裝Ruby,按照devkit的安裝說明來安裝。還是不正確。 Devkit的安裝說明的第4步為Run Installation Scripts:

  • cd <DEVKIT_INSTALL_DIR> from Step 3 above.
  • ruby dk.rb init to generate the config.yml file to be used later in this Step. Your installed Rubies will be listed there (only those installed by a RubyInstaller package are detected at present).
  • edit the generated config.yml file to include installed Rubies not automagically discovered or remove Rubies you do not want to use the DevKit with.
  • [optional] ruby dk.rb review to review the list of Rubies to be enhanced to use the DevKit and verify the changes you made to it are correct.
  • finally, ruby dk.rb install to DevKit enhance your installed Rubies. This step installs (or updates) an operating_system.rb file into the relevant directory needed to implement a RubyGems pre_install hook and a devkit.rb helper library file into <RUBY_INSTALL_DIR>\lib\ruby\site_ruby . NOTE: you may need to use the --force option to update (with backup of the originals) the above mentioned files as discussed at the SFX DevKit upgrade FAQ entry.

在最后一步可知,安裝Devkit其實就是更新了 operating_system.rb 文件,同時新建了 devkit.rb 文件。 在我的電腦上 devkit.rb 已經(jīng)創(chuàng)建好(Devkit安裝在 D:/Ruby187/devkit 目錄下, 其他電腦上的路徑可能與我的不同 ):

  1. # enable RubyInstaller DevKit usage as a vendorable helper library ?
  2. unless ENV[ 'PATH' ].include?( 'd:\\Ruby187\\devkit\\mingw\\bin' ) then ?
  3. ? puts 'Temporarily enhancing PATH to include DevKit...' ?
  4. ? ENV[ 'PATH' ] = 'd:\\Ruby187\\devkit\\bin;d:\\Ruby187\\devkit\\mingw\\bin;' + ENV[ 'PATH' ]?
  5. end ?
    # enable RubyInstaller DevKit usage as a vendorable helper library

unless ENV['PATH'].include?('d:\\Ruby187\\devkit\\mingw\\bin') then

  puts 'Temporarily enhancing PATH to include DevKit...'

  ENV['PATH'] = 'd:\\Ruby187\\devkit\\bin;d:\\Ruby187\\devkit\\mingw\\bin;' + ENV['PATH']

end
  

在Ruby1.9.2中,有兩個 operating_system.rb 文件,分別位于 lib\ruby\site_ruby\1.9.1\rubygems\defaults lib\ruby\1.9.1\rubygems\defaults 下,其內(nèi)容相同:

  1. # :DK-BEG: missing DevKit/build tool convenience notice ?
  2. ?
  3. Gem.pre_install do |gem_installer|?
  4. ? unless gem_installer.spec.extensions.empty??
  5. ??? have_tools = %w{gcc make sh}.all? do |t|?
  6. ????? system( "#{t} --version > NUL 2>&1" )?
  7. ??? end ?
  8. ?
  9. ??? unless have_tools?
  10. ????? raise Gem::InstallError,<<-EOT?
  11. The '#{gem_installer.spec.name}' native gem requires installed build tools.?
  12. ?
  13. Please update your PATH to include build tools or download the DevKit?
  14. from 'http://rubyinstaller.org/downloads' and follow the instructions?
  15. at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit' ?
  16. EOT?
  17. ??? end ?
  18. ? end ?
  19. end ?
  20. # :DK-END: ?
    # :DK-BEG: missing DevKit/build tool convenience notice



Gem.pre_install do |gem_installer|

  unless gem_installer.spec.extensions.empty?

    have_tools = %w{gcc make sh}.all? do |t|

      system("#{t} --version > NUL 2>&1")

    end



    unless have_tools

      raise Gem::InstallError,<<-EOT

The '#{gem_installer.spec.name}' native gem requires installed build tools.



Please update your PATH to include build tools or download the DevKit

from 'http://rubyinstaller.org/downloads' and follow the instructions

at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

EOT

    end

  end

end

# :DK-END:
  

參考了我電腦上其他版本的Ruby(1.8.7-p334和1.8.7-p330,分別都只有一個 operating_system.rb ),在安裝好Devkit之后,該文件應(yīng)該為:

  1. Gem.pre_install do |i|?
  2. ? unless ENV[ 'PATH' ].include?( 'd:\\Ruby187\\devkit\\mingw\\bin' ) then ?
  3. ??? puts 'Temporarily enhancing PATH to include DevKit...' ?
  4. ??? ENV[ 'PATH' ] = 'd:\\Ruby187\\devkit\\bin;d:\\Ruby187\\devkit\\mingw\\bin;' + ENV[ 'PATH' ]?
  5. ? end ?
  6. end ?
    Gem.pre_install do |i|

  unless ENV['PATH'].include?('d:\\Ruby187\\devkit\\mingw\\bin') then

    puts 'Temporarily enhancing PATH to include DevKit...'

    ENV['PATH'] = 'd:\\Ruby187\\devkit\\bin;d:\\Ruby187\\devkit\\mingw\\bin;' + ENV['PATH']

  end

end
  

在修改了 lib\ruby\1.9.1\rubygems\defaults\operating_system.rb 之后,構(gòu)建native gem時,依然找不到Devkit;但修改 lib\ruby\site_ruby\1.9.1\rubygems\defaults\operating_system.rb 后(不修改 lib\ruby\1.9.1\rubygems\defaults\operating_system.rb ),便可以成功構(gòu)建。 所以, 如何確認Devkit是否安裝成功呢? 答:檢查 devkit.rb operating_system.rb 文件,其內(nèi)容應(yīng)該和上面的內(nèi)容相同;否則,安裝不成功。 可以手動更改這兩個文件為上面的形式(好像也可以刪除這兩個文件,然后使用 ruby dk.rb install 命令,此時會創(chuàng)建 – 未驗證)。在使用 ruby dk.rb install 時候,需要注意安裝信息或警告,如果某些文件已經(jīng)存在,可能會跳過。 但是, 為什么在看似“正常”的安裝步驟下,為什么沒能安裝好Devkit? 我沒有找到原因;或許我的某個步驟有問題。我發(fā)現(xiàn),雖然我安裝的是1.9.2,但是卻被安裝在了 lib\ruby\1.9.1 目錄下, 官方解釋 說:

This version is a “l(fā)ibrary compatible version.” Ruby 1.9.2 is almost 1.9.1 compatible, so the library is installed in the 1.9.1 directory.

如何確認Devkit是否安裝成功


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 三穗县| 三都| 大庆市| 根河市| 潼南县| 丰城市| 烟台市| 南康市| 闽侯县| 平阴县| 铜川市| 称多县| 临澧县| 喀喇| 广昌县| 建水县| 平湖市| 保德县| 博爱县| 北海市| 房产| 高唐县| 县级市| 会理县| 东海县| 红原县| 新乐市| 锡林浩特市| 年辖:市辖区| 西贡区| 沙河市| 尼木县| 林周县| 万宁市| 兴国县| 裕民县| 东乌| 修武县| 蛟河市| 定边县| 清镇市|