Chef build pulls chef-zero 4.6.1 when semver is set to ~>4.5

When I build chef for an omnibus project the chef.gemspec file has chef-zero set to ~> 4.5, but when I build it I get chef-zero 4.6.1 which is the latest. My Omnibus project has “dependency” set to chef and I am using the chef-software repository. Can someone explain to me why I end up with chef-zero 4.6.1 since I believe I should only end up with 4.5.0 when using the semver constraint?

Your pessimistic constraint is working as designed. If you want to limit
to 4.5.x, you need to set the gemspec to ~>4.5.0

Mark
Tact is the ability to tell a man he has an open mind when he has a hole in
his head.

~> 4.5 means >= 4.5 and < 5.0. In other words you’ll always be at the latest 4.x release. As the earlier reply said, you want ~> 4.5.0 if you want the latest 4.5.x without going to 4.6.

Thank you for the explanation. I did not realize it worked that way.