<commit_before>require 'capistrano/cli'

module Sprinkle
  module Actors
    class Capistrano
      def initialize(&block)
        @config = ::Capistrano::Configuration.new
        @config.logger.level = ::Capistrano::Logger::TRACE
        @config.set(:password) { ::Capistrano::CLI.password_prompt }
        self.instance_eval &block
      end

      def recipes(script)
        @recipes = script
        @config.load @recipes # normally config/deploy in rails
      end

      # better name

      def process(name, commands, roles)
        define_task(name, roles) do
          via = fetch(:run_method, :sudo)
          commands.each do |command|
            invoke_command command, :via => via
          end
        end
        run(name)
      end

      private

        # REVISIT: can we set the description somehow?
        def define_task(name, roles, &block)
          @config.task task_sym(name), :roles => roles, &block
        end

        def run(task)
          @config.send task_sym(task)
        end

        def task_sym(name)
          "install_#{name.to_task_name}".to_sym
        end
    end
  end
end


=begin

# channel: the SSH channel object used for this response
# stream: either :err or :out, for stderr or stdout responses
# output: the text that the server is sending, might be in chunks
run "apt-get update" do |channel, stream, output|
   if output =~ /Are you sure?/
     answer = Capistrano::CLI.ui.ask("Are you sure: ")
     channel.send_data(answer + "\n")
   else
     # allow the default callback to be processed
     Capistrano::Configuration.default_io_proc.call[channel, stream, output]
   end
 end



 You can tell subversion to use a different username+password by
 setting a couple variables:
    set :svn_username, "my svn username"
    set :svn_password, "<PASSWORD>"
 If you don't want to set the password explicitly in your recipe like
 that, you can make capistrano prompt you for it like this:
    set(:svn_password) { Capistrano::CLI.password_prompt("Subversion
 password: ") }
 - Jamis
=end
<commit_msg>Remove local<commit_after>require 'capistrano/cli'

module Sprinkle
  module Actors
    class Capistrano
      def initialize(&block)
        @config = ::Capistrano::Configuration.new
        @config.logger.level = ::Capistrano::Logger::TRACE
        @config.set(:password) { ::Capistrano::CLI.password_prompt }
        self.instance_eval &block
      end

      def recipes(script)
        @config.load script # normally config/deploy in rails
      end

      # better name

      def process(name, commands, roles)
        define_task(name, roles) do
          via = fetch(:run_method, :sudo)
          commands.each do |command|
            invoke_command command, :via => via
          end
        end
        run(name)
      end

      private

        # REVISIT: can we set the description somehow?
        def define_task(name, roles, &block)
          @config.task task_sym(name), :roles => roles, &block
        end

        def run(task)
          @config.send task_sym(task)
        end

        def task_sym(name)
          "install_#{name.to_task_name}".to_sym
        end
    end
  end
end


=begin

# channel: the SSH channel object used for this response
# stream: either :err or :out, for stderr or stdout responses
# output: the text that the server is sending, might be in chunks
run "apt-get update" do |channel, stream, output|
   if output =~ /Are you sure?/
     answer = Capistrano::CLI.ui.ask("Are you sure: ")
     channel.send_data(answer + "\n")
   else
     # allow the default callback to be processed
     Capistrano::Configuration.default_io_proc.call[channel, stream, output]
   end
 end



 You can tell subversion to use a different username+password by
 setting a couple variables:
    set :svn_username, "my svn username"
    set :svn_password, "<PASSWORD>"
 If you don't want to set the password explicitly in your recipe like
 that, you can make capistrano prompt you for it like this:
    set(:svn_password) { Capistrano::CLI.password_prompt("Subversion
 password: ") }
 - Jamis
=end

{'fraction_non_alphanumeric': 0.08948271635204708, 'fraction_numerical': 0.0, 'mean_word_length': 2.6266666666666665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '799112', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1178, 'n_words': 393}