diff --git a/.gitignore b/.gitignore index 1904ffff..6afbc30c 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ node_modules/ _site docs/build/* !docs/build/.keep +vendor diff --git a/.kitchen.yml b/.kitchen.yml index 589d7c3c..7df5fe64 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -4,6 +4,7 @@ driver: provisioner: name: chef_zero + require_chef_omnibus: 12 # Uncomment the following verifier to leverage Inspec instead of Busser (the # default verifier) diff --git a/.overcommit.yml b/.overcommit.yml index b108a3dd..af56bb55 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -4,6 +4,12 @@ PreCommit: on_warn: fail # Treat all warnings as failures exclude: - test/integration/repos/**/* + AuthorEmail: + enabled: true + required: false + AuthorName: + enabled: true + required: false BrokenSymlinks: enabled: true BundleAudit: diff --git a/.ruby-version b/.ruby-version index 262714f1..55bc9834 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.4.0 +ruby-2.4.1 diff --git a/Berksfile b/Berksfile index 30c95447..b3280c65 100644 --- a/Berksfile +++ b/Berksfile @@ -1,4 +1,5 @@ # frozen_string_literal: true + source 'https://supermarket.chef.io' solver :ruby, :required diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..27dffee8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +FROM ruby:2.4.1 + +RUN printf "deb http://deb.debian.org/debian testing main\ndeb http://deb.debian.org/debian testing-updates main\ndeb http://security.debian.org testing/updates main" >> /etc/apt/sources.list +RUN apt-get update && \ + apt-get install --yes --no-install-recommends apt-transport-https=1.0.* && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* +RUN echo 'deb https://deb.nodesource.com/node_6.x jessie main' > /etc/apt/sources.list.d/nodesource.list && \ + curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ + apt-get update && \ + apt-get install --yes --target-release=stable --no-install-recommends python-pip python-yaml locales nodejs=6.* build-essential && \ + apt-get install --yes --target-release=testing --no-install-recommends git python-sphinx && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* +RUN gem update --no-document --system +RUN npm install -g conventional-changelog-cli + +RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen +RUN locale-gen +ENV LC_ALL en_US.UTF-8 + +ENV APP_HOME /app +RUN mkdir "$APP_HOME" + +RUN curl -o /tmp/chefdk.deb https://packages.chef.io/files/stable/chefdk/1.3.43/debian/8/chefdk_1.3.43-1_amd64.deb && \ + dpkg -i /tmp/chefdk.deb && \ + rm -rf /tmp/chefdk.deb + +RUN gem install bundler +RUN pip install yamllint>=1 + +WORKDIR $APP_HOME +COPY package.json $APP_HOME/ +COPY Gemfile* $APP_HOME/ +COPY Berksfile* $APP_HOME/ +COPY metadata.rb $APP_HOME/ +COPY README.md $APP_HOME/ + +RUN npm install +RUN bundle install -j 4 +RUN chef exec berks + diff --git a/Gemfile b/Gemfile index 7e3fc7f8..86493a3d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ # frozen_string_literal: true + source 'https://rubygems.org/' group :lint do @@ -15,7 +16,9 @@ end group :chef do gem 'berkshelf' - gem 'chefspec' + gem 'chef', '~> 12.0' + gem 'chef-zero', '~> 5.3' + gem 'chefspec', '~> 6.0' gem 'kitchen-docker' gem 'kitchen-vagrant' gem 'rspec' diff --git a/Gemfile.lock b/Gemfile.lock index 5f8e8691..7cdb7505 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,10 +2,10 @@ GEM remote: https://rubygems.org/ specs: addressable (2.4.0) - artifactory (2.7.0) + artifactory (2.8.1) ast (2.3.0) - backports (3.6.8) - berkshelf (5.6.3) + backports (3.7.0) + berkshelf (5.6.4) addressable (~> 2.3, >= 2.3.4) berkshelf-api-client (>= 2.0.2, < 4.0) buff-config (~> 2.0) @@ -25,7 +25,7 @@ GEM faraday (~> 0.9) httpclient (~> 2.7) ridley (>= 4.5, < 6.0) - brakeman (3.5.0) + brakeman (3.6.1) buff-config (2.0.0) buff-extensions (~> 2.0) varia_model (~> 0.6) @@ -77,7 +77,7 @@ GEM fuzzyurl mixlib-config (~> 2.0) mixlib-shellout (~> 2.0) - chef-zero (5.3.0) + chef-zero (5.3.2) ffi-yajl (~> 2.2) hashie (>= 2.0, < 4.0) mixlib-log (~> 1.3) @@ -87,7 +87,7 @@ GEM chef (>= 12.0) fauxhai (~> 3.6) rspec (~> 3.0) - childprocess (0.5.9) + childprocess (0.6.3) ffi (~> 1.0, >= 1.0.11) cleanroom (1.0.0) colorize (0.8.1) @@ -114,10 +114,10 @@ GEM ruby_parser (~> 3.7) fauxhai (3.10.0) net-ssh - ffi (1.9.17) + ffi (1.9.18) ffi-yajl (2.3.0) libyajl2 (~> 1.2) - foodcritic (9.0.0) + foodcritic (10.4.1) cucumber-core (>= 1.3) erubis nokogiri (>= 1.5, < 2.0) @@ -126,24 +126,24 @@ GEM treetop (~> 1.4) yajl-ruby (~> 1.1) fuzzyurl (0.9.0) - gh (0.15.0) + gh (0.15.1) addressable (~> 2.4.0) backports faraday (~> 0.8) multi_json (~> 1.0) net-http-persistent (~> 2.9) net-http-pipeline - gherkin (4.0.0) + gherkin (4.1.1) hashie (3.5.5) highline (1.7.8) hitimes (1.2.4) httpclient (2.8.3) iniparse (1.4.2) ipaddress (0.8.3) - json (2.0.3) + json (2.1.0) kitchen-docker (2.6.0) test-kitchen (>= 1.0.0) - kitchen-vagrant (1.0.2) + kitchen-vagrant (1.1.0) test-kitchen (~> 1.4) kramdown (1.13.2) launchy (2.4.3) @@ -169,7 +169,7 @@ GEM mixlib-log (1.7.1) mixlib-shellout (2.2.7) mixlib-versioning (1.1.0) - molinillo (0.5.6) + molinillo (0.5.7) multi_json (1.12.1) multipart-post (2.0.0) net-http-persistent (2.9.4) @@ -186,9 +186,9 @@ GEM net-ssh-gateway (>= 1.2.0) net-telnet (0.1.1) nio4r (2.0.0) - nokogiri (1.7.0.1) + nokogiri (1.7.1) mini_portile2 (~> 2.1.0) - octokit (4.6.2) + octokit (4.7.0) sawyer (~> 0.8.0, >= 0.5.3) ohai (8.23.0) chef-config (>= 12.5.0.alpha.1, < 13) @@ -202,8 +202,8 @@ GEM plist (~> 3.1) systemu (~> 2.6.4) wmi-lite (~> 1.0) - overcommit (0.38.0) - childprocess (~> 0.5.8) + overcommit (0.39.1) + childprocess (~> 0.6.3) iniparse (~> 1.4) parser (2.4.0.0) ast (~> 2.2) @@ -215,7 +215,8 @@ GEM json websocket (~> 1.0) rack (2.0.1) - rainbow (2.2.1) + rainbow (2.2.2) + rake rake (12.0.0) retryable (2.0.4) ridley (5.1.0) @@ -255,14 +256,14 @@ GEM rspec_junit_formatter (0.2.3) builder (< 4) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (0.47.1) + rubocop (0.48.1) parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.8.1) - ruby_parser (3.8.4) + ruby_parser (3.9.0) sexp_processor (~> 4.1) rufus-lru (1.1.0) safe_yaml (1.0.4) @@ -275,7 +276,7 @@ GEM rspec (~> 3.0) rspec-its specinfra (~> 2.53) - sexp_processor (4.8.0) + sexp_processor (4.9.0) sfl (2.3) simplecov (0.12.0) docile (~> 1.1.0) @@ -285,28 +286,28 @@ GEM solve (3.1.0) molinillo (>= 0.5) semverse (>= 1.1, < 3.0) - specinfra (2.67.2) + specinfra (2.67.8) net-scp net-ssh (>= 2.7, < 5.0) net-telnet sfl syslog-logger (1.6.8) systemu (2.6.5) - term-ansicolor (1.4.0) + term-ansicolor (1.6.0) tins (~> 1.0) - test-kitchen (1.15.0) + test-kitchen (1.16.0) mixlib-install (>= 1.2, < 3.0) mixlib-shellout (>= 1.2, < 3.0) net-scp (~> 1.1) net-ssh (>= 2.9, < 5.0) net-ssh-gateway (~> 1.2) safe_yaml (~> 1.0) - thor (~> 0.18) + thor (~> 0.19, < 0.19.2) thor (0.19.1) timers (4.0.4) hitimes tins (1.13.2) - travis (1.8.6) + travis (1.8.8) backports faraday (~> 0.9) faraday_middleware (~> 0.9, >= 0.9.1) @@ -319,7 +320,7 @@ GEM polyglot (~> 0.3) typhoeus (0.8.0) ethon (>= 0.8.0) - unicode-display_width (1.1.3) + unicode-display_width (1.2.1) uuidtools (2.1.5) varia_model (0.6.0) buff-extensions (~> 2.0) @@ -335,7 +336,9 @@ DEPENDENCIES berkshelf brakeman bundler-audit - chefspec + chef (~> 12.0) + chef-zero (~> 5.3) + chefspec (~> 6.0) coveralls fasterer foodcritic @@ -349,4 +352,4 @@ DEPENDENCIES travis BUNDLED WITH - 1.14.5 + 1.14.6 diff --git a/README.md b/README.md index ac75f67f..3f54298e 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,34 @@ A [chef](https://www.chef.io/) cookbook to deploy Ruby applications to Amazon Op Refer to [Getting Started](http://opsworks-ruby.readthedocs.io/en/latest/getting_started.html) guide in [documentation](http://opsworks-ruby.readthedocs.io/en/latest/index.html). +## Development + +You can either install eveyrthing locally using [rvm](https://rvm.io/) and [pip](https://pypi.python.org/pypi/pip) +or use the Docker container which includes all necessary dependencies inside it. + +### Unit Testing and Linting + +``` +docker-compose run -e SKIP="AuthorName AuthorEmail" cookbook \ +bash -c "overcommit --sign && overcommit -r && rspec" +``` + +### Integration Testing + +To run integration tests you need [Chef Development Kit](https://downloads.chef.io/chefdk). +After installing it, invoke: + +``` +chef exec bundle install -j 4 --path vendor +sudo chef exec bundle exec rake integration:docker +``` + +### Build documentation + +``` +docker-compose run cookbook bash -c "cd docs && make html" +``` + ## Contributing Please see [CONTRIBUTING](https://github.com/ajgon/opsworks_ruby/blob/master/CONTRIBUTING.md) diff --git a/RELEASING.md b/RELEASING.md index 953f66ec..0acd77c9 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -9,7 +9,8 @@ 1. Bump version in `package.json` 1. Bump version in `metadata.rb` 1. Bump version in `docs/source/config.py` -1. `conventional-changelog -p angular -i CHANGELOG.md -s` +1. `docker-compose build` +1. `docker-compose run cookbook sh -c "conventional-changelog -s -p angular -i CHANGELOG.md"` 1. Commit all the things with `chore: Version bump` 1. Tag version 1. Push: `git push origin master --tags` diff --git a/Rakefile b/Rakefile index 6ce47fd1..cd55d6a3 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'bundler/setup' desc 'Run Test Kitchen integration tests' @@ -22,4 +23,4 @@ namespace :integration do end end -task default: %w(integration:vagrant) +task default: %w[integration:vagrant] diff --git a/attributes/default.rb b/attributes/default.rb index 76cbf02b..21afd493 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -4,10 +4,10 @@ default['build-essential']['compile_time'] = true default['ruby-ng']['ruby_version'] = node['ruby'].try(:[], 'version') || '2.4' -default['nginx']['source']['modules'] = %w( +default['nginx']['source']['modules'] = %w[ nginx::http_ssl_module nginx::http_realip_module nginx::http_gzip_static_module nginx::headers_more_module nginx::http_stub_status_module -) +] default['deploy']['timeout'] = 600 @@ -21,8 +21,8 @@ 'log' => 'log' } default['defaults']['global']['create_dirs_before_symlink'] = - %w(tmp public config ../../shared/cache ../../shared/assets) -default['defaults']['global']['purge_before_symlink'] = %w(log tmp/cache tmp/pids public/system public/assets) + %w[tmp public config ../../shared/cache ../../shared/assets] +default['defaults']['global']['purge_before_symlink'] = %w[log tmp/cache tmp/pids public/system public/assets] default['defaults']['global']['rollback_on_error'] = true default['defaults']['global']['logrotate_rotate'] = 30 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..457ccb66 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +--- +version: '2' + +services: + cookbook: + build: . + volumes: + - ".:/app" diff --git a/libraries/all.rb b/libraries/all.rb index 172819f0..4e529467 100644 --- a/libraries/all.rb +++ b/libraries/all.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + libdir = File.expand_path('..', __FILE__) require File.join(libdir, 'core_ext') require File.join(libdir, 'helpers') diff --git a/libraries/core_ext.rb b/libraries/core_ext.rb index c1efa6b5..696cb4d4 100644 --- a/libraries/core_ext.rb +++ b/libraries/core_ext.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + class Object def try(*a, &b) try!(*a, &b) if a.empty? || respond_to?(a.first) diff --git a/libraries/drivers_appserver_base.rb b/libraries/drivers_appserver_base.rb index f60da6fa..2cf63c05 100644 --- a/libraries/drivers_appserver_base.rb +++ b/libraries/drivers_appserver_base.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Appserver class Base < Drivers::Base diff --git a/libraries/drivers_appserver_factory.rb b/libraries/drivers_appserver_factory.rb index 888ad3d6..afaa2718 100644 --- a/libraries/drivers_appserver_factory.rb +++ b/libraries/drivers_appserver_factory.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Appserver class Factory diff --git a/libraries/drivers_appserver_null.rb b/libraries/drivers_appserver_null.rb index 7e6e6672..d5a26ca1 100644 --- a/libraries/drivers_appserver_null.rb +++ b/libraries/drivers_appserver_null.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Appserver class Null < Drivers::Appserver::Base diff --git a/libraries/drivers_appserver_puma.rb b/libraries/drivers_appserver_puma.rb index efff8a32..d12a4566 100644 --- a/libraries/drivers_appserver_puma.rb +++ b/libraries/drivers_appserver_puma.rb @@ -1,10 +1,11 @@ # frozen_string_literal: true + module Drivers module Appserver class Puma < Drivers::Appserver::Base adapter :puma allowed_engines :puma - output filter: [:log_requests, :preload_app, :thread_max, :thread_min, :timeout, :worker_processes] + output filter: %i[log_requests preload_app thread_max thread_min timeout worker_processes] def appserver_config 'puma.rb' diff --git a/libraries/drivers_appserver_thin.rb b/libraries/drivers_appserver_thin.rb index 6f7e3274..8390cf6e 100644 --- a/libraries/drivers_appserver_thin.rb +++ b/libraries/drivers_appserver_thin.rb @@ -1,10 +1,11 @@ # frozen_string_literal: true + module Drivers module Appserver class Thin < Drivers::Appserver::Base adapter :thin allowed_engines :thin - output filter: [:max_connections, :max_persistent_connections, :timeout, :worker_processes] + output filter: %i[max_connections max_persistent_connections timeout worker_processes] def appserver_config 'thin.yml' diff --git a/libraries/drivers_appserver_unicorn.rb b/libraries/drivers_appserver_unicorn.rb index ba9a8eb5..2c799fcb 100644 --- a/libraries/drivers_appserver_unicorn.rb +++ b/libraries/drivers_appserver_unicorn.rb @@ -1,11 +1,12 @@ # frozen_string_literal: true + module Drivers module Appserver class Unicorn < Drivers::Appserver::Base adapter :unicorn allowed_engines :unicorn - output filter: [ - :backlog, :delay, :preload_app, :tcp_nodelay, :tcp_nopush, :tries, :timeout, :worker_processes + output filter: %i[ + backlog delay preload_app tcp_nodelay tcp_nopush tries timeout worker_processes ] def appserver_config diff --git a/libraries/drivers_base.rb b/libraries/drivers_base.rb index 21eba3e3..e4a244eb 100644 --- a/libraries/drivers_base.rb +++ b/libraries/drivers_base.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers class Base attr_reader :app, :options, :configuration_data_source diff --git a/libraries/drivers_db_mysql.rb b/libraries/drivers_db_mysql.rb index 6f221f99..816f50a2 100644 --- a/libraries/drivers_db_mysql.rb +++ b/libraries/drivers_db_mysql.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Db class Mysql < Base diff --git a/libraries/drivers_db_postgresql.rb b/libraries/drivers_db_postgresql.rb index eb3364b7..91464995 100644 --- a/libraries/drivers_db_postgresql.rb +++ b/libraries/drivers_db_postgresql.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Db class Postgresql < Base diff --git a/libraries/drivers_db_sqlite.rb b/libraries/drivers_db_sqlite.rb index e4d40343..fd5c1954 100644 --- a/libraries/drivers_db_sqlite.rb +++ b/libraries/drivers_db_sqlite.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Db class Sqlite < Base diff --git a/libraries/drivers_dsl_defaults.rb b/libraries/drivers_dsl_defaults.rb index 0d0ecd87..4858ade6 100644 --- a/libraries/drivers_dsl_defaults.rb +++ b/libraries/drivers_dsl_defaults.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Dsl module Defaults diff --git a/libraries/drivers_dsl_notifies.rb b/libraries/drivers_dsl_notifies.rb index c7c81e05..df7694cf 100644 --- a/libraries/drivers_dsl_notifies.rb +++ b/libraries/drivers_dsl_notifies.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Dsl module Notifies diff --git a/libraries/drivers_dsl_output.rb b/libraries/drivers_dsl_output.rb index f673c96d..f4f54368 100644 --- a/libraries/drivers_dsl_output.rb +++ b/libraries/drivers_dsl_output.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Dsl module Output diff --git a/libraries/drivers_dsl_packages.rb b/libraries/drivers_dsl_packages.rb index 9c842368..75dfc8a4 100644 --- a/libraries/drivers_dsl_packages.rb +++ b/libraries/drivers_dsl_packages.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Dsl module Packages diff --git a/libraries/drivers_framework_base.rb b/libraries/drivers_framework_base.rb index 83ffa018..7648eb71 100644 --- a/libraries/drivers_framework_base.rb +++ b/libraries/drivers_framework_base.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Framework class Base < Drivers::Base diff --git a/libraries/drivers_framework_factory.rb b/libraries/drivers_framework_factory.rb index 5c71bd13..94e1f727 100644 --- a/libraries/drivers_framework_factory.rb +++ b/libraries/drivers_framework_factory.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Framework class Factory diff --git a/libraries/drivers_framework_hanami.rb b/libraries/drivers_framework_hanami.rb index a8a764e9..e7440a21 100644 --- a/libraries/drivers_framework_hanami.rb +++ b/libraries/drivers_framework_hanami.rb @@ -1,11 +1,12 @@ # frozen_string_literal: true + module Drivers module Framework class Hanami < Drivers::Framework::Base adapter :hanami allowed_engines :hanami - output filter: [ - :migrate, :migration_command, :deploy_environment, :assets_precompile, :assets_precompilation_command + output filter: %i[ + migrate migration_command deploy_environment assets_precompile assets_precompilation_command ] def raw_out diff --git a/libraries/drivers_framework_null.rb b/libraries/drivers_framework_null.rb index e7d86a50..355a240f 100644 --- a/libraries/drivers_framework_null.rb +++ b/libraries/drivers_framework_null.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Framework class Null < Drivers::Framework::Base diff --git a/libraries/drivers_framework_padrino.rb b/libraries/drivers_framework_padrino.rb index 52061a73..d1e0c424 100644 --- a/libraries/drivers_framework_padrino.rb +++ b/libraries/drivers_framework_padrino.rb @@ -1,11 +1,12 @@ # frozen_string_literal: true + module Drivers module Framework class Padrino < Drivers::Framework::Base adapter :padrino allowed_engines :padrino - output filter: [ - :migrate, :migration_command, :deploy_environment, :assets_precompile, :assets_precompilation_command + output filter: %i[ + migrate migration_command deploy_environment assets_precompile assets_precompilation_command ] def raw_out diff --git a/libraries/drivers_framework_rails.rb b/libraries/drivers_framework_rails.rb index eccf8d70..6c154379 100644 --- a/libraries/drivers_framework_rails.rb +++ b/libraries/drivers_framework_rails.rb @@ -1,12 +1,13 @@ # frozen_string_literal: true + module Drivers module Framework class Rails < Drivers::Framework::Base adapter :rails allowed_engines :rails - output filter: [ - :migrate, :migration_command, :deploy_environment, :assets_precompile, :assets_precompilation_command, - :envs_in_console + output filter: %i[ + migrate migration_command deploy_environment assets_precompile assets_precompilation_command + envs_in_console ] packages debian: 'zlib1g-dev', rhel: 'zlib-devel' log_paths lambda { |context| diff --git a/libraries/drivers_scm_base.rb b/libraries/drivers_scm_base.rb index 447d21fd..66cc1355 100644 --- a/libraries/drivers_scm_base.rb +++ b/libraries/drivers_scm_base.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Scm class Base < Drivers::Base diff --git a/libraries/drivers_scm_factory.rb b/libraries/drivers_scm_factory.rb index 5fd012e5..10c8b43c 100644 --- a/libraries/drivers_scm_factory.rb +++ b/libraries/drivers_scm_factory.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Scm class Factory diff --git a/libraries/drivers_scm_git.rb b/libraries/drivers_scm_git.rb index f88e9001..66775a26 100644 --- a/libraries/drivers_scm_git.rb +++ b/libraries/drivers_scm_git.rb @@ -1,11 +1,12 @@ # frozen_string_literal: true + module Drivers module Scm class Git < Drivers::Scm::Base adapter Chef::Provider::Git allowed_engines :git packages :git - output filter: [:scm_provider, :repository, :revision, :enable_submodules, :ssh_wrapper, :remove_scm_files] + output filter: %i[scm_provider repository revision enable_submodules ssh_wrapper remove_scm_files] defaults enable_submodules: true, ssh_wrapper: '/tmp/ssh-git-wrapper.sh' def before_deploy diff --git a/libraries/drivers_webserver_apache2.rb b/libraries/drivers_webserver_apache2.rb index 3f6b747e..1234bb5e 100644 --- a/libraries/drivers_webserver_apache2.rb +++ b/libraries/drivers_webserver_apache2.rb @@ -1,13 +1,14 @@ # frozen_string_literal: true + module Drivers module Webserver class Apache2 < Drivers::Webserver::Base adapter :apache2 allowed_engines :apache2 - packages debian: 'apache2', rhel: %w(httpd24 mod24_ssl) - output filter: [ - :dhparams, :keepalive_timeout, :limit_request_body, :log_dir, :log_level, :proxy_timeout, - :ssl_for_legacy_browsers, :extra_config, :extra_config_ssl + packages debian: 'apache2', rhel: %w[httpd24 mod24_ssl] + output filter: %i[ + dhparams keepalive_timeout limit_request_body log_dir log_level proxy_timeout + ssl_for_legacy_browsers extra_config extra_config_ssl ] notifies :deploy, action: :restart, resource: { debian: 'service[apache2]', rhel: 'service[httpd]' }, timer: :delayed @@ -30,7 +31,7 @@ def raw_out def setup handle_packages - enable_modules(%w(expires headers lbmethod_byrequests proxy proxy_balancer proxy_http rewrite ssl)) + enable_modules(%w[expires headers lbmethod_byrequests proxy proxy_balancer proxy_http rewrite ssl]) add_sites_available_enabled define_service(:start) end diff --git a/libraries/drivers_webserver_base.rb b/libraries/drivers_webserver_base.rb index b8d341d3..c172cbf6 100644 --- a/libraries/drivers_webserver_base.rb +++ b/libraries/drivers_webserver_base.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Webserver class Base < Drivers::Base diff --git a/libraries/drivers_webserver_factory.rb b/libraries/drivers_webserver_factory.rb index 2f20086a..2393fcfa 100644 --- a/libraries/drivers_webserver_factory.rb +++ b/libraries/drivers_webserver_factory.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Webserver class Factory diff --git a/libraries/drivers_webserver_nginx.rb b/libraries/drivers_webserver_nginx.rb index ff2f8c0b..1058c237 100644 --- a/libraries/drivers_webserver_nginx.rb +++ b/libraries/drivers_webserver_nginx.rb @@ -1,13 +1,14 @@ # frozen_string_literal: true + module Drivers module Webserver class Nginx < Drivers::Webserver::Base adapter :nginx allowed_engines :nginx - output filter: [ - :build_type, :client_body_timeout, :client_header_timeout, :client_max_body_size, :dhparams, :keepalive_timeout, - :log_dir, :log_level, :proxy_read_timeout, :proxy_send_timeout, :send_timeout, :ssl_for_legacy_browsers, - :extra_config, :extra_config_ssl + output filter: %i[ + build_type client_body_timeout client_header_timeout client_max_body_size dhparams keepalive_timeout + log_dir log_level proxy_read_timeout proxy_send_timeout send_timeout ssl_for_legacy_browsers + extra_config extra_config_ssl ] notifies :deploy, action: :restart, resource: 'service[nginx]', timer: :delayed notifies :undeploy, action: :restart, resource: 'service[nginx]', timer: :delayed diff --git a/libraries/drivers_webserver_null.rb b/libraries/drivers_webserver_null.rb index 196d9f67..3cd34824 100644 --- a/libraries/drivers_webserver_null.rb +++ b/libraries/drivers_webserver_null.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Webserver class Null < Drivers::Webserver::Base diff --git a/libraries/drivers_worker_base.rb b/libraries/drivers_worker_base.rb index 24427cf0..c32eb809 100644 --- a/libraries/drivers_worker_base.rb +++ b/libraries/drivers_worker_base.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Worker class Base < Drivers::Base diff --git a/libraries/drivers_worker_delayed_job.rb b/libraries/drivers_worker_delayed_job.rb index 08c9bc59..ea60377e 100644 --- a/libraries/drivers_worker_delayed_job.rb +++ b/libraries/drivers_worker_delayed_job.rb @@ -1,10 +1,11 @@ # frozen_string_literal: true + module Drivers module Worker class DelayedJob < Drivers::Worker::Base adapter :delayed_job allowed_engines :delayed_job - output filter: [:process_count, :syslog, :queues] + output filter: %i[process_count syslog queues] packages :monit def after_deploy diff --git a/libraries/drivers_worker_factory.rb b/libraries/drivers_worker_factory.rb index 93d543d7..5ddee7f4 100644 --- a/libraries/drivers_worker_factory.rb +++ b/libraries/drivers_worker_factory.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Worker class Factory diff --git a/libraries/drivers_worker_null.rb b/libraries/drivers_worker_null.rb index 0423bf92..ec8c0b32 100644 --- a/libraries/drivers_worker_null.rb +++ b/libraries/drivers_worker_null.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Drivers module Worker class Null < Drivers::Worker::Base diff --git a/libraries/drivers_worker_resque.rb b/libraries/drivers_worker_resque.rb index e3d74b07..dece6f92 100644 --- a/libraries/drivers_worker_resque.rb +++ b/libraries/drivers_worker_resque.rb @@ -1,10 +1,11 @@ # frozen_string_literal: true + module Drivers module Worker class Resque < Drivers::Worker::Base adapter :resque allowed_engines :resque - output filter: [:process_count, :syslog, :workers, :queues] + output filter: %i[process_count syslog workers queues] packages :monit, debian: 'redis-server', rhel: 'redis' def configure diff --git a/libraries/drivers_worker_sidekiq.rb b/libraries/drivers_worker_sidekiq.rb index 3d962711..4b72d3f9 100644 --- a/libraries/drivers_worker_sidekiq.rb +++ b/libraries/drivers_worker_sidekiq.rb @@ -1,10 +1,11 @@ # frozen_string_literal: true + module Drivers module Worker class Sidekiq < Drivers::Worker::Base adapter :sidekiq allowed_engines :sidekiq - output filter: [:config, :process_count, :require, :syslog] + output filter: %i[config process_count require syslog] packages 'monit', debian: 'redis-server', rhel: 'redis' def configure diff --git a/libraries/helpers.rb b/libraries/helpers.rb index a4976aa6..3085bb84 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -100,5 +100,5 @@ def prepare_recipe def apps_not_included return [] if node['applications'].blank? - node['deploy'].keys.select { |app_name| !node['applications'].include?(app_name) } + node['deploy'].keys.reject { |app_name| node['applications'].include?(app_name) } end diff --git a/metadata.rb b/metadata.rb index 414c95ab..2b08ad1a 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + name 'opsworks_ruby' maintainer 'Igor Rzegocki' maintainer_email 'igor@rzegocki.pl' @@ -6,6 +7,7 @@ description 'Set of chef recipes for OpsWorks based Ruby projects' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '1.4.0' +chef_version '~> 12.0' if respond_to?(:chef_version) depends 'deployer' depends 'chef_nginx' diff --git a/recipes/configure.rb b/recipes/configure.rb index 7d3ea690..1d4899b0 100644 --- a/recipes/configure.rb +++ b/recipes/configure.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # # Cookbook Name:: opsworks_ruby # Recipe:: configure diff --git a/recipes/default.rb b/recipes/default.rb index fb4972af..9d5191d7 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,2 +1,3 @@ # frozen_string_literal: true + include_recipe 'opsworks_ruby::deploy' diff --git a/recipes/provision.rb b/recipes/provision.rb index f13ceed5..d18ab74d 100644 --- a/recipes/provision.rb +++ b/recipes/provision.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # Used for tests, don't touch! file '/etc/monit/conf.d/00_httpd.monitrc' do diff --git a/recipes/setup.rb b/recipes/setup.rb index a88a3f5e..91b324fb 100644 --- a/recipes/setup.rb +++ b/recipes/setup.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # # Cookbook Name:: opsworks_ruby # Recipe:: setup @@ -20,13 +21,16 @@ apt_repository 'apache2' do uri 'http://ppa.launchpad.net/ondrej/apache2/ubuntu' distribution node['lsb']['codename'] - components %w(main) + components %w[main] keyserver 'keyserver.ubuntu.com' key 'E5267A6C' only_if { node['platform'] == 'ubuntu' } end -gem_package 'bundler' +gem_package 'bundler' do + action :install +end + if node['platform_family'] == 'debian' link '/usr/local/bin/bundle' do to '/usr/bin/bundle' diff --git a/recipes/shutdown.rb b/recipes/shutdown.rb index ca55857c..28ace4cb 100644 --- a/recipes/shutdown.rb +++ b/recipes/shutdown.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # # Cookbook Name:: opsworks_ruby # Recipe:: shutdown diff --git a/spec/fixtures/aws_opsworks_app.rb b/spec/fixtures/aws_opsworks_app.rb index b47cab99..fb417f57 100644 --- a/spec/fixtures/aws_opsworks_app.rb +++ b/spec/fixtures/aws_opsworks_app.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # rubocop:disable Metrics/MethodLength def aws_opsworks_app(override = {}) item = { diff --git a/spec/fixtures/aws_opsworks_rds_db_instance.rb b/spec/fixtures/aws_opsworks_rds_db_instance.rb index c65d6c69..45f1f904 100644 --- a/spec/fixtures/aws_opsworks_rds_db_instance.rb +++ b/spec/fixtures/aws_opsworks_rds_db_instance.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # rubocop:disable Metrics/MethodLength def aws_opsworks_rds_db_instance(override = {}) item = { diff --git a/spec/fixtures/node.rb b/spec/fixtures/node.rb index e5f8b0d4..88844018 100644 --- a/spec/fixtures/node.rb +++ b/spec/fixtures/node.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # rubocop:disable Metrics/MethodLength def node(override = {}) item = { @@ -14,7 +15,7 @@ def node(override = {}) global: { environment: 'staging', create_dirs_before_symlink: %(../shared/test), - purge_before_symlink: %w(public/test), + purge_before_symlink: %w[public/test], symlinks: { 'test' => 'public/test' } }, # database: { @@ -73,8 +74,8 @@ def node(override = {}) pids: 'tmp/pids', log: 'log' }, - create_dirs_before_symlink: %w(tmp public config ../../shared/cache ../../shared/assets), - purge_before_symlink: %w(log tmp/cache tmp/pids public/system public/assets) + create_dirs_before_symlink: %w[tmp public config ../../shared/cache ../../shared/assets], + purge_before_symlink: %w[log tmp/cache tmp/pids public/system public/assets] }, scm: { remove_scm_files: true diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1cdbbeec..df379fc6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'chefspec' require 'chefspec/berkshelf' diff --git a/spec/unit/examples/db_parameters_and_connection.rb b/spec/unit/examples/db_parameters_and_connection.rb index b565c718..ed2d0fe7 100644 --- a/spec/unit/examples/db_parameters_and_connection.rb +++ b/spec/unit/examples/db_parameters_and_connection.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + RSpec.shared_examples 'db parameters and connection' do |rdbms, options = {}| it 'receives and exposes app, node and database bag' do driver = described_class.new( diff --git a/spec/unit/examples/db_validate_adapter_and_engine.rb b/spec/unit/examples/db_validate_adapter_and_engine.rb index fe5f517a..e73c6884 100644 --- a/spec/unit/examples/db_validate_adapter_and_engine.rb +++ b/spec/unit/examples/db_validate_adapter_and_engine.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + RSpec.shared_examples 'db validate adapter and engine' do |rdbms| context "#{rdbms}: validate adapter and engine" do it 'adapter = missing, engine = missing' do diff --git a/spec/unit/libraries/core_ext_spec.rb b/spec/unit/libraries/core_ext_spec.rb index 6f50a7a6..df5dd9a1 100644 --- a/spec/unit/libraries/core_ext_spec.rb +++ b/spec/unit/libraries/core_ext_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe 'Core extensions' do diff --git a/spec/unit/libraries/drivers_appserver_factory_spec.rb b/spec/unit/libraries/drivers_appserver_factory_spec.rb index 99fa4195..9d9d9852 100644 --- a/spec/unit/libraries/drivers_appserver_factory_spec.rb +++ b/spec/unit/libraries/drivers_appserver_factory_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Appserver::Factory do diff --git a/spec/unit/libraries/drivers_appserver_null_spec.rb b/spec/unit/libraries/drivers_appserver_null_spec.rb index 5b669a82..e01cfd1b 100644 --- a/spec/unit/libraries/drivers_appserver_null_spec.rb +++ b/spec/unit/libraries/drivers_appserver_null_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Appserver::Null do diff --git a/spec/unit/libraries/drivers_appserver_puma_spec.rb b/spec/unit/libraries/drivers_appserver_puma_spec.rb index 4d674b09..2afb50e5 100644 --- a/spec/unit/libraries/drivers_appserver_puma_spec.rb +++ b/spec/unit/libraries/drivers_appserver_puma_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Appserver::Puma do diff --git a/spec/unit/libraries/drivers_appserver_thin_spec.rb b/spec/unit/libraries/drivers_appserver_thin_spec.rb index 987b069f..8d7e10e1 100644 --- a/spec/unit/libraries/drivers_appserver_thin_spec.rb +++ b/spec/unit/libraries/drivers_appserver_thin_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Appserver::Thin do diff --git a/spec/unit/libraries/drivers_appserver_unicorn_spec.rb b/spec/unit/libraries/drivers_appserver_unicorn_spec.rb index e84fa373..02339bfd 100644 --- a/spec/unit/libraries/drivers_appserver_unicorn_spec.rb +++ b/spec/unit/libraries/drivers_appserver_unicorn_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Appserver::Unicorn do diff --git a/spec/unit/libraries/drivers_db_factory_spec.rb b/spec/unit/libraries/drivers_db_factory_spec.rb index d43e14e2..9a26ff33 100644 --- a/spec/unit/libraries/drivers_db_factory_spec.rb +++ b/spec/unit/libraries/drivers_db_factory_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Db::Factory do diff --git a/spec/unit/libraries/drivers_db_mysql_spec.rb b/spec/unit/libraries/drivers_db_mysql_spec.rb index aabe4ac2..0f0b5e13 100644 --- a/spec/unit/libraries/drivers_db_mysql_spec.rb +++ b/spec/unit/libraries/drivers_db_mysql_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' require 'unit/examples/db_validate_adapter_and_engine' require 'unit/examples/db_parameters_and_connection' diff --git a/spec/unit/libraries/drivers_db_postgresql_spec.rb b/spec/unit/libraries/drivers_db_postgresql_spec.rb index 2bc75520..1e3d75a9 100644 --- a/spec/unit/libraries/drivers_db_postgresql_spec.rb +++ b/spec/unit/libraries/drivers_db_postgresql_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' require 'unit/examples/db_validate_adapter_and_engine' require 'unit/examples/db_parameters_and_connection' diff --git a/spec/unit/libraries/drivers_framework_factory_spec.rb b/spec/unit/libraries/drivers_framework_factory_spec.rb index 4b63844a..4a75f93e 100644 --- a/spec/unit/libraries/drivers_framework_factory_spec.rb +++ b/spec/unit/libraries/drivers_framework_factory_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Framework::Factory do diff --git a/spec/unit/libraries/drivers_framework_hanami_spec.rb b/spec/unit/libraries/drivers_framework_hanami_spec.rb index e1f3b173..689fedab 100644 --- a/spec/unit/libraries/drivers_framework_hanami_spec.rb +++ b/spec/unit/libraries/drivers_framework_hanami_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Framework::Hanami do diff --git a/spec/unit/libraries/drivers_framework_null_spec.rb b/spec/unit/libraries/drivers_framework_null_spec.rb index e9c15537..77b0ac51 100644 --- a/spec/unit/libraries/drivers_framework_null_spec.rb +++ b/spec/unit/libraries/drivers_framework_null_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Framework::Null do diff --git a/spec/unit/libraries/drivers_framework_padrino_spec.rb b/spec/unit/libraries/drivers_framework_padrino_spec.rb index 57375b35..195bf872 100644 --- a/spec/unit/libraries/drivers_framework_padrino_spec.rb +++ b/spec/unit/libraries/drivers_framework_padrino_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Framework::Padrino do diff --git a/spec/unit/libraries/drivers_framework_rails_spec.rb b/spec/unit/libraries/drivers_framework_rails_spec.rb index d28f1d38..5c4e46df 100644 --- a/spec/unit/libraries/drivers_framework_rails_spec.rb +++ b/spec/unit/libraries/drivers_framework_rails_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Framework::Rails do diff --git a/spec/unit/libraries/drivers_scm_factory_spec.rb b/spec/unit/libraries/drivers_scm_factory_spec.rb index 55ce7e81..7ef8b837 100644 --- a/spec/unit/libraries/drivers_scm_factory_spec.rb +++ b/spec/unit/libraries/drivers_scm_factory_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Scm::Factory do diff --git a/spec/unit/libraries/drivers_scm_git_spec.rb b/spec/unit/libraries/drivers_scm_git_spec.rb index e995ec2d..1bc1e89c 100644 --- a/spec/unit/libraries/drivers_scm_git_spec.rb +++ b/spec/unit/libraries/drivers_scm_git_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Scm::Git do diff --git a/spec/unit/libraries/drivers_webserver_apache2_spec.rb b/spec/unit/libraries/drivers_webserver_apache2_spec.rb index 18abad0c..92958512 100644 --- a/spec/unit/libraries/drivers_webserver_apache2_spec.rb +++ b/spec/unit/libraries/drivers_webserver_apache2_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Webserver::Apache2 do diff --git a/spec/unit/libraries/drivers_webserver_factory_spec.rb b/spec/unit/libraries/drivers_webserver_factory_spec.rb index 5254b2fa..20b9ffb7 100644 --- a/spec/unit/libraries/drivers_webserver_factory_spec.rb +++ b/spec/unit/libraries/drivers_webserver_factory_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Webserver::Factory do diff --git a/spec/unit/libraries/drivers_webserver_nginx_spec.rb b/spec/unit/libraries/drivers_webserver_nginx_spec.rb index 07a0d959..e8422da5 100644 --- a/spec/unit/libraries/drivers_webserver_nginx_spec.rb +++ b/spec/unit/libraries/drivers_webserver_nginx_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Webserver::Nginx do diff --git a/spec/unit/libraries/drivers_webserver_null_spec.rb b/spec/unit/libraries/drivers_webserver_null_spec.rb index 6ef117eb..670b451d 100644 --- a/spec/unit/libraries/drivers_webserver_null_spec.rb +++ b/spec/unit/libraries/drivers_webserver_null_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Webserver::Null do diff --git a/spec/unit/libraries/drivers_worker_delayed_job_spec.rb b/spec/unit/libraries/drivers_worker_delayed_job_spec.rb index 6ddb54fe..c22f23cb 100644 --- a/spec/unit/libraries/drivers_worker_delayed_job_spec.rb +++ b/spec/unit/libraries/drivers_worker_delayed_job_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Worker::DelayedJob do diff --git a/spec/unit/libraries/drivers_worker_factory_spec.rb b/spec/unit/libraries/drivers_worker_factory_spec.rb index d9209f8a..a49b96f7 100644 --- a/spec/unit/libraries/drivers_worker_factory_spec.rb +++ b/spec/unit/libraries/drivers_worker_factory_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Worker::Factory do diff --git a/spec/unit/libraries/drivers_worker_null_spec.rb b/spec/unit/libraries/drivers_worker_null_spec.rb index 4c4156df..6ce72082 100644 --- a/spec/unit/libraries/drivers_worker_null_spec.rb +++ b/spec/unit/libraries/drivers_worker_null_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Worker::Null do diff --git a/spec/unit/libraries/drivers_worker_resque_spec.rb b/spec/unit/libraries/drivers_worker_resque_spec.rb index ec6704dc..941fe957 100644 --- a/spec/unit/libraries/drivers_worker_resque_spec.rb +++ b/spec/unit/libraries/drivers_worker_resque_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Worker::Resque do diff --git a/spec/unit/libraries/drivers_worker_sidekiq_spec.rb b/spec/unit/libraries/drivers_worker_sidekiq_spec.rb index 4fc85967..712466a9 100644 --- a/spec/unit/libraries/drivers_worker_sidekiq_spec.rb +++ b/spec/unit/libraries/drivers_worker_sidekiq_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Drivers::Worker::Sidekiq do diff --git a/spec/unit/recipes/configure_spec.rb b/spec/unit/recipes/configure_spec.rb index 29604026..9927f258 100644 --- a/spec/unit/recipes/configure_spec.rb +++ b/spec/unit/recipes/configure_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # # Cookbook Name:: opsworks_ruby # Spec:: configure diff --git a/spec/unit/recipes/deploy_spec.rb b/spec/unit/recipes/deploy_spec.rb index 5de7bdca..30e7bd24 100644 --- a/spec/unit/recipes/deploy_spec.rb +++ b/spec/unit/recipes/deploy_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # # Cookbook Name:: opsworks_ruby # Spec:: deploy @@ -93,8 +94,8 @@ 'log' => 'log', 'test' => 'public/test' }, - 'create_dirs_before_symlink' => %w(tmp public config ../../shared/cache ../../shared/assets ../shared/test), - 'purge_before_symlink' => %w(log tmp/cache tmp/pids public/system public/assets public/test) + 'create_dirs_before_symlink' => %w[tmp public config ../../shared/cache ../../shared/assets ../shared/test], + 'purge_before_symlink' => %w[log tmp/cache tmp/pids public/system public/assets public/test] ) expect(chef_run).to run_execute('stop unicorn') @@ -204,7 +205,7 @@ chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node| solo_node.set['lsb'] = node['lsb'] solo_node.set['deploy'] = { 'a1' => {}, 'a2' => {}, 'a3' => {} } - solo_node.set['applications'] = %w(a1 a2) + solo_node.set['applications'] = %w[a1 a2] end.converge(described_recipe) service = chef_run.service('puma_a1') diff --git a/spec/unit/recipes/setup_spec.rb b/spec/unit/recipes/setup_spec.rb index 2491545b..282138fe 100644 --- a/spec/unit/recipes/setup_spec.rb +++ b/spec/unit/recipes/setup_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # # Cookbook Name:: opsworks_ruby # Spec:: default diff --git a/spec/unit/recipes/shutdown_spec.rb b/spec/unit/recipes/shutdown_spec.rb index 50d78df8..74f6ecfb 100644 --- a/spec/unit/recipes/shutdown_spec.rb +++ b/spec/unit/recipes/shutdown_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # # Cookbook Name:: opsworks_ruby # Spec:: shutdown diff --git a/spec/unit/recipes/undeploy_spec.rb b/spec/unit/recipes/undeploy_spec.rb index da014721..83dedb5d 100644 --- a/spec/unit/recipes/undeploy_spec.rb +++ b/spec/unit/recipes/undeploy_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # # Cookbook Name:: opsworks_ruby # Spec:: undeploy diff --git a/test/integration/all_options/serverspec/all_options_spec.rb b/test/integration/all_options/serverspec/all_options_spec.rb index fa63ede3..ff4907d5 100644 --- a/test/integration/all_options/serverspec/all_options_spec.rb +++ b/test/integration/all_options/serverspec/all_options_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe 'opsworks_ruby::setup' do diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb index 52d57d72..9e80a711 100644 --- a/test/integration/default/serverspec/default_spec.rb +++ b/test/integration/default/serverspec/default_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe 'opsworks_ruby::setup' do diff --git a/test/integration/helpers/serverspec/spec_helper.rb b/test/integration/helpers/serverspec/spec_helper.rb index a536a0d7..0af9df37 100644 --- a/test/integration/helpers/serverspec/spec_helper.rb +++ b/test/integration/helpers/serverspec/spec_helper.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'serverspec' if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM).nil? diff --git a/test/integration/nullified/serverspec/nullified_spec.rb b/test/integration/nullified/serverspec/nullified_spec.rb index 3dde1521..08dd16fd 100644 --- a/test/integration/nullified/serverspec/nullified_spec.rb +++ b/test/integration/nullified/serverspec/nullified_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe 'opsworks_ruby::setup' do diff --git a/test/integration/thin_nginx_padrino_delayed_job/serverspec/thin_nginx_padrino_delayed_job_spec.rb b/test/integration/thin_nginx_padrino_delayed_job/serverspec/thin_nginx_padrino_delayed_job_spec.rb index 5639c88c..e5c44653 100644 --- a/test/integration/thin_nginx_padrino_delayed_job/serverspec/thin_nginx_padrino_delayed_job_spec.rb +++ b/test/integration/thin_nginx_padrino_delayed_job/serverspec/thin_nginx_padrino_delayed_job_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe 'opsworks_ruby::setup' do diff --git a/test/integration/unicorn_apache_hanami_resque/serverspec/unicorn_apache_hanami_resque_spec.rb b/test/integration/unicorn_apache_hanami_resque/serverspec/unicorn_apache_hanami_resque_spec.rb index 5ea7a0a5..7ac6671e 100644 --- a/test/integration/unicorn_apache_hanami_resque/serverspec/unicorn_apache_hanami_resque_spec.rb +++ b/test/integration/unicorn_apache_hanami_resque/serverspec/unicorn_apache_hanami_resque_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe 'opsworks_ruby::setup' do