tootlcrl error: Could not find concurrent-ruby-1.1.10 in any of the sources - ruby

I'm trying to run a tootctl command, but am running into a problem with it not being able to detect the required dependency is not present.
Could not find concurrent-ruby-1.1.10 in any of the sources
I have run bundle install and the gems get installed (or are confirmed already installed), but the command still has trouble not finding the
Using concurrent-ruby-1.1.10
...dozens of other packages
Using rails-settings-cached 0.6.6
Bundle complete! 122 Gemfile dependencies, 225 gems now installed.
Gems in the groups 'development' and 'test' were not installed.
Bundled gems are installed into `../vendor/bundle`
then I attempt the command again..
me#mastodon-vm:/var/www/mastodon/bin$ ./tootctl media remove --days=7
Could not find concurrent-ruby-1.1.10 in any of the sources
Run `bundle install` to install missing gems.
me#mastodon-vm:/var/www/mastodon/bin$
but I'm back to the same problem. What is the typical approach to fix this?
Note: I did try to follow the guidance in this SO post, but it broke the entire installation. I was able to save it by replacing Gemfile and Gemfile.lock from Mastodon's source (phew)

Your log shows
Gems in the groups 'development' and 'test' were not installed.
Try to install your Gems with
bundle install --with development test
or run
RAILS_ENV=production tootctl
According to https://rubygems.org/gems/concurrent-ruby/versions/1.1.10 the gem is named "concurrent-ruby". When I run gem install concurrent-ruby, it is installed successfully on my computer.

Related

What does this mean? Could not find command "add" when running 'bundle add'

I get this error Could not find command "add" when I try to run something like bundle add bcrypt_pbkdf --version "<2.0,>=1.0"
I cannot find anything like this online. I tried bundle install, bundle update, gem install bundler, etc, but it didn't work
How do I fix it?
bundle doesn't have a subcommando for adding new gems. To add a new one, open the Gemfile and manually add your new gem into it. Like:
gem bcrypt_pbkdfm, "~> 1.1"
After that, run:
bundle install
It will read your Gemfile, will download the gems and create a new Gemfile.lock with the installed version.
To understand more about the specs of Gemfile visit https://bundler.io/gemfile.html
EDIT
In fact bundle has bundle add command. I've never used, but it seems to achive the same goal as the manual insert.

Can't install gem using Bundler's Rakefile install task when developing a custom gem

I'm developing a couple of private gems and I think I don't understand correctly the PATH/GEM_PATH and/or Bundler/RVM installation flow, would love if someone could chip in.
I have a repository with two gems (A & B for simplicity sake). I've developed the gems using the scaffolding + following the guidelines provided by this bundler tutorial.
Thanks to the Bundler project I have a few Rakefile tasks like rake build, rake install, rake install:local and rake release. Because of the private nature of these gems I can't release them to RubyGems (and we haven't looked into hosting our rubygems).
My machines are using RVM to manage ruby versions and Bundler version 1.15.1
What I want to do: Assuming a new machine/developer trying out the project, ideally we would cd into each of the subfolders (currently 2, gem A and gem B), run rake install and after that we should have the gems available system wide for the current user.
What is happening: The gems are built and work properly, but they are only available inside the subfolder of each gem i.e. gem A is only available inside the subfolder A and gem B is only available inside subfolder B.
What I've tried: So, after rake build/install/install:local a new .gem file is generated under pkg. I've tried to manually install the "compiled" file using gem install pkg/A.gem, gem install --local pkg/A.gem and gem install --local --user-install pkg/A.gem without success. (there are plenty of SO questions/answers about this)
I believe this has something to do with the PATH variables, but like I said before I don't fully understand the way they are managed. I get the following results from these commands:
# Our gem
> gem which A
/home/ubuntu/.rvm/gems/ruby-2.4.0/gems/A-0.1.8/lib/A.rb
# Pry, available globally
> gem which pry
/home/ubuntu/.rvm/gems/ruby-2.4.0/gems/pry-0.11.1/lib/pry.rb
I've been lost and frustrated for far too long now, any help is appreciated. Also open to hear suggestions of better private gem installation flows :)
Yes, it has something to do with your PATH variables. Your installation seems to be good.
I advise you to first affirm your gems installation path with:
echo $GEM_HOME
The double check your PATH to ensure its present and also confirm that the GEM home is also where the gem got installed into from the rake install
echo $PATH
If not, put it in your path and you should be fine with something like this:
echo PATH=$PATH:$GEM_HOME >> ~/.bashrc
source ~/.bashrc
Build your gem as per that guide you linked. You should end up with a gem file. Distribute this as you see fit (I use rsync/crontab to download newer gem versions but anything goes). User can install the gem as follows:
gem install --user-install /path/to/your/file.gem
This will install the gem in the user's ~/.gem/ruby/<version>/gems/<your-gem-name> directory.
Tried it with an empty gem (foodie, as in that example guide) and it works fine. But if you don't specify the --user-install parameter it will try to install in the system ruby dir (/usr/lib/ruby/gems...)

How to run Bundle after installing?

I have done
gem install bundle
inside my directory that I have a git repository. But now when I try to run it with
bundle
run bundle
bundle install
it says:
Could not locate Gemfile.
How would I check that it has installed ?
It looks like it installed the gem correctly, however, you need to create a file named Gemfile for bundler to know what gems it should install. This file should be in your project's root. You can create one manually, or run bundle init to have a default one generated.
You can read more about the Gemfile in the docs

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.

Using Bundler in deployment

Pretty fundamental question but I'm trying to understand how best to use Bundler in a deployment situation.
I'm working on a Sinatra application that has about 20 dependent gems. During development, I'm using RVM with a custom gemset for the application, and I run bundle install to update the gemset in accordance with the gemfile.
When it comes to deployment (manually for now, so I can understand how it all works before using a tool like capistrano), I need to do bundle install --development right? This downloads the gems and places them in vendor/bundle.
My question is what else do I need to do? I'm using Unicorn on the server - do I just bundle exec unicorn ... and everything just works? (i.e. bundler finds the vendor directory and uses the gems from there?)
Should unicorn be a vendored gem in the application or a separate 'system' gem on the server that all applications share?
You need --deployment key, not --development: http://gembundler.com/man/bundle-install.1.html#DEPLOYMENT-MODE
On first run bundler creates config in .bundle directory. You can check it by running bundle config or just cat .bundle/config in project's directory. So bundle exec unicorn is enough since bundler knows where gems are installed. On development machine you can also install gems to arbitrary directory using --path key. For more details see manpage for bundle install (link above or bundle help install).

Resources