This project is archived and is in readonly mode.
config.gem github friendly (discussion)
-
Markús
- Assigned user set to josh
-
josh
- Assigned user changed from josh to Rick
-
Rick
I like James Beddington's solution. It makes it more clear what's happening, and doesn't do anything special for github.
config.gem_source :github => 'http://gems.github.com' config.gem 'user-foo', :source => :githubCommon repos like github could be specified by default.
-
Matt Jones
A few things:
-
I don't think that Rails should have a bunch of github-specific code. The solutions presented help a little, but they use quite a few lines in the framework to save a few characters in environment.rb.
-
the gem_source thing is coming close to replicating some of the functionality of Rubygems.
-
Finally, it's looking more and more like the entire mechanism will need to be rewritten for 3.0; there are a number of edge cases where the existing code breaks badly and solutions are hard to impossible. There's also the problems experienced by some users where gems:install needs to load the environment, but the environment won't load without the gems.
I'd encourage anybody who reads this and has an interest to comment on #1721 Unify approach to gem dependencies with ideas.
-
-
Markús
@Matt
I think you're right. This solution doesn't make any sense if the whole config.gem 'thing' is giving errors to everyone. I've read your ticket and it's much more important than this.
I sent this ticket while I was trying the new Templates feature, but I didn't use the config.gem command before (I didn't need).
After trying it, I have to say it doesn't work at all, fails on almost every gem, in both local and remote machines, constantly complains about non-writable directories, tries to download the gems in ~/.gem, etc.
Well, If I come up with any interesting idea to solve this, I will comment it in your ticket.
Cheers
-
Matt Jones
- Assigned user changed from Rick to Matt Jones
@Markus:
The writable directories noises and the ~/.gem thing are both Rubygems stuff; if you're installing gems from a template you'll most likely need to use
rake "gems:install", :sudo => truein your template file to install them to your system repository. (Note: it's not presently possible to download a gem directly to vendor/gems - it has to be installed somewhere before it can be unpacked).
As for the rest, I'm interested to find out what "fails on almost every gem" involves. Can you give any examples? Thanks!
-
Markús
@Matt
I alrteady tried it with :sudo => true (and with sudo rake gems:install too).
Well, actually, "almost every gem" means that once one gem fails to install, all others fail as well, they don't install because the code "exists" due to a single exception (which is very irritating, it will be far better to try to install all, and then ouput a report with the problems found if any).
I've been playing a bit with the "position" of the config.gem command inside the environment configuration to figure out what is the gem or gems are causing the problem. I've just tried this:
config.gem 'mislav-will_paginate', :lib => 'will_paginate', :source => 'http://gems.github.com' config.gem 'RedCloth', :lib => 'redcloth' config.gem 'rubyist-aasm', :lib => 'aasm', :source => 'http://gems.github.com' config.gem 'aslakhellesoy-cucumber', :lib => 'cucumber', :source => 'http://gems.github.com' config.gem 'rspec', :lib => 'spec' config.gem 'rspec-rails', :lib => 'spec/rails'All gems were installed except Rspec (in my previous config rspec was the first config.gem, for that reason I said 'almost every gem', it makes all others to fail)
This is the ouput:
/Users/**sysaccount**/.gem/ruby/1.8/gems/rspec-1.1.12/lib/spec/runner/options.rb:240:in `files_to_load': File or directory not found: gems:install (RuntimeError)By the way, I already have this gem installed.
Cheers
-
Markús
- Title changed from config.gem github friendly to config.gem github friendly (discussion)
I been testing config.gem (manually) a bit more in one of my projects, and I found a very strange error. When I call 'sudo rake gems' (or any other rake gems: task), the script aborts saying "method missing validates_period". This doesn't happen when any other rake task, only with gems related tasks.
The point is that validates_period is a custom validator method which is loaded in an initializer. The --trace option shown me that the error was thrown in ** Execute environment. I have other initializers defined, and they seems to load correctly. Later, I commented out the line which calls the custom validates_period method and all worked perfectly.
I loaded the custom validator using various ways, declaring it in environment.rb, through extend, through module_eval, through class_eval... and nothing worked, this method never loaded in environment with rake gems:*
I have to say that this validator actually works and its tested.
-
Prem Sichanugrist (sikachu)
- State changed from new to resolved
I think this has already be fixed by using
config.gem 'name-my_gem', :lib => 'my_gem', :source => "http://gems.github.com"Also, gem hosting on Github is deprecated, and config.gem will be deprecated in Rails 3.
-
Ryan Bigg
Automatic cleanup of spam.