<commit_before>require 'itamae'

module Itamae
  module Resource
    class Execute < Base
      define_attribute :action, default: :run
      define_attribute :command, type: String, default_name: true
      define_attribute :cwd, type: String

      def action_run(options)
        run_command(attributes.command, cwd: attributes.cwd)
        updated!
      end
    end
  end<commit_msg>Set executed attr of execute resource for logging purpose.<commit_after>require 'itamae'

module Itamae
  module Resource
    class Execute < Base
      define_attribute :action, default: :run
      define_attribute :command, type: String, default_name: true
      define_attribute :cwd, type: String

      def pre_action
        case @current_action
        when :run
          attributes.executed = true
        end
      end

      def set_current_attributes
        current.executed = false
      end

      def action_run(options)
        run_command(attributes.command, cwd: attributes.cwd)
        updated!
      end
    end
  end
{'fraction_non_alphanumeric': 0.0594541910331384, 'fraction_numerical': 0.0, 'mean_word_length': 2.6035087719298247, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6062260', 'n_tokens_mistral': 288, 'n_tokens_neox': 283, 'n_words': 86}