<commit_before>

bash "install_forever" do
	code <<-EOH
		sudo npm install forever -g
		EOH
	not_if "type -p forever"
end<commit_msg>Install forever globally with npm and start a specific script<commit_after>Chef::Log.info("*---------Forever Log-------------*")

include_recipe "nodejs::npm"

#-------------------------------------------------------#
Chef::Log.info("Installing forever globally with npm")

bash "install_forever" do
	code <<-BASH
		sudo npm install forever -g
		BASH
	not_if "test -f /usr/local/bin/forever"
end

#-------------------------------------------------------#

script_dir = node["forever"]["script_dir"]
script = node["forever"]["script"]

Chef::Log.info("Calling forever on script #{script_dir}/#{script}")

bash "start_forever" do
	cwd "#{script_dir}"
	code <<-BASH
		forever start -w -a -l forever.log -o out.log -e err.log #{script}
	BASH
end


Chef::Log.info("*---------Forever Log-------------*")
{'fraction_non_alphanumeric': 0.28817204301075267, 'fraction_numerical': 0.0, 'mean_word_length': 2.2103448275862068, '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': '1732261', 'n_tokens_mistral': 312, 'n_tokens_neox': 297, 'n_words': 81}