Check if Gemfile.lock matches Gemfile

I want to write a unit test to check if the Gemfile.lock in my project matches the Gemfile in case I forget to call bundle before committing.

Is there an option for the bundle command (or another method) to check this?

Note that bundle check does not suit this purpose. It checks to see if all gems in the Gemfile are installed on the local system, but it does not check the Gemfile.lock. Therefore the bundle install --deployment command on the server can fail even if bundle check succeeds on the development machine or in CI.

Answers


Try:

cp Gemfile.lock Gemfile.lock.orig
bundle install
diff Gemfile.lock Gemfile.lock.orig && echo "Gemfile.lock matches Gemfile"

Use bundle check command

Check searches the local machine for each of the gems requested in the Gemfile. If all gems are found, Bundler prints a success message and exits with a status of 0. If not, the first missing gem is listed and Bundler exits status 1.


Need Your Help

Selected Item of Treeview

c# wpf xaml treeview

I want to get selectedItem from the treeview on which the user right clicks using a context menu in a command parameter. I don't understand what should be the relative source here. Please help

Cayenne: retrieving positions of tokens after parsing an expression

java apache parsing apache-cayenne

I am parsing an expression with Cayenne, so I have the tokens (org.apache.cayenne.exp.parser.Token) resulting from the parsing.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.