<commit_before>#
# Cookbook Name:: practicingruby
# Recipe:: god
#
# Installs, configures, and starts God
#

# Install Ruby first
include_recipe "practicingruby::ruby"

# Install god gem
gem_package "god" do
  gem_binary node["practicingruby"]["ruby"]["gem"]["binary"]
  options    node["practicingruby"]["ruby"]["gem"]["options"]
  action     :install
end

# Add god to default PATH for sudo and startup script
link "/usr/local/bin/god" do
  to        "/opt/rubies/#{node["practicingruby"]["ruby"]["version"]}/bin/god"
  link_type :symbolic
  action    :create
end

# Create config directory
directory "/etc/god" do
  owner  "root"
  group  "root"
  mode   "0755"
  action :create
end

# Create config file
template "/etc/god/master.conf" do
  source  "god.conf.erb"
  owner   "root"
  group   "root"
  mode    "0644"
  action  :create
  variables(
    :god_file => "/home/#{node["practicingruby"]["deploy"]["username"]}/current/config/delayed_job.god"
  )
end

# Install startup script
template "/etc/init.d/god" do
  source "god.sh.erb"
  owner  "root"
  group  "root"
  mode   "0755"
  action :create
  variables(
    :ruby_version => node["practicingruby"]["ruby"]["version"]
  )
end

# Start god
service "god" do
  supports :status => true, :restart => true
  action   [:enable, :start]<commit_msg>Restart god when config changes<commit_after>#
# Cookbook Name:: practicingruby
# Recipe:: god
#
# Installs, configures, and starts God
#

# Install Ruby first
include_recipe "practicingruby::ruby"

# Install god gem
gem_package "god" do
  gem_binary node["practicingruby"]["ruby"]["gem"]["binary"]
  options    node["practicingruby"]["ruby"]["gem"]["options"]
  action     :install
end

# Add god to default PATH for sudo and startup script
link "/usr/local/bin/god" do
  to        "/opt/rubies/#{node["practicingruby"]["ruby"]["version"]}/bin/god"
  link_type :symbolic
  action    :create
end

# Create config directory
directory "/etc/god" do
  owner  "root"
  group  "root"
  mode   "0755"
  action :create
end

# Create config file
template "/etc/god/master.conf" do
  source   "god.conf.erb"
  owner    "root"
  group    "root"
  mode     "0644"
  action   :create
  notifies :restart, "service[god]"
  variables(
    :god_file => "/home/#{node["practicingruby"]["deploy"]["username"]}/current/config/delayed_job.god"
  )
end

# Install startup script
template "/etc/init.d/god" do
  source "god.sh.erb"
  owner  "root"
  group  "root"
  mode   "0755"
  action :create
  variables(
    :ruby_version => node["practicingruby"]["ruby"]["version"]
  )
end

# Start god
service "god" do
  supports :status => true, :restart => true
  action   [:enable, :start]
{'fraction_non_alphanumeric': 0.1484814398200225, 'fraction_numerical': 0.008998875140607425, 'mean_word_length': 3.8775137111517366, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2704214', 'n_tokens_mistral': 951, 'n_tokens_neox': 955, 'n_words': 240}