If you look at the facebookbusiness gem , you will notice that currently the latest version is 0.4.0.1
However running gem install 'facebookbusiness'
gives: Successfully installed facebookbusiness-0.3.3.4 1 gem installed
Trying to specify a version in the gem file with gem 'facebookbusiness', '~> 0.4.0.1'
results in Could not find gem 'facebookbusiness (~> 0.4.0.1)' in any of the gem sources listed in your Gemfile.
When I type gem env
I get:
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.4
- RUBY VERSION: 2.5.1 (2018-03-29 patchlevel 57) [x86_64-darwin17]
- INSTALLATION DIRECTORY: /Users/me/.rvm/gems/ruby-2.5.1@rails
- USER INSTALLATION DIRECTORY: /Users/me/.gem/ruby/2.5.0
- RUBY EXECUTABLE: /Users/me/.rvm/rubies/ruby-2.5.1/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /Users/me/.rvm/gems/ruby-2.5.1@rails/bin
- SPEC CACHE DIRECTORY: /Users/me/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/me/.rvm/rubies/ruby-2.5.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-17
- GEM PATHS:
- /Users/me/.rvm/gems/ruby-2.5.1@rails
- /Users/me/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/local/sbin
- ~/bin
- /Users/me/.npm-packages/bin
- /Users/me/.rvm/gems/ruby-2.5.1@rails/bin
- /Users/me/.rvm/gems/ruby-2.5.1@global/bin
- /Users/me/.rvm/rubies/ruby-2.5.1/bin
- /Users/me/.rvm/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/go/bin
- /opt/X11/bin
- /usr/local/bin
Any ideas what's going on?
gem install
pulls the published gem from rubygems.org. Just because a developer has pushed a newer version to their git repository doesn't mean that they've also published the newer version of the gem to rubygems.
In this case, that's exactly what's happened. The latest published version at rubygems can be seen here: https://rubygems.org/gems/facebookbusiness/
It may be that the version in their git repository isn't stable, or isn't ready for release for some other reason like the documentation isn't ready for it, or the APIs it relies on aren't yet publicly available, or is undergoing a security review before being published, or any other reason you can think of. If you want to use it anyway, it's fairly straightforward to do so in your Gemfile:
gem 'facebookbusiness', git: 'git@github.com:facebook/facebook-ruby-business-sdk'
Then run bundle install
to pull the gem directly from GitHub.
http://
and git://
URLs are insecure. A man-in-the-middle attacker could tamper with the code as you check it out, and potentially supply you with malicious code instead of the code you meant to check out. Because the :github
shortcut uses a git://
URL in Bundler 1.x
versions, we recommend using HTTPS
URLs or overriding the :github
shortcut with your own HTTPS
git source.
Not good way to adding gem in your Gemfile
gem 'facebookbusiness', git: 'git@github.com:facebook/facebook-ruby-business-sdk'
Good way to adding gem in your Gemfile
gem 'facebookbusiness', github: 'facebook/facebook-ruby-business-sdk'
Better way to adding gem in your Gemfile with branch
gem 'facebookbusiness', github: 'facebook/facebook-ruby-business-sdk', branch: 'branch_name'
or
gem 'facebookbusiness', github: 'facebook/facebook-ruby-business-sdk', ref: 'ref_number'
or
gem 'facebookbusiness', github: 'facebook/facebook-ruby-business-sdk', tag: 'tag_number'
For security point of view and prevent the future failures don't take to master
branch code.
I hope that helpful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.