<commit_before>#
# Cookbook Name:: openhab
# Recipe:: install_from_source
#
# Copyright (C) 2015 <NAME>
#
# MIT
#

RELEASE_URL = "https://github.com/openhab/openhab/releases/download/"
VERSION_URL = "#{RELEASE_URL}v#{node[:openhab][:version]}/distribution-#{node[:openhab][:version]}-"

package 'unzip'

ark 'openhab' do
  url "#{VERSION_URL}runtime.zip"
  version node[:openhab][:version]
  path node[:openhab][:install_dir]
  owner node[:openhab][:user]
  group node[:openhab][:group]

  action :put
end

PLUGIN_REGEX = /\A(action|binding|persistance|io)\-(.*)\z/

if node['openhab']['plugins'].count > 0

  ark 'openhab-addons' do
    url "#{VERSION_URL}addons.zip"
    version node[:openhab][:version]
    path "#{node[:openhab][:install_dir]}/openhab/disabled-addons"
    owner node[:openhab][:user]
    group node[:openhab][:group]

    action :dump
  end

  directory "#{node[:openhab][:install_dir]}/openhab/addons" do
    owner node[:openhab][:user]
    group node[:openhab][:group]
    action :create
  end

  node['openhab']['plugins'].each do |plugin|
    jar_name = plugin.gsub(PLUGIN_REGEX, 'org.openhab.\1.\2') + "-#{node[:openhab][:version]}.jar"

    bash "install #{jar_name}" do
      cwd  "#{node[:openhab][:install_dir]}/openhab/addons"
      code "mv ../disabled-addons/#{jar_name} ."
      only_if { ::File.exists? "#{node[:openhab][:install_dir]}/openhab/disabled-addons/#{jar_name}" }
      not_if  { ::File.exists? "#{node[:openhab][:install_dir]}/openhab/addons/#{jar_name}"          }
    end
  end
end
<commit_msg>[BUGFIX] Components need 0 stripping<commit_after>#
# Cookbook Name:: openhab
# Recipe:: install_from_source
#
# Copyright (C) 2015 <NAME>
#
# MIT
#

RELEASE_URL = "https://github.com/openhab/openhab/releases/download/"
VERSION_URL = "#{RELEASE_URL}v#{node[:openhab][:version]}/distribution-#{node[:openhab][:version]}-"

package 'unzip'

ark "openhab-#{node[:openhab][:version]}" do
  name 'openhab'
  url "#{VERSION_URL}runtime.zip"
  version node[:openhab][:version]
  path node[:openhab][:install_dir]
  owner node[:openhab][:user]
  group node[:openhab][:group]
  strip_components 0
  action :put
end

PLUGIN_REGEX = /\A(action|binding|persistance|io)\-(.*)\z/

if node['openhab']['plugins'].count > 0

  ark 'openhab-addons' do
    url "#{VERSION_URL}addons.zip"
    version node[:openhab][:version]
    path "#{node[:openhab][:install_dir]}/openhab/disabled-addons"
    owner node[:openhab][:user]
    group node[:openhab][:group]

    action :dump
  end

  directory "#{node[:openhab][:install_dir]}/openhab/addons" do
    owner node[:openhab][:user]
    group node[:openhab][:group]
    action :create
  end

  node['openhab']['plugins'].each do |plugin|
    jar_name = plugin.gsub(PLUGIN_REGEX, 'org.openhab.\1.\2') + "-#{node[:openhab][:version]}.jar"

    bash "install #{jar_name}" do
      cwd  "#{node[:openhab][:install_dir]}/openhab/addons"
      code "mv ../disabled-addons/#{jar_name} ."
      only_if { ::File.exists? "#{node[:openhab][:install_dir]}/openhab/disabled-addons/#{jar_name}" }
      not_if  { ::File.exists? "#{node[:openhab][:install_dir]}/openhab/addons/#{jar_name}"          }
    end
  end
end

{'fraction_non_alphanumeric': 0.19344675488342786, 'fraction_numerical': 0.005040957781978576, 'mean_word_length': 4.579964850615114, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7634964', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1160, 'n_words': 186}