<commit_before>#
# Author:: <NAME> (<<EMAIL>>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require 'chef/mixin/command'
require 'chef/log'
require 'chef/file_cache'
require 'chef/platform'

class Chef
  class Provider
    class Package < Chef::Provider

      include Chef::Mixin::Command

      attr_accessor :candidate_version
      def initialize(new_resource, run_context)
        super
        @candidate_version = nil
      end

      def whyrun_supported?
        true
      end

      def load_current_resource

      end

      def define_resource_requirements
        requirements.assert(:install) do |a| 
          a.assertion { !(candidate_version.nil? && @new_resource.version.nil?) }
          a.failure_message(Chef::Exceptions::Package, "No version specified, and no candidate version available for #{@new_resource.package_name}")
          a.whyrun("Package #{@new_resource.package_name} does not exist in a currently configured repository. Attempting to install it will fail unless it's provided by a previously configured package repo.")
        end

        requirements.assert(:upgrade) do |a|
          # Can't upgrade what we don't have<commit_msg>Fix non-whyrun failure for gem_package :install action when a gem is already installed.<commit_after>#
# Author:: <NAME> (<<EMAIL>>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require 'chef/mixin/command'
require 'chef/log'
require 'chef/file_cache'
require 'chef/platform'

class Chef
  class Provider
    class Package < Chef::Provider

      include Chef::Mixin::Command

      attr_accessor :candidate_version
      def initialize(new_resource, run_context)
        super
        @candidate_version = nil
      end

      def whyrun_supported?
        true
      end

      def load_current_resource

      end

      def define_resource_requirements
        requirements.assert(:install) do |a| 
          a.assertion { !(@current_resource.version.nil? && candidate_version.nil?)  }
          a.failure_message(Chef::Exceptions::Package, "No version specified, and no candidate version available for #{@new_resource.package_name}")
          a.whyrun("Package #{@new_resource.package_name} does not exist in a currently configured repository. Attempting to install it will fail unless it's provided by a previously configured package repo.")
        end

        requirements.assert(:upgrade) do |a|
          # Can't upgrade what we don't have
{'fraction_non_alphanumeric': 0.08349514563106795, 'fraction_numerical': 0.005547850208044383, 'mean_word_length': 3.485074626865672, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '343430', 'n_tokens_mistral': 991, 'n_tokens_neox': 951, 'n_words': 371}