Deploying error with capistrano: "bundler: not executable: cap" - ruby-on-rails

I am supposed to work on a quite antique Ruby On Rails project to make some minor (mostly HTML and CSS) changes on some webpages. I did not work with Ruby On Rails before and I am just getting into it.
I have cloned the project via git from github and installed all gems via 'bundler install'. Note that I am using an old version of Ruby (1.8.7) since I was told the project would not work with a newer version. Note also I am on Windows 7 and the project was built with Mac OS X.
Now I am trying to get the changes I made to the live site (after commiting and pushing the changes to the git repository) with Capistrano (Installed and Version 2.8.0) which should be possible with
bundle exec cap production deploy
However when I try this I just get:
bundler: not executable: cap
Any ideas what is going wrong here? Thanks alot in advance!
Kind regards,
Peter

Generally, capisrano is not defined as a gem in a project's Gemfile. Try installing the gem with gem install capistrano.
You can also check if Capistrano is installed on your system by running cap -T in your project folder. This should give you a list of all tasks in that project.

Related

Rails bundle error when pushing to Elastic Beanstalk

I had an app deployed on Heroku and I am currently trying to create the same app on AWS.
I've copied my folder, created a complete separated repo on Github and installed ebcli, the setup looks fine.
When I try to run eb deploy, I have this error:
[Instance: i-03051e2a022886184] Command failed on instance. Return code: 1 Output: (TRUNCATED)...:in find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
from /opt/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems.rb:308:inactivate_bin_path'
from /opt/rubies/ruby-2.5.3/bin/bundle:23:in `'.
I've looked online and it says it comes from incompatibility between your gemlock file bundler version and actual bundler version.
I've tried to change my bundler version to this one, but I gave up and came back to 2.0.1 because I had to install too many dependencies otherwise.
I removed the gemlock, bundle again, but I still got the same error when trying to deploy.
With my heroku version, it always worked.
Any idea how to solve that?
Thanks a lot
We moved from Heroku to AWS a few months back as well and it will likely take some some custom scripting to get things to work.
It would help to know more about your EB environment, but I am assuming you are using Ruby 2.5 with Puma on Amazon Linux 2.9.0 (?)
Not sure what bundle version comes with that, But I don’t think it’s 2.x. so you have to add an .ebextensions file too install your preferred bundled version.
# .ebextensions/01_install_bundler.config
container_commands:
install_bundler:
command: “gem install bundler —-version 2.0.0”
More info on AWS Linux customizations
End of the day, we are much happier with our AWS environment (lower cost, better performance), but requires more work to get it set up
Actually the problem exists because the bundler version in the eb env is older than the one being used in the project source.
So the solution is to use a bundler version less or equal the eb env installed version.
First uninstalled the current bundler:
gem uninstall bundle
and then install the desired one:
gem install bundler -v 1.16.6
See more details

Rubymine -- Configuring remote SDK?

I am unable to get a remote SDK to run from my client workstation. It complains that the remote SDK doesn't have rails installed.
Here is my environment:
Windows 8 Workstation:
Rubymine
CentOS 7 Development Server:
rvm (installed Ruby 2.1.2)
/opt/learning_stuff (git repo with app in there)
bundle install was ran
A few diagnostic commands yield these results:
# which ruby
/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby
# which rails
/usr/local/rvm/gems/ruby-2.1.2/bin/rails
How do I get rubymine to see the rails installation? Do I need to drop rvm and install from source?
In Rubymine 7.1, I used my gem directory instead of the path to the ruby executable in the "Ruby interpreter path". It found my gems for my project, and performed the sync.
Not a solution to the actual problem, but what I ended up doing is just figuring out how to make the application work on both my windows localmachine and on my linux dev box. The benefit to this is that my application is now cross platform even though I don't need it to be.

Heroku can't find libruby-1.9.1.so.1.9

I'm running through a ruby on rails tutorial, and I just installed the Heroku toolkit.
My problem is that whenever I try "Heroku login", or whatever heroku command, I get :
ruby1.9.1: error while loading shared libraries: libruby-1.9.1.so.1.9: cannot open shared object file: No such file or directory
I remember having cleaned my ruby installations recently, so I wonder if I just miss some libs that I have deleted or something, but I haven't been able to find anything satisfying about that.
Do you have an idea how to get out of this situation, and be able to use Heroku ?
I managed to make heroku work by installing it with gem :
gem install heroku
instead of :
sudo apt-get heroku
It seems like heroku was trying to use a ruby version out of rvm (but i deleted the ruby version which was installed before rvm). Now the gem installation took care of that.

Rails 3 and Bundler. How to deploy and NOT package gems

I'm having lots of problems trying to deploy using capistrano. I keep on getting errors about libv8 not in any of the sources.
Could not find libv8-3.11.8.13 in any of the sources
Here https://github.com/cowboyd/libv8/issues/56 tells you that you could "not to use packaging", that way, the deployed app won't use the bundle package.
How can I deploy and use the gems NOT IN THE BUNDLE PACKAGE? I want the app do run bundle everytime I deploy instead or to just run bundle when the Gemfile has changed.
This is how I got it working: https://github.com/cowboyd/libv8/issues/77#issuecomment-12711634
I'm doing development on a mac and deploying to a red hat server. It seems Rails needs a OS, platform-specific version of the gem. So when I'm running bundle on my development machine (mac) and then deploy it with capistrano to the production server (red hat), it won't work.
What I ended up doing is...
manually download the libv8 gem I needed from http://rubygems.org/gems/libv8
copy the downloaded gem to the vendor/cache folder
then deployed the app (cap deploy:cold)
and it worked.
If I understand your question correctly it sounds like you're missing the bundle capistrano task. See https://github.com/carlhuda/bundler/blob/master/lib/bundler/capistrano.rb for more. You should be able to "require 'bundler/capistrano'" to your capistrano deploy.rb file so that bundle is run on every deploy.

Missing Gemfiles in Rails Install

Bit of a strange question, but here goes.
I'm a relative beginner to rails, and I've just started working on my second app locally. However, after each install I'm getting the following problem - that several gemfiles are missing (railties being the most obvious).
So, I deleted the install, re-ran it and listed the gemfiles - they are all there. However, after initializing a git repo and pushing the project up to my GitHub a gem list command shows that a number of gems are now missing - at this point I can't run any rake commands or for example rails server.
So I cleared the repo and re-installed. gem list says the gems are all present, server and rake commands work; but push the repo and it subsequently packs up - gem list shows only a handful of gems remain.
Bearing in mind my experience, I'm prepared to believe I'm missing something very obvious, but any advice would be appreciated.
welcome ;-)
I suppose you want to create a Rails 3 application. So first make sure you have installed bundler.
gem install bundler
The steps for creating the application are:
rails new your_app
Then run bundler in the applications folder:
cd your_app
bundler install
Now you should be able to run the application:
rails s
Go and visit localhost:3000. If that does not work, you have other problems. Paste the stack trace then ...
The problem was I forgot that I had two versions of Ruby installed and I had not properly set a default with rvm for some reason. Specifying the default then checking the gems were present for that version of Ruby fixed it.

Resources