Geokit issue - "could not find generator" - ruby-on-rails

I am trying to get started with Geokit, and I ran the install command and was greeted with the following:
rails g geokit_rails:install
Could not find generator geokit_rails:install.
Any idea what's going on? I am so confused. bundle install works just fine. I run bundle exec rake db:migrate. but when I go into the console, when I try require 'geokit', I get false. I assume it's because the config file is missing? But how do I generate a sample config file to modify if the install script is failing??

The problem is that your version of the geokit-rails gem does not contain the generator. It was added with https://github.com/geokit/geokit-rails/commit/bb4261acef62a26de823c4b7306634ffb7c3381f. The latest version of the gem is 2.1.0, and as you can see here, the generators were not part of that release.
If you want to use the head version of the gem, then you can change your Gemfile to match gem 'geokit-rails', github: 'geokit/geokit-rails'.

Related

Spring is troubling rails console to start

When i am trying to execute:
bundle exec rails console
It is throwing me error as:
/gems/spring-3.1.1/lib/spring/application.rb:96:in `preload': Spring only supports Rails >= 5.2.0 (RuntimeError)
Earlier it was working fine.
Can anyone help me with a workaround for this.
The workaround I did for this was to create a new project with rails 5.2.3 or something.
If you want to do the same, you can first list all your local gems by doing gem list rails --local
You will see all your rails versions installed locally.
Then do gem install rails -v '5.2.3'
Now go to a new project directory and run rails _5.2.3_ new appname
Now, you should be able to use the console, generate, migrate and other commands.
You can do bundle install after adding other relevant gems based on your apps requirement.

Ruby on Rails Trouble - rake-12.3.1

Anytime I try running the following basic rails commands, e.g. rails g model or rails console, I encounter the following error;
Could not find rake-12.3.1 in any of the sources
Run bundle install to install missing gems.
I've already looked through the forums for solutions and haven't found anything that solves my problem.
My gem file includes the necessary gem and I already ran bundle install.
Thanks in advance for your help.
This is because you have two versions of rake instaled.
Sometimes you have two rails projects with different rake versions and you did bundle install in one and after in another. (now you have two rake versions)
try gem uninstall rake
This command above will show you two these rake versions. You have to type the number that you want to unistall.

"Could not find generator figaro:install"

I'm using the "Learn Ruby On Rails" pdf book from learn-rails.com.
I'm at chapter 13, "Configure". Where we are supposed to do the command: "rails generate figaro:install"
In chapter 12 we installed the figaro gem,: "We’ve already installed the figaro gem in the Gemfile and run bundle install."
When I run that command I get: "Could not find generator figaro:install."
I started searching for similar questions, and I did find this question here: rails generate - "Could not find generator"
where they were recommended to include "migration" into the command as well.
I included it in my command and I got it to do something, but I don't think it's doing what it should be?
invoke active_record
/Users/NormalUse/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/activerecord-4.0.2/lib/rails/generators/active_record/migration/migration_generator.rb:57:in `validate_file_name!': Illegal name for migration file: figaro:install (ActiveRecord::IllegalMigrationNameError)
(only lower case letters, numbers, and '_' allowed)
from /Users/NormalUse/.rvm/gems/ruby-2.0.0-p353#learn-rails/gems/activerecord-4.0.2/lib/rails/generators/active_record/migration/migration_generator.rb:10:in `create_migration_file'
Then about 20 more lines as well. I just didn't want to put it all here.
The author goes on to say:
"Using the rails generate command, the figaro gem generates a config/application.yml file and lists it in your .gitignore file. The .gitignore file prevents the config/application.yml file from being saved in the Git repository so your credentials are kept private."
When I go to my project directory, and look inside the "config" folder, I do have an "application" file, but it ends with ".rb" and not "yml". So obviously the command didn't do what it is supposed to do, right?
Does anyone have any ideas for me?
I'm using Ruby 2.0.0 and Rails 4.0.2 with RVM on Mac OSX 10.7.5
If you do this tutorial nowadays instead of "rails generate figaro:install" run command "figaro:install" due to figaro 1.0.0 version https://github.com/laserlemon/figaro
As you're learning (welcome to the Rails community btw!), let me explain what Figaro does & how to use (install) it:
Figaro
Figaro is a way to create ENV variables in both development & production. It's a gem which you have to install before invoking from the Rails cmd
Like other Ruby gems in Rails, you have to add it to your Gemfile, which lists all the plugins your app will use. According to RubyGems.org, you could list it in your Gemfile like this:
#Gemfile
gem "figaro", "~> 0.7.0"
After you've added this line to your Gemfile, you need to install it. To do this, you should run bundle install to run the bundler (installer)
Once you've done this, you need to run this command from cmd:
rails generate figaro:install
Error
Your errors seem to indicate you've got migration problems?
Illegal name for migration file: figaro:install
(ActiveRecord::IllegalMigrationNameError)
I would guess you called this command:
rake db:migrate figaro:install
If this is the case, you should perform any migrations by running rake db:migrate and then rails generate figaro:install. This will run the commands separately, which should help them work
Please try below one:
bundle exec figaro install
Thank you

undefined method `action_mailer' during Capistrano deployment

I'm having this error message come up during Capistrano deployment. It implies to me that something's wrong with Rails being installed or something? Rails is not currently installed on the server side, but it's in my Gemfile (and my Gemfile.lock), so I'm assuming it should be installed during the bundle install command that gets executed before this line.
The actual command that's giving the error is:
bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile
I guess the problem is just that Rails is not being installed during the bundle install. Am I missing something?
Thanks!
UPDATE 1: Rails appears to be installing correctly via the bundle install command. If I check out the directory .../shared/bundle/ruby/1.9.1/gems, I can see action mailer in there.
UPDATE 2: Running the command rake assets:precompile actually fails locally as well, so this doesn't have anything to do with Capistrano it would appear. Now I just have to figure out why the config object doesn't know anything about action mailer?
UPDATE 3: Hot on the trail. It looks like my installed version of actionmailer is 0.6.1 (?!), meanwhile all the rest of my Rails stuff is up at 3.2.9. bundle update refuses to update actionmailer past this version. I'm going to remove all of my gems and start fresh.
UPDATE 4: Deleted my entire gemset using rvm gemset empty. Then tried to run bundle again, and again it tries to get actionmailer 0.6.1. I think something is screwed up with bundler or something...
The problem ended up being that I had removed a dependency upon a specific version of Rails in my Gemfile. I just had gem "rails" in there. That seemed to completely botch the dependency calculations, because it was getting super-old versions of action mailer rather than getting a consistent version from all gems. Guess it's a bad idea to not specify an exact Rails version. Yikes!
#aardvarkk,
Thanks for posting this issue, I was having the same error with my installation of Rails 4.0.0 and the error was preventing me from running my rails server
This is while I'm trying to follow the Hartl Tutorial for RoR.
I added gem "rails", '4.0.0' to my gem file and now I'm able to run my rails server.
Thank you

How do I fix this error? config.gem: Unpacked gem authlogic-2.1.3 in vendor/gems has no specification file

I get this error when launching my Mongrel server...
$ script/server --debugger
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
config.gem: Unpacked gem authlogic-2.1.3 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
=> Debugger enabled
=> Call with -d to detach
=> Ctrl-C to shutdown server
When I run rake gems:refresh_specs like it suggests I get another error though:
rake aborted!
undefined method `installed_source_index' for #<Gem::SourceIndex:0x100551a58>
Any thoughts on how to fix this?
I am not sure why it is broken in Authlogic, but I had to generate it myself.
Try this in your Rails project:
$prompt> cd vendor/gems/authlogic-2.1.3
$prompt> gem specification authlogic > .specification
I'm just going to chime in here, because I experience the same thing today, except with a different gem.
I was updating hoptoad to use the notifier as a gem instead of a plugin, and one of the instructions from the Github page is to unpack the gem into vendor/gems.
I'm on Mac OS X, and I unpacked the gem as so:
$> rake gems:unpack GEM=hoptoad_notifier
After I did this, I got the error specified, and the gem didn't actually unpack (it created the directory in vendor/gems, but didn't actually unpack the gem).
I deleted the directory from vendor/gems, and tried again as:
$> sudo rake gems:unpack GEM=hoptoad_notifier
Worked this time, unpacked properly, and no error.
I believe this is the reason:
http://github.com/binarylogic/authlogic/commit/05e452472616bd60bb81affc75a1cb3d95cf7857
The owner purposely added the gitignore on the .specification file.
I'm guessing u freeze this particular gem and submit it in your code branch under vendor/gems/..and as expected, git ignore this particular file per request
I had to pop into vendor/gems/authlogic and remove '.specification' from the .gitignore
Once you've done that you can run rake gems:refresh_specs
Only problem is that the next time you upgrade this gem the bad .gitignore comes back
I had the same "unknown GEM" problems. After much faffing about I found the following recipe :
First, I installed the gem using the standard "gem install authlogic", which placed the gem in /Library/Ruby/Gems/1.8.
Within RadRails, I used the rake task "gems:unpack" which seems to gather all the gems relevant to your app and place them in /vendor/gems as desired.
I then uninstalled the system wide gem to check it has really worked with : gem uninstall authlogic --install-dir=/Library/Ruby/Gems/1.8
Seems to work well.
Build and install the gem before generating the .specification file
$prompt> cd vendor/gems/authlogic-2.1.3
$prompt> gem build authlogic.gemspec
$prompt> gem install authlogic.gemspec
$prompt> gem specification authlogic > .specification

Resources