I recently started my first gem, but as I was familiarizing myself with the gem command, how the build process worked, etc., I published several versions of my gem with varying version numbers before I realized I could simply run rake install.
I know the site doesn't give any information regarding deleting/resetting a gem, but is there any way to reset a gem that I started? When I go to "previous versions", every dummy version I published is listed regardless if I yanked it or not. Is there a way to reset this?
Related
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.
I have a gem published here: https://rubygems.org/gems/rangy-rails/
When I first released it in March 2013 I later realized that I had set an incorrect version.
I immediately yanked the gem and resubmitted it with the correct version. Unfortunately RubyGems does not remove the yanked gem and this is causing two problems:
The version list is not ordered correctly (yanked gem is on top): https://rubygems.org/gems/rangy-rails/versions
My gem's main page on RubyGems: https://rubygems.org/gems/rangy-rails/ is using a description about the gem being yanked instead of the gemspec's description.
How can I fix this?
So far my only option seems to be contacting RubyGems but they explicitly say the following:
Our policy is to only perma-delete gems that really need it, such as
gems that may contain passwords, malicious/harmful code, etc. Yanking
a gem effectively removes it from being found and will do the trick in
99% percent of situations.
(source: http://help.rubygems.org/kb/gemcutter/removing-a-published-rubygem)
Problem 2 is solvable. The description is taken from the latest non-prerelease version of the gem (not including yanked versions). (See more info about prerelease gem versions here.) Right now, your gem has 3 versions, and the two non-yanked ones are both prerelease (they have letters in the gem version). If you push a new version of the gem, even if it's 0.0.1 or something, that's a "release" version, and it will be used for the description instead.
I made a little test gem here to demonstrate what I'm talking about -- notice that the description page is taken from the latest non-prerelease version (0.0.1, in my case.)
There is no self-serve way to "solve" problem 1 -- Rubygems.org will always display your gem versions in semantic versioning order, from highest to lowest. I'm not sure why this is a big issue, though -- most people typically won't look at the versions page. Yanking will mask the bad version in most situations and, as the documentation says, will probably "do the trick" in this case.
If you really want to permanently hide the traces of the yanked gem and remove it from the versions list completely, you'll need to contact the Rubygems staff and see if they're willing to help out.
You need to publish new version, that is more than yanked. I.e., if yanked version is 1.3.0.772, you need to publish 1.3.0.780 (for example)
I'm really just a beginner to ruby, so hopefully this is an easy one. I've got to the point where I'm starting to look into some of the gems that the community have put together. I decided to check out something that would help my application consume rss feeds. So, headed over to rubygems (which is where i thought people go to get these kinds of things) and searched for rss. I found this one;
http://rubygems.org/gems/simple-rss
instructions were to just install the gem with
gem install simple-rss
So far, so good. When i came to actually use the gem, the documentation I received from doing the above was a bit naff, so i searched a bit further and found the git repo;
https://github.com/cardmagic/simple-rss
The documentation there (their code examples) complain about missing methods etc. and after a bit of digging I came to the conclusion that I must have downloaded an older version of the gem than the git trunk.
So, my question is, should I be using rubygems to get the latest gems, and if not, what other resources are out there to help find the latest builds of the comminities gems?
As far as finding a good gem for a task — use Ruby Toolbox, since it also shows you how actively maintained a gem is. Here's, for example, a section on feed parsing.
If you want to get the latest gem code that hasn't been released yet, you could download the code directly from github and build the gem yourself. However, it's easier to use bundler for that. It allows you to create a Gemfile for your project looking something like the following.
gem 'simple_rss', :git => "git://github.com/cardmagic/simple-rss.git"
Then run bundle command to download and build these gems from their corresponding sources.
In general, bundler is a great solution for managing gem dependencies for any ruby project. It provides ways to quickly reference any released gems, automatically builds gems directly from a git source, git refs, or paths on your filesystem, and has other convenient features.
By far the best place for all things Ruby & Ruby on Rails for the devs is the Ruby Toolbox
i am running ruby 1.9.2p0 on rails on windows OS with rubymine 3.1.1.
i use it for גseveral weeks.
a few days ago- i tried to run my project from rubymine and the console notification was:
"Could not find rake-0.8.7 in any of the sources
Process finished with exit code 7"
i googled it and i found reference to this problem in several places. the solution repeated most often was to delete the non-versioned "rake.gemspec" file.
i tried this solution but the problem is not resolved, it still says the same notification.
i trying to solve this problem for several days!!!
please help me if you know how!!!
thanks a lot in advanced!
Asaf,
I've had literally hours of frustration dealing with similar problems. The solution can be a challenge to track down, because there are numerous reasons you could be having the problem. I'm no expert myself, but I'll try to pass on some of what I've learned.
First, you mentioned getting an error about Rake, but didn't mention that you had tried to actually run Rake. Are you getting the error upon loading up RubyMine or specifically after running a Rake command?
Next, if you are running a Rake command and getting an error, you should take note that WHERE you run the command from is pretty important. For example, if you keep a Terminal window open like I do, and run the Rake command from Terminal, you won't necessarily get the same results you would get by running Rake from RubyMine itself. The reason for this was not self-evident when I first started with RubyMine, but I think it comes down to this:
The Ruby SDK and Gems preferences in RubyMine should be determining what types of dependency errors you get from within RubyMine. So you might start by looking there to see if there are any dependency errors. Next, I would guess that you're running RVM? Please be aware that it is completely possible to be using one RVM set in RubyMine (check the Ruby Interpreter in SDK and Gems Preferences to see which one you're using) and an entirely different RVM in Terminal (the command "RVM info" should get you the version you're using). If those don't match, you could very well get different results from both RubyMine and Terminal, even when running exactly the same commands.
My solution to this problem was to carefully ensure that both of my environments matched. I think you can set RVM defaults by typing "rvm default" plus the version you want to default to. That way both your Terminal and RubyMine environments match.
Lastly, be aware that RubyMine allows more than one version of a Gem to be installed at the same time. So, if you're getting an error that a Gem is failing because some dependency requires a specific version, you can tell RubyMine to install multiple versions. Do this thru the SDK manager, select the Gem, then click "Select Versions".
Hopefully some of this information applies to your issue. I sort of did the shotgun approach, because I'm not really sure what is causing your error, but maybe some of this can put you on the right path. One final note would be this: Use your Gemfile to control Gem versions, if need be. I've spent hours of frustration over broken dependencies, only to discover that the reason for the break was me telling RubyMine to update all my Gems to the latest version. The latest version of a particular Gem isn't necessarily backwards compatible with previous versions, and blindly updating Gems can cause huge problems.
Asaf, you should delete rake.gemspec and run gem install rake to get problem fixed
I'm confused about the world of Ruby Gems. There are several well-known repositories. Which is the right one, or does it matter?
I guess Gemcutter is the hip repository right now. They definitely have the nicest-looking website. Does that mean I should get my gems from there?
The main reason I'm asking is that I want to make sure I'm getting the latest release of the gem. If I don't specify the source, am I in danger of installing a crap version of the gem, or am I bugging?
Why is there more than one repository anyway?
GitHub gem building is defunct -- it got disabled for an upgrade, and was never re-enabled because GemCutter is taking over that role. There are no new gems being generated on GitHub.
RubyForge is planning to phase phase out gem hosting too -- GemCutter will become the standard source for gems.
Edit: The whole migration plan is here
Go gemcutter. It's been publicized that gemcutter is going to become the new de facto. But, if you can't find the gem on gemcutter, you have to look at github or rubyforge. Hopefully most people will (if they haven't already) start moving towards gemcutter.
I think that's where "we" are at right now.
Why is there more than one repository anyway?
Because you can run your very own gem server and install from that (some folks use it on large deployments to host their own gems).