I'm fairly new to programming with ruby and have been trying to install a gem so that I can make graphs. I've tried unsuccessfully with gruff and gnuplot as I have run into errors for both. can someone give me a detailed step by step on how install or a link to one? thanks
there is a discussion about it here
What graphing packages/APIs exist for Ruby?
Related
I've recently replaced an aging Mac with a new one, and so I am setting up my new environment. I installed ruby using rbenv, and have installed many gems already, but one, won't seem to install due to this error:
rdoc's executable "rdoc" conflicts with /Users/username/.rbenv/versions/2.1.2/bin/rdoc
Overwrite the executable? [yN] N
It's refinerycms of which I've built a production site on and am fairly familiar with. I thought I'd start looking at rbenv first and then look into the actual gem (not much here https://rubygems.org/gems/refinerycms that was of any help, but I'll reach out to their awesome devs next)...I was trying to see what version the refinerycms gem was using.
I appreciate any help!
Thank you, everyone,
Dinos
Try prepending yes |. This is unlikely to solve the problem but you might also wanna take a look at this issue on github where people are trying to solve the same problem:
Conflict when installing gems that have default versions
Is there a Ruby gem that can write formulas to an xls/xlsx spreadsheet? The Spreadsheet gem doesn't appear to allow this, at least not in the latest version. Are there any gems out there that allow this or am I stuck doing it in a csv file?
Thanks,
Ben
I had this exact same problem and there is a gem that will do this for you!
Check out writeexcel. It will write all those formulas you have been missing. Here is an example of how it works:
worksheet.write('B5', '=SIN(B4/4)')
Hope this helps!
I want to write a small reporting tool and looking to fetch data from MySQL. After searching I found a tool called as Ruport but I am not following where are it's binaries located. If not binaries than how to install it. It discusses the installation commands to install via gems, but where are the files located.
Secondly, do I have to create a Windows interface using fxRuby or wxRuby to work with it?
Are there other free reporting tools for Ruby?
It's probably a good idea to get a good book or two on Ruby, rather than asking these kind of questions, but here goes:
To install a gem, do
gem install gemname
To use it, put the following in Ruby code:
require "rubygems" # May not be necessary
require "gemname"
To find where your gem files are stored, do
gem env
And as for whether you need a GUI for ruport: can you try working that out yourself first?
I have a ruby gem I created and installed and want to be able to use it in a Shoes app. As expected, Shoes reports it cannot find the gem, understandably since the gem is only installed for the standard ruby distribution. Can help pointing towards documentation explaining how to get Shoes to find this gem would be most appreciated.
Thanks.
Unless things have changed since _why left, this is not possible. Shoes is a separate Ruby installation and therefore needs its own gems.
To install a gem, you can do something like this at the beginning of your Shoes app:
Shoes.setup do
gem 'json'
end
Edit: there's also this previous SO thread:
Using Ruby libraries and gems with a Shoes app
U can think Shoes as a ruby-distro, like jruby or other rubies, it maintains its own gems.
therefore you will need to install it via shoes way like Michael Kohl said
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.