Devkitが正常にインストールされているかどうかを確認する方法

7241 ワード

昨日Ruby 1.9.2がインストールされ、そのパスがDevkitconfig.ymlに追加され、ruby dk.rb installがインストールされました(残念ながら、インストール情報に注意していません).しかし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が作成されています(DevkitはD:/Ruby187/devkitディレクトリにインストールされています.他のパソコンのパスは私とは異なるかもしれません):
    view plain
    copy to clipboard
    print
    ?
    # 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 
    # 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

    Ruby 1.9.2には2つのoperating_system.rbファイルがあり、それぞれlib\ruby\site_ruby\1.9.1\rubygems\defaultslib\ruby\1.9.1\rubygems\defaultsの下にあり、その内容は同じである.
    view plain
    copy to clipboard
    print
    ?
    # :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: 
  • # :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-p 334と1.8.7-p 330は、それぞれoperating_system.rbが1つしかありません)を参考にして、Devkitをインストールした後、このファイルは次のようになります.
    view plain
    copy to clipboard
    print
    ?
    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 
  • 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を修正した後も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を修正しない)、構築に成功することができる.では、Devkitが正常にインストールされているかどうかをどのように確認しますか?答え:devkit.rboperating_system.rbのファイルを検査して、その内容は上の内容と同じであるべきです;そうでなければ、インストールは成功しません.この2つのファイルは、上記の形式で手動で変更できます(2つのファイルを削除してruby dk.rb installコマンドを使用すると、作成されます–検証されていません).ruby dk.rb installを使用する場合は、インストール情報や警告に注意する必要があります.一部のファイルがすでに存在する場合は、スキップする可能性があります.しかし、なぜ「正常」に見えるインストール手順で、なぜDevkitをインストールできなかったのでしょうか.私は原因を見つけられなかった.私のステップに問題があるかもしれません.私は1.9.2をインストールしていますが、lib\ruby\1.9.1ディレクトリの下にインストールされていることに気づきました.公式解釈は言います.
    This version is a “library compatible version.” Ruby 1.9.2 is almost 1.9.1 compatible, so the library is installed in the 1.9.1 directory.