LoadError when installing ruby devkit [closed] - ruby

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I have installed ruby on Windows 7 using the installer Ruby 1.9.3-p125 which is the latest version (ruby -v shows the right version). Next, I downloaded devkit-3.4.5r3-20091110, which is also the latest version. When I tried the following in the installation directory,
ruby dk.rb init
the console showed an error:
ruby: No such file or directory -- dk.rb (LoadError)
I am new to ruby and I don't want to learn ruby — I just want to use Jekyll which needs ruby.
How can I fix this error?

Try to run the command from the devkit folder, and let me know if it doesn't work.

Try installing the dev kit from here. You'll find dk.rb in the directory you extracted the contents to.

Related

Does Ruby have anything like Python PEX [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Does Ruby have a capability to archive all dependent gems and application code in a file like Python's PEX?
To implement Python PEX, Ruby needs a feature like python's zipimport, which the current version of Ruby doesn't seem to have. But PEX looks very interesting if we have for Rails and other usages.
So my question is "Does Ruby have PEX like feature?" If not how can i implement it?
Please check Traveling Ruby, from the project description:
Traveling Ruby is a project which supplies self-contained, "portable"
Ruby binaries: Ruby binaries that can run on any Linux distribution
and any OS X machine. This allows Ruby app developers to bundle these
binaries with their Ruby app, so that they can distribute a single
package to end users, without needing end users to first install Ruby
or gems.
The only downside is Windows is not supported, which is fine for most users.
Ruby has some tools similar to PEX.
JRuby Warbler packs files into a jar or war file, both of which are essentially zip files.
Warbler can package anything from a simple Ruby command-line script to an entire Rails app.
The jar or war contains your own files, plus optionally any gems you want, but does not contain a JRuby runtime, Ruby runtime, or JVM.
A typical use case is to package your app into a war file, then send the file to a remote server that already has a Java server installed, the the Java server runs your app.
For example, I can use Warbler to package my Rails app to deploy to Google AppEngine.
Targets any typical JVM.
Traveling Ruby lets you create self-contained Ruby app packages.
An app packaged with Traveling Ruby is self-contained and doesn't require the user to install any further dependencies or runtimes.
The package contains your app, your app's gems, and a portable Ruby runtime. The package tends to be much larger than just your app's source code.
A typical use case is to send someone an app so they can run it on their own system. For example, I want to send someone my Rails app and have the him run it on his own server, without installing anything else.
Targets Linux or OSX.
Ruby Ship provides a portable Ruby runtime, and can also package your code.
Ruby Ship is an alternative to installing Ruby on a system.
You can send Ruby Ship as is, or you can include in your script folder, or app folder, so you can distribute your own Ruby script or app with a fully runnable Ruby environment.
A typical use case is to package Ruby for someone else. For example, I want to send a Ruby 2.2 runtime to someone who only has Ruby 2.0. I can use Ruby Ship, and I can optionally include my own scripts and apps in the package. For example, I have some data analytics scripts that I wrote using Ruby 2.2 features, and I want to send them to someone who has a system which runs an older Ruby 2.0; I can use Ruby Ship to build Ruby 2.2 on a similar system then send my scripts plus the ship.
Targets Linux, OSX, or Windows.
For zip file management:
You can use any JRuby Java zip tool, or a Ruby gem such as rubyzip
To require Ruby code from a zipfile, you can use ziprequire

Errors when trying to set up Ruby on Rails and connect to localhost:3000

I apologize ahead of time if I don't do a good job of explaining this. I am a complete beginner and I have been struggling to find anything online that is written with that in mind.
So far, my only experience is doing the Javascript and Ruby sections of Codecademy.com. I read that I should have some knowledge of Ruby before trying out Rails.
So I found this site Getting Started with Rails and I tried to follow the steps and do exactly as it said. It even says at the beginning, "This guide is designed for beginners who want to get started with a Rails application from scratch. It does not assume that you have any prior experience with Rails." It also says, "The best way to use this guide is to follow each step as it happens, no code or step needed to make this example application has been left out, so you can literally follow along step by step."
Anyway, I'm using Windows 7 Home Premium and I already had Ruby installed. When I go into the command prompt and type ruby -v it says ruby 1.9.3p484 (2013-11-22) [i386-mingw32]. When I type rails -v it says 4.0.2. When I type gem -v I get 1.8.28. Now in the instructions it links to a place to download RubyGems and it says that it's 2.2.2. I downloaded that and clicked the setup.rb file and it said it installed it, yet the version is still 1.8.28. I don't know why, but it says it's installed so I assumed it did what it was supposed to do. I'm probably wrong.
Then I'm supposed to type rails server and then go to localhost:3000 and see some kind of default page. However, when I type rails server I get these errors. Sorry for the copy and paste, but I'm not allowed to post a pic of the command prompt.
E:\Apps\RailsWork\blog>rails server
←[31mCould not find gem 'rails (= 4.0.2) x86-mingw32' in the gems available on t
his machine.←[0m
←[33mRun `bundle install` to install missing gems.←[0m
E:\Apps\RailsWork\blog>bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.9.0)
Installing atomic (1.1.16)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.
"E:/Apps/Rails Installer Package/RailsInstaller/Ruby1.9.3/bin/ruby.exe"
extconf.rb
E:/Apps/Rails Installer Package/RailsInstaller/Ruby1.9.3/bin/ruby.exe: invalid o
ption -P (-h will show valid options) (RuntimeError)
Gem files will remain installed in E:/Apps/Rails Installer Package/RailsInstalle
r/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/atomic-1.1.16 for inspection.
Results logged to E:/Apps/Rails Installer Package/RailsInstaller/Ruby1.9.3/lib/r
uby/gems/1.9.1/gems/atomic-1.1.16/ext/gem_make.out
An error occurred while installing atomic (1.1.16), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.16'` succeeds before bundling.
E:\Apps\RailsWork\blog>
You can see that it tells me to type bundle install, but when I try that I get another few error messages. I've tried googling these error messages, and some of them even linked me to questions asked on this site, but most of them were close, but not exactly what I'm having trouble with, and all of them have answers that are away over my head.
I also thought maybe it didn't matter and so I tried to go to localhost:3000 anyway, but I get the "Oops! Google Chrome could not connect to localhost:3000" message.
I'm a total noob. Everything I look up just gets me more confused so I'm hoping the answer is kind of simple and that someone can point it out for me in a beginner-friendly kind of way. I feel like once I get over this hump of getting all of this set up, I can actually start learning and gaining some experience. I had a blast learning Ruby so far and I hope to continue on with learning Rails. Thanks for reading and any help would be greatly appreciated. Oh, and if anyone has any better suggestions for a beginner's guide to all of this stuff, I'd also really appreciate it. Thanks again.
On windows it is probably the easiest to get started with the one click rails installer as this will also install the devkit although I see that it is not being kept up to date with ruby or rails versions. Although it does work Windows is not the best environment for Rails development. Starting up the rails server and running tests is much slower than on mac or linux and will get frustrating after a while. Also some handy gems and third party tools doesn't work on windows. Save yourself the pain and run ubuntu on a vm (virtualbox is good). Also use a ruby version manager like rbenv otherwise it becomes a royal pain to upgrade ruby later.

Tips for ruby migration from 1.8? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am looking at migrating to the new ruby. The question is what is the new ruby? 1.9.3 with some patchlevel or 2.0 with some patchlevel?
Has anyone tried doing the migration? I know a lot of code is not going to be backward compatible but how do you manage production then - keep using old ruby for old code and new ruby for the latest stuff? Kind of hack it in with RVM? But then again will 1.8 code run side by side with say 1.9?
Also if I want to test for the existing code compat levels between 1.8 and 1.9 what would you recommend?
To answer your questions:
What is the new ruby? — On ruby-lang.org you'll find that currently Ruby 2.0.0-p274 (and Ruby 1.9.3-p448) are the most recent releases. If you are migrating to a new version, you should always chose the latest patchlevel.
Has anyone tried doing the migration? — Yup. I've been using both RVM and rbenv to manage different Ruby installs and gemsets (they both get the job done). This way, you can run different code in production.
...test for the existing code compat levels... — This SO answer (gee... from 2008 :-)) is pretty much comprehensive. If you have code using 1.8-specific behaviour, write an extensive test suite, switch to Ruby 2.0.0 and compare the results.
Btw.: The only problems I had when switching from Ruby 1.8.7 to 1.9.3 were encoding related, some of which could be resolved with a simple #encoding: UTF-8 comment. Other (I/O-related) code has needed some refactoring, though.
I also had some trouble with the built-in (but switchable) Syck and Psych YAML parsers, which behave a little different when it comes to serializing BigDecimal values, but that is caused by a Rails monkey patch (upgrading Rails from 2.3.x to 3.2.x or 4.0.0 is another level of pain :-)).

bundler vs RVM vs gems vs RubyGems vs gemsets vs system ruby [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am new to Ruby and trying to wrap my head around following concepts: bundler vs RVM vs gems vs RubyGems vs gemsets vs system rub and I'm confused.
Can someone please describe a 'best practice' of how I should manage all this on a fresh install of the latest version of Ubuntu? What should I install, and how should I use it all?
I'm guessing that doing a sudo apt-get install ruby is not be recommended, but I am not sure. I tried it on my system in addition to 'all the other Ruby stuff'. It's just adding to my confusion. I am not talking about Rails but just regular Ruby gems (e.g. Vagrant, Chef, scripts).
As per the previous answer, this is quite a lot to cover, so consider this a short introduction.
gems are the way Ruby libraries are packaged. They are to Ruby what jars are to Java. Inside a gem file, you find Ruby code (.rb files), but also tests, and a special file giving information on the gem itself, such as its name, dependencies and version (gemspec). Any Ruby project can define the gems it needs via a Gemfile that just need to declare dependencies. Rubygems is the name of the package manager - the tool used to install the packages (while the gems are the packages themselves). Rubygems is now part of Ruby.
Bundler is what makes managing gems bearable. Based on your Gemfile, a simple call to bundler using bundle install will download and install all the required gems. Using standard gem command, you would have to install each of them manually, using gem install <gem_name>. Bundler is not part of Ruby (it is itself packaged as a gem), but it a "de facto standard" for most applications (you will not find many people not using it, and no good reasons not to use it, actually).
RVM is a tool allowing you to install multiple versions of Ruby on a machine, switching between them when needed. This can be used to install both a Ruby 1.8 and 1.9, or even a "MRI" (Matz's Ruby, the default implementation) and alternatives (such as JRuby or Rubinius). Note that RVM is not alone in this field, see for instance rbenv.
A gemset in RVM is a set of gems specific to a given context, typically a project. This is useful if you are for example developing different applications, each with its own sets of gems, and want to keep them separate.
system Ruby is, when using RVM, the Ruby version installed on the machine (ie, not via RVM).
If you are just starting, gems and bundler are of interest to you. You can let RVM and gemsets aside for now.
You're asking for more information in one question than is in-scope for Stack Overflow. To cover it all would take a book.
On Ubuntu it's easy to install and remove gems to the "system" version of Ruby, so get used to installing and removing regular gems via sudo. (On Mac OS I'd give different advice because Apple bundles Ruby for their own use and it's not a great idea to mess with it.) Then, when you have an idea how the whole gem idea works, and you know you want multiple Ruby versions on your system, try "rbenv" or "RVM" and install a version or two in your sandbox.
Linux makes it easy to add/remove Ruby via a distribution, but we're limited to the versions the distro maintainers have packaged, so I usually install from source. But, that's a pain when managing several versions of Ruby for development, test and production systems, which is why rbenv and RVM were invented -- they handle the dirty detail allowing us to concentrate on programming.
I've used both rbenv and RVM, and have been using rbenv for the last six months or so, with good results. It's less complicated than RVM which I like. In either case they make it easy to have different versions installed, with separate sets of Gems. You can have different Ruby versions open in different terminal windows if you want, making it easy to test for compatibility.
Rule one when debugging is to make changes one at a time, which is true for learning to program or learning a new language. Don't be distracted, just keep it simple.

What are the important Ruby commands? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm not sure of all of them, but what are the commands to do things like update Ruby, download a new gem, or update an existing gem? What other important things are there?
Since it might matter, I'm running Windows.
By Ruby commands you probably mean the command line programs for Ruby. These are also called Ruby Helper programs. Here are a few:
ruby - The interpreter itself. Run Ruby scripts or statements.
gem - Ruby Package Manager. Great for automatically downloading or updating small Ruby modules like XML libraries, web servers, or even whole Ruby programs.
irb - Interactive Ruby Prompt. This is an entire Ruby shell that will let you execute any Ruby code you want. You can load libraries, test code directly, anything you can do with Ruby you can do in this shell. Believe me, there is quite a lot that you can do with it to improve your Ruby development workflow [1].
ri - Quick shell access to Ruby documentation. You can find the RDoc information on nearly any Ruby Class or method. The same kind of documentation that you would find on the online ruby-docs.
erb - Evaluates embedded Ruby in Ruby Templated documents. Embedded Ruby is just like embedding php into a document, and this is an interpreter for that kind of document. This is really more for the rails crowd. An alternative would be haml.
rdoc - Generate the standard Ruby documentation for one of your Ruby classes. Its like Javadocs. It parses the Ruby source files and generates the standard documentation from special comments.
testrb and rake. I'm not familiar enough with these. I'd love it if someone could fill these in!
Hopefully this was what you were looking for!
Useful command: Rake
In addition to the commands listed by Joseph Pecoraro, the 'rake' command is also pretty standard when working with Ruby. Rake makes it easy to automate (simple) tasks; like building a RubyGem or running your unit tests.
With rake, the only important command to remember is 'rake -T', which shows a list of rake tasks available in the current directory.
Updating a Ruby gem
To get back to your specific question:
To update a specific gem, you can do two things: simply update the gem:
gem update <gemname>
This will update the gem to the latest version.
Install a Ruby gem
If you want to update to a specific version, you must install it:
gem install <gemname> -v <gemversion>
You can leave out the -v options. Rubygems then installs the latest version.
How to help yourself
Two useful gem commands to remember are:
gem help
This shows how to get help with rubygems.
gem help commands
This shows all commands available to rubygems.
From here you can get more specific help on a command by using gem help:
gem help update
sudo gem install gemname
sudo gem update gemname
Okay. I see what you're going for but again try to go abstract because I know someone will give you a direct answer (which people should up-vote over this).
Everyone should get comfortable with man pages. But even if you are, you'll find that these commands lack decent man pages. However, those that do will point you to cmd --help and you will find some decent documentation there. I linked each of the commands above to a hopefully useful resource that will lead you to an answer if you're worried about command line switches. I see someone already posted the commands so I won't repeat those for gem. But I'd go further and say:
sudo gem update [gemname]
The default behavior will update all installed gems.
Also, as a bonus there is a neat gem called cheat. The idea is that instead of typing man cmd you will type cheat cmd and you can get a community editable man page for that command. Or better yet, it doesn't have to be a command, it can be an entire topic. Coincidentally to install cheat you would do:
sudo gem install cheat
And then:
cheat gem
That will list out a "man page" written by users like you about the gem command. The commands that you asked for are on that page. Anyone can add new pages, update existing pages, and contribute to the community. If you're interested here is a quick addition you can make to have autocompletion for the cheat command from the command line.
I know I have long winded answers ;)
Is there a similar command to update Ruby itself?
Alas, no there is not. I'm afraid that if you want to update Ruby itself you will have to either download an installer from the Ruby website, or compile it from source.
I should mention though that compiling from source is very easy and offers developers quite a bit of neat flexibility. You can add a suffix to the generated commands so that you can have standalone Ruby 1.8 and Ruby 1.9 builds both at the same time. That can be very helpful for testing.
Finally, its always a danger to update an operating systems built in commands unless it occurs through an official update. Installed applications may be expecting to a Ruby 1.8 in the standard location and crash if they meet an updated version. Any updates you make should just not overwrite one that came with an OS. (If any app crashes then its the fault of the app's developers for not specifying the absolute path to the OS version).
#John Topley: Thanks. Is there a
similar command to update Ruby itself?
Not really. You don't say which operating system you're using. I use Mac OS X and tend to build Ruby from source.

Resources