Code Monkey home page Code Monkey logo

Comments (7)

mattbrictson avatar mattbrictson commented on September 22, 2024

Thanks for the heads up!

This will be a bit tricky, because airbrussh needs to support Ruby as old as Ruby 1.9. Module#prepend was introduced in 2.0. If you have any suggestions, let me know!

from airbrussh.

mattbrictson avatar mattbrictson commented on September 22, 2024

@benebrice can you test the branch in this PR to see if it solves the problem? #152

from airbrussh.

benebrice avatar benebrice commented on September 22, 2024

Thanks @mattbrictson !

Actually, I'm not able to test it properly. I cannot even run the cap command.

root@f627dd4a0252:/tss_rails# cap staging deploy --trace
Traceback (most recent call last):
	8: from /usr/local/bundle/bin/cap:23:in `<main>'
	7: from /usr/local/lib/ruby/2.7.0/rubygems.rb:297:in `activate_bin_path'
	6: from /usr/local/lib/ruby/2.7.0/rubygems.rb:297:in `synchronize'
	5: from /usr/local/lib/ruby/2.7.0/rubygems.rb:298:in `block in activate_bin_path'
	4: from /usr/local/lib/ruby/2.7.0/rubygems/specification.rb:1371:in `activate'
	3: from /usr/local/lib/ruby/2.7.0/rubygems/specification.rb:1389:in `activate_dependencies'
	2: from /usr/local/lib/ruby/2.7.0/rubygems/specification.rb:1389:in `each'
	1: from /usr/local/lib/ruby/2.7.0/rubygems/specification.rb:1400:in `block in activate_dependencies'
/usr/local/lib/ruby/2.7.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'airbrussh' (>= 1.0.0) among 312 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/root/.gem/ruby/2.7.0:/usr/local/lib/ruby/gems/2.7.0:/usr/local/bundle', execute `gem env` for more information

I've simply update the Gemfile with

# Gemfile
gem 'airbrussh', git: 'https://github.com/mattbrictson/airbrussh.git', branch: 'features/use-prepend-if-supported'
# Gemfile.lock
GIT
  remote: https://github.com/mattbrictson/airbrussh.git
  revision: 6a9b7ac68521d37d59285c10155e2e922807fc56
  branch: features/use-prepend-if-supported
  specs:
    airbrussh (1.4.2)
      sshkit (>= 1.6.1, != 1.7.0)

... 
GEM
  remote: https://rubygems.org/
  specs:
    capistrano (3.17.3)
      airbrussh (>= 1.0.0)
      i18n
      rake (>= 10.0.0)
      sshkit (>= 1.9.0)


...



DEPENDENCIES
  airbrussh!

It seems not to be properly installed. Maybe it's a version conflict somehow?

from airbrussh.

mattbrictson avatar mattbrictson commented on September 22, 2024

@benebrice can you try bundle exec cap?

from airbrussh.

benebrice avatar benebrice commented on September 22, 2024

It worked with bundle exec cap @mattbrictson

Could you explain me why?

from airbrussh.

mattbrictson avatar mattbrictson commented on September 22, 2024

@benebrice thanks for verifying!

It worked with bundle exec cap Could you explain me why?

When you run the bare cap command, Ruby executes the version of Capistrano and its dependencies that are installed globally on your system for that version of Ruby. It completely ignores Gemfile.lock.

To install a gem from a git branch, the easy way to do it is via Bundler, by adding it to a Gemfile and then running bundle install, which updates Gemfile.lock. Installing a gem from a git branch does not install it globally. This is a Bundler-specific feature.

So when you run the bare cap command, Ruby is unaware of the airbrussh gem that Bundler obtained from git. The only way Ruby knows about it is if you run cap via Bundler. When you run bundle exec cap, Bundler steps in and looks at the Gemfile.lock, and uses that to find the gems. That is why you need bundle exec to be able to use git-sourced gems.

from airbrussh.

benebrice avatar benebrice commented on September 22, 2024

Wonderful explanation. Thanks a lot for this and for the fix!

from airbrussh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.