<commit_before>require 'capistrano/cli'
require 'pp'

module Sprinkle
  module Actors
    class Dummy < Actor #:nodoc:

      def initialize(&block) #:nodoc:
        # @config.set(:_sprinkle_actor, self)
        @roles={}
        self.instance_eval &block
      end

      def role(role, server, opts={})
        @roles[role]||=[]
        @roles[role] << [ server, opts ]
      end
      
      # Determines if there are any servers for the given roles
      def servers_for_role?(roles)
        roles=Array(roles)
        roles.any? { |r| @roles.keys.include?(r) }
      end
      
      def install(installer, roles, opts={})
        if per_host=opts.delete(:per_host)
          servers_per_role(roles).each do |server|
            installer.reconfigure_for(server)
            installer.announce
            process(installer.package.name, installer.install_sequence, server, opts)
          end
        else
          process(installer.package, installer.install_sequence, roles, opts)
        end
      end
      
      def verify(verifier, roles, opts = {})
        process(verifier.package.name, verifier.commands, roles, opts = {})
      end
      
      def servers_per_role(role)
        @roles[role]
      end

      def process(name, commands, roles, opts = {}) #:nodoc:
        # puts "PROCESS: #{name} on #{roles}"
        pp commands
        # return false if suppress_and_return_failures
        true
      end
    end
  end
end<commit_msg>actors must define sudo?<commit_after>require 'capistrano/cli'
require 'pp'

module Sprinkle
  module Actors
    class Dummy < Actor #:nodoc:

      def initialize(&block) #:nodoc:
        # @config.set(:_sprinkle_actor, self)
        @roles={}
        self.instance_eval &block
      end

      def role(role, server, opts={})
        @roles[role]||=[]
        @roles[role] << [ server, opts ]
      end
      
      # Determines if there are any servers for the given roles
      def servers_for_role?(roles)
        roles=Array(roles)
        roles.any? { |r| @roles.keys.include?(r) }
      end
      
      def install(installer, roles, opts={})
        if per_host=opts.delete(:per_host)
          servers_per_role(roles).each do |server|
            installer.reconfigure_for(server)
            installer.announce
            process(installer.package.name, installer.install_sequence, server, opts)
          end
        else
          process(installer.package, installer.install_sequence, roles, opts)
        end
      end
      
      def sudo?
        false
      end
      
      def verify(verifier, roles, opts = {})
        process(verifier.package.name, verifier.commands, roles, opts = {})
      end
      
      def servers_per_role(role)
        @roles[role]
      end

      def process(name, commands, roles, opts = {}) #:nodoc:
        # puts "PROCESS: #{name} on #{roles}"
        pp commands
        # return false if suppress_and_return_failures
        true
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10437710437710437, 'fraction_numerical': 0.0, 'mean_word_length': 2.0723888314374355, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4123934', 'n_tokens_mistral': 911, 'n_tokens_neox': 909, 'n_words': 216}