rake aborted help - ruby

i don't really know what ruby,gems, or ror is, my objective is make this web application run in my local and after that push it on live. the problem is, when I perform this command
rake db:migrate
i am getting an error saying
rake aborted! Could not find RubyGem rack (~) 1.0.1)
what should I do ? please help me

It's telling you that you need a specific version of the Gem called "rack". You can install it by doing:
gem install rack -v=1.0.1
This will only install it to your local gem directory. If you want to install it globally (which is recommended for production environments), simply do:
sudo gem install rack -v=1.0.1
This will prompt you for the administrator password as usual.

You need to write this in your command prompt:
gem install rack

Related

rake neo4j:install[community-latest] - The `neo4j-rake_tasks` gem is no longer a dependency of the `neo4j-core` gem

I am following this instruction, "Getting Started with Neo4j and Ruby", https://neo4j.com/developer/ruby-course/.
Here is how you would setup your asset portal Rails app:
rails new asset_portal -m http://neo4jrb.io/neo4j/neo4j.rb -O
cd asset_portal
rake neo4j:install[community-latest]
rake neo4j:start
But after I run
rake neo4j:install[community-latest]
I got this note
The `neo4j-rake_tasks` gem is no longer a dependency of the `neo4j-core` gem.
If you would like to use the rake tasks, you will need to explicitly include the `neo4j-rake_tasks` gem in your project.
Please note that the `neo4j-rake_tasks` gem is only for development and test environments (NOT for production).
Be sure to require the `neo4j-rake_tasks` gem AFTER the `neo4j-core` and `neo4j` gems.
For more details see the Neo4j.rb documentation
What can I do now to make this statement, rake neo4j:install[community-latest], work?
Thanks!
only add the flowing snippet
gem 'neo4j-rake_tasks'
bundle install
Hopefully would solve your problem.
I need to add the following lines to GemFile
gem 'neo4j-core'
gem 'neo4j-rake_tasks'
And then run the commands
bundle install
rake neo4j:install[community-latest]
rake neo4j:start

Make ruby script use local gems, instead of common

I'm deploying my rails project to production server. There is only 1.9.3 version of ruby (I developed on 2.1.2) so there is few compatibility problems in gems versions. More over, I downloaded one of gems to vendor/gem_name and made necessary fixes in its sources, so I need to use exactly my version of that gem and, as you understand, It's not possible to update it.
in Gemfile
require 'gem_name', :path => 'vendor/gem_name'
So after cloning project to server I run
bundle install --path vendor/bundle
and it created bundle directory in vendor folder with gems versions, needed to me, inside it.
After that I tried to run fetching script to fill db with some data by command
ruby *_fetch.rb
inside *_fetch.rb:
require 'gem_name'
And it fails with error
You have already activated gem_name older_version, but your Gemfile requires
gem_name newest_version. Using bundle exec may solve this. (Gem::LoadError)
from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/bundler-1.3.5/lib/bundler/runtime.rb:19:in `setup'
So how could I specify script to require my edited local gem?
Run it with bundle exec That's exactly what bundle exec is for.

Create gem locally and skip rake install

I'm creating a ruby gem using Bundler for a simple rackup app (not Rails). It's a real pain to run rake install and then restart the webserver everytime. For most part it's ok because I test everything using rspec but not design. My gem contains a whole lot of design and everytime I update my gem I have to go threw the same procedure.
Is it possible to build gems locally without having to run rake install and then restart my rack server every single time?
If you're using Bundler to manage the gems in your application, you can use Bundler's path directive to use a gem that's currently in development.
In your Gemfile:
# My awesome gem that I'm developing
gem 'some-awesome-gem', :path => '~/Projects/some_awesome_gem'
Essentially, just point the path at the directory where your gem resides and you won't have to package new versions of the gem while you're actively developing it.
See the Bundler homepage and Gemfile Manual for more details.

Rake aborted ! Issue installing Octopress

I m trying to install the Octopress on my windows. As per their Tutorial on their website. But when I type the command
rake install
It gives me the following error
C:\Documents and Settings\admin\octopress>rake install
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. U
sing bundle exec may solve this.
(See full trace by running task with --trace)
And as the error says I need to install rake 0.9.2
I tried it doing with the following command.
C:\Documents and Settings\admin\octopress>gem install rack -v=0.9.2.0
ERROR: Could not find a valid gem 'rack' (= 0.9.2.0) in any repository
ERROR: Possible alternatives: rack
I already have Ruby & Gems installed on my PC. But I m not able to figure out how to solve this issue. How do I even use the "bundle exec" to install Octopress ?
You probably need to use the bundle exec in this way
bundle exec rake install
This might just solve you problem.
I solve this with bundle update
it's a dependency problem and not big deal
The first time you spelled it rake and the second time you spelled it rack
First update the documentation to say,
bundle exec rake install
Then update the Gemfile.lock with,
bundle update

Ruby: install gem if user does not have it installed

I have a ruby script that I want to send to a couple of coworkers. Instead of telling them to install a few required gems, is there a safe way to have ruby install them if not found?
For example, a user doesn't have the yui-compressor gem. Instead of the terminal displaying an error when they run ruby example.rb it would automatically run gem install -r yui-compressor for them. Is there a way to handle this?
You could use a tool like bundler: http://gembundler.com/

Resources