Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Commit

Permalink
rubocop cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Schuhmann committed Apr 1, 2015
1 parent 28a49ea commit 5f826b3
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 71 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
inherit_from: .rubocop_todo.yml

11 changes: 11 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-03-31 23:40:42 -0400 using RuboCop version 0.28.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 18
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 117
2 changes: 1 addition & 1 deletion Thorfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ begin
require 'kitchen/thor_tasks'
Kitchen::ThorTasks.new
rescue LoadError
puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI']
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
end
80 changes: 40 additions & 40 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
BOXES = [
{
hostname: 'teamcity',
ip: '192.168.80.10',
ports: [8111, 5432],
role: 'server',
ram: 2048,
cpus: 2,
chef: {
json: {
'teamcity' => {
'password' => '$1$ByY03mDX$4pk9wp9bC19yB6pxSoVB81',
'server' => {
'backup' => 'file:///vagrant/tmp/TeamCity_Backup_20141216_154715.zip',
'database' => {
'username' => 'postgres',
'password' => '3175bce1d3201d16594cebf9d7eb3f9d',
'jar' => 'file:///usr/share/java/postgresql93-jdbc.jar',
'connection_url' => 'jdbc\:postgresql\:///postgres'
hostname: 'teamcity',
ip: '192.168.80.10',
ports: [8111, 5432],
role: 'server',
ram: 2048,
cpus: 2,
chef: {
json: {
'teamcity' => {
'password' => '$1$ByY03mDX$4pk9wp9bC19yB6pxSoVB81',
'server' => {
'backup' => 'file:///vagrant/tmp/TeamCity_Backup_20141216_154715.zip',
'database' => {
'username' => 'postgres',
'password' => '3175bce1d3201d16594cebf9d7eb3f9d',
'jar' => 'file:///usr/share/java/postgresql93-jdbc.jar',
'connection_url' => 'jdbc\:postgresql\:///postgres'
}
}
},
'postgresql' => {
'version' => '9.3',
'enable_pgdg_yum' => true,
'password' => {
'postgres' => '3175bce1d3201d16594cebf9d7eb3f9d'
},
'contrib' => {
'packages' => ['postgresql93-jdbc']
}
},
'java' => {
'install_flavor' => 'oracle',
'jdk_version' => 7,
'set_etc_environment' => true,
'oracle' => {
'accept_oracle_download_terms' => true
}
}
}
},
'postgresql' => {
'version' => '9.3',
'enable_pgdg_yum' => true,
'password' => {
'postgres' => '3175bce1d3201d16594cebf9d7eb3f9d'
},
'contrib' => {
'packages' => ['postgresql93-jdbc']
}
},
'java' => {
'install_flavor' => 'oracle',
'jdk_version' => 7,
'set_etc_environment' => true,
'oracle' => {
'accept_oracle_download_terms' => true
}
run_list: %w(recipe[java] recipe[postgresql::contrib] recipe[chef-teamcity::server])
}
},
run_list: %w(recipe[java] recipe[postgresql::contrib] recipe[chef-teamcity::server])
}
},
{
hostname: 'agent01',
ip: '192.168.80.11',
Expand Down Expand Up @@ -85,9 +85,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

node_config.vm.network :private_network, ip: node[:ip]

node[:ports].each { |port|
node[:ports].each do |port|
node_config.vm.network :forwarded_port, guest: port, host: port
}
end

node_config.vm.provider :virtualbox do |box|
box.customize ['modifyvm', :id, '--name', node[:hostname]]
Expand Down
6 changes: 3 additions & 3 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
recipe 'chef-teamcity::server', 'Install a TeamCity server'
recipe 'chef-teamcity::agent', 'Installs a TeamCity agent'

supports "redhat", '~> 6.0'
supports "centos", '~> 6.0'
supports "windows"
supports 'redhat', '~> 6.0'
supports 'centos', '~> 6.0'
supports 'windows'

depends 'java'
depends 'git'
Expand Down
14 changes: 7 additions & 7 deletions recipes/linux_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
owner TEAMCITY_USERNAME
group TEAMCITY_GROUP
mode TEAMCITY_READ_MODE
not_if { ::File.exists?(TEAMCITY_PATH) }
not_if { ::File.exist?(TEAMCITY_PATH) }
end

bash 'extract_teamcity' do
Expand All @@ -61,7 +61,7 @@
chown -R #{TEAMCITY_USERNAME}.#{TEAMCITY_GROUP} #{TEAMCITY_PATH}
rm -f #{TEAMCITY_SRC_PATH}
EOH
not_if { ::File.exists?(TEAMCITY_PATH) }
not_if { ::File.exist?(TEAMCITY_PATH) }
end

file TEAMCITY_AGENT_EXECUTABLE do
Expand All @@ -84,7 +84,7 @@
mode TEAMCITY_READ_MODE
owner TEAMCITY_USERNAME
group TEAMCITY_GROUP
variables({
variables(
server_uri: TEAMCITY_AGENT_SERVER_URI,
name: TEAMCITY_AGENT_NAME,
work_dir: TEAMCITY_AGENT_WORK_DIR,
Expand All @@ -95,8 +95,8 @@
authorization_token: TEAMCITY_AGENT_AUTH_TOKEN,
system_properties: TEAMCITY_AGENT_SYSTEM_PROPERTIES,
env_properties: TEAMCITY_AGENT_ENV_PROPERTIES
})
not_if { ::File.exists?(TEAMCITY_AGENT_PROPERTIES) }
)
not_if { ::File.exist?(TEAMCITY_AGENT_PROPERTIES) }
notifies :restart, "service[#{TEAMCITY_SERVICE_NAME}]", :delayed
end

Expand All @@ -105,12 +105,12 @@
mode TEAMCITY_EXECUTABLE_MODE
owner 'root'
group 'root'
variables({
variables(
teamcity_user_name: TEAMCITY_USERNAME,
teamcity_executable: TEAMCITY_AGENT_EXECUTABLE,
teamcity_pidfile: TEAMCITY_PID_FILE,
teamcity_service_name: TEAMCITY_SERVICE_NAME
})
)
notifies :restart, "service[#{TEAMCITY_SERVICE_NAME}]", :delayed
end

Expand Down
22 changes: 11 additions & 11 deletions recipes/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
mv #{TEAMCITY_PATH}/*/* #{TEAMCITY_PATH}/
chown -R #{TEAMCITY_USERNAME}.#{TEAMCITY_GROUP} #{TEAMCITY_PATH}
EOH
not_if { ::File.exists?(TEAMCITY_PATH) }
not_if { ::File.exist?(TEAMCITY_PATH) }
end

paths = [
Expand Down Expand Up @@ -99,19 +99,19 @@
owner TEAMCITY_USERNAME
group TEAMCITY_GROUP
mode TEAMCITY_READ_MODE
not_if { ::File.exists?(processed_backup_path) }
not_if { ::File.exist?(processed_backup_path) }
end

template home_database_props do
source 'database.properties.erb'
mode TEAMCITY_READ_MODE
owner TEAMCITY_USERNAME
group TEAMCITY_GROUP
variables({
variables(
url: TEAMCITY_DB_CONNECTION_URL,
username: TEAMCITY_DB_USERNAME,
password: TEAMCITY_DB_PASSWORD,
})
password: TEAMCITY_DB_PASSWORD
)
end

bash 'restore' do
Expand All @@ -122,7 +122,7 @@
rm -f #{backup_path}
touch #{processed_backup_path}
EOH
not_if { ::File.exists?(processed_backup_path) }
not_if { ::File.exist?(processed_backup_path) }
end
end

Expand All @@ -131,11 +131,11 @@
mode TEAMCITY_READ_MODE
owner TEAMCITY_USERNAME
group TEAMCITY_GROUP
variables({
variables(
url: TEAMCITY_DB_CONNECTION_URL,
username: TEAMCITY_DB_USERNAME,
password: TEAMCITY_DB_PASSWORD,
})
password: TEAMCITY_DB_PASSWORD
)
notifies :restart, "service[#{TEAMCITY_SERVICE_NAME}]", :delayed
end

Expand All @@ -144,13 +144,13 @@
mode TEAMCITY_EXECUTABLE_MODE
owner 'root'
group 'root'
variables({
variables(
teamcity_user_name: TEAMCITY_USERNAME,
teamcity_server_executable: TEAMCITY_SERVER_EXECUTABLE,
teamcity_data_path: TEAMCITY_DATA_PATH,
teamcity_pidfile: TEAMCITY_PID_FILE,
teamcity_service_name: TEAMCITY_SERVICE_NAME
})
)
notifies :restart, "service[#{TEAMCITY_SERVICE_NAME}]", :delayed
end

Expand Down
18 changes: 9 additions & 9 deletions recipes/windows_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

TEAMCITY_VERSION = node['teamcity']['version'].freeze
TEAMCITY_SERVICE_NAME = "TCBuildAgent".freeze
TEAMCITY_SERVICE_NAME = 'TCBuildAgent'.freeze

TEAMCITY_AGENT_NAME = node['teamcity']['agent']['name'].freeze
TEAMCITY_AGENT_SERVER_URI = node['teamcity']['agent']['server_uri'].freeze
Expand All @@ -33,31 +33,31 @@
TEAMCITY_AGENT_SRC_PATH = ::File.join(TEAMCITY_AGENT_SYSTEM_DIR, TEAMCITY_AGENT_FILE).freeze
TEAMCITY_AGENT_CONFIG_PATH = "#{TEAMCITY_AGENT_SYSTEM_DIR}/conf".freeze
TEAMCITY_AGENT_PROPERTIES = "#{TEAMCITY_AGENT_CONFIG_PATH}/buildAgent.properties".freeze
TEAMCITY_AGENT_BIN_PATH = ::File.join(TEAMCITY_AGENT_SYSTEM_DIR, "bin")
TEAMCITY_AGENT_BIN_PATH = ::File.join(TEAMCITY_AGENT_SYSTEM_DIR, 'bin')

TEAMCITY_SRC_PATH = "#{TEAMCITY_AGENT_SYSTEM_DIR}.zip".freeze
TEAMCITY_PID_FILE = "#{TEAMCITY_AGENT_SYSTEM_DIR}\\logs\\buildAgent.pid".freeze

remote_file TEAMCITY_SRC_PATH do
source TEAMCITY_AGENT_URI
not_if { ::File.exists?(TEAMCITY_AGENT_CONFIG_PATH) }
not_if { ::File.exist?(TEAMCITY_AGENT_CONFIG_PATH) }
end

directory TEAMCITY_AGENT_SYSTEM_DIR do
action :create
recursive true
not_if { ::File.exists?(TEAMCITY_AGENT_CONFIG_PATH) }
not_if { ::File.exist?(TEAMCITY_AGENT_CONFIG_PATH) }
end

windows_zipfile TEAMCITY_AGENT_SYSTEM_DIR do
source TEAMCITY_SRC_PATH
action :unzip
not_if { ::File.exists?(TEAMCITY_AGENT_BIN_PATH) }
not_if { ::File.exist?(TEAMCITY_AGENT_BIN_PATH) }
end

template TEAMCITY_AGENT_PROPERTIES do
source 'buildAgent.properties.erb'
variables({
variables(
server_uri: TEAMCITY_AGENT_SERVER_URI,
name: TEAMCITY_AGENT_NAME,
work_dir: TEAMCITY_AGENT_WORK_DIR,
Expand All @@ -68,16 +68,16 @@
authorization_token: TEAMCITY_AGENT_AUTH_TOKEN,
system_properties: TEAMCITY_AGENT_SYSTEM_PROPERTIES,
env_properties: TEAMCITY_AGENT_ENV_PROPERTIES
})
not_if { ::File.exists?(TEAMCITY_AGENT_PROPERTIES) }
)
not_if { ::File.exist?(TEAMCITY_AGENT_PROPERTIES) }
notifies :restart, "service[#{TEAMCITY_SERVICE_NAME}]", :delayed
end

execute 'install teamcity service' do
command "#{TEAMCITY_AGENT_BIN_PATH}/service.install.bat"
action :run
cwd "#{TEAMCITY_AGENT_SYSTEM_DIR}/bin"
not_if { ::Win32::Service.exists?("TCBuildAgent") }
not_if { ::Win32::Service.exists?('TCBuildAgent') }
end

service TEAMCITY_SERVICE_NAME do
Expand Down

0 comments on commit 5f826b3

Please sign in to comment.