<commit_before>#
# Cookbook Name:: jetty
# Recipe::eclipse
#
# Copyright 2012, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

include_recipe "java"

jetty_tar_gz = File.join(Chef::Config[:file_cache_path], "/", "jetty-distribution-#{node["jetty"]["eclipse"]["version"]}.tar.gz")

eclipse_mirror = node["jetty"]["eclipse"]["mirror"]

remote_file jetty_tar_gz do
  source "#{eclipse_mirror}/jetty/#{node["jetty"]["eclipse"]["version"]}/dist/jetty-distribution-#{node["jetty"]["eclipse"]["version"]}.tar.gz"
  mode "0644"
  action :create_if_missing 
end

execute "untar jetty" do
  command "tar -xzf #{jetty_tar_gz} -C /opt"
  creates "/opt/jetty-distribution-#{node["jetty"]["eclipse"]["version"]}"
  action :run
end

execute "link jetty-distribution-#{node["jetty"]["eclipse"]["version"]} to /opt/jetty" do
  command "ln -fs /opt/jetty-distribution-#{node["jetty"]["eclipse"]["version"]} /opt/jetty"
  action :run
end

execute "copy jetty startscript" do
  command "cp /opt/jetty/bin/jetty.sh /etc/init.d/jetty"
  creates "/etc/init.d/jetty"
  action :run
end

user "jetty" do
   comment "jetty user"
   system true
   shell "/bin/false"
end

directory node["jetty"]["log_dir"] do
  owner "jetty"
  group "jetty"
  mode "0755"
  action :create
end

service "jetty" do
  case node["platform"]
  when "centos","redhat","fedora"
    service_name "jetty6"
    supports :restart => true
  when "debian","ubuntu"
    service_name "jetty"
    supports :restart => true, :status => true
    action [:enable]
  end
end

template "/etc/default/jetty" do
  source "default_jetty.erb"
  owner "root"
  group "root"
  mode "0644"
  notifies :restart, "service[jetty]"
end
<commit_msg>make sure the symlink gets overwritten<commit_after>#
# Cookbook Name:: jetty
# Recipe::eclipse
#
# Copyright 2012, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

include_recipe "java"

jetty_tar_gz = File.join(Chef::Config[:file_cache_path], "/", "jetty-distribution-#{node["jetty"]["eclipse"]["version"]}.tar.gz")

eclipse_mirror = node["jetty"]["eclipse"]["mirror"]

remote_file jetty_tar_gz do
  source "#{eclipse_mirror}/jetty/#{node["jetty"]["eclipse"]["version"]}/dist/jetty-distribution-#{node["jetty"]["eclipse"]["version"]}.tar.gz"
  mode "0644"
  action :create_if_missing 
end

execute "untar jetty" do
  command "tar -xzf #{jetty_tar_gz} -C /opt"
  creates "/opt/jetty-distribution-#{node["jetty"]["eclipse"]["version"]}"
  action :run
end

execute "link jetty-distribution-#{node["jetty"]["eclipse"]["version"]} to /opt/jetty" do
  command "ln --force --symbolic --no-target-directory /opt/jetty-distribution-#{node["jetty"]["eclipse"]["version"]} /opt/jetty"
  action :run
end

execute "copy jetty startscript" do
  command "cp /opt/jetty/bin/jetty.sh /etc/init.d/jetty"
  creates "/etc/init.d/jetty"
  action :run
end

user "jetty" do
   comment "jetty user"
   system true
   shell "/bin/false"
end

directory node["jetty"]["log_dir"] do
  owner "jetty"
  group "jetty"
  mode "0755"
  action :create
end

service "jetty" do
  case node["platform"]
  when "centos","redhat","fedora"
    service_name "jetty6"
    supports :restart => true
  when "debian","ubuntu"
    service_name "jetty"
    supports :restart => true, :status => true
    action [:enable]
  end
end

template "/etc/default/jetty" do
  source "default_jetty.erb"
  owner "root"
  group "root"
  mode "0644"
  notifies :restart, "service[jetty]"
end

{'fraction_non_alphanumeric': 0.14778880866425992, 'fraction_numerical': 0.00947653429602888, 'mean_word_length': 4.590163934426229, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2712756', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1540, 'n_words': 427}