<commit_before>#
# Cookbook Name:: application_zf
# Recipe:: default
#
# Copyright 2013, <NAME>.
#
# 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 "build-essential"
include_recipe "apt"
include_recipe "apache2"
include_recipe "php"
include_recipe "php::module_apc"

package "git"
package "php5-intl"
package "libpcre3-dev"

# update the main channels
php_pear_channel 'pear.php.net' do
  action :update
end

# install apc pecl with directives
php_pear "APC" do
  action :install
end

path_on_disk = String.new(node['zend']['version'])
path_on_disk["/"] = "_"


if node['zend']['version'] == 'latest'
  require 'open-uri'
  remote_file  "#{Chef::Config[:file_cache_path]}/latest.tar.gz" do
    source "https://github.com/zendframework/ZendSkeletonApplication/archive/master.tar.gz"
    mode "0644"
  end
else
  remote_file "#{Chef::Config[:file_cache_path]}/#{path_on_disk}.tar.gz" do
    source "https://github.com/zendframework/ZendSkeletonApplication/archive/#{node['zend']['version']}.tar.gz"
    mode "0644"
  end
end

directory "#{node['zend']['dir']}" do
  owner "root"
  group "root"
  mode "0755"
  action :create
  recursive true
end

execute "unzip-zend" do
  cwd node['zend']['dir']
  command "tar -xzf #{Chef::Config[:file_cache_path]}/#{path_on_disk}.tar.gz --strip 1"
end

execute "update-composer" do
	cwd node['zend']['dir']
	command "php composer.phar self-update"
end

execute "base-install" do
    cwd node['zend']['dir']
	command "php composer.phar install"
end

node['zend']['composer']['packages'].each do |package|
    execute "install-requires" do
        cwd node['zend']['dir']
        command "php composer.phar require #{package['name']}:#{package['version']}"
        not_if { node['zend']['composer']['packages'].count == 0 }
    end
end

zend_module "application_modules" do
	modules node['zend']['modules']
end
<commit_msg>Add permissions on data/cache folder #7<commit_after>#
# Cookbook Name:: application_zf
# Recipe:: default
#
# Copyright 2013, <NAME>.
#
# 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 "build-essential"
include_recipe "apt"
include_recipe "apache2"
include_recipe "php"

package "git"
package "subversion"
package "php5-intl"
package "libpcre3-dev"

# update the main channels
php_pear_channel 'pear.php.net' do
  action :update
end

# install apc pecl with directives
php_pear "APC" do
  action :install
end

path_on_disk = String.new(node['zend']['version'])
path_on_disk["/"] = "_"


if node['zend']['version'] == 'latest'
  require 'open-uri'
  remote_file  "#{Chef::Config[:file_cache_path]}/latest.tar.gz" do
    source "https://github.com/zendframework/ZendSkeletonApplication/archive/master.tar.gz"
    mode "0644"
  end
else
  remote_file "#{Chef::Config[:file_cache_path]}/#{path_on_disk}.tar.gz" do
    source "https://github.com/zendframework/ZendSkeletonApplication/archive/#{node['zend']['version']}.tar.gz"
    mode "0644"
  end
end

directory "#{node['zend']['dir']}" do
  owner "root"
  group "root"
  mode "0755"
  action :create
  recursive true
end

execute "unzip-zend" do
  cwd node['zend']['dir']
  command "tar -xzf #{Chef::Config[:file_cache_path]}/#{path_on_disk}.tar.gz --strip 1"
end

directory "#{node['zend']['dir']}/data" do
  owner "root"
  group "root"
  mode "0777"
  recursive false
end

directory "#{node['zend']['dir']}/data/cache" do
  owner "root"
  group "root"
  mode "0777"
  recursive false
end

execute "update-composer" do
	cwd node['zend']['dir']
	command "php composer.phar self-update"
end

execute "base-install" do
    cwd node['zend']['dir']
	command "php composer.phar install"
end

node['zend']['composer']['packages'].each do |package|
    execute "install-requires" do
        cwd node['zend']['dir']
        command "php composer.phar require #{package['name']}:#{package['version']}"
        not_if { node['zend']['composer']['packages'].count == 0 }
    end
end

zend_module "application_modules" do
	modules node['zend']['modules']
end

{'fraction_non_alphanumeric': 0.14368971061093247, 'fraction_numerical': 0.011856913183279742, 'mean_word_length': 4.733870967741935, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, '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': '873221', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1651, 'n_words': 469}