Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
chore: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgon committed Oct 8, 2021
1 parent 11ff52d commit 1a9a8f8
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 23 deletions.
41 changes: 41 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Layout/BeginEndAlignment:
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true

Layout/LineEndStringConcatenationIndentation:
Enabled: true

Layout/LineLength:
Max: 120
Enabled: true
Expand All @@ -24,6 +27,11 @@ Layout/SpaceBeforeBrackets:
Lint/AmbiguousAssignment:
Enabled: true

Lint/AmbiguousOperatorPrecedence:
Enabled: true
Lint/AmbiguousRange:
Enabled: true

Lint/BinaryOperatorWithIdenticalOperands:
Enabled: true

Expand Down Expand Up @@ -63,6 +71,9 @@ Lint/EmptyConditionalBody:
Lint/EmptyFile:
Enabled: true

Lint/EmptyInPattern:
Enabled: true

Lint/FloatComparison:
Enabled: true

Expand All @@ -72,6 +83,9 @@ Lint/HashCompareByIdentity:
Lint/IdentityComparison:
Enabled: true

Lint/IncompatibleIoSelectWithFiberScheduler:
Enabled: true

Lint/LambdaWithoutLiteralBlock:
Enabled: true

Expand Down Expand Up @@ -102,6 +116,9 @@ Lint/RedundantDirGlobSort:
Lint/RedundantSafeNavigation:
Enabled: true

Lint/RequireRelativeSelfPath:
Enabled: true

Lint/SelfAssignment:
Enabled: true

Expand Down Expand Up @@ -197,6 +214,9 @@ Performance/StringInclude:
Performance/Sum:
Enabled: true

Security/IoMethods:
Enabled: true

Style/AccessorGrouping:
Enabled: true

Expand Down Expand Up @@ -263,18 +283,32 @@ Style/HashTransformValues:
Style/IfWithBooleanLiteralBranches:
Enabled: true

Style/InPatternThen:
Enabled: true

Style/KeywordParametersOrder:
Enabled: true

Style/MultilineInPatternThen:
Enabled: true

Style/NegatedIfElseCondition:
Enabled: true

Style/NilLambda:
Enabled: true

Style/NumberedParameters:
Enabled: true
Style/NumberedParametersLimit:
Enabled: true

Style/OptionalBooleanParameter:
Enabled: true

Style/QuotedSymbols:
Enabled: true

Style/RedundantArgument:
Enabled: true

Expand All @@ -296,6 +330,12 @@ Style/RedundantRegexpEscape:
Style/RedundantSelfAssignment:
Enabled: true

Style/RedundantSelfAssignmentBranch:
Enabled: true

Style/SelectByRegexp:
Enabled: true

Style/SingleArgumentDig:
Enabled: true

Expand All @@ -317,6 +357,7 @@ Style/SwapValues:
AllCops:
TargetRubyVersion: 2.6
DisplayCopNames: true
SuggestExtensions: false

Exclude:
- libraries/provider_*.rb
Expand Down
4 changes: 2 additions & 2 deletions libraries/drivers_source_remote_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def remove_obsolete_directories

def dummy_git_command
"cd #{dummy_repository_dir} && git init && git config user.name 'Chef' && " \
'git config user.email \'chef@localhost\' && git add -A && ' \
'git commit --author=\'Chef <>\' -m \'dummy repo\' -an'
'git config user.email \'chef@localhost\' && git add -A && ' \
'git commit --author=\'Chef <>\' -m \'dummy repo\' -an'
end

def archive_file_dir
Expand Down
4 changes: 2 additions & 2 deletions libraries/drivers_source_remote_s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def parse_uri(uri) # rubocop:disable Metrics/MethodLength
# scheme, userinfo, host, port, registry | path, opaque, query, fragment

components = URI.split(uri)
base_uri = URI::HTTP.new(*(components.take(5) + [nil] * 4))
remote_path = URI::HTTP.new(*([nil] * 5 + components.drop(5)))
base_uri = URI::HTTP.new(*(components.take(5) + ([nil] * 4)))
remote_path = URI::HTTP.new(*(([nil] * 5) + components.drop(5)))

virtual_host_match =
base_uri.host.match(/\A(.+)\.s3(?:[-.](?:ap|eu|sa|us)-(?:.+-)\d|-external-1)?\.amazonaws\.com/i)
Expand Down
4 changes: 2 additions & 2 deletions libraries/drivers_worker_sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def stop_sidekiq

def send_signal_to_sidekiq(process_number, signal = nil)
"/bin/su - #{node['deployer']['user']} -c \"ps -ax | grep 'bundle exec sidekiq' | " \
"grep sidekiq_#{process_number}.yml | grep -v grep | awk '{print \\$1}' | " \
"xargs --no-run-if-empty pgrep -P | xargs --no-run-if-empty kill#{" -#{signal}" if signal}\""
"grep sidekiq_#{process_number}.yml | grep -v grep | awk '{print \\$1}' | " \
"xargs --no-run-if-empty pgrep -P | xargs --no-run-if-empty kill#{" -#{signal}" if signal}\""
end

def configuration
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
maintainer_email '[email protected]'
license 'MIT'
description 'Set of chef recipes for OpsWorks based Ruby projects'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
long_description File.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.20.3'
chef_version '>= 12.0' if respond_to?(:chef_version)

Expand Down
20 changes: 10 additions & 10 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ copyright: Copyright &copy; 2016 - 2021 Igor Rzegocki
nav:
- 'Home': index.md
- 'User Documentation':
- 'Getting Started': getting-started.md
- 'Troubleshooting': troubleshooting.md
- 'Getting Started': getting-started.md
- 'Troubleshooting': troubleshooting.md
- 'Cookbook Documentation':
- 'Supported Technologies': support.md
- 'Requirements': requirements.md
- 'Attributes': attributes.md
- 'Recipes': recipes.md
- 'Supported Technologies': support.md
- 'Requirements': requirements.md
- 'Attributes': attributes.md
- 'Recipes': recipes.md
- 'About opsworks_ruby':
- 'Contributing': contributing.md
- 'Author and Contributors': team.md
- 'Changelog': changelog.md
- 'License': license.md
- 'Contributing': contributing.md
- 'Author and Contributors': team.md
- 'Changelog': changelog.md
- 'License': license.md

plugins:
- search
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/recipes/configure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@
deploy['dummy_project']['appserver']['mount_point'] = '/some/mount/point'
deploy['dummy_project']['appserver']['pool_idle_time'] = 300
deploy['dummy_project']['appserver']['max_request_queue_size'] = 100
deploy['dummy_project']['appserver']['error_document'] = { "503": '503.html', "504": '504.html' }
deploy['dummy_project']['appserver']['error_document'] = { '503': '503.html', '504': '504.html' }
deploy['dummy_project']['appserver']['passenger_max_preloader_idle_time'] = 300
deploy['dummy_project']['webserver']['adapter'] = 'apache2'
deploy['dummy_project']['global']['environment'] = 'production'
Expand Down Expand Up @@ -1057,7 +1057,7 @@
deploy['dummy_project']['appserver']['mount_point'] = '/some/mount/point'
deploy['dummy_project']['appserver']['pool_idle_time'] = 300
deploy['dummy_project']['appserver']['max_request_queue_size'] = 100
deploy['dummy_project']['appserver']['error_document'] = { "503": '503.html', "504": '504.html' }
deploy['dummy_project']['appserver']['error_document'] = { '503': '503.html', '504': '504.html' }
deploy['dummy_project']['appserver']['passenger_max_preloader_idle_time'] = 300
deploy['dummy_project']['webserver']['adapter'] = 'apache2'
deploy['dummy_project']['webserver']['port'] = 8080
Expand Down
1 change: 0 additions & 1 deletion spec/unit/recipes/deploy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@
])
end


context 'when deploy_dir is not specified' do
cached(:chef_runner) do
ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
Expand Down
3 changes: 1 addition & 2 deletions spec/unit/recipes/setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@

let(:expected_path) do
'/usr/lib/fullstaq-ruby/versions/2.6/bin:' \
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games'
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games'
end

it 'install gnupg2' do
Expand Down Expand Up @@ -604,7 +604,6 @@
end

context 'apt_repository' do

context 'debian' do
context 'when use_apache2_ppa is set to true' do
cached(:chef_runner) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
describe file('/etc/monit/conf.d/shoryuken_dummy_project.monitrc') do
its(:content) do
should include 'bundle exec shoryuken -C /srv/www/dummy_project/shared/config/shoryuken_dummy_project-1.yml ' \
'-P /run/lock/shoryuken_dummy_project-1.pid -R'
'-P /run/lock/shoryuken_dummy_project-1.pid -R'
end
its(:content) { should include 'kill -s TERM $(cat /run/lock/shoryuken_dummy_project-1.pid)' }
end
Expand Down

0 comments on commit 1a9a8f8

Please sign in to comment.