source "https://rubygems.org"

gem "chef", path: "."

gem "ohai", git: "https://github.com/chef/ohai.git", branch: "18-stable"

# Nwed to file a bug with rest-client. In the meantime, we can use this until they accept the update.
gem "rest-client", git: "https://github.com/chef/rest-client", branch: "jfm/ucrt_update1"

gem "ffi", ">= 1.15.5", "<= 1.18.0"
gem "chef-utils", path: File.expand_path("chef-utils", __dir__) if File.exist?(File.expand_path("chef-utils", __dir__))
gem "chef-config", path: File.expand_path("chef-config", __dir__) if File.exist?(File.expand_path("chef-config", __dir__))

# required for FIPS or bundler will pick up default openssl
install_if -> { RUBY_PLATFORM !~ /darwin/ } do
  gem "openssl", "= 3.3.0"
end

if File.exist?(File.expand_path("chef-bin", __dir__))
  # bundling in a git checkout
  gem "chef-bin", path: File.expand_path("chef-bin", __dir__)
else
  # bundling in omnibus
  gem "chef-bin" # rubocop:disable Bundler/DuplicatedGem
end

gem "cheffish", ">= 17"

group(:omnibus_package) do
  gem "appbundler"
  gem "rb-readline"
  gem "chef-vault"

  gem "inspec-core-bin", "~> 5.24", "< 6"
end

group(:omnibus_package, :pry) do
  # Locked because pry-byebug is broken with 13+.
  # some work is ongoing? https://github.com/deivid-rodriguez/pry-byebug/issues/343
  gem "pry", "0.15.2"
  # byebug does not install on freebsd on ruby 3.0; byebug >= 12 requires ruby >= 3.1
  # which is incompatible with the AIX omnibus toolchain (ruby 3.0.3)
  unless RUBY_PLATFORM.match?(/freebsd|aix/i)
    gem "byebug", "< 13"
    gem "pry-byebug", "< 3.12"
  end
  gem "pry-stack_explorer"
end

# Everything except AIX and Windows
group(:ruby_shadow) do
  install_if -> { RUBY_PLATFORM.match?(/linux|darwin|bsd|solaris/i) } do
    # if ruby-shadow does a release that supports ruby-3.0 this can be removed
    gem "ruby-shadow", git: "https://github.com/chef/ruby-shadow", branch: "lcg/ruby-3.0", platforms: :ruby
  end
end

# deps that cannot be put in the knife gem because they require a compiler and fail on windows nodes
group(:knife_windows_deps) do
  gem "ed25519", "~> 1.2" # ed25519 ssh key support
end

group(:development, :test) do
  gem "rake", ">= 12.3.3"
  gem "rspec"
  gem "webmock"
  gem "crack", "< 1.0.2" # due to https://github.com/jnunemaker/crack/pull/75
  gem "fauxhai-ng" # for chef-utils gem
end

gem "cookstyle", "~> 8.6"

instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]

# If you want to load debugging tools into the bundle exec sandbox,
# add these additional dependencies into Gemfile.local
#
# But doing eval_gemfile("./Gemfile.local") breaks dependabot, so a
# bit of indirection here
local_gemfile = File.join(__dir__, "Gemfile.local")
eval(File.read(local_gemfile)) if File.exist?(local_gemfile)
