Yesterday I installed Ruby 1.9.2 and added the path to the devkitConfig. yml
And useRuby DK. RB install
Install (unfortunately, do not pay attention to the installation information ).. But still cannot build native gem. Therefore, reinstall Ruby and install it according to the devkit installation instructions. Still incorrect. Step 1 of devkit installation instructions is run installation scripts:
-
CD <devkit_install_dir>
From step 3 above.
-
Ruby DK. RB init
To generateConfig. 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.
-
- [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 instils (or updates)Operating_system.rb
File into the relevant directory needed to implement a rubygemsPre_install
Hook andDevkit. Rb
Helper library file<Ruby_install_dir> \ Lib \ Ruby \ site_ruby
.Note:You may need to use-- Force
Option to update (with backup of the originals) the above mentioned files as discussed at the SFX devkit upgrade FAQ entry.
The last step shows that installing devkit is actually an update.Operating_system.rb
File, and a newDevkit. Rb
File. On my computerDevkit. Rb
Created (devkit installed onD:/ruby187/devkit
Directory,The path on other computers may be different from mine.):
View plaincopy to clipboardprint?
- # 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' ] / span>
- end
# Enable rubyinstaller devkit usage as a vendorable helper libraryunless 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
In ruby1.9.2, there are twoOperating_system.rb
File, located inLib \ Ruby \ site_ruby \ 1.9.1 \ rubygems \ defaults
AndLib \ Ruby \ 1.9.1 \ rubygems \ defaults
The content is the same:
View plaincopy to clipboardprint?
-
- #: DK-BEG: Missing devkit/build tool convenience notice
-
-
- Gem. pre_installDo| Gem_installer |
- UnlessGem_installer.spec.extensions.empty?
-
- Have_tools = % W {GCC make sh}. All?Do| T |
-
- System ("# {T} -- version> NUL 2> & 1")
-
- End
-
-
- UnlessHave_tools
-
- RaiseGEM: installerror, <-EOT
- The'# {Gem_installer.spec.name }'Native gem requires installed build tools.
-
-
- Please update your path to include build toolsOrDownload the devkit
-
- From'Http: // rubyinstaller.org/downloads'AndFollow the instructions
-
- At'Http: // github.com/oneclick/rubyinstaller/wiki/development-kit'
-
- EOT
-
- End
-
- End
- End
-
- #: DK-END:
#: DK-BEG: Missing devkit/build tool convenience noticegem. 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, <-eotthe '# {gem_installer.spec.name} 'native gem requires installed build tools. please update your path to include build tools or download the devkitfrom 'HTTP: // rubyinstaller.org/downloads' and follow the instructionsat 'HTTP: // your end endend #: DK-END:
Refer to other Ruby versions on my computer (1.8.7-p334 and 1.8.7-P330, each of which has only oneOperating_system.rb
After devkit is installed, the file should be:
View plaincopy to clipboardprint?
-
- Gem. pre_installDo| I |
-
- UnlessEnv ['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'] endend
After modificationLib \ Ruby \ 1.9.1 \ rubygems \ defaults \ operating_system.rb
After that, devkit is still not found when building native gem;Lib \ Ruby \ site_ruby \ 1.9.1 \ rubygems \ defaults \ operating_system.rb
After (not modifiedLib \ Ruby \ 1.9.1 \ rubygems \ defaults \ operating_system.rb
. So,How can I check whether devkit is successfully installed? Answer: CheckDevkit. Rb
AndOperating_system.rb
File, the content should be the same as the above content; otherwise, the installation fails.You can manually change these two files to the above format (it seems you can also delete these two files, and then useRuby DK. RB install
Command, which is created at this time-not verified ). In useRuby DK. RB install
You must pay attention to the installation information or warning. If some files already exist, they may be skipped. However,Why didn't devkit be installed properly under the seemingly "normal" Installation Steps?I did not find the cause; maybe there is a problem with one of my steps. I found that although I installed 1.9.2, it was installed inLib \ Ruby \ 1.9.1
The official explanation is as follows:
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.