<commit_before>def sensu_ctl
  ::File.join(node.sensu.embedded_directory,'bin','sensu-ctl')
end

def service_pipe
  ::File.join(node.sensu.embedded_directory,'sv',new_resource.name,'supervise','ok')
end

def sensu_service_path
  ::File.join(node.sensu.embedded_directory,'service',new_resource.name)
end

def load_current_resource
  @service_enabled = ::File.symlink?(sensu_service_path) && ::FileTest.pipe?(service_pipe)
end

action :enable do
  ruby_block "block_until_runsv_#{new_resource.name}_available" do
    block do
      Chef::Log.debug("waiting until named pipe #{service_pipe} exists")
      until ::FileTest.pipe?(service_pipe)
        sleep(1)
        Chef::Log.debug(".")
      end
    end
    action :nothing
  end

  execute "sensu-ctl_#{new_resource.name}_enable" do
    command "#{sensu_ctl} #{new_resource.name} enable"
    not_if { @service_enabled }
    notifies :create, "ruby_block[block_until_runsv_#{new_resource.name}_available]", :immediately
  end
end
<commit_msg>[runit] shortening sensu_service_path to service_path<commit_after>def sensu_ctl
  ::File.join(node.sensu.embedded_directory,'bin','sensu-ctl')
end

def service_pipe
  ::File.join(node.sensu.embedded_directory,'sv',new_resource.name,'supervise','ok')
end

def service_path
  ::File.join(node.sensu.embedded_directory,'service',new_resource.name)
end

def load_current_resource
  @service_enabled = ::File.symlink?(service_path) && ::FileTest.pipe?(service_pipe)
end

action :enable do
  ruby_block "block_until_runsv_#{new_resource.name}_available" do
    block do
      Chef::Log.debug("waiting until named pipe #{service_pipe} exists")
      until ::FileTest.pipe?(service_pipe)
        sleep(1)
        Chef::Log.debug(".")
      end
    end
    action :nothing
  end

  execute "sensu-ctl_#{new_resource.name}_enable" do
    command "#{sensu_ctl} #{new_resource.name} enable"
    not_if { @service_enabled }
    notifies :create, "ruby_block[block_until_runsv_#{new_resource.name}_available]", :immediately
  end
end

{'fraction_non_alphanumeric': 0.12810327706057598, 'fraction_numerical': 0.0009930486593843098, 'mean_word_length': 5.124620060790273, 'pattern_counts': {'":': 0, '<': 3, '<?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': '769149', 'n_tokens_mistral': 709, 'n_tokens_neox': 693, 'n_words': 116}