I want to install the simple-private-messages gem (http://agilewebdevelopment.com/plugins/simple_private_messaging), https://github.com/jongilbraith/simple-private-messages.
I added to my Gemfile:
gem 'simple-private-messages'
But get error:
Fetching source index for http://rubygems.org/
Could not find gem 'simple-private-messages (>= 0)' in any of the gem sources listed in your Gemfile.
I then tried modifying Gemfile to:
gem 'simple-private-messages', :git => 'git://github.com/professionalnerd/simple-private-messages.git'
but get error:
Fetching git://github.com/professionalnerd/simple-private-messages.git
github.com[0: 207.97.227.239]: errno=Operation timed out
fatal: unable to connect a socket (Operation timed out)
Git error: command `git clone 'git://github.com/professionalnerd/simple-private- messages.git' "/Users/homanchou/.rvm/gems/ruby-1.9.2-p180/cache/bundler/git/simple-private-messages-26451211e7d7acc0c1b523bad2621cb2cd38f77e" --bare --no-hardlinks`
1) How else can I install this gem locally?
2) How can I deploy this app to heroku and protect against deployment error if Heroku can not find the gem in any repositories? Do I vendor them into the app?
It doesn't look like that project is a Gem; it's actually a Rails Plugin.
To install, run this in your project folder:
rails plugin install git://github.com/jongilbraith/simple-private-messages.git
Related
Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/gem_make.out
An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.4.0' succeeds before bundling.
I tried to install earlier version on sqlite, not working.
Tried one of the solutions from stackoverflow :
gem 'sqlite3', '~> 1.3.6'
getting this error
ERROR: While executing gem ... (Gem::CommandLineError)
Unknown command sqlite3,
Please help i'm new in Rails , this is my first project in rails.
Add gem 'sqlite3' to Gemfile in the root directory of your rails project. Then run bundle install and it should install sqlite and make it available to use in your rails project.
Specify git and branch for the gem sqlite3 in your Gemfile should fix the problem.
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
For more info
https://medium.com/#declancronje/installing-and-troubleshooting-ruby-on-rails-sqlite3-windows-10-fix-87c8886d03b
cannot load such file — sqlite3/sqlite3_native (LoadError) Ruby on Rails
Replace gem 'sqlite3' with gem 'sqlite3', '~> 1.3.11' which is in Gemfile in the root directory of your rails project. Then run bundle install.
I've been trying to trouble shoot this error now for a couple hours without making any progress. I've tried running bundle install in different environments with no luck. I'm not sure what is happening and I feel as if the error is no longer providing relevant feedback. However, I am using Ruby 1.9.3 and when I push it states that Heroku is using ruby 2.0.0. Could this have something to do with it?
Castillos-MacBook-Pro:reservester-nysum13 castillo$ git push heroku master
Identity added: /Users/castillo/.ssh/id_rsa (/Users/castillo/.ssh/id_rsa)
Counting objects: 66, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (66/66), 26.25 KiB, done.
Total 66 (delta 4), reused 38 (delta 1)
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have added to the Gemfile:
* debugger
Bundler Output: You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have added to the Gemfile:
* debugger
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby/Rails app
To git#heroku.com:guarded-sierra-5306.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:guarded-sierra-5306.git'
gem 'debugger' originally was placed outside of the environment group. I moved it to the development group and reran bundle.
Here is my Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'therubyracer'
gem 'twitter-bootstrap-rails'
gem 'carrierwave'
gem 'rmagick'
gem "fog", "~> 1.3.1"
gem "devise"
gem "figaro"
gem "galetahub-simple_captcha", :require => "simple_captcha"
group :development do
gem 'annotate'
gem 'sqlite3'
gem 'rspec-rails', '~> 2.0'
gem 'debugger'
end
group :production do
gem 'pg'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
I got similar error. I tried delete Gemfile.lock file manually, rebundle, push it to git and still no luck.
But finally I make it work by change my rvm version to ruby 2.0.0, precomplie the asset with this command
RAILS_ENV=production bundle exec rake assets:precompile
and delete the Gemfile.lock, rebundle, and push it to github. Last part when you push in to heroku use your branch instead your master, this happen because you not deploying the master branch to heroku master branch with this command:
git push heroku your-branch:master
I had a similar situation. Heroku does not support every ruby version. You may be using an unsupported version.
Check for Heroku Ruby supported versions
Change your local ruby version. For example, if you are using rbenv
rbenv local 2.1.6
bundle install
Push the changes to herokugit push heroku master
You can't expect Heroku to know what version of Ruby you're running locally :-) If you want Heroku to use a particular version, tell it. Add ruby '1.9.3' to your Gemfile for example.
It also looks like you didn't rerun bundle install after putting the gem in development group? Try that.
Then add all the changes to git, commit, and push.
This problem is bacause you commit bad (old) Gemfile.lock to heroku server.
You need to update Gemfile.lock on heroku after adding/removing gems.
Do following steps:
save HEROKU_APP_NAME of existing heroku app ( HEROKU_APP_NAME.herokuapp.com )
remove heroku application from https://dashboard.heroku.com/apps and create new one
rename new heroku app to old HEROKU_APP_NAME
remove Gemfile.lock from your git repo
remove Gemfile.lock form your local project and form .gitignore (if it exist there)
run bundle install
commit changes to git repo ( new created Gemfile.lock )
run git push heroku master
I have followed this tutorial to configure apn_on_rails but I am getting the following error message when I call my action:
uninitialized constant APN::Device
This is the line that produces the conflict:
device = APN::Device.create(:token => device_token)
As suggested here, I have added a require 'apn_on_rails' in my environment.rb but nothing changed.
It seems that the gem apn_on_rails is only installed under gem/bundler, could that be the problem? If so, how can I install it if I have it in my gemfile like this:
gem 'apn_on_rails', :git => 'https://github.com/natescherer/apn_on_rails.git', :branch => 'rails3'
then how can I call something like sudo gem install 'apn_on_rails' ... to install that version?
I am using ruby 1.9.2 and rails 3.1.
Any help is greatly appreciated.
I fixed by following these instructions and making a change to that solution
Clone the Git repository.
$ git clone https://github.com/natescherer/apn_on_rails.git
Change to the new directory.
cd apn_on_rails
Build the gem.
$ gem build apn_on_rails.gemspec
(Running that I got:
Successfully built RubyGem
Name: apn_on_rails
Version: 0.3.1rails3
File: apn_on_rails-0.3.1rails3.gem
Install the gem.
$ gem install apn_on_rails-0.3.1rails3.gem
I am trying to deploy to heroku.
Rails 3.1.0.rc4,
I get the following error from Heroku logs:
Starting process with command: `thin -p 48902 -e production -R /home/heroku_rack/heroku.ru start`
2011-06-20T11:25:44+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) (RuntimeError)
I tried to install the activerecord-postgresql-adapter but then I get this error:
Could not find gem 'activerecord-postgresql-adapter (>= 0)' in any of the gem sources listed in your Gemfile.
So I tried to add this to my gem file
gem 'pg'
which produced this error:
Installing pg (0.11.0) with native extensions /Users/imac/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
any ideas?
You don't have to install Postgres locally. In your Gemfile, put 'pg' in group :production, as johnny-grass suggests, and then when you run bundle, just specify --without production, like this:
bundle --without production
Unfortunately, you have to remember this argument when you run bundler, but at least you don't have to install and maintain postgres locally.
Please note that Heroku "strongly recommends against" using sqlite, saying that "Your production and development environment should be as close to identical as possible" http://devcenter.heroku.com/articles/rails3
Do you have PostgreSQL installed on your computer? If you don't then install it first, then install the pg gem.
# gemfile
group :production do
gem 'therubyracer-heroku', '0.8.1.pre3' # you will need this too
gem 'pg'
end
I found a solution in this Heroku article.
As Jared said, they suggest to create a different group for postgresql.
I'm trying to install this gem: https://github.com/jongilbraith/simple-private-messages with bundle install.
And I'm getting the following error message:
Updating git://github.com/professionalnerd/simple-private-messages.git
Fetching source index for http://rubygems.org/
Could not find gem 'simple-private-messages (>= 0, runtime)' in git://github.com/professionalnerd/simple-private-messages.git (at master).
Source does not contain any versions of 'simple-private-messages (>= 0, runtime)'
entry in Gemfile:
gem "simple-private-messages",:git =>"git://github.com/professionalnerd/simple-private-messages.git"
Any ideas?
As per #bjeanes answer, ideally the Git repository should have a .gemspec file for each gem the Git repository represents.
However, if the repository is only missing the .gemspec file and would otherwise be a valid Git gem source, you can specify a version number in your gem call to have Bundler generate a .gemspec for you:
gem 'simple-private-messages', '0.0.0', :git => 'git://github.com/jongilbraith/simple-private-messages.git'
The git repo needs to have a .gemspec file in it in order to be a valid gem.