code: private String getGemsFileName() {
          File gemsRb = new File(rootDirectory + fileSeparator + GEMS_RB);
          File gemFile = new File(rootDirectory + fileSeparator + GEM_FILE);
  
          if (!gemsRb.isFile() && !gemFile.isFile()) {
              return null;
          }
  
          List<String> bundleVersionResult = cli.runCmd(rootDirectory, cli.getCommandParams(BUNDLE, Constants.VERSION));
  
          if (bundleVersionResult != null) {
              if (bundleVersionResult.get(0).contains("Bundler version")) {
                  Pattern p = Pattern.compile("Bundler version ((?:\\d|\\.)+)");
                  Matcher m = p.matcher(bundleVersionResult.get(0));
                  if (m.find()) {
                      String version = m.group(1);
                      int versionNumber = Integer.parseInt(version.substring(0, version.indexOf('.')));
                      if (versionNumber < 2) {
                          // In version <2 if gems.rb exist and gemFile doesn't exist return "gems.locked" else "gemFile.lock"
                          if (gemFile.isFile()) {
                              return GEM_FILE_LOCK;
                          } else if (gemsRb.isFile()) {
                              return GEMS_LOCKED;
                          }
                      } else {
                          // In version > 2 if gems.rb exist return "gems.locked" else "gemFile.lock"
                          if (gemsRb.isFile()) {
                              return GEMS_LOCKED;
                          } else if (gemFile.isFile()) {
                              return GEM_FILE_LOCK;
                          }
                      }
                  }
              }
          }
          return null;
      }
docs: Get gems file name {gems.locked / Gemfile.lock} that will be created in bundle install command.
  Bundler version < 2 will create 'Gemfile.lock' if 'Gemfile' exist, If 'Gemfile' doesn't exist and 'gems.rb' exist it will create 'gems.locked'
  Bundler version >= 2 will create 'gems.locked' if 'gems.rb' exist, If 'gems.rb' doesn't exist and 'Gemfile' exist it will create 'Gemfile.lock'
  
  @return Gem file that will be created - 'gems.locked' / 'Gemfile.lock'