Skip to content

Commit

Permalink
Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
atomic-penguin committed Jun 11, 2014
1 parent 71f0356 commit fec94a6
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 55 deletions.
14 changes: 7 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:chefspec)

# rubocop rake task
desc "Ruby style guide linter"
desc 'Ruby style guide linter'
task :rubocop do
sh "rubocop"
sh 'rubocop'
end

# foodcritic task
desc "Runs foodcritic linter"
desc 'Runs foodcritic linter'
task :foodcritic do
if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup)
sh "foodcritic --epic-fail any ."
if Gem::Version.new('1.9.2') <= Gem::Version.new(RUBY_VERSION.dup)
sh 'foodcritic --epic-fail any .'
else
puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2."
end
end

task :default => [ 'foodcritic', 'rubocop', 'chefspec' ]
task default: %w(foodcritic rubocop chefspec)

begin
require 'kitchen/rake_tasks'
Kitchen::RakeTasks.new
rescue LoadError
puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI']
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
end
20 changes: 10 additions & 10 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,37 +57,37 @@
default['ruby_build']['upgrade'] = 'sync'
default['gitlab']['install_ruby'] = '1.9.3-p484'
default['gitlab']['install_ruby_path'] = node['gitlab']['home']
default['gitlab']['cookbook_dependencies'] = %w[
default['gitlab']['cookbook_dependencies'] = %w(
zlib readline ncurses openssh
logrotate redisio::install redisio::enable ruby_build
]
)

# Required packages for Gitlab
case node['platform_family']
when 'debian'
default['gitlab']['packages'] = %w[
default['gitlab']['packages'] = %w(
libyaml-dev libssl-dev libgdbm-dev libffi-dev checkinstall
curl libcurl4-openssl-dev libicu-dev wget python-docutils sudo
]
)
when 'rhel'
default['gitlab']['packages'] = %w[
default['gitlab']['packages'] = %w(
libyaml-devel openssl-devel gdbm-devel libffi-devel
curl libcurl-devel libicu-devel wget python-docutils sudo
]
)
else
default['gitlab']['install_ruby'] = 'package'
default['gitlab']['cookbook_dependencies'] = %w[
default['gitlab']['cookbook_dependencies'] = %w(
openssh readline zlib ruby_build
redisio::install redisio::enable
]
default['gitlab']['packages'] = %w[
)
default['gitlab']['packages'] = %w(
autoconf binon flex gcc gcc-c++ make m4
git
zlib1g-dev libyaml-dev libssl-dev libgdbm-dev
libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server
redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev
libicu-dev python-docutils sudo
]
)
end

default['gitlab']['trust_local_sshkeys'] = 'yes'
Expand Down
16 changes: 8 additions & 8 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
maintainer 'Eric G. Wolfe'
maintainer 'Eric G. Wolfe'
maintainer_email 'eric.wolfe@gmail.com'
license 'Apache 2.0'
description 'Installs/Configures gitlab'
license 'Apache 2.0'
description 'Installs/Configures gitlab'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
name 'gitlab'
version '6.9.0'
name 'gitlab'
version '6.9.0'

%w[build-essential zlib readline ncurses git openssh redisio xml
%w(build-essential zlib readline ncurses git openssh redisio xml
ruby_build certificate database logrotate mysql nginx
postgresql apt yum-epel].each do |cb_depend|
postgresql apt yum-epel).each do |cb_depend|
depends cb_depend
end

%w[ redhat centos scientific amazon debian ubuntu ].each do |os|
%w(redhat centos scientific amazon debian ubuntu).each do |os|
supports os
end
14 changes: 7 additions & 7 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@
# cross-platform. Issue #66
execute 'update-alternatives-ruby' do
command "update-alternatives --install /usr/local/bin/ruby ruby #{node['gitlab']['install_ruby_path']}/bin/ruby 10"
not_if { ::File.exists?('/usr/local/bin/ruby') }
not_if { ::File.exist?('/usr/local/bin/ruby') }
end

# Install required Ruby Gems for Gitlab with ~git/bin/gem
%w[charlock_holmes bundler].each do |gempkg|
%w(charlock_holmes bundler).each do |gempkg|
gem_package gempkg do
gem_binary "#{node['gitlab']['install_ruby_path']}/bin/gem"
action :install
Expand All @@ -119,7 +119,7 @@
end
else
# Install required Ruby Gems for Gitlab with system gem
%w[charlock_holmes bundler].each do |gempkg|
%w(charlock_holmes bundler).each do |gempkg|
gem_package gempkg do
action :install
options('--no-ri --no-rdoc')
Expand Down Expand Up @@ -218,7 +218,7 @@
end

# create log, tmp, pids and sockets directory
%w{ log tmp tmp/pids tmp/sockets public/uploads }.each do |dir|
%w(log tmp tmp/pids tmp/sockets public/uploads).each do |dir|
directory File.join(node['gitlab']['app_home'], dir) do
user node['gitlab']['user']
group node['gitlab']['group']
Expand All @@ -234,7 +234,7 @@
path ["#{node['gitlab']['app_home']}/log/*.log",
"#{node['gitlab']['shell']['home']}/gitlab-shell.log"]
rotate 52
options %w[compress delaycompress notifempty copytruncate]
options %w(compress delaycompress notifempty copytruncate)
end

# create gitlab-satellites directory
Expand Down Expand Up @@ -286,7 +286,7 @@
user node['gitlab']['user']
group node['gitlab']['group']
environment('LANG' => 'en_US.UTF-8', 'LC_ALL' => 'en_US.UTF-8')
not_if { File.exists?(bundle_success) }
not_if { File.exist?(bundle_success) }
end

# Precompile assets
Expand All @@ -305,7 +305,7 @@
cwd node['gitlab']['app_home']
user node['gitlab']['user']
group node['gitlab']['group']
not_if { File.exists?("#{node['gitlab']['app_home']}/.gitlab-setup") }
not_if { File.exist?("#{node['gitlab']['app_home']}/.gitlab-setup") }
end

# Use certificate cookbook for keys.
Expand Down
20 changes: 10 additions & 10 deletions recipes/mysql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@

# Create the database
mysql_database database do
connection database_connection
action :create
connection database_connection
action :create
end

# Create the database user
mysql_database_user database_user do
connection database_connection
password database_password
host database_userhost
database_name database
action :create
connection database_connection
password database_password
host database_userhost
database_name database
action :create
end

# Grant all privileges to user on database
mysql_database_user database_user do
connection database_connection
database_name database
connection database_connection
database_name database
privileges ['SELECT', 'LOCK TABLES', 'INSERT', 'UPDATE', 'DELETE', 'CREATE', 'DROP', 'INDEX', 'ALTER']
action :grant
action :grant
end
20 changes: 10 additions & 10 deletions recipes/postgres.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@

# Create the database
postgresql_database database do
connection database_connection
action :create
connection database_connection
action :create
end

# Create the database user
postgresql_database_user database_user do
connection database_connection
password database_password
host database_userhost
database_name database
action :create
connection database_connection
password database_password
host database_userhost
database_name database
action :create
end

# Grant all privileges to user on database
postgresql_database_user database_user do
connection database_connection
database_name database
action :grant
connection database_connection
database_name database
action :grant
end
6 changes: 3 additions & 3 deletions spec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
end

it 'ISSUE #66 installs gems using /srv/git/bin/gem' do
%w[charlock_holmes bundler].each do |gem|
%w(charlock_holmes bundler).each do |gem|
expect(chef_run).to install_gem_package(gem).with(gem_binary: '/srv/git/bin/gem')
end
end
Expand All @@ -134,7 +134,7 @@
end

it 'ISSUE #66 installs gems using /var/lib/git/bin/gem' do
%w[charlock_holmes bundler].each do |gem|
%w(charlock_holmes bundler).each do |gem|
expect(chef_run).to install_gem_package(gem).with(gem_binary: '/var/lib/git/bin/gem')
end
end
Expand All @@ -152,7 +152,7 @@
end

it 'ISSUE #66 installs gems using system gem' do
%w[charlock_holmes bundler].each do |gem|
%w(charlock_holmes bundler).each do |gem|
expect(chef_run).to install_gem_package(gem).with(gem_binary: nil)
end
end
Expand Down

0 comments on commit fec94a6

Please sign in to comment.