<commit_before>include_recipe "chef-streambot-api"

puts node['streambot']

group node['streambot']['node']['group']

user node['streambot']['node']['user'] do
  comment	'Streambot API node (ssh)'
  gid 		node['streambot']['node']['group']
  home 		node['streambot']['node']['home']
  shell 	node['streambot']['node']['shell']
end

directory "/opt/go" do
  owner 	node['streambot']['node']['user']
  group 	node['streambot']['node']['group']
  recursive true
end

bash "prepare_api_source" do
	user "root"
	cwd "/tmp"
	code 	<<-EOH
	chown -R #{node[:node][:user]}:#{node[:node][:group]} #{node[:streambot][:api][:src]}
	EOH
end

bash "build_streambot_api" do
	cwd		"/tmp"
	user 	"streambot"
	group 	"streambot"
	code 	<<-EOH
	tar xvfj #{node[:streambot][:api][:src]}
	cd streambot-api
	go build api.go
	mv api #{node[:streambot][:api][:binary]}
	EOH
  	not_if { ::File.exists?(node[:streambot][:api][:binary]) }
end

template "/etc/init/streambot-api.conf" do
  source      'streambot-api.conf.erb'
  owner       'root'
  group       'root'
  mode        '0644'
end<commit_msg>Fixes wrong attribute calls in API server's recipe<commit_after>include_recipe "chef-streambot-api"

group node['streambot']['node']['group']

user node['streambot']['node']['user'] do
	comment		'Streambot API node (ssh)'
	gid 		node['streambot']['node']['group']
	home 		node['streambot']['node']['home']
	shell 		node['streambot']['node']['shell']
end

directory "/opt/go" do
	owner 		node['streambot']['node']['user']
	group 		node['streambot']['node']['group']
	recursive	true
end

bash "prepare_api_source" do
	user 	"root"
	cwd 	"/tmp"
	code 	<<-EOH
	chown -R #{node[:streambot][:node][:user]}:#{node[:streambot][:node][:group]} #{node[:streambot][:api][:src]}
	EOH
end

bash "build_streambot_api" do
	cwd		"/tmp"
	user 	"streambot"
	group 	"streambot"
	code 	<<-EOH
	tar xvfj #{node[:streambot][:api][:src]}
	cd streambot-api
	go build api.go
	mv api #{node[:streambot][:api][:binary]}
	EOH
  	not_if { ::File.exists?(node[:streambot][:api][:binary]) }
end

template "/etc/init/streambot-api.conf" do
  source      'streambot-api.conf.erb'
  owner       'root'
  group       'root'
  mode        '0644'
end
{'fraction_non_alphanumeric': 0.2004566210045662, 'fraction_numerical': 0.0036529680365296802, 'mean_word_length': 4.796296296296297, 'pattern_counts': {'":': 0, '<': 11, '<?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': '1682471', 'n_tokens_mistral': 859, 'n_tokens_neox': 881, 'n_words': 172}