From 5870fe8d3ff201d02e4347226d5210acb91c138d Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Tue, 11 Dec 2018 10:00:44 +0100 Subject: [PATCH 01/33] Depend on hanami gems at develop branch --- Gemfile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index 8b46ed51..cce90a2c 100644 --- a/Gemfile +++ b/Gemfile @@ -8,16 +8,16 @@ end gem 'i18n' -gem 'hanami-utils', '~> 1.3', require: false, git: 'https://github.com/hanami/utils.git', branch: 'master' -gem 'hanami-validations', '~> 1.3', require: false, git: 'https://github.com/hanami/validations.git', branch: 'master' -gem 'hanami-router', '~> 1.3', require: false, git: 'https://github.com/hanami/router.git', branch: 'master' -gem 'hanami-controller', '~> 1.3', require: false, git: 'https://github.com/hanami/controller.git', branch: 'master' -gem 'hanami-view', '~> 1.3', require: false, git: 'https://github.com/hanami/view.git', branch: 'master' -gem 'hanami-model', '~> 1.3', require: false, git: 'https://github.com/hanami/model.git', branch: 'master' -gem 'hanami-helpers', '~> 1.3', require: false, git: 'https://github.com/hanami/helpers.git', branch: 'master' -gem 'hanami-mailer', '~> 1.3', require: false, git: 'https://github.com/hanami/mailer.git', branch: 'master' -gem 'hanami-assets', '~> 1.3', require: false, git: 'https://github.com/hanami/assets.git', branch: 'master' -gem 'hanami-cli', '~> 0.3', require: false, git: 'https://github.com/hanami/cli.git', branch: 'master' +gem 'hanami-utils', '~> 1.3', require: false, git: 'https://github.com/hanami/utils.git', branch: 'develop' +gem 'hanami-validations', '~> 1.3', require: false, git: 'https://github.com/hanami/validations.git', branch: 'develop' +gem 'hanami-router', '~> 1.3', require: false, git: 'https://github.com/hanami/router.git', branch: 'develop' +gem 'hanami-controller', '~> 1.3', require: false, git: 'https://github.com/hanami/controller.git', branch: 'develop' +gem 'hanami-view', '~> 1.3', require: false, git: 'https://github.com/hanami/view.git', branch: 'develop' +gem 'hanami-model', '~> 1.3', require: false, git: 'https://github.com/hanami/model.git', branch: 'develop' +gem 'hanami-helpers', '~> 1.3', require: false, git: 'https://github.com/hanami/helpers.git', branch: 'develop' +gem 'hanami-mailer', '~> 1.3', require: false, git: 'https://github.com/hanami/mailer.git', branch: 'develop' +gem 'hanami-assets', '~> 1.3', require: false, git: 'https://github.com/hanami/assets.git', branch: 'develop' +gem 'hanami-cli', '~> 0.3', require: false, git: 'https://github.com/hanami/cli.git', branch: 'develop' platforms :ruby do gem 'sqlite3' From b5db9a62718e49c7a9e5fb73741ce689e3bf1cec Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Mon, 7 Jan 2019 22:16:07 +0100 Subject: [PATCH 02/33] Ruby 2.6 (#978) --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 1445b230..afe27da6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ rvm: - 2.3.8 - 2.4.5 - 2.5.3 + - 2.6.0 notifications: webhooks: From 1674739c7dea0af0008b3658a4f1c24fa2a25d55 Mon Sep 17 00:00:00 2001 From: Aidan Coyle Date: Wed, 9 Jan 2019 04:35:46 -0600 Subject: [PATCH 03/33] Remove force_ssl from new app templates (#974) --- lib/hanami/cli/commands/generate/app/application.erb | 5 ----- spec/integration/cli/new_spec.rb | 5 ----- spec/integration/security/force_ssl_spec.rb | 2 +- spec/support/shared_examples/cli/generate/app.rb | 5 ----- 4 files changed, 1 insertion(+), 16 deletions(-) diff --git a/lib/hanami/cli/commands/generate/app/application.erb b/lib/hanami/cli/commands/generate/app/application.erb index 32a02b46..49678529 100644 --- a/lib/hanami/cli/commands/generate/app/application.erb +++ b/lib/hanami/cli/commands/generate/app/application.erb @@ -105,11 +105,6 @@ module <%= app.classify %> # # body_parsers :json - # When it's true and the router receives a non-encrypted request (http), - # it redirects to the secure equivalent (https). Disabled by default. - # - # force_ssl true - ## # TEMPLATES # diff --git a/spec/integration/cli/new_spec.rb b/spec/integration/cli/new_spec.rb index ea81ea08..0b99ae5d 100644 --- a/spec/integration/cli/new_spec.rb +++ b/spec/integration/cli/new_spec.rb @@ -566,11 +566,6 @@ module Web # # body_parsers :json - # When it's true and the router receives a non-encrypted request (http), - # it redirects to the secure equivalent (https). Disabled by default. - # - # force_ssl true - ## # TEMPLATES # diff --git a/spec/integration/security/force_ssl_spec.rb b/spec/integration/security/force_ssl_spec.rb index e378be1e..32890cea 100644 --- a/spec/integration/security/force_ssl_spec.rb +++ b/spec/integration/security/force_ssl_spec.rb @@ -5,7 +5,7 @@ RSpec.describe "force SSL", type: :integration do with_project(project, server: :puma) do generate "action web home#index --url=/" - replace "apps/web/application.rb", "# force_ssl true", "force_ssl true" + inject_line_after "apps/web/application.rb", "configure do", "force_ssl true" RSpec::Support::Env['HANAMI_ENV'] = 'production' RSpec::Support::Env['DATABASE_URL'] = "sqlite://#{Pathname.new('db').join('bookshelf.sqlite')}" diff --git a/spec/support/shared_examples/cli/generate/app.rb b/spec/support/shared_examples/cli/generate/app.rb index adb9d6b0..f07b1a68 100644 --- a/spec/support/shared_examples/cli/generate/app.rb +++ b/spec/support/shared_examples/cli/generate/app.rb @@ -141,11 +141,6 @@ module #{app_name} # # body_parsers :json - # When it's true and the router receives a non-encrypted request (http), - # it redirects to the secure equivalent (https). Disabled by default. - # - # force_ssl true - ## # TEMPLATES # From 6ba63110d2aee1952a83736757486faf51220833 Mon Sep 17 00:00:00 2001 From: Alessandro Caporrini Date: Mon, 14 Jan 2019 15:05:03 +0100 Subject: [PATCH 04/33] Don't generate apps with deprecated `body_parsers` setting (#977) --- lib/hanami/cli/commands/generate/app/application.erb | 8 -------- spec/integration/body_parsers_spec.rb | 2 +- spec/integration/cli/new_spec.rb | 8 -------- spec/support/shared_examples/cli/generate/app.rb | 8 -------- 4 files changed, 1 insertion(+), 25 deletions(-) diff --git a/lib/hanami/cli/commands/generate/app/application.erb b/lib/hanami/cli/commands/generate/app/application.erb index 49678529..50ed477a 100644 --- a/lib/hanami/cli/commands/generate/app/application.erb +++ b/lib/hanami/cli/commands/generate/app/application.erb @@ -97,14 +97,6 @@ module <%= app.classify %> # # default_response_format :html - # HTTP Body parsers - # Parse non GET responses body for a specific mime type - # Argument: Symbol, which represent the format of the mime type - # (only `:json` is supported) - # Object, the parser - # - # body_parsers :json - ## # TEMPLATES # diff --git a/spec/integration/body_parsers_spec.rb b/spec/integration/body_parsers_spec.rb index b5f549e2..96f47c26 100644 --- a/spec/integration/body_parsers_spec.rb +++ b/spec/integration/body_parsers_spec.rb @@ -43,6 +43,6 @@ EOF end def enable_json_body_parser - replace "apps/web/application.rb", "# body_parsers :json", "body_parsers :json" + inject_line_after "apps/web/application.rb", "configure do", "body_parsers :json" end end diff --git a/spec/integration/cli/new_spec.rb b/spec/integration/cli/new_spec.rb index 0b99ae5d..14714c93 100644 --- a/spec/integration/cli/new_spec.rb +++ b/spec/integration/cli/new_spec.rb @@ -558,14 +558,6 @@ module Web # # default_response_format :html - # HTTP Body parsers - # Parse non GET responses body for a specific mime type - # Argument: Symbol, which represent the format of the mime type - # (only `:json` is supported) - # Object, the parser - # - # body_parsers :json - ## # TEMPLATES # diff --git a/spec/support/shared_examples/cli/generate/app.rb b/spec/support/shared_examples/cli/generate/app.rb index f07b1a68..850d476e 100644 --- a/spec/support/shared_examples/cli/generate/app.rb +++ b/spec/support/shared_examples/cli/generate/app.rb @@ -133,14 +133,6 @@ module #{app_name} # # default_response_format :html - # HTTP Body parsers - # Parse non GET responses body for a specific mime type - # Argument: Symbol, which represent the format of the mime type - # (only `:json` is supported) - # Object, the parser - # - # body_parsers :json - ## # TEMPLATES # From f145548be4df1416d19a080cc9018bbb7e30eb69 Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Tue, 15 Jan 2019 10:19:57 +0100 Subject: [PATCH 05/33] Prepare for v1.3.1 --- CHANGELOG.md | 10 ++++++++++ hanami.gemspec | 2 +- lib/hanami/version.rb | 2 +- spec/unit/version_spec.rb | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c97f17d..9846b007 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ # Hanami The web, with simplicity. +## v1.3.1 - 2019-01-17 +### Added +- [Luca Guidi] Official support for Ruby: MRI 2.6 +- [Luca Guidi] Support `bundler` 2.0+ + +### Fixed +- [Aidan Coyle] Remove from app generator support for deprecated `force_ssl` setting +- [Alessandro Caporrini] Remove from app generator support for deprecated `body_parsers` setting +- [Daphne Rouw & Sean Collins] Make app generator to work when code in `config/enviroment.rb` uses double quotes + ## v1.3.0 - 2018-10-24 ### Added - [Luca Guidi] Automatically log body payload from body parsers diff --git a/hanami.gemspec b/hanami.gemspec index b8fc350b..ca1edd6a 100644 --- a/hanami.gemspec +++ b/hanami.gemspec @@ -31,7 +31,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'hanami-assets', '~> 1.3' spec.add_dependency 'hanami-cli', '~> 0.3' spec.add_dependency 'concurrent-ruby', '~> 1.0' - spec.add_dependency 'bundler' + spec.add_dependency 'bundler', '>= 1.6', '< 3' spec.add_development_dependency 'rspec', '~> 3.7' spec.add_development_dependency 'rack-test', '~> 1.1' diff --git a/lib/hanami/version.rb b/lib/hanami/version.rb index 7748eadf..0bbd6326 100644 --- a/lib/hanami/version.rb +++ b/lib/hanami/version.rb @@ -6,7 +6,7 @@ module Hanami module Version # @since 0.9.0 # @api private - VERSION = '1.3.0'.freeze + VERSION = '1.3.1'.freeze # @since 0.9.0 # @api private diff --git a/spec/unit/version_spec.rb b/spec/unit/version_spec.rb index 2b6dac91..cd1ea7bf 100644 --- a/spec/unit/version_spec.rb +++ b/spec/unit/version_spec.rb @@ -1,5 +1,5 @@ RSpec.describe "Hanami::VERSION" do it "returns current version" do - expect(Hanami::VERSION).to eq("1.3.0") + expect(Hanami::VERSION).to eq("1.3.1") end end From 0fdaf4683433375e01d5b6a9b59aea5bfa363ae9 Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Fri, 18 Jan 2019 16:19:01 +0100 Subject: [PATCH 06/33] CHANGELOG [ci skip] --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9846b007..9a7f5caf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Hanami The web, with simplicity. -## v1.3.1 - 2019-01-17 +## v1.3.1 - 2019-01-18 ### Added - [Luca Guidi] Official support for Ruby: MRI 2.6 - [Luca Guidi] Support `bundler` 2.0+ From 43e1bce35c7aebf37323028c0c1d14f697588d73 Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Fri, 18 Jan 2019 18:39:11 +0100 Subject: [PATCH 07/33] FEATURES [ci skip] --- FEATURES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FEATURES.md b/FEATURES.md index 849462c0..1212ca5c 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -3,6 +3,8 @@ ## Features +## v1.3.1 - 2019-01-18 + ## v1.3.0 - 2018-10-24 - Default testing framework is RSpec From 8d0ae2e5ed2bc06964ed0b5bdc95c2908b814fde Mon Sep 17 00:00:00 2001 From: Sharipov Ruslan Date: Thu, 24 Jan 2019 20:31:30 +0600 Subject: [PATCH 08/33] Fix broken 404 links to guides.hanamirb.org (#981) --- lib/hanami.rb | 2 +- .../cli/commands/generate/app/application.erb | 10 +++++----- .../cli/commands/generate/app/routes.erb | 2 +- lib/hanami/cli/commands/new/Gemfile.erb | 2 +- lib/hanami/cli/commands/new/README.md.erb | 2 +- .../cli/commands/new/config/environment.erb | 4 ++-- lib/hanami/configuration.rb | 4 ++-- lib/hanami/routes.rb | 2 +- spec/integration/cli/new_spec.rb | 20 +++++++++---------- .../shared_examples/cli/generate/app.rb | 16 +++++++-------- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/hanami.rb b/lib/hanami.rb index 9390d03d..49578737 100644 --- a/lib/hanami.rb +++ b/lib/hanami.rb @@ -264,7 +264,7 @@ module Hanami # @since 1.0.0 # @api private # - # @see http://hanamirb.org/guides/projects/code-reloading/ + # @see https://guides.hanamirb.org/projects/code-reloading def self.code_reloading? environment Components.resolve('code_reloading') diff --git a/lib/hanami/cli/commands/generate/app/application.erb b/lib/hanami/cli/commands/generate/app/application.erb index 50ed477a..0f5a278b 100644 --- a/lib/hanami/cli/commands/generate/app/application.erb +++ b/lib/hanami/cli/commands/generate/app/application.erb @@ -122,7 +122,7 @@ module <%= app.classify %> # * :yui # * :closure # - # See: http://hanamirb.org/guides/assets/compressors + # See: https://guides.hanamirb.org/assets/compressors # # In order to skip JavaScript compression comment the following line javascript_compressor :builtin @@ -135,7 +135,7 @@ module <%= app.classify %> # * :yui # * :sass # - # See: http://hanamirb.org/guides/assets/compressors + # See: https://guides.hanamirb.org/assets/compressors # # In order to skip stylesheet compression comment the following line stylesheet_compressor :builtin @@ -292,12 +292,12 @@ module <%= app.classify %> # Use fingerprint file name for asset paths # - # See: http://hanamirb.org/guides/assets/overview + # See: https://guides.hanamirb.org/assets/overview fingerprint true # Content Delivery Network (CDN) # - # See: http://hanamirb.org/guides/assets/content-delivery-network + # See: https://guides.hanamirb.org/assets/content-delivery-network # # scheme 'https' # host 'cdn.example.org' @@ -305,7 +305,7 @@ module <%= app.classify %> # Subresource Integrity # - # See: http://hanamirb.org/guides/assets/content-delivery-network/#subresource-integrity + # See: https://guides.hanamirb.org/assets/content-delivery-network/#subresource-integrity subresource_integrity :sha256 end end diff --git a/lib/hanami/cli/commands/generate/app/routes.erb b/lib/hanami/cli/commands/generate/app/routes.erb index 4ccedc9d..d690afd5 100644 --- a/lib/hanami/cli/commands/generate/app/routes.erb +++ b/lib/hanami/cli/commands/generate/app/routes.erb @@ -1,5 +1,5 @@ # Configure your routes here -# See: http://hanamirb.org/guides/routing/overview/ +# See: https://guides.hanamirb.org/routing/overview # # Example: # get '/hello', to: ->(env) { [200, {}, ['Hello from Hanami!']] } diff --git a/lib/hanami/cli/commands/new/Gemfile.erb b/lib/hanami/cli/commands/new/Gemfile.erb index 2b42dc23..d32a2cfa 100644 --- a/lib/hanami/cli/commands/new/Gemfile.erb +++ b/lib/hanami/cli/commands/new/Gemfile.erb @@ -34,7 +34,7 @@ gem 'haml' <%- if code_reloading -%> group :development do # Code reloading - # See: http://hanamirb.org/guides/projects/code-reloading + # See: https://guides.hanamirb.org/projects/code-reloading gem 'shotgun', platforms: :ruby gem 'hanami-webconsole' end diff --git a/lib/hanami/cli/commands/new/README.md.erb b/lib/hanami/cli/commands/new/README.md.erb index 6a98a387..69f20284 100644 --- a/lib/hanami/cli/commands/new/README.md.erb +++ b/lib/hanami/cli/commands/new/README.md.erb @@ -30,4 +30,4 @@ How to prepare (create and migrate) DB for `development` and `test` environments % HANAMI_ENV=test bundle exec hanami db prepare ``` -Explore Hanami [guides](http://hanamirb.org/guides/), [API docs](http://docs.hanamirb.org/<%= Hanami::VERSION %>/), or jump in [chat](http://chat.hanamirb.org) for help. Enjoy! 🌸 +Explore Hanami [guides](https://guides.hanamirb.org/), [API docs](http://docs.hanamirb.org/<%= Hanami::VERSION %>/), or jump in [chat](http://chat.hanamirb.org) for help. Enjoy! 🌸 diff --git a/lib/hanami/cli/commands/new/config/environment.erb b/lib/hanami/cli/commands/new/config/environment.erb index 7c40043c..3a0f933a 100644 --- a/lib/hanami/cli/commands/new/config/environment.erb +++ b/lib/hanami/cli/commands/new/config/environment.erb @@ -30,12 +30,12 @@ Hanami.configure do mailer do root 'lib/<%= project %>/mailers' - # See http://hanamirb.org/guides/mailers/delivery + # See https://guides.hanamirb.org/mailers/delivery delivery :test end environment :development do - # See: http://hanamirb.org/guides/projects/logging + # See: https://guides.hanamirb.org/projects/logging logger level: :debug end diff --git a/lib/hanami/configuration.rb b/lib/hanami/configuration.rb index d1e907d4..400f9c4a 100644 --- a/lib/hanami/configuration.rb +++ b/lib/hanami/configuration.rb @@ -75,7 +75,7 @@ module Hanami # mailer do # root 'lib/bookshelf/mailers' # - # # See http://hanamirb.org/guides/mailers/delivery + # # See https://guides.hanamirb.org/mailers/delivery # delivery :test # end # @@ -151,7 +151,7 @@ module Hanami # @see Hanami.logger # @see Hanami::Logger # - # @see http://hanamirb.org/guides/projects/logging/ + # @see https://guides.hanamirb.org/projects/logging # # @example Basic Usage # # config/environment.rb diff --git a/lib/hanami/routes.rb b/lib/hanami/routes.rb index eec18e56..61c4da1f 100644 --- a/lib/hanami/routes.rb +++ b/lib/hanami/routes.rb @@ -147,7 +147,7 @@ module Hanami # # @since 0.8.0 # - # @see http://hanamirb.org/guides/routing/testing + # @see https://guides.hanamirb.org/routing/testing # # @example Path Generation # # spec/web/routes_spec.rb diff --git a/spec/integration/cli/new_spec.rb b/spec/integration/cli/new_spec.rb index 14714c93..044ffcba 100644 --- a/spec/integration/cli/new_spec.rb +++ b/spec/integration/cli/new_spec.rb @@ -115,7 +115,7 @@ How to prepare (create and migrate) DB for `development` and `test` environments % HANAMI_ENV=test bundle exec hanami db prepare ``` -Explore Hanami [guides](http://hanamirb.org/guides/), [API docs](http://docs.hanamirb.org/#{Hanami::VERSION}/), or jump in [chat](http://chat.hanamirb.org) for help. Enjoy! 🌸 +Explore Hanami [guides](https://guides.hanamirb.org/), [API docs](http://docs.hanamirb.org/#{Hanami::VERSION}/), or jump in [chat](http://chat.hanamirb.org) for help. Enjoy! 🌸 END # @@ -133,7 +133,7 @@ gem 'sqlite3' group :development do # Code reloading - # See: http://hanamirb.org/guides/projects/code-reloading + # See: https://guides.hanamirb.org/projects/code-reloading gem 'shotgun', platforms: :ruby gem 'hanami-webconsole' end @@ -231,12 +231,12 @@ Hanami.configure do mailer do root 'lib/#{project}/mailers' - # See http://hanamirb.org/guides/mailers/delivery + # See https://guides.hanamirb.org/mailers/delivery delivery :test end environment :development do - # See: http://hanamirb.org/guides/projects/logging + # See: https://guides.hanamirb.org/projects/logging logger level: :debug end @@ -583,7 +583,7 @@ module Web # * :yui # * :closure # - # See: http://hanamirb.org/guides/assets/compressors + # See: https://guides.hanamirb.org/assets/compressors # # In order to skip JavaScript compression comment the following line javascript_compressor :builtin @@ -596,7 +596,7 @@ module Web # * :yui # * :sass # - # See: http://hanamirb.org/guides/assets/compressors + # See: https://guides.hanamirb.org/assets/compressors # # In order to skip stylesheet compression comment the following line stylesheet_compressor :builtin @@ -753,12 +753,12 @@ module Web # Use fingerprint file name for asset paths # - # See: http://hanamirb.org/guides/assets/overview + # See: https://guides.hanamirb.org/assets/overview fingerprint true # Content Delivery Network (CDN) # - # See: http://hanamirb.org/guides/assets/content-delivery-network + # See: https://guides.hanamirb.org/assets/content-delivery-network # # scheme 'https' # host 'cdn.example.org' @@ -766,7 +766,7 @@ module Web # Subresource Integrity # - # See: http://hanamirb.org/guides/assets/content-delivery-network/#subresource-integrity + # See: https://guides.hanamirb.org/assets/content-delivery-network/#subresource-integrity subresource_integrity :sha256 end end @@ -779,7 +779,7 @@ END # expect("apps/web/config/routes.rb").to have_file_content <<-END # Configure your routes here -# See: http://hanamirb.org/guides/routing/overview/ +# See: https://guides.hanamirb.org/routing/overview # # Example: # get '/hello', to: ->(env) { [200, {}, ['Hello from Hanami!']] } diff --git a/spec/support/shared_examples/cli/generate/app.rb b/spec/support/shared_examples/cli/generate/app.rb index 850d476e..371424c9 100644 --- a/spec/support/shared_examples/cli/generate/app.rb +++ b/spec/support/shared_examples/cli/generate/app.rb @@ -158,7 +158,7 @@ module #{app_name} # * :yui # * :closure # - # See: http://hanamirb.org/guides/assets/compressors + # See: https://guides.hanamirb.org/assets/compressors # # In order to skip JavaScript compression comment the following line javascript_compressor :builtin @@ -171,7 +171,7 @@ module #{app_name} # * :yui # * :sass # - # See: http://hanamirb.org/guides/assets/compressors + # See: https://guides.hanamirb.org/assets/compressors # # In order to skip stylesheet compression comment the following line stylesheet_compressor :builtin @@ -328,12 +328,12 @@ module #{app_name} # Use fingerprint file name for asset paths # - # See: http://hanamirb.org/guides/assets/overview + # See: https://guides.hanamirb.org/assets/overview fingerprint true # Content Delivery Network (CDN) # - # See: http://hanamirb.org/guides/assets/content-delivery-network + # See: https://guides.hanamirb.org/assets/content-delivery-network # # scheme 'https' # host 'cdn.example.org' @@ -341,7 +341,7 @@ module #{app_name} # Subresource Integrity # - # See: http://hanamirb.org/guides/assets/content-delivery-network/#subresource-integrity + # See: https://guides.hanamirb.org/assets/content-delivery-network/#subresource-integrity subresource_integrity :sha256 end end @@ -354,7 +354,7 @@ END # expect("apps/#{app}/config/routes.rb").to have_file_content <<-END # Configure your routes here -# See: http://hanamirb.org/guides/routing/overview/ +# See: https://guides.hanamirb.org/routing/overview # # Example: # get '/hello', to: ->(env) { [200, {}, ['Hello from Hanami!']] } @@ -451,12 +451,12 @@ Hanami.configure do mailer do root 'lib/#{project}/mailers' - # See http://hanamirb.org/guides/mailers/delivery + # See https://guides.hanamirb.org/mailers/delivery delivery :test end environment :development do - # See: http://hanamirb.org/guides/projects/logging + # See: https://guides.hanamirb.org/projects/logging logger level: :debug end From 9c422ba03e176cf1d1b4844f52cd302272c550fa Mon Sep 17 00:00:00 2001 From: Kasper Meyer Date: Mon, 28 Jan 2019 16:08:25 +0100 Subject: [PATCH 09/33] Update copyright to 2019 (#986) --- LICENSE.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 56a5aab5..2e763592 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright © 2014-2017 Luca Guidi +Copyright © 2014-2019 Luca Guidi MIT License diff --git a/README.md b/README.md index d4f72e22..5b05c251 100644 --- a/README.md +++ b/README.md @@ -137,4 +137,4 @@ Released under MIT License. This project was formerly known as Lotus (`lotusrb`). -Copyright © 2014-2018 Luca Guidi. +Copyright © 2014-2019 Luca Guidi. From 8c6e5147e92ef869b25379448572da3698eacfdc Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Mon, 25 Mar 2019 11:30:27 +0100 Subject: [PATCH 10/33] Use `run_cmd` in specs Ref https://github.com/hanami/devtools/commit/afc2341578408af0581e5003888bdc59f4d476db --- .../integration/cli/assets/precompile_spec.rb | 2 +- spec/integration/cli/assets_spec.rb | 2 +- spec/integration/cli/console_spec.rb | 6 +-- spec/integration/cli/db/apply_spec.rb | 2 +- spec/integration/cli/db/console_spec.rb | 2 +- spec/integration/cli/db/create_spec.rb | 2 +- spec/integration/cli/db/drop_spec.rb | 2 +- spec/integration/cli/db/migrate_spec.rb | 2 +- spec/integration/cli/db/prepare_spec.rb | 2 +- spec/integration/cli/db/rollback_spec.rb | 6 +-- spec/integration/cli/db/version_spec.rb | 2 +- spec/integration/cli/db_spec.rb | 2 +- spec/integration/cli/destroy/action_spec.rb | 16 ++++---- spec/integration/cli/destroy/app_spec.rb | 10 ++--- spec/integration/cli/destroy/mailer_spec.rb | 8 ++-- .../integration/cli/destroy/migration_spec.rb | 8 ++-- spec/integration/cli/destroy/model_spec.rb | 12 +++--- spec/integration/cli/destroy_spec.rb | 2 +- spec/integration/cli/generate/action_spec.rb | 38 +++++++++---------- spec/integration/cli/generate/app_spec.rb | 14 +++---- spec/integration/cli/generate/mailer_spec.rb | 16 ++++---- .../cli/generate/migration_spec.rb | 4 +- spec/integration/cli/generate/model_spec.rb | 20 +++++----- spec/integration/cli/generate/secret_spec.rb | 2 +- spec/integration/cli/generate_spec.rb | 2 +- spec/integration/cli/new/database_spec.rb | 10 ++--- spec/integration/cli/new/hanami_head_spec.rb | 2 +- spec/integration/cli/new/template_spec.rb | 10 ++--- spec/integration/cli/new/test_spec.rb | 8 ++-- spec/integration/cli/new_spec.rb | 10 ++--- spec/integration/cli/plugins_spec.rb | 2 +- spec/integration/cli/routes_spec.rb | 2 +- spec/integration/cli/server_spec.rb | 8 ++-- spec/integration/cli/version_spec.rb | 20 +++++----- .../shared_examples/cli/generate/app.rb | 2 +- .../shared_examples/cli/generate/migration.rb | 2 +- .../shared_examples/cli/generate/model.rb | 2 +- spec/support/shared_examples/cli/new.rb | 2 +- 38 files changed, 132 insertions(+), 132 deletions(-) diff --git a/spec/integration/cli/assets/precompile_spec.rb b/spec/integration/cli/assets/precompile_spec.rb index b30e87c9..5afd21eb 100644 --- a/spec/integration/cli/assets/precompile_spec.rb +++ b/spec/integration/cli/assets/precompile_spec.rb @@ -140,7 +140,7 @@ Examples: hanami assets precompile HANAMI_ENV=production # Precompile assets for production environment OUT - run_command "hanami assets precompile --help", output + run_cmd "hanami assets precompile --help", output end end end diff --git a/spec/integration/cli/assets_spec.rb b/spec/integration/cli/assets_spec.rb index ba94b42f..ebeeb974 100644 --- a/spec/integration/cli/assets_spec.rb +++ b/spec/integration/cli/assets_spec.rb @@ -6,7 +6,7 @@ Commands: hanami assets precompile # Precompile assets for deployment OUT - run_command "hanami assets", output, exit_status: 1 + run_cmd "hanami assets", output, exit_status: 1 end end end diff --git a/spec/integration/cli/console_spec.rb b/spec/integration/cli/console_spec.rb index a1c71c28..466c8727 100644 --- a/spec/integration/cli/console_spec.rb +++ b/spec/integration/cli/console_spec.rb @@ -62,14 +62,14 @@ EOF xit "returns error when known engine isn't bundled" do with_project("bookshelf_console_irb", console: :irb) do output = "Missing gem for `pry' console engine. Please make sure to add it to `Gemfile'." - run_command "hanami console --engine=pry", output, exit_status: 1 + run_cmd "hanami console --engine=pry", output, exit_status: 1 end end it "returns error when unknown engine is requested" do with_project("bookshelf_console_irb", console: :irb) do output = "Unknown console engine: `foo'." - run_command "hanami console --engine=foo", output, exit_status: 1 + run_cmd "hanami console --engine=foo", output, exit_status: 1 end end @@ -94,7 +94,7 @@ Examples: hanami console --engine=pry # Force to use Pry OUT - run_command "hanami console --help", output + run_cmd "hanami console --help", output end end diff --git a/spec/integration/cli/db/apply_spec.rb b/spec/integration/cli/db/apply_spec.rb index b083d4a4..8c8c818f 100644 --- a/spec/integration/cli/db/apply_spec.rb +++ b/spec/integration/cli/db/apply_spec.rb @@ -40,7 +40,7 @@ Options: --help, -h # Print this help OUT - run_command "hanami db apply --help", output + run_cmd "hanami db apply --help", output end end end diff --git a/spec/integration/cli/db/console_spec.rb b/spec/integration/cli/db/console_spec.rb index 2b5228ee..690ac645 100644 --- a/spec/integration/cli/db/console_spec.rb +++ b/spec/integration/cli/db/console_spec.rb @@ -31,7 +31,7 @@ Options: --help, -h # Print this help OUT - run_command "hanami db console --help", output + run_cmd "hanami db console --help", output end end end diff --git a/spec/integration/cli/db/create_spec.rb b/spec/integration/cli/db/create_spec.rb index 161a510c..b7cfe418 100644 --- a/spec/integration/cli/db/create_spec.rb +++ b/spec/integration/cli/db/create_spec.rb @@ -41,7 +41,7 @@ Options: --help, -h # Print this help OUT - run_command 'hanami db create --help', output + run_cmd 'hanami db create --help', output end end end diff --git a/spec/integration/cli/db/drop_spec.rb b/spec/integration/cli/db/drop_spec.rb index 1563939b..816bea2d 100644 --- a/spec/integration/cli/db/drop_spec.rb +++ b/spec/integration/cli/db/drop_spec.rb @@ -45,7 +45,7 @@ Options: --help, -h # Print this help OUT - run_command 'hanami db drop --help', output + run_cmd 'hanami db drop --help', output end end end diff --git a/spec/integration/cli/db/migrate_spec.rb b/spec/integration/cli/db/migrate_spec.rb index 0a7a2960..b7ad077a 100644 --- a/spec/integration/cli/db/migrate_spec.rb +++ b/spec/integration/cli/db/migrate_spec.rb @@ -105,7 +105,7 @@ OUT %r{ hanami db migrate [\d]{14} # Migrate to a specific version} ] - run_command 'hanami db drop --help', output + run_cmd 'hanami db drop --help', output end end end diff --git a/spec/integration/cli/db/prepare_spec.rb b/spec/integration/cli/db/prepare_spec.rb index 58379dc5..53e98e9b 100644 --- a/spec/integration/cli/db/prepare_spec.rb +++ b/spec/integration/cli/db/prepare_spec.rb @@ -27,7 +27,7 @@ Options: --help, -h # Print this help OUT - run_command 'hanami db prepare --help', output + run_cmd 'hanami db prepare --help', output end end end diff --git a/spec/integration/cli/db/rollback_spec.rb b/spec/integration/cli/db/rollback_spec.rb index 1ca0e71e..8ee44722 100644 --- a/spec/integration/cli/db/rollback_spec.rb +++ b/spec/integration/cli/db/rollback_spec.rb @@ -48,7 +48,7 @@ RSpec.describe "hanami db", type: :integration do hanami "db migrate" output = "the number of steps must be a positive integer (you entered `quindici')." - run_command "hanami db rollback quindici", output, exit_status: 1 + run_cmd "hanami db rollback quindici", output, exit_status: 1 end end @@ -60,7 +60,7 @@ RSpec.describe "hanami db", type: :integration do hanami "db migrate" output = "the number of steps must be a positive integer (you entered `0')." - run_command "hanami db rollback 0", output, exit_status: 1 + run_cmd "hanami db rollback 0", output, exit_status: 1 end end @@ -86,7 +86,7 @@ Examples: hanami db rollback # Rollbacks latest migration hanami db rollback 2 # Rollbacks last two migrations OUT - run_command 'hanami db rollback --help', output + run_cmd 'hanami db rollback --help', output end end end diff --git a/spec/integration/cli/db/version_spec.rb b/spec/integration/cli/db/version_spec.rb index bbbac096..e7127c0d 100644 --- a/spec/integration/cli/db/version_spec.rb +++ b/spec/integration/cli/db/version_spec.rb @@ -29,7 +29,7 @@ Options: --help, -h # Print this help OUT - run_command 'hanami db version --help', output + run_cmd 'hanami db version --help', output end end end diff --git a/spec/integration/cli/db_spec.rb b/spec/integration/cli/db_spec.rb index 51fd5ccd..e61735fc 100644 --- a/spec/integration/cli/db_spec.rb +++ b/spec/integration/cli/db_spec.rb @@ -13,7 +13,7 @@ Commands: hanami db version # Print the current migrated version OUT - run_command "hanami db", output, exit_status: 1 + run_cmd "hanami db", output, exit_status: 1 end end end diff --git a/spec/integration/cli/destroy/action_spec.rb b/spec/integration/cli/destroy/action_spec.rb index ce650d9a..d3b0bdce 100644 --- a/spec/integration/cli/destroy/action_spec.rb +++ b/spec/integration/cli/destroy/action_spec.rb @@ -12,7 +12,7 @@ RSpec.describe "hanami destroy", type: :integration do "remove spec/web/controllers/books/index_spec.rb" ] - run_command "hanami destroy action web books#index", output + run_cmd "hanami destroy action web books#index", output expect('spec/web/controllers/books/index_spec.rb').to_not be_an_existing_file expect('apps/web/controllers/books/index.rb').to_not be_an_existing_file @@ -36,7 +36,7 @@ RSpec.describe "hanami destroy", type: :integration do "remove spec/web/controllers/api/books/index_spec.rb" ] - run_command "hanami destroy action web api/books#index", output + run_cmd "hanami destroy action web api/books#index", output expect('spec/web/controllers/api/books/index_spec.rb').to_not be_an_existing_file expect('apps/web/controllers/api/books/index.rb').to_not be_an_existing_file @@ -57,7 +57,7 @@ RSpec.describe "hanami destroy", type: :integration do "remove spec/web/controllers/home/ping_spec.rb" ] - run_command "hanami destroy action web home#ping", output + run_cmd "hanami destroy action web home#ping", output expect('spec/web/controllers/home/ping_spec.rb').to_not be_an_existing_file expect('apps/web/controllers/home/ping.rb').to_not be_an_existing_file @@ -76,7 +76,7 @@ ERROR: "hanami destroy action" was called with no arguments Usage: "hanami destroy action APP ACTION" OUT - run_command "hanami destroy action", output, exit_status: 1 + run_cmd "hanami destroy action", output, exit_status: 1 end end @@ -87,7 +87,7 @@ ERROR: "hanami destroy action" was called with arguments ["home#index"] Usage: "hanami destroy action APP ACTION" OUT - run_command "hanami destroy action home#index", output, exit_status: 1 + run_cmd "hanami destroy action home#index", output, exit_status: 1 end end @@ -95,7 +95,7 @@ OUT with_project('bookshelf_generate_action_with_unknown_app') do output = "`foo' is not a valid APP. Please specify one of: `web'" - run_command "hanami destroy action foo home#index", output, exit_status: 1 + run_cmd "hanami destroy action foo home#index", output, exit_status: 1 end end @@ -106,7 +106,7 @@ cannot find `home#index' in `web' application. please run `hanami routes' to know the existing actions. OUT - run_command "hanami destroy action web home#index", output, exit_status: 1 + run_cmd "hanami destroy action web home#index", output, exit_status: 1 end end @@ -134,7 +134,7 @@ Examples: hanami destroy action admin users#index # Destroy from `admin` app OUT - run_command 'hanami destroy action --help', output + run_cmd 'hanami destroy action --help', output end end end # action diff --git a/spec/integration/cli/destroy/app_spec.rb b/spec/integration/cli/destroy/app_spec.rb index f83d5405..eed82efc 100644 --- a/spec/integration/cli/destroy/app_spec.rb +++ b/spec/integration/cli/destroy/app_spec.rb @@ -13,7 +13,7 @@ RSpec.describe "hanami destroy", type: :integration do "remove apps/admin" ] - run_command "hanami destroy app admin", output + run_cmd "hanami destroy app admin", output expect(".env.test").to_not have_file_content(%r{ADMIN_SESSIONS_SECRET}) expect(".env.development").to_not have_file_content(%r{ADMIN_SESSIONS_SECRET}) @@ -50,7 +50,7 @@ RSpec.describe "hanami destroy", type: :integration do "remove apps/api" ] - run_command "hanami destroy app api", output + run_cmd "hanami destroy app api", output expect(".env.test").to_not have_file_content(%r{API_SESSIONS_SECRET}) expect(".env.development").to_not have_file_content(%r{API_SESSIONS_SECRET}) @@ -72,7 +72,7 @@ RSpec.describe "hanami destroy", type: :integration do ERROR: "hanami destroy app" was called with no arguments Usage: "hanami destroy app APP" OUT - run_command "hanami destroy app", output, exit_status: 1 + run_cmd "hanami destroy app", output, exit_status: 1 end end @@ -81,7 +81,7 @@ OUT output = <<-OUT `unknown' is not a valid APP. Please specify one of: `web' OUT - run_command "hanami destroy app unknown", output, exit_status: 1 + run_cmd "hanami destroy app unknown", output, exit_status: 1 end end @@ -107,7 +107,7 @@ Examples: hanami destroy app admin # Destroy `admin` app OUT - run_command 'hanami destroy app --help', output + run_cmd 'hanami destroy app --help', output end end end # app diff --git a/spec/integration/cli/destroy/mailer_spec.rb b/spec/integration/cli/destroy/mailer_spec.rb index 2ca48710..b02ccebe 100644 --- a/spec/integration/cli/destroy/mailer_spec.rb +++ b/spec/integration/cli/destroy/mailer_spec.rb @@ -12,7 +12,7 @@ RSpec.describe "hanami destroy", type: :integration do with_project('bookshelf_generate_mailer', test: 'rspec') do generate "mailer welcome" - run_command "hanami destroy mailer welcome", output + run_cmd "hanami destroy mailer welcome", output expect('spec/bookshelf_generate_mailer/mailers/welcome_spec.rb').to_not be_an_existing_file expect('lib/bookshelf_generate_mailer/mailers/templates/welcome.html.erb').to_not be_an_existing_file @@ -29,7 +29,7 @@ ERROR: "hanami generate mailer" was called with no arguments Usage: "hanami generate mailer MAILER" OUT - run_command "hanami generate mailer", output, exit_status: 1 + run_cmd "hanami generate mailer", output, exit_status: 1 end end @@ -39,7 +39,7 @@ OUT cannot find `unknown' mailer. Please have a look at `lib/bookshelf/mailers' directory to find an existing mailer. OUT - run_command "hanami destroy mailer unknown", output, exit_status: 1 + run_cmd "hanami destroy mailer unknown", output, exit_status: 1 end end @@ -65,7 +65,7 @@ Examples: hanami destroy mailer welcome # Destroy `WelcomeMailer` mailer OUT - run_command 'hanami destroy mailer --help', output + run_cmd 'hanami destroy mailer --help', output end end end diff --git a/spec/integration/cli/destroy/migration_spec.rb b/spec/integration/cli/destroy/migration_spec.rb index b610a414..293e73ee 100644 --- a/spec/integration/cli/destroy/migration_spec.rb +++ b/spec/integration/cli/destroy/migration_spec.rb @@ -11,7 +11,7 @@ RSpec.describe "hanami destroy", type: :integration do "remove #{migration}" ] - run_command "hanami destroy migration create_users", output + run_cmd "hanami destroy migration create_users", output expect(migration).to_not be_an_existing_file end @@ -23,7 +23,7 @@ RSpec.describe "hanami destroy", type: :integration do ERROR: "hanami destroy migration" was called with no arguments Usage: "hanami destroy migration MIGRATION" OUT - run_command "hanami destroy migration", output, exit_status: 1 + run_cmd "hanami destroy migration", output, exit_status: 1 end end @@ -32,7 +32,7 @@ OUT output = <<-OUT cannot find `create_unknowns'. Please have a look at `db/migrations' directory to find an existing migration OUT - run_command "hanami destroy migration create_unknowns", output, exit_status: 1 + run_cmd "hanami destroy migration create_unknowns", output, exit_status: 1 end end @@ -61,7 +61,7 @@ OUT %r{ hanami destroy migration create_users # Destroy `db/migrations/[\d]{14}_create_users.rb`} ] - run_command 'hanami destroy migration --help', output + run_cmd 'hanami destroy migration --help', output end end end # migration diff --git a/spec/integration/cli/destroy/model_spec.rb b/spec/integration/cli/destroy/model_spec.rb index f618509e..d4daf4c2 100644 --- a/spec/integration/cli/destroy/model_spec.rb +++ b/spec/integration/cli/destroy/model_spec.rb @@ -14,7 +14,7 @@ RSpec.describe "hanami destroy", type: :integration do "remove lib/bookshelf/entities/user.rb" ] - run_command "hanami destroy model user", output + run_cmd "hanami destroy model user", output expect(migration).to be_an_existing_file @@ -41,7 +41,7 @@ RSpec.describe "hanami destroy", type: :integration do "remove lib/bookshelf/entities/user.rb" ] - run_command "hanami destroy model user", output + run_cmd "hanami destroy model user", output end end @@ -52,7 +52,7 @@ ERROR: "hanami destroy model" was called with no arguments Usage: "hanami destroy model MODEL" OUT - run_command "hanami destroy model", output, exit_status: 1 + run_cmd "hanami destroy model", output, exit_status: 1 end end @@ -68,7 +68,7 @@ Description: > $ hanami destroy model car OUT - run_command 'hanami destroy model --help', output + run_cmd 'hanami destroy model --help', output end end @@ -78,7 +78,7 @@ OUT cannot find `unknown' model. Please have a look at `lib/bookshelf/entities' directory to find an existing model. OUT - run_command "hanami destroy model unknown", output, exit_status: 1 + run_cmd "hanami destroy model unknown", output, exit_status: 1 end end @@ -104,7 +104,7 @@ Examples: hanami destroy model user # Destroy `User` entity and `UserRepository` repository OUT - run_command 'hanami destroy model --help', output + run_cmd 'hanami destroy model --help', output end end end # model diff --git a/spec/integration/cli/destroy_spec.rb b/spec/integration/cli/destroy_spec.rb index d1b969eb..51947685 100644 --- a/spec/integration/cli/destroy_spec.rb +++ b/spec/integration/cli/destroy_spec.rb @@ -10,7 +10,7 @@ Commands: hanami destroy model MODEL # Destroy a model OUT - run_command "hanami destroy", output, exit_status: 1 + run_cmd "hanami destroy", output, exit_status: 1 end end end diff --git a/spec/integration/cli/generate/action_spec.rb b/spec/integration/cli/generate/action_spec.rb index 5d46ae7e..07b785e7 100644 --- a/spec/integration/cli/generate/action_spec.rb +++ b/spec/integration/cli/generate/action_spec.rb @@ -11,7 +11,7 @@ RSpec.describe "hanami generate", type: :integration do "insert apps/web/config/routes.rb" ] - run_command "hanami generate action web authors#index", output + run_cmd "hanami generate action web authors#index", output # # apps/web/controllers/authors/index.rb @@ -64,7 +64,7 @@ RSpec.describe "hanami generate", type: :integration do "insert apps/web/config/routes.rb" ] - run_command "hanami generate action web api/authors#index", output + run_cmd "hanami generate action web api/authors#index", output # # apps/web/controllers/api/authors/index.rb @@ -112,7 +112,7 @@ RSpec.describe "hanami generate", type: :integration do it "generates non-RESTful actions" do with_project do - run_command "hanami generate action web sessions#sign_out" + run_cmd "hanami generate action web sessions#sign_out" # # apps/web/config/routes.rb @@ -127,7 +127,7 @@ RSpec.describe "hanami generate", type: :integration do ERROR: "hanami generate action" was called with no arguments Usage: "hanami generate action APP ACTION" OUT - run_command "hanami generate action", output, exit_status: 1 + run_cmd "hanami generate action", output, exit_status: 1 end end @@ -138,7 +138,7 @@ RSpec.describe "hanami generate", type: :integration do Usage: "hanami generate action APP ACTION" OUT - run_command "hanami generate action home#index", output, exit_status: 1 + run_cmd "hanami generate action home#index", output, exit_status: 1 end end @@ -146,7 +146,7 @@ RSpec.describe "hanami generate", type: :integration do with_project('bookshelf_generate_action_with_unknown_app') do output = "`foo' is not a valid APP. Please specify one of: `web'" - run_command "hanami generate action foo home#index", output, exit_status: 1 + run_cmd "hanami generate action foo home#index", output, exit_status: 1 end end @@ -157,7 +157,7 @@ RSpec.describe "hanami generate", type: :integration do "insert apps/web/config/routes.rb" ] - run_command "hanami generate action web home#index --url=/", output + run_cmd "hanami generate action web home#index --url=/", output # # apps/web/config/routes.rb @@ -169,7 +169,7 @@ RSpec.describe "hanami generate", type: :integration do it "fails with missing argument" do with_project('bookshelf_generate_action_missing_url') do output = "`' is not a valid URL" - run_command "hanami generate action web books#create --url=", output, exit_status: 1 + run_cmd "hanami generate action web books#create --url=", output, exit_status: 1 end end end @@ -182,7 +182,7 @@ RSpec.describe "hanami generate", type: :integration do "create spec/web/controllers/status/check_spec.rb", "insert apps/web/config/routes.rb" ] - run_command "hanami generate action web status#check --skip-view", output + run_cmd "hanami generate action web status#check --skip-view", output # # apps/web/controllers/status/check.rb @@ -212,7 +212,7 @@ RSpec.describe "hanami generate", type: :integration do "create spec/web/controllers/api/authors/index_spec.rb", "insert apps/web/config/routes.rb" ] - run_command "hanami generate action web api/authors#index --skip-view", output + run_cmd "hanami generate action web api/authors#index --skip-view", output # # apps/web/controllers/status/check.rb @@ -245,7 +245,7 @@ RSpec.describe "hanami generate", type: :integration do "insert apps/web/config/routes.rb" ] - run_command "hanami generate action web books#create --method=POST", output + run_cmd "hanami generate action web books#create --method=POST", output # # apps/web/config/routes.rb @@ -257,14 +257,14 @@ RSpec.describe "hanami generate", type: :integration do it "fails with missing argument" do with_project('bookshelf_generate_action_missing_method') do output = "`' is not a valid HTTP method. Please use one of: `GET' `POST' `PUT' `DELETE' `HEAD' `OPTIONS' `TRACE' `PATCH' `OPTIONS' `LINK' `UNLINK'" - run_command "hanami generate action web books#create --method=", output, exit_status: 1 + run_cmd "hanami generate action web books#create --method=", output, exit_status: 1 end end it "fails with unknown argument" do with_project('bookshelf_generate_action_uknown_method') do output = "`FOO' is not a valid HTTP method. Please use one of: `GET' `POST' `PUT' `DELETE' `HEAD' `OPTIONS' `TRACE' `PATCH' `OPTIONS' `LINK' `UNLINK'" - run_command "hanami generate action web books#create --method=FOO", output, exit_status: 1 + run_cmd "hanami generate action web books#create --method=FOO", output, exit_status: 1 end end end @@ -276,7 +276,7 @@ RSpec.describe "hanami generate", type: :integration do "create apps/web/templates/books/index.html.erb" ] - run_command "hanami generate action web books#index", output + run_cmd "hanami generate action web books#index", output # # apps/web/templates/books/index.html.erb @@ -299,7 +299,7 @@ RSpec.describe "hanami generate", type: :integration do "create apps/web/templates/books/index.html.haml" ] - run_command "hanami generate action web books#index", output + run_cmd "hanami generate action web books#index", output # # apps/web/templates/books/index.html.haml @@ -322,7 +322,7 @@ RSpec.describe "hanami generate", type: :integration do "create apps/web/templates/books/index.html.slim" ] - run_command "hanami generate action web books#index", output + run_cmd "hanami generate action web books#index", output # # apps/web/templates/books/index.html.slim @@ -346,7 +346,7 @@ RSpec.describe "hanami generate", type: :integration do "create spec/web/views/books/index_spec.rb" ] - run_command "hanami generate action web books#index", output + run_cmd "hanami generate action web books#index", output # # spec/web/controllers/books/index_spec.rb @@ -394,7 +394,7 @@ RSpec.describe "hanami generate", type: :integration do "create spec/web/views/books/index_spec.rb" ] - run_command "hanami generate action web books#index", output + run_cmd "hanami generate action web books#index", output # # spec/web/controllers/books/index_spec.rb @@ -460,7 +460,7 @@ RSpec.describe "hanami generate", type: :integration do hanami generate action web books#create --skip-view # Skip view and template OUT - run_command 'hanami generate action --help', output + run_cmd 'hanami generate action --help', output end end end # action diff --git a/spec/integration/cli/generate/app_spec.rb b/spec/integration/cli/generate/app_spec.rb index 5c910c42..e2f0d38b 100644 --- a/spec/integration/cli/generate/app_spec.rb +++ b/spec/integration/cli/generate/app_spec.rb @@ -45,7 +45,7 @@ RSpec.describe "hanami generate", type: :integration do .join('') ) - run_command "hanami generate app #{app}", output + run_cmd "hanami generate app #{app}", output # # config/environment.rb @@ -65,7 +65,7 @@ RSpec.describe "hanami generate", type: :integration do "insert config/environment.rb" ] - run_command "hanami generate app #{app} --application-base-url=/api/v1", output + run_cmd "hanami generate app #{app} --application-base-url=/api/v1", output # # config/environment.rb @@ -78,7 +78,7 @@ RSpec.describe "hanami generate", type: :integration do it "fails with missing argument" do with_project('bookshelf_generate_app_missing_application_base_url') do output = "`' is not a valid URL" - run_command "hanami generate app foo --application-base-url=", output, exit_status: 1 + run_cmd "hanami generate app foo --application-base-url=", output, exit_status: 1 end end end @@ -92,7 +92,7 @@ RSpec.describe "hanami generate", type: :integration do "create apps/#{app}/templates/application.html.erb" ] - run_command "hanami generate app #{app}", output + run_cmd "hanami generate app #{app}", output # # apps/admin/templates/application.html.erb @@ -126,7 +126,7 @@ END "create apps/#{app}/templates/application.html.haml" ] - run_command "hanami generate app #{app}", output + run_cmd "hanami generate app #{app}", output # # apps/admin/templates/application.html.haml @@ -158,7 +158,7 @@ END "create apps/#{app}/templates/application.html.slim" ] - run_command "hanami generate app #{app}", output + run_cmd "hanami generate app #{app}", output # # apps/admin/templates/application.html.slim @@ -206,7 +206,7 @@ Examples: hanami generate app api --application-base-url=/api/v1 # Generate `api` app and mount at `/api/v1` OUT - run_command 'hanami generate app --help', output + run_cmd 'hanami generate app --help', output end end end # app diff --git a/spec/integration/cli/generate/mailer_spec.rb b/spec/integration/cli/generate/mailer_spec.rb index 5bc1560f..898a54bb 100644 --- a/spec/integration/cli/generate/mailer_spec.rb +++ b/spec/integration/cli/generate/mailer_spec.rb @@ -10,7 +10,7 @@ RSpec.describe "hanami generate", type: :integration do it 'generate the mailer files' do with_project('bookshelf_generate_mailer', test: 'rspec') do - run_command "hanami generate mailer welcome", output + run_cmd "hanami generate mailer welcome", output # # lib/bookshelf_generate_mailer/mailers/welcome.rb # @@ -33,7 +33,7 @@ RSpec.describe "hanami generate", type: :integration do it 'generates a proper minitest file' do with_project('bookshelf_generate_mailer', test: 'minitest') do - run_command "hanami generate mailer welcome", output + run_cmd "hanami generate mailer welcome", output # # spec/bookshelf_generate_mailer/mailers/welcome_spec.rb # @@ -51,7 +51,7 @@ RSpec.describe "hanami generate", type: :integration do it 'generates a proper RSpec file' do with_project('bookshelf_generate_mailer', test: 'rspec') do - run_command "hanami generate mailer welcome", output + run_cmd "hanami generate mailer welcome", output # # spec/bookshelf_generate_mailer/mailers/welcome_spec.rb # @@ -75,7 +75,7 @@ RSpec.describe "hanami generate", type: :integration do "create lib/bookshelf_generate_mailer_with_options/mailers/templates/welcome.html.erb" ] - run_command "hanami generate mailer welcome --from=\"'mail@example.com'\" --to=\"'user@example.com'\" --subject=\"'Let\'s start'\"", output + run_cmd "hanami generate mailer welcome --from=\"'mail@example.com'\" --to=\"'user@example.com'\" --subject=\"'Let\'s start'\"", output expect('lib/bookshelf_generate_mailer_with_options/mailers/welcome.rb').to have_file_content <<~END module Mailers @@ -100,7 +100,7 @@ RSpec.describe "hanami generate", type: :integration do "create lib/bookshelf_generate_mailer_with_options/mailers/templates/welcome.html.erb" ] - run_command "hanami generate mailer welcome --from='\"mail@example.com\"' --to='\"user@example.com\"' --subject='\"Come on \"Folks\"\"'", output + run_cmd "hanami generate mailer welcome --from='\"mail@example.com\"' --to='\"user@example.com\"' --subject='\"Come on \"Folks\"\"'", output expect('lib/bookshelf_generate_mailer_with_options/mailers/welcome.rb').to have_file_content <<~END module Mailers @@ -125,7 +125,7 @@ RSpec.describe "hanami generate", type: :integration do "create lib/bookshelf_generate_mailer_with_options/mailers/templates/welcome.html.erb" ] - run_command "hanami generate mailer welcome --from=mail@example.com --to=user@example.com --subject=Welcome", output + run_cmd "hanami generate mailer welcome --from=mail@example.com --to=user@example.com --subject=Welcome", output expect('lib/bookshelf_generate_mailer_with_options/mailers/welcome.rb').to have_file_content <<~END module Mailers @@ -148,7 +148,7 @@ RSpec.describe "hanami generate", type: :integration do Usage: "hanami generate mailer MAILER" OUT - run_command "hanami generate mailer", output, exit_status: 1 + run_cmd "hanami generate mailer", output, exit_status: 1 end end @@ -180,7 +180,7 @@ RSpec.describe "hanami generate", type: :integration do hanami generate mailer forgot_password --subject="Your password reset" # Generate with default `subject` OUT - run_command 'hanami generate mailer --help', output + run_cmd 'hanami generate mailer --help', output end end end diff --git a/spec/integration/cli/generate/migration_spec.rb b/spec/integration/cli/generate/migration_spec.rb index 7a8e7e1f..fe50e2d9 100644 --- a/spec/integration/cli/generate/migration_spec.rb +++ b/spec/integration/cli/generate/migration_spec.rb @@ -31,7 +31,7 @@ RSpec.describe "hanami generate", type: :integration do ERROR: "hanami generate migration" was called with no arguments Usage: "hanami generate migration MIGRATION" END - run_command "hanami generate migration", output, exit_status: 1 + run_cmd "hanami generate migration", output, exit_status: 1 end end end @@ -62,7 +62,7 @@ OUT %r{ hanami generate migration create_users # Generate `db/migrations/[\d]{14}_create_users.rb`}, ] - run_command 'hanami generate migration --help', output + run_cmd 'hanami generate migration --help', output end end end # migration diff --git a/spec/integration/cli/generate/model_spec.rb b/spec/integration/cli/generate/model_spec.rb index f807dde1..25a48b80 100644 --- a/spec/integration/cli/generate/model_spec.rb +++ b/spec/integration/cli/generate/model_spec.rb @@ -33,7 +33,7 @@ RSpec.describe "hanami generate", type: :integration do ERROR: "hanami generate model" was called with no arguments Usage: "hanami generate model MODEL" END - run_command "hanami generate model", output, exit_status: 1 + run_cmd "hanami generate model", output, exit_status: 1 end end end @@ -45,7 +45,7 @@ END directory = Pathname.new("db").join("migrations") FileUtils.rm_rf(directory) - run_command "hanami generate model #{model_name}" + run_cmd "hanami generate model #{model_name}" expect(directory).to be_directory migration = directory.children.find do |m| @@ -63,7 +63,7 @@ END table_name = "users" project = "bookshelf_generate_model_skip_migration" with_project(project) do - run_command "hanami generate model #{model_name} --skip-migration" + run_cmd "hanami generate model #{model_name} --skip-migration" # # db/migrations/_create_.rb # @@ -81,7 +81,7 @@ END table_name = "accounts" project = "bookshelf_generate_model_skip_migration" with_project(project) do - run_command "hanami generate model #{model_name} --skip-migration --relation=#{table_name}" + run_cmd "hanami generate model #{model_name} --skip-migration --relation=#{table_name}" # # db/migrations/_create_.rb # @@ -109,7 +109,7 @@ END /create db\/migrations\/(\d+)_create_#{relation_name}.rb/ ] - run_command "hanami generate model #{model_name} --relation=#{relation_name}", output + run_cmd "hanami generate model #{model_name} --relation=#{relation_name}", output expect("lib/#{project}/repositories/#{model_name}_repository.rb").to have_file_content <<-END class #{class_name}Repository < Hanami::Repository @@ -146,7 +146,7 @@ END /create db\/migrations\/(\d+)_create_#{relation_name}.rb/ ] - run_command "hanami generate model #{model} --relation=BlackSheeps", output + run_cmd "hanami generate model #{model} --relation=BlackSheeps", output expect("lib/#{project}/repositories/sheep_repository.rb").to have_file_content <<-END class SheepRepository < Hanami::Repository @@ -175,7 +175,7 @@ END it "returns error for blank option" do with_project(project) do - run_command "hanami generate model #{model_name} --relation=", "`' is not a valid relation name", exit_status: 1 + run_cmd "hanami generate model #{model_name} --relation=", "`' is not a valid relation name", exit_status: 1 end end end @@ -192,7 +192,7 @@ END "create spec/#{project}/repositories/#{model}_repository_spec.rb" ] - run_command "hanami generate model #{model}", output + run_cmd "hanami generate model #{model}", output # # spec//entities/_spec.rb @@ -231,7 +231,7 @@ END "create spec/#{project}/repositories/#{model}_repository_spec.rb" ] - run_command "hanami generate model #{model}", output + run_cmd "hanami generate model #{model}", output # # spec//entities/_spec.rb @@ -280,7 +280,7 @@ Examples: hanami generate model user --relation=accounts # Generate `User` entity, `UserRepository` and migration to create `accounts` table OUT - run_command 'hanami generate model --help', output + run_cmd 'hanami generate model --help', output end end end # model diff --git a/spec/integration/cli/generate/secret_spec.rb b/spec/integration/cli/generate/secret_spec.rb index 450dc9b4..00211d9f 100644 --- a/spec/integration/cli/generate/secret_spec.rb +++ b/spec/integration/cli/generate/secret_spec.rb @@ -47,7 +47,7 @@ OUT %r{ hanami generate secret web # Prints session secret (eg. `WEB_SESSIONS_SECRET=[\w]{64}`)} ] - run_command 'hanami generate secret --help', output + run_cmd 'hanami generate secret --help', output end end end # secret diff --git a/spec/integration/cli/generate_spec.rb b/spec/integration/cli/generate_spec.rb index cacd9507..b1bcd5e6 100644 --- a/spec/integration/cli/generate_spec.rb +++ b/spec/integration/cli/generate_spec.rb @@ -11,7 +11,7 @@ Commands: hanami generate secret [APP] # Generate session secret OUT - run_command "hanami generate", output, exit_status: 1 + run_cmd "hanami generate", output, exit_status: 1 end end end diff --git a/spec/integration/cli/new/database_spec.rb b/spec/integration/cli/new/database_spec.rb index 5203a623..63237a60 100644 --- a/spec/integration/cli/new/database_spec.rb +++ b/spec/integration/cli/new/database_spec.rb @@ -8,7 +8,7 @@ RSpec.describe "hanami new", type: :integration do "create db/schema.sql" ] - run_command "hanami new #{project} --database=postgres", output + run_cmd "hanami new #{project} --database=postgres", output within_project_directory(project) do # @@ -77,7 +77,7 @@ RSpec.describe "hanami new", type: :integration do "create db/schema.sql" ] - run_command "hanami new #{project} --database=sqlite", output + run_cmd "hanami new #{project} --database=sqlite", output within_project_directory(project) do # @@ -147,7 +147,7 @@ RSpec.describe "hanami new", type: :integration do "create db/schema.sql" ] - run_command "hanami new #{project} --database=mysql", output + run_cmd "hanami new #{project} --database=mysql", output within_project_directory(project) do # @@ -212,7 +212,7 @@ RSpec.describe "hanami new", type: :integration do it "returns error" do output = "`' is not a valid database engine" - run_command "hanami new bookshelf --database=", output, exit_status: 1 + run_cmd "hanami new bookshelf --database=", output, exit_status: 1 end end # missing @@ -220,7 +220,7 @@ RSpec.describe "hanami new", type: :integration do it "returns error" do output = "`foo' is not a valid database engine" - run_command "hanami new bookshelf --database=foo", output, exit_status: 1 + run_cmd "hanami new bookshelf --database=foo", output, exit_status: 1 end end # unknown end # database diff --git a/spec/integration/cli/new/hanami_head_spec.rb b/spec/integration/cli/new/hanami_head_spec.rb index 08ed0629..6eef0ee8 100644 --- a/spec/integration/cli/new/hanami_head_spec.rb +++ b/spec/integration/cli/new/hanami_head_spec.rb @@ -3,7 +3,7 @@ RSpec.describe "hanami new", type: :integration do it "generates project" do project = 'bookshelf_hanami_head' - run_command "hanami new #{project} --hanami-head" + run_cmd "hanami new #{project} --hanami-head" within_project_directory(project) do # diff --git a/spec/integration/cli/new/template_spec.rb b/spec/integration/cli/new/template_spec.rb index f414f2f7..13062d48 100644 --- a/spec/integration/cli/new/template_spec.rb +++ b/spec/integration/cli/new/template_spec.rb @@ -7,7 +7,7 @@ RSpec.describe "hanami new", type: :integration do "create apps/web/templates/application.html.erb" ] - run_command "hanami new #{project} --template=erb", output + run_cmd "hanami new #{project} --template=erb", output within_project_directory(project) do # @@ -41,7 +41,7 @@ END "create apps/web/templates/application.html.haml" ] - run_command "hanami new #{project} --template=haml", output + run_cmd "hanami new #{project} --template=haml", output within_project_directory(project) do # @@ -72,7 +72,7 @@ END "create apps/web/templates/application.html.slim" ] - run_command "hanami new #{project} --template=slim", output + run_cmd "hanami new #{project} --template=slim", output within_project_directory(project) do # @@ -101,7 +101,7 @@ END it "returns error" do output = "`' is not a valid template engine. Please use one of: `erb', `haml', `slim'" - run_command "hanami new bookshelf --template=", output, exit_status: 1 + run_cmd "hanami new bookshelf --template=", output, exit_status: 1 end end # missing @@ -109,7 +109,7 @@ END it "returns error" do output = "`foo' is not a valid template engine. Please use one of: `erb', `haml', `slim'" - run_command "hanami new bookshelf --template=foo", output, exit_status: 1 + run_cmd "hanami new bookshelf --template=foo", output, exit_status: 1 end end # unknown end # template diff --git a/spec/integration/cli/new/test_spec.rb b/spec/integration/cli/new/test_spec.rb index ea85c326..7d7ac8fa 100644 --- a/spec/integration/cli/new/test_spec.rb +++ b/spec/integration/cli/new/test_spec.rb @@ -9,7 +9,7 @@ RSpec.describe "hanami new", type: :integration do "create spec/web/views/application_layout_spec.rb" ] - run_command "hanami new #{project} --test=minitest", output + run_cmd "hanami new #{project} --test=minitest", output within_project_directory(project) do # @@ -77,7 +77,7 @@ END "create spec/web/views/application_layout_spec.rb" ] - run_command "hanami new #{project} --test=rspec", output + run_cmd "hanami new #{project} --test=rspec", output within_project_directory(project) do # @@ -259,7 +259,7 @@ END it "returns error" do output = "`' is not a valid test framework. Please use one of: `rspec', `minitest'" - run_command "hanami new bookshelf --test=", output, exit_status: 1 + run_cmd "hanami new bookshelf --test=", output, exit_status: 1 end end # missing @@ -267,7 +267,7 @@ END it "returns error" do output = "`foo' is not a valid test framework. Please use one of: `rspec', `minitest'" - run_command "hanami new bookshelf --test=foo", output, exit_status: 1 + run_cmd "hanami new bookshelf --test=foo", output, exit_status: 1 end end # unknown end # test diff --git a/spec/integration/cli/new_spec.rb b/spec/integration/cli/new_spec.rb index 044ffcba..a0111b12 100644 --- a/spec/integration/cli/new_spec.rb +++ b/spec/integration/cli/new_spec.rb @@ -48,11 +48,11 @@ RSpec.describe 'hanami new', type: :integration do append .env.test OUT - run_command "hanami new #{project}", output + run_cmd "hanami new #{project}", output within_project_directory(project) do # Assert it's an initialized Git repository - run_command "git status", "On branch master" + run_cmd "git status", "On branch master" # # .hanamirc @@ -880,7 +880,7 @@ END it "generates project" do cd(dir) do - run_command "hanami new ." + run_cmd "hanami new ." end [ @@ -912,7 +912,7 @@ ERROR: "hanami new" was called with no arguments Usage: "hanami new PROJECT" OUT - run_command "hanami new", output, exit_status: 1 + run_cmd "hanami new", output, exit_status: 1 end end @@ -947,6 +947,6 @@ Examples: hanami new bookshelf --hanami-head # Use Hanami HEAD OUT - run_command 'hanami new --help', output + run_cmd 'hanami new --help', output end end diff --git a/spec/integration/cli/plugins_spec.rb b/spec/integration/cli/plugins_spec.rb index 07c74bb2..d89977a9 100644 --- a/spec/integration/cli/plugins_spec.rb +++ b/spec/integration/cli/plugins_spec.rb @@ -20,7 +20,7 @@ RSpec.describe "CLI plugins", type: :integration do project = 'bookshelf_without_gemfile' with_system_tmp_directory do - run_command_with_clean_env "hanami new #{project}" + run_cmd_with_clean_env "hanami new #{project}" destination = Pathname.new(Dir.pwd).join(project) expect(destination).to exist diff --git a/spec/integration/cli/routes_spec.rb b/spec/integration/cli/routes_spec.rb index e668b48c..8e746ccf 100644 --- a/spec/integration/cli/routes_spec.rb +++ b/spec/integration/cli/routes_spec.rb @@ -41,7 +41,7 @@ Options: --help, -h # Print this help OUT - run_command 'hanami routes --help', output + run_cmd 'hanami routes --help', output end end end diff --git a/spec/integration/cli/server_spec.rb b/spec/integration/cli/server_spec.rb index 86b04791..c3233bef 100644 --- a/spec/integration/cli/server_spec.rb +++ b/spec/integration/cli/server_spec.rb @@ -112,7 +112,7 @@ EOF touch log replace "config/environment.rb", "logger level: :debug", %(logger level: :debug, stream: "#{log}") - run_command "hanami generate action web home#index --url=/", [] + run_cmd "hanami generate action web home#index --url=/", [] server do visit "/?ping=pong" @@ -130,7 +130,7 @@ EOF touch log replace "config/environment.rb", "logger level: :debug", %(logger level: :debug, stream: "#{log}") - run_command "hanami generate action web books#create --method=POST", [] + run_cmd "hanami generate action web books#create --method=POST", [] server do post "/books", book: { title: "Functions" } @@ -148,7 +148,7 @@ EOF replace "config/environment.rb", "logger level: :debug", %(logger level: :debug, stream: "#{log}") inject_line_after "config/environment.rb", "Hanami.configure", "require 'hanami/middleware/body_parser'\nmiddleware.use Hanami::Middleware::BodyParser, :json" - run_command "hanami generate action web books#create --method=POST", [] + run_cmd "hanami generate action web books#create --method=POST", [] inject_line_after "apps/web/controllers/books/create.rb", "call", 'Hanami.logger.debug(request.env["CONTENT_TYPE"]);self.body = %({"status":"OK"})' server do @@ -556,7 +556,7 @@ Examples: hanami server --no-code-reloading # Disable code reloading OUT - run_command 'hanami server --help', output + run_cmd 'hanami server --help', output end end diff --git a/spec/integration/cli/version_spec.rb b/spec/integration/cli/version_spec.rb index 106da3a2..ea4d3d26 100644 --- a/spec/integration/cli/version_spec.rb +++ b/spec/integration/cli/version_spec.rb @@ -2,25 +2,25 @@ RSpec.describe 'hanami version', type: :integration do context "within a project" do it 'prints current version' do with_project do - run_command 'hanami version', "v#{Hanami::VERSION}" + run_cmd 'hanami version', "v#{Hanami::VERSION}" end end it 'prints current version with v alias' do with_project do - run_command 'hanami v', "v#{Hanami::VERSION}" + run_cmd 'hanami v', "v#{Hanami::VERSION}" end end it 'prints current version with -v alias' do with_project do - run_command 'hanami -v', "v#{Hanami::VERSION}" + run_cmd 'hanami -v', "v#{Hanami::VERSION}" end end it 'prints current version with --version alias' do with_project do - run_command 'hanami --version', "v#{Hanami::VERSION}" + run_cmd 'hanami --version', "v#{Hanami::VERSION}" end end @@ -40,26 +40,26 @@ Options: --help, -h # Print this help OUT - run_command 'hanami version --help', output + run_cmd 'hanami version --help', output end end end context "outside of a project" do it 'prints current version' do - run_command 'hanami version', "v#{Hanami::VERSION}" + run_cmd 'hanami version', "v#{Hanami::VERSION}" end it 'prints current version with v alias' do - run_command 'hanami v', "v#{Hanami::VERSION}" + run_cmd 'hanami v', "v#{Hanami::VERSION}" end it 'prints current version with -v alias' do - run_command 'hanami -v', "v#{Hanami::VERSION}" + run_cmd 'hanami -v', "v#{Hanami::VERSION}" end it 'prints current version with --version alias' do - run_command 'hanami --version', "v#{Hanami::VERSION}" + run_cmd 'hanami --version', "v#{Hanami::VERSION}" end it 'prints help message' do @@ -77,7 +77,7 @@ Options: --help, -h # Print this help OUT - run_command 'hanami version --help', output + run_cmd 'hanami version --help', output end end end diff --git a/spec/support/shared_examples/cli/generate/app.rb b/spec/support/shared_examples/cli/generate/app.rb index 371424c9..8d937b99 100644 --- a/spec/support/shared_examples/cli/generate/app.rb +++ b/spec/support/shared_examples/cli/generate/app.rb @@ -28,7 +28,7 @@ RSpec.shared_examples "a new app" do append .env.test OUT - run_command "hanami generate app #{input}", output + run_cmd "hanami generate app #{input}", output # # apps//application.rb diff --git a/spec/support/shared_examples/cli/generate/migration.rb b/spec/support/shared_examples/cli/generate/migration.rb index d4635719..126997d7 100644 --- a/spec/support/shared_examples/cli/generate/migration.rb +++ b/spec/support/shared_examples/cli/generate/migration.rb @@ -7,7 +7,7 @@ RSpec.shared_examples "a new migration" do project = "bookshelf_generate_migration_#{Random.rand(100_000_000)}" with_project(project) do - run_command "hanami generate migration #{input}", migration + run_cmd "hanami generate migration #{input}", migration # # db/migrations/_.rb diff --git a/spec/support/shared_examples/cli/generate/model.rb b/spec/support/shared_examples/cli/generate/model.rb index 9d9ca452..a31bf0c5 100644 --- a/spec/support/shared_examples/cli/generate/model.rb +++ b/spec/support/shared_examples/cli/generate/model.rb @@ -17,7 +17,7 @@ RSpec.shared_examples "a new model" do "create spec/#{project}/repositories/#{model}_repository_spec.rb" ] - run_command "hanami generate model #{input}", output + run_cmd "hanami generate model #{input}", output # # lib//entities/.rb diff --git a/spec/support/shared_examples/cli/new.rb b/spec/support/shared_examples/cli/new.rb index 4c572866..b41e34c3 100644 --- a/spec/support/shared_examples/cli/new.rb +++ b/spec/support/shared_examples/cli/new.rb @@ -4,7 +4,7 @@ RSpec.shared_examples "a new project" do let(:project) { Hanami::Utils::String.new(input).underscore.to_s } it 'generates vanilla project' do - run_command "hanami new #{input}" + run_cmd "hanami new #{input}" [ "create lib/#{project}.rb", From 4c585e8259fe582e4e0604bfc3b557be305b9a4d Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Wed, 26 Jun 2019 09:20:53 +0200 Subject: [PATCH 11/33] Skip specs for plugins CLI --- spec/integration/cli/plugins_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/integration/cli/plugins_spec.rb b/spec/integration/cli/plugins_spec.rb index d89977a9..e58b4191 100644 --- a/spec/integration/cli/plugins_spec.rb +++ b/spec/integration/cli/plugins_spec.rb @@ -1,14 +1,14 @@ require "pathname" RSpec.describe "CLI plugins", type: :integration do - it "includes its commands in CLI output" do + xit "includes its commands in CLI output" do with_project do bundle_exec "hanami" expect(out).to include("hanami plugin [SUBCOMMAND]") end end - it "executes command from plugin" do + xit "executes command from plugin" do with_project do bundle_exec "hanami plugin version" expect(out).to include("v0.1.0") From 99563c69aa1db65c46a6f68b94226a116856aa43 Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Thu, 4 Jul 2019 12:15:58 +0200 Subject: [PATCH 12/33] Fix specs for custom exception handling templates --- spec/integration/handle_exceptions_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/integration/handle_exceptions_spec.rb b/spec/integration/handle_exceptions_spec.rb index 723d96b0..907a78bb 100644 --- a/spec/integration/handle_exceptions_spec.rb +++ b/spec/integration/handle_exceptions_spec.rb @@ -102,7 +102,7 @@ RSpec.describe "handle exceptions", type: :integration do expect(last_response.status).to eq(500) expect(last_response.body).to_not include("This is a custom template for 500 error") - expect(last_response.body).to include("

Boot Error

Something went wrong while loading") + expect(last_response.body).to include("Error from custom template") end end end @@ -207,7 +207,7 @@ RSpec.describe "handle exceptions", type: :integration do expect(last_response.status).to eq(500) expect(last_response.body).to_not include("This is a custom template for 500 error") - expect(last_response.body).to include("

Boot Error

Something went wrong while loading") + expect(last_response.body).to include("Error from custom template") end end end From dbca2f70c753c68f7694df5e31ff1ff1ab2b4b80 Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Thu, 4 Jul 2019 15:14:36 +0200 Subject: [PATCH 13/33] Relax dependency requirements for `hanami-validations` (#1006) --- hanami.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hanami.gemspec b/hanami.gemspec index ca1edd6a..3422a58f 100644 --- a/hanami.gemspec +++ b/hanami.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.metadata['allowed_push_host'] = 'https://rubygems.org' spec.add_dependency 'hanami-utils', '~> 1.3' - spec.add_dependency 'hanami-validations', '~> 1.3' + spec.add_dependency 'hanami-validations', '~> 1.3', '< 3' spec.add_dependency 'hanami-router', '~> 1.3' spec.add_dependency 'hanami-controller', '~> 1.3' spec.add_dependency 'hanami-view', '~> 1.3' From 131f0e1a8ef454f5e2950d388339c2048db10fc3 Mon Sep 17 00:00:00 2001 From: Leo Generali Date: Fri, 5 Jul 2019 06:03:44 -0400 Subject: [PATCH 14/33] Update URL to Hanami Guides (#999) Default template used to send to http://hanamirb.org/guides. This commit updates link to be https://guides.hanamirb.org/. --- lib/hanami/templates/welcome.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hanami/templates/welcome.html.erb b/lib/hanami/templates/welcome.html.erb index 9baad18d..61b0858d 100644 --- a/lib/hanami/templates/welcome.html.erb +++ b/lib/hanami/templates/welcome.html.erb @@ -38,7 +38,7 @@

  • Website
  • -
  • Guides
  • +
  • Guides
  • API docs
  • Source code
  • Chat
  • From f44bb5dab8d0651e7bf9060e3967f268c9e251ad Mon Sep 17 00:00:00 2001 From: matttrix1999 <48925109+matttrix1999@users.noreply.github.com> Date: Fri, 5 Jul 2019 18:04:54 +0800 Subject: [PATCH 15/33] Remove unnecessary Spaces (#996) Remove extra spaces from the gemspec --- hanami.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hanami.gemspec b/hanami.gemspec index 3422a58f..3ab16140 100644 --- a/hanami.gemspec +++ b/hanami.gemspec @@ -33,8 +33,8 @@ Gem::Specification.new do |spec| spec.add_dependency 'concurrent-ruby', '~> 1.0' spec.add_dependency 'bundler', '>= 1.6', '< 3' - spec.add_development_dependency 'rspec', '~> 3.7' + spec.add_development_dependency 'rspec', '~> 3.7' spec.add_development_dependency 'rack-test', '~> 1.1' - spec.add_development_dependency 'aruba', '~> 0.14' + spec.add_development_dependency 'aruba', '~> 0.14' spec.add_development_dependency 'rake', '~> 12.0' end From 031fccdb69dca11dac2e7974050346f5fa804e09 Mon Sep 17 00:00:00 2001 From: takakuda Date: Fri, 5 Jul 2019 19:06:18 +0900 Subject: [PATCH 16/33] Add empty line (#995) Adds a missing empty line for better legibility --- lib/hanami/rake_tasks.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/hanami/rake_tasks.rb b/lib/hanami/rake_tasks.rb index e5621acf..cb8abba2 100644 --- a/lib/hanami/rake_tasks.rb +++ b/lib/hanami/rake_tasks.rb @@ -1,2 +1,3 @@ require 'hanami/rake_helper' + Hanami::RakeHelper.install_tasks From edd5b4ebdb6eb955b949b27ceac94fa5b61c1796 Mon Sep 17 00:00:00 2001 From: Wisnu Adi Nurcahyo Date: Fri, 5 Jul 2019 17:08:04 +0700 Subject: [PATCH 17/33] Avoid zsh command error (#994) Showing correct command line instructions, quotes included, is better than just one that works just in bash. --- lib/hanami/templates/welcome.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hanami/templates/welcome.html.erb b/lib/hanami/templates/welcome.html.erb index 61b0858d..76968719 100644 --- a/lib/hanami/templates/welcome.html.erb +++ b/lib/hanami/templates/welcome.html.erb @@ -32,7 +32,7 @@

    Hanami is Open Source Software for MVC web development with Ruby.

    -

    Please generate a new action with:
    bundle exec hanami generate action <%= application_name %> home#index --url=/

    +

    Please generate a new action with:
    bundle exec hanami generate action <%= application_name %> 'home#index' --url=/


    From 2e29971efd02f800837186b05cc0cc3432b248ad Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Fri, 5 Jul 2019 12:10:55 +0200 Subject: [PATCH 18/33] Reference Bundler as a top-level constant (#992) Fixes #991 --- bin/hanami | 2 +- lib/hanami/environment.rb | 2 +- lib/hanami/setup.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/hanami b/bin/hanami index b3ede1cd..3c7d754b 100755 --- a/bin/hanami +++ b/bin/hanami @@ -2,5 +2,5 @@ require 'bundler' require 'hanami/cli/commands' -Bundler.require(:plugins) if File.exist?(ENV["BUNDLE_GEMFILE"] || "Gemfile") +::Bundler.require(:plugins) if File.exist?(ENV["BUNDLE_GEMFILE"] || "Gemfile") Hanami::CLI.new(Hanami::CLI::Commands).call diff --git a/lib/hanami/environment.rb b/lib/hanami/environment.rb index b9c7973a..293ecc1f 100644 --- a/lib/hanami/environment.rb +++ b/lib/hanami/environment.rb @@ -391,7 +391,7 @@ module Hanami # @since 0.4.0 # @api private def require_application_environment - Bundler.setup(*bundler_groups) + ::Bundler.setup(*bundler_groups) require project_environment_configuration.to_s # if project_environment_configuration.exist? end diff --git a/lib/hanami/setup.rb b/lib/hanami/setup.rb index ca97186a..c2ed1626 100644 --- a/lib/hanami/setup.rb +++ b/lib/hanami/setup.rb @@ -1,3 +1,3 @@ require 'hanami' -Bundler.require(*Hanami::Environment.new.bundler_groups) +::Bundler.require(*Hanami::Environment.new.bundler_groups) From 96897091373fa44994f8a46ef7c1b83f996696fe Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Fri, 12 Jul 2019 23:08:40 +0200 Subject: [PATCH 19/33] Drone CI (#1007) --- .drone.yml | 349 ++++++++++++++++++++ script/test | 36 ++ spec/integration/cli/server_spec.rb | 4 +- spec/integration/rake/with_minitest_spec.rb | 2 +- spec/integration/sessions_spec.rb | 2 +- 5 files changed, 389 insertions(+), 4 deletions(-) create mode 100644 .drone.yml create mode 100755 script/test diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 00000000..50d2837b --- /dev/null +++ b/.drone.yml @@ -0,0 +1,349 @@ +kind: pipeline +name: ruby-2-6 +group: build + +steps: +- name: install + image: hanami/ruby-2.6-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + path: /usr/local/bundle + commands: + - ruby -v + - gem install bundler + - bundle install --jobs=3 --retry=3 + +- name: unit + image: hanami/ruby-2.6-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + path: /usr/local/bundle + commands: + - COVERAGE=true bundle exec rake spec:unit + +- name: isolation + image: hanami/ruby-2.6-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + # path: /drone/src/vendor/cache + path: /usr/local/bundle + commands: + - ./script/test isolation + +- name: integration + image: hanami/ruby-2.6-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + # path: /drone/src/vendor/cache + path: /usr/local/bundle + commands: + - ./script/test integration + +- name: quality + image: hanami/ruby-2.6-full + docker: + stdin_open: true + tty: true + environment: + CI: true + CODECOV_TOKEN: + from_secret: codecov + volumes: + - name: bundle + # path: /drone/src/vendor/cache + path: /usr/local/bundle + commands: + - CI=true bundle exec rake codecov:upload + +volumes: +- name: bundle + temp: {} + +--- +kind: pipeline +name: ruby-2-5 +group: build + +steps: +- name: install + image: hanami/ruby-2.5-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + path: /usr/local/bundle + commands: + - ruby -v + - gem install bundler + - bundle install --jobs=3 --retry=3 + +- name: unit + image: hanami/ruby-2.5-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + path: /usr/local/bundle + commands: + - COVERAGE=true bundle exec rake spec:unit + +- name: isolation + image: hanami/ruby-2.5-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + # path: /drone/src/vendor/cache + path: /usr/local/bundle + commands: + - ./script/test isolation + +- name: integration + image: hanami/ruby-2.5-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + # path: /drone/src/vendor/cache + path: /usr/local/bundle + commands: + - ./script/test integration + +- name: quality + image: hanami/ruby-2.5-full + docker: + stdin_open: true + tty: true + environment: + CI: true + CODECOV_TOKEN: + from_secret: codecov + volumes: + - name: bundle + # path: /drone/src/vendor/cache + path: /usr/local/bundle + commands: + - CI=true bundle exec rake codecov:upload + +volumes: +- name: bundle + temp: {} + +--- +kind: pipeline +name: ruby-2-4 +group: build + +steps: +- name: install + image: hanami/ruby-2.4-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + path: /usr/local/bundle + commands: + - ruby -v + - gem install bundler + - bundle install --jobs=3 --retry=3 + +- name: unit + image: hanami/ruby-2.4-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + path: /usr/local/bundle + commands: + - COVERAGE=true bundle exec rake spec:unit + +- name: isolation + image: hanami/ruby-2.4-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + # path: /drone/src/vendor/cache + path: /usr/local/bundle + commands: + - ./script/test isolation + +- name: integration + image: hanami/ruby-2.4-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + # path: /drone/src/vendor/cache + path: /usr/local/bundle + commands: + - ./script/test integration + +- name: quality + image: hanami/ruby-2.4-full + docker: + stdin_open: true + tty: true + environment: + CI: true + CODECOV_TOKEN: + from_secret: codecov + volumes: + - name: bundle + # path: /drone/src/vendor/cache + path: /usr/local/bundle + commands: + - CI=true bundle exec rake codecov:upload + +volumes: +- name: bundle + temp: {} + +--- +kind: pipeline +name: ruby-2-3 +group: build + +steps: +- name: install + image: hanami/ruby-2.3-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + path: /usr/local/bundle + commands: + - ruby -v + - gem install bundler + - bundle install --jobs=3 --retry=3 + +- name: unit + image: hanami/ruby-2.3-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + path: /usr/local/bundle + commands: + - COVERAGE=true bundle exec rake spec:unit + +- name: isolation + image: hanami/ruby-2.3-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + # path: /drone/src/vendor/cache + path: /usr/local/bundle + commands: + - ./script/test isolation + +- name: integration + image: hanami/ruby-2.3-full + docker: + stdin_open: true + tty: true + environment: + CI: true + volumes: + - name: bundle + # path: /drone/src/vendor/cache + path: /usr/local/bundle + commands: + - ./script/test integration + +- name: quality + image: hanami/ruby-2.3-full + docker: + stdin_open: true + tty: true + environment: + CI: true + CODECOV_TOKEN: + from_secret: codecov + volumes: + - name: bundle + # path: /drone/src/vendor/cache + path: /usr/local/bundle + commands: + - CI=true bundle exec rake codecov:upload + +volumes: +- name: bundle + temp: {} + +--- +kind: pipeline +name: slack +group: build + +clone: + disable: true + +depends_on: + - ruby-2-3 + +steps: +- name: slack + image: plugins/slack + settings: + link_names: true + webhook: + from_secret: slack + channel: dev + when: + event: + - push diff --git a/script/test b/script/test new file mode 100755 index 00000000..515b35eb --- /dev/null +++ b/script/test @@ -0,0 +1,36 @@ +#!/bin/bash +set -euo pipefail +IFS=$'\n\t' + +run_tests() { + local type=$1 + local pwd=$PWD + local root="$pwd/spec/$type" + + for test in $(find $root -name '*_spec.rb') + do + run_test $root $test + + if [ $? -ne 0 ]; then + local exit_code=$? + echo "Failing test: $test" + exit $exit_code + fi + done +} + +run_test() { + local root=$1 + local test=$2 + local hash="$(shasum "$test" | cut -b 1-40)" + + printf "\n\n\nRunning: $test\n" + SIMPLECOV_COMMAND_NAME=$hash bundle exec rspec $test +} + +main() { + local type=$1 + run_tests $type +} + +main $1 diff --git a/spec/integration/cli/server_spec.rb b/spec/integration/cli/server_spec.rb index c3233bef..d91ebac8 100644 --- a/spec/integration/cli/server_spec.rb +++ b/spec/integration/cli/server_spec.rb @@ -11,7 +11,7 @@ RSpec.describe 'hanami server', type: :integration do expect(page).to have_content("The web, with simplicity.") expect(page).to have_content("Hanami is Open Source Software for MVC web development with Ruby.") - expect(page).to have_content("bundle exec hanami generate action web home#index --url=/") + expect(page).to have_content("bundle exec hanami generate action web 'home#index' --url=/") end end end @@ -23,7 +23,7 @@ RSpec.describe 'hanami server', type: :integration do server do visit "/admin" - expect(page).to have_content("bundle exec hanami generate action admin home#index --url=/") + expect(page).to have_content("bundle exec hanami generate action admin 'home#index' --url=/") end end end diff --git a/spec/integration/rake/with_minitest_spec.rb b/spec/integration/rake/with_minitest_spec.rb index 3b4837be..67117e6d 100644 --- a/spec/integration/rake/with_minitest_spec.rb +++ b/spec/integration/rake/with_minitest_spec.rb @@ -1,6 +1,6 @@ RSpec.describe "Rake: default task", type: :integration do context "with Minitest" do - it "runs tests" do + xit "runs tests" do with_project("bookshelf", test: "minitest") do setup_model diff --git a/spec/integration/sessions_spec.rb b/spec/integration/sessions_spec.rb index bc8fde01..5d0e507d 100644 --- a/spec/integration/sessions_spec.rb +++ b/spec/integration/sessions_spec.rb @@ -8,7 +8,7 @@ RSpec.describe "Sessions", type: :integration do expect(page).to have_content("The web, with simplicity.") expect(page).to have_content("Hanami is Open Source Software for MVC web development with Ruby.") - expect(page).to have_content("bundle exec hanami generate action web home#index --url=/") + expect(page).to have_content("bundle exec hanami generate action web 'home#index' --url=/") end end end From c3b76c77e1eaf2e073fe9fa0cbe4a522c6a07d4b Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Tue, 16 Jul 2019 10:16:38 +0200 Subject: [PATCH 20/33] Fix versioning for `hanami-validations` The previous definition was preventing apps to install `hanami-validations` `2.0.0.alpha1`, in combination with `hanami` `1.3`. --- hanami.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hanami.gemspec b/hanami.gemspec index 3ab16140..305ad7c3 100644 --- a/hanami.gemspec +++ b/hanami.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.metadata['allowed_push_host'] = 'https://rubygems.org' spec.add_dependency 'hanami-utils', '~> 1.3' - spec.add_dependency 'hanami-validations', '~> 1.3', '< 3' + spec.add_dependency 'hanami-validations', '>= 1.3', '< 3' spec.add_dependency 'hanami-router', '~> 1.3' spec.add_dependency 'hanami-controller', '~> 1.3' spec.add_dependency 'hanami-view', '~> 1.3' From d97b02713c5fd18077d8da8e661cc6ba0b7ea2ac Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Fri, 26 Jul 2019 08:38:46 +0200 Subject: [PATCH 21/33] Prepare for v1.3.2 --- CHANGELOG.md | 8 ++++++++ FEATURES.md | 2 ++ lib/hanami/version.rb | 2 +- spec/unit/version_spec.rb | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a7f5caf..ffd6f19f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # Hanami The web, with simplicity. +## v1.3.2 - 2019-07-26 +### Added +- [Luca Guidi] Support both `hanami-validations` 1 and 2 + +### Fixed +- [Wisnu Adi Nurcahyo] Ensure `hanami generate` syntax for Welcome page is compatible with ZSH +- [Luca Guidi] Don't let `hanami` to crash when called without `bundle exec` + ## v1.3.1 - 2019-01-18 ### Added - [Luca Guidi] Official support for Ruby: MRI 2.6 diff --git a/FEATURES.md b/FEATURES.md index 1212ca5c..f23146e1 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -3,6 +3,8 @@ ## Features +## v1.3.2 - 2019-07-26 + ## v1.3.1 - 2019-01-18 ## v1.3.0 - 2018-10-24 diff --git a/lib/hanami/version.rb b/lib/hanami/version.rb index 0bbd6326..76670ba8 100644 --- a/lib/hanami/version.rb +++ b/lib/hanami/version.rb @@ -6,7 +6,7 @@ module Hanami module Version # @since 0.9.0 # @api private - VERSION = '1.3.1'.freeze + VERSION = '1.3.2'.freeze # @since 0.9.0 # @api private diff --git a/spec/unit/version_spec.rb b/spec/unit/version_spec.rb index cd1ea7bf..1c2dc14a 100644 --- a/spec/unit/version_spec.rb +++ b/spec/unit/version_spec.rb @@ -1,5 +1,5 @@ RSpec.describe "Hanami::VERSION" do it "returns current version" do - expect(Hanami::VERSION).to eq("1.3.1") + expect(Hanami::VERSION).to eq("1.3.2") end end From 442c842e7b228b42181216ddd35bd5397246675c Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Thu, 8 Aug 2019 10:30:43 +0200 Subject: [PATCH 22/33] Use `sassc` for tests (#1011) --- Gemfile | 2 +- spec/integration/assets/serve_spec.rb | 2 +- spec/integration/cli/assets/precompile_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 8b46ed51..c44ecf75 100644 --- a/Gemfile +++ b/Gemfile @@ -41,7 +41,7 @@ if RUBY_DESCRIPTION =~ /linux/ end # `hanami assets` integration tests -gem 'sass', require: false +gem 'sassc', require: false gem 'coffee-script', require: false gem 'dotenv', '~> 2.4', require: false diff --git a/spec/integration/assets/serve_spec.rb b/spec/integration/assets/serve_spec.rb index 6aed84ba..6c442980 100644 --- a/spec/integration/assets/serve_spec.rb +++ b/spec/integration/assets/serve_spec.rb @@ -3,7 +3,7 @@ RSpec.describe "assets", type: :integration do it "compiles and serves assets in development mode" do project = "bookshelf_serve_assets" - with_project(project, gems: ['sass']) do + with_project(project, gems: ['sassc']) do generate "action web home#index --url=/" write "apps/web/assets/javascripts/application.css.sass", <<-EOF diff --git a/spec/integration/cli/assets/precompile_spec.rb b/spec/integration/cli/assets/precompile_spec.rb index 5afd21eb..33fc6a9c 100644 --- a/spec/integration/cli/assets/precompile_spec.rb +++ b/spec/integration/cli/assets/precompile_spec.rb @@ -3,7 +3,7 @@ require 'json' RSpec.describe 'hanami assets', type: :integration do describe 'precompile' do it "precompiles assets" do - gems = ['sass', 'coffee-script'] + gems = ['sassc', 'coffee-script'] Platform.match do os(:linux).engine(:ruby) { gems.push('therubyracer') } From 25923823a1d40c39a2402d7b8317768512982f83 Mon Sep 17 00:00:00 2001 From: Alfonso Uceda Date: Sat, 14 Sep 2019 00:40:52 +0200 Subject: [PATCH 23/33] Fix :host mount option (#976) --- lib/hanami/app.rb | 2 +- lib/hanami/configuration.rb | 5 +- lib/hanami/configuration/app.rb | 7 +- lib/hanami/welcome.rb | 7 +- spec/integration/mount_applications_spec.rb | 88 +++++++++++++++++++++ spec/isolation/hanami/configure_spec.rb | 10 ++- 6 files changed, 111 insertions(+), 8 deletions(-) create mode 100644 spec/integration/mount_applications_spec.rb diff --git a/lib/hanami/app.rb b/lib/hanami/app.rb index 61499503..2c51f3bc 100644 --- a/lib/hanami/app.rb +++ b/lib/hanami/app.rb @@ -62,7 +62,7 @@ module Hanami # @api private def mount(configuration) configuration.mounted.each do |klass, app| - routes.mount(klass, at: app.path_prefix) + routes.mount(klass, at: app.path_prefix, host: app.host) end end diff --git a/lib/hanami/configuration.rb b/lib/hanami/configuration.rb index 400f9c4a..ea13828d 100644 --- a/lib/hanami/configuration.rb +++ b/lib/hanami/configuration.rb @@ -20,6 +20,7 @@ module Hanami # @param app [#call] an application compatible with Rack SPEC # @param options [Hash] a set of options # @option :at [String] options the mount point + # @option :host [String] options the mount point # # @since 0.9.0 # @@ -27,12 +28,14 @@ module Hanami # # config/environment.rb # # ... # Hanami.configure do + # mount Beta::Application, at: '/', host: 'beta.bookshelf.com' + # mount Admin::Application, at: '/api' # mount Web::Application, at: '/' # # # ... # end def mount(app, options) - mounted[app] = App.new(app, options.fetch(:at)) + mounted[app] = App.new(app, options) end # Configure database diff --git a/lib/hanami/configuration/app.rb b/lib/hanami/configuration/app.rb index e4c25df7..4c83da48 100644 --- a/lib/hanami/configuration/app.rb +++ b/lib/hanami/configuration/app.rb @@ -7,11 +7,14 @@ module Hanami class App < SimpleDelegator # @api private attr_reader :path_prefix + # @api private + attr_reader :host # @api private - def initialize(app, path_prefix) + def initialize(app, options = {}) super(app) - @path_prefix = path_prefix + @path_prefix = options[:at] + @host = options[:host] end end end diff --git a/lib/hanami/welcome.rb b/lib/hanami/welcome.rb index 0fb4a8f6..42c3d52e 100644 --- a/lib/hanami/welcome.rb +++ b/lib/hanami/welcome.rb @@ -14,6 +14,7 @@ module Hanami # @api private def call(env) @request_path = env['REQUEST_PATH'] || '' + @request_host = env['HTTP_HOST'] || '' @body = [ERB.new(@root.join('welcome.html.erb').read).result(binding)] [200, {}, @body] @@ -29,7 +30,11 @@ module Hanami # @api private def application_class Hanami.configuration.apps do |app| - return app if @request_path.include?(app.path_prefix) + if app.host.nil? + return app if @request_path.include?(app.path_prefix) + else + return app if @request_host == app.host + end end end end diff --git a/spec/integration/mount_applications_spec.rb b/spec/integration/mount_applications_spec.rb new file mode 100644 index 00000000..815b3b4e --- /dev/null +++ b/spec/integration/mount_applications_spec.rb @@ -0,0 +1,88 @@ +require "resolv-replace" +require "net/http" +require "uri" + +RSpec.describe "mount applications", type: :integration do + before do + stub_dns_hosts("127.0.0.1 #{host} www.#{host} #{subdomain} localhost") + end + + let(:host) { "bookshelf.test" } + let(:subdomain) { "beta.#{host}" } + + context "with apps mounted with path" do + it "shows welcome page" do + with_project do + generate_host_middleware + generate "app admin" + generate "app beta" + + replace "config/environment.rb", "Beta::Application", %( mount Beta::Application, at: "/", host: "#{subdomain}") + + server do + # Web + visit "/" + expect(page).to have_content("bundle exec hanami generate action web 'home#index' --url=/") + + # Admin + visit "/admin" + expect(page).to have_content("bundle exec hanami generate action admin 'home#index' --url=/") + end + end + end + end + + context "when apps mounted with host: option" do + it "shows welcome page" do + with_project do + generate_host_middleware + generate "app admin" + generate "app beta" + + replace "config/environment.rb", "Beta::Application", %( mount Beta::Application, at: "/", host: "#{subdomain}") + + port = RSpec::Support::RandomPort.call + server(port: port) do + # Beta + response = raw_http_request("http://#{subdomain}:#{port}") + expect(response.body).to include("bundle exec hanami generate action beta 'home#index' --url=/") + end + end + end + end + + private + + def generate_host_middleware + unshift "config/environment.rb", 'require_relative "./middleware/host"' + + inject_line_after "config/environment.rb", "Hanami.configure", <<-EOL +middleware.use Middleware::Host +EOL + + write "config/middleware/host.rb", <<-EOF +require "uri" + +module Middleware + class Host + def initialize(app) + @app = app + end + + def call(env) + host = URI.parse(env["REQUEST_URI"]).host + env["SERVER_NAME"] = host + env["HTTP_HOST"] = host + env["HTTP_X_FORWARDED_HOST"] = host + + @app.call(env) + end + end +end +EOF + end + + def raw_http_request(uri) + Net::HTTP.get_response(URI.parse(uri)) + end +end diff --git a/spec/isolation/hanami/configure_spec.rb b/spec/isolation/hanami/configure_spec.rb index 1670656a..4fb28fb9 100644 --- a/spec/isolation/hanami/configure_spec.rb +++ b/spec/isolation/hanami/configure_spec.rb @@ -1,10 +1,12 @@ RSpec.describe "Hanami.configure" do before do - application = app - model_config = model_configuration + application = app + beta_application = beta_app + model_config = model_configuration mailer_config = mailer_configuration Hanami.configure do + mount beta_application, at: '/', host: 'beta.hanamirb.test' mount application, at: '/' model(&model_config) mailer(&mailer_config) @@ -12,6 +14,7 @@ RSpec.describe "Hanami.configure" do end let(:app) { double('app') } + let(:beta_app) { double('beta_app') } let(:model_configuration) do lambda do @@ -30,7 +33,8 @@ RSpec.describe "Hanami.configure" do it "setups apps" do mounted = Hanami.configuration.mounted - expect(mounted[app]).to eq(Hanami::Configuration::App.new(app, '/')) + expect(mounted[app]).to eq(Hanami::Configuration::App.new(app, at: '/')) + expect(mounted[beta_app]).to eq(Hanami::Configuration::App.new(beta_app, at: '/', host: 'beta.hanamirb.test')) end it "holds model configuration" do From 9738257cd363c66969f91e9871900b049bd109a8 Mon Sep 17 00:00:00 2001 From: Gray Manley Date: Wed, 18 Sep 2019 12:24:40 -0500 Subject: [PATCH 24/33] Standardize file loading for .env (#1004) --- lib/hanami/cli/commands/new/gitignore.erb | 2 + .../commands/new/gitignore_with_sqlite.erb | 2 + lib/hanami/environment.rb | 48 +++++++++++++++---- spec/integration/cli/new/database_spec.rb | 6 +++ spec/integration/cli/new_spec.rb | 2 + spec/support/fixtures/dotenv/.env.development | 1 + .../fixtures/dotenv/.env.development.local | 1 + spec/support/fixtures/dotenv/.env.local | 1 + spec/support/shared_examples/cli/new.rb | 2 + spec/unit/environment_spec.rb | 32 +++++++++---- 10 files changed, 78 insertions(+), 19 deletions(-) create mode 100644 spec/support/fixtures/dotenv/.env.development.local create mode 100644 spec/support/fixtures/dotenv/.env.local diff --git a/lib/hanami/cli/commands/new/gitignore.erb b/lib/hanami/cli/commands/new/gitignore.erb index e7f26f4f..07a1467e 100644 --- a/lib/hanami/cli/commands/new/gitignore.erb +++ b/lib/hanami/cli/commands/new/gitignore.erb @@ -1,2 +1,4 @@ /public/assets* /tmp +.env.local +.env.*.local diff --git a/lib/hanami/cli/commands/new/gitignore_with_sqlite.erb b/lib/hanami/cli/commands/new/gitignore_with_sqlite.erb index 16938ada..3950d4a8 100644 --- a/lib/hanami/cli/commands/new/gitignore_with_sqlite.erb +++ b/lib/hanami/cli/commands/new/gitignore_with_sqlite.erb @@ -1,3 +1,5 @@ /db/*.sqlite /public/assets* /tmp +.env.local +.env.*.local diff --git a/lib/hanami/environment.rb b/lib/hanami/environment.rb index 293ecc1f..aade8799 100644 --- a/lib/hanami/environment.rb +++ b/lib/hanami/environment.rb @@ -36,6 +36,12 @@ module Hanami # @api private DEFAULT_ENV = 'development'.freeze + # Test environment + # + # @since 1.3.3 + # @api private + TEST_ENV = 'test'.freeze + # Production environment # # @since 0.6.0 @@ -48,11 +54,21 @@ module Hanami # @api private RACK_ENV_DEPLOYMENT = 'deployment'.freeze - # Default `.env` per environment file name - # - # @since 0.2.0 + # @since 1.3.3 # @api private - DEFAULT_DOTENV_ENV = '.env.%s'.freeze + DOTENV_LOCAL_FILE = '.env.local'.freeze + + # Default `.env` files that are loaded. The entries are ordered from highest + # to lowest priority. + # + # @since 1.3.3 + # @api private + DOTENV_FILES = [ + '.env.%{environment}.local'.freeze, + DOTENV_LOCAL_FILE, + '.env.%{environment}'.freeze, + '.env'.freeze + ].freeze # Default configuration directory under application root # @@ -132,9 +148,8 @@ module Hanami # located under the config directory. All the settings in those files will # be exported as `ENV` variables. # - # Master .env file is ignored to suggest clear separation of environment - # configurations and discourage putting sensitive information into source - # control. + # This table: https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use + # has more info on the priority of the .env files. # # The format of those `.env.` files follows UNIX and UNIX-like # operating system environment variable declaration format and compatible @@ -487,10 +502,13 @@ module Hanami # @since 0.2.0 # @api private def set_application_env_vars! - dotenv = root.join(DEFAULT_DOTENV_ENV % environment) - return unless dotenv.exist? + DOTENV_FILES.each do |filename_format| + file = filename_format % { environment: environment } + next unless dotenv_applicable?(file) - env.load!(dotenv) + path = root.join(file) + env.load!(path) if path.exist? + end end # @since 0.1.0 @@ -509,5 +527,15 @@ module Hanami env[RACK_ENV] end end + + # @api private + # @since 1.3.3 + # + # @see https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use + def dotenv_applicable?(file) + return false if file == DOTENV_LOCAL_FILE && environment == TEST_ENV + + true + end end end diff --git a/spec/integration/cli/new/database_spec.rb b/spec/integration/cli/new/database_spec.rb index 63237a60..29bc55e6 100644 --- a/spec/integration/cli/new/database_spec.rb +++ b/spec/integration/cli/new/database_spec.rb @@ -64,6 +64,8 @@ RSpec.describe "hanami new", type: :integration do expect(".gitignore").to have_file_content <<-END /public/assets* /tmp +.env.local +.env.*.local END end end @@ -134,6 +136,8 @@ RSpec.describe "hanami new", type: :integration do /db/*.sqlite /public/assets* /tmp +.env.local +.env.*.local END end end @@ -203,6 +207,8 @@ RSpec.describe "hanami new", type: :integration do expect(".gitignore").to have_file_content <<-END /public/assets* /tmp +.env.local +.env.*.local END end end diff --git a/spec/integration/cli/new_spec.rb b/spec/integration/cli/new_spec.rb index a0111b12..ba1a8aad 100644 --- a/spec/integration/cli/new_spec.rb +++ b/spec/integration/cli/new_spec.rb @@ -453,6 +453,8 @@ END /db/*.sqlite /public/assets* /tmp +.env.local +.env.*.local END # diff --git a/spec/support/fixtures/dotenv/.env.development b/spec/support/fixtures/dotenv/.env.development index 4654f61e..8c8a2588 100644 --- a/spec/support/fixtures/dotenv/.env.development +++ b/spec/support/fixtures/dotenv/.env.development @@ -1,3 +1,4 @@ HANAMI_PORT=42 BAZ="yes" WAT="true" +LOADED_ENV_FILE='.env.development' diff --git a/spec/support/fixtures/dotenv/.env.development.local b/spec/support/fixtures/dotenv/.env.development.local new file mode 100644 index 00000000..0ac0c138 --- /dev/null +++ b/spec/support/fixtures/dotenv/.env.development.local @@ -0,0 +1 @@ +LOADED_ENV_FILE='.env.development.local' diff --git a/spec/support/fixtures/dotenv/.env.local b/spec/support/fixtures/dotenv/.env.local new file mode 100644 index 00000000..8777df71 --- /dev/null +++ b/spec/support/fixtures/dotenv/.env.local @@ -0,0 +1 @@ +GLOBAL_ENV_LOCAL='true' diff --git a/spec/support/shared_examples/cli/new.rb b/spec/support/shared_examples/cli/new.rb index b41e34c3..c0ac9134 100644 --- a/spec/support/shared_examples/cli/new.rb +++ b/spec/support/shared_examples/cli/new.rb @@ -87,6 +87,8 @@ END /db/*.sqlite /public/assets* /tmp +.env.local +.env.*.local END end end diff --git a/spec/unit/environment_spec.rb b/spec/unit/environment_spec.rb index d8498e72..4a19f3bf 100644 --- a/spec/unit/environment_spec.rb +++ b/spec/unit/environment_spec.rb @@ -20,21 +20,27 @@ RSpec.describe Hanami::Environment do end describe "#initialize" do - context "global .env" do - it "doesn't set env vars from .env" do - with_directory('spec/support/fixtures') do + context 'when environment is test' do + let(:env) { Hash['HANAMI_ENV' => 'test'] } + + it 'does not set env variables from .env.local' do + + with_directory('spec/support/fixtures/dotenv') do described_class.new(env: env) - expect(env['FOO']).to be_nil # see spec/support/fixtures/.env + expect(env['GLOBAL_ENV_LOCAL']).to eq(nil) end end + end - it "doesn't sets port" do - with_directory('spec/support/fixtures') do - subject = described_class.new(env: env) + context 'when environment is not test' do + let(:env) { Hash['HANAMI_ENV' => 'development'] } - # returns default instead the value from spec/support/fixtures/.env - expect(subject.port).to eq(2300) + it 'loads environment variables from .env.local' do + with_directory('spec/support/fixtures/dotenv') do + described_class.new(env: env) + + expect(env['GLOBAL_ENV_LOCAL']).to eq('true') end end end @@ -51,6 +57,14 @@ RSpec.describe Hanami::Environment do end end + it 'sets env variables from env specific .local files with highest priority' do + with_directory('spec/support/fixtures/dotenv') do + env = Hash['HANAMI_ENV' => 'development'] + described_class.new(env: env) + expect(env['LOADED_ENV_FILE']).to eq('.env.development.local') + end + end + it "sets port from .env.development" do with_directory('spec/support/fixtures/dotenv') do subject = described_class.new(env: env) From c7d4185de0895252d6d0745137e696d110b728aa Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Thu, 19 Sep 2019 11:13:44 +0200 Subject: [PATCH 25/33] Prepare for v1.3.3 --- CHANGELOG.md | 7 +++++++ FEATURES.md | 4 ++++ lib/hanami/version.rb | 2 +- spec/unit/version_spec.rb | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffd6f19f..b65e44d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Hanami The web, with simplicity. +## v1.3.3 - 2019-09-20 +### Added +- [Gray Manley] Standardize file loading for `.env` files (see: https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use) + +### Fixed +- [Alfonso Uceda & Luca Guidi] Ensure to use `:host` option when mounting an application in main router (e.g. `mount Beta::Application.new, at: "/", host: "beta.hanami.test"`) + ## v1.3.2 - 2019-07-26 ### Added - [Luca Guidi] Support both `hanami-validations` 1 and 2 diff --git a/FEATURES.md b/FEATURES.md index f23146e1..3e81a241 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -3,6 +3,10 @@ ## Features +## v1.3.3 - 2019-09-20 + +- Standardize file loading for `.env` files (see: https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use) + ## v1.3.2 - 2019-07-26 ## v1.3.1 - 2019-01-18 diff --git a/lib/hanami/version.rb b/lib/hanami/version.rb index 76670ba8..62e6c3f1 100644 --- a/lib/hanami/version.rb +++ b/lib/hanami/version.rb @@ -6,7 +6,7 @@ module Hanami module Version # @since 0.9.0 # @api private - VERSION = '1.3.2'.freeze + VERSION = '1.3.3'.freeze # @since 0.9.0 # @api private diff --git a/spec/unit/version_spec.rb b/spec/unit/version_spec.rb index 1c2dc14a..0980c09c 100644 --- a/spec/unit/version_spec.rb +++ b/spec/unit/version_spec.rb @@ -1,5 +1,5 @@ RSpec.describe "Hanami::VERSION" do it "returns current version" do - expect(Hanami::VERSION).to eq("1.3.2") + expect(Hanami::VERSION).to eq("1.3.3") end end From 09d28ac432d73436481c023dd59b84ce9c6b58d1 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2019 11:45:06 +0200 Subject: [PATCH 26/33] Update rake to version 13.0.0 (#1016) --- hanami.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hanami.gemspec b/hanami.gemspec index 305ad7c3..378418cf 100644 --- a/hanami.gemspec +++ b/hanami.gemspec @@ -36,5 +36,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rspec', '~> 3.7' spec.add_development_dependency 'rack-test', '~> 1.1' spec.add_development_dependency 'aruba', '~> 0.14' - spec.add_development_dependency 'rake', '~> 12.0' + spec.add_development_dependency 'rake', '~> 13.0' end From 31103a7b47d8317f51982d6c1356061a6ccf195a Mon Sep 17 00:00:00 2001 From: Ivan Shamatov Date: Sun, 2 Feb 2020 20:51:20 +0300 Subject: [PATCH 27/33] hanami/cli -> dry/cli (#1021) --- Gemfile | 1 - README.md | 1 - bin/hanami | 2 +- hanami.gemspec | 2 +- lib/hanami/cli/commands.rb | 4 +-- lib/hanami/cli/commands/command.rb | 4 +-- lib/hanami/cli/commands/new/Gemfile.erb | 1 - lib/hanami/rake_helper.rb | 2 +- script/setup | 2 +- script/teardown | 2 +- spec/integration/cli/db/apply_spec.rb | 27 +++++++++++++++++++- spec/integration/cli/new/hanami_head_spec.rb | 1 - 12 files changed, 35 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index c44ecf75..85cc31fb 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,6 @@ gem 'hanami-model', '~> 1.3', require: false, git: 'https://github.com/han gem 'hanami-helpers', '~> 1.3', require: false, git: 'https://github.com/hanami/helpers.git', branch: 'master' gem 'hanami-mailer', '~> 1.3', require: false, git: 'https://github.com/hanami/mailer.git', branch: 'master' gem 'hanami-assets', '~> 1.3', require: false, git: 'https://github.com/hanami/assets.git', branch: 'master' -gem 'hanami-cli', '~> 0.3', require: false, git: 'https://github.com/hanami/cli.git', branch: 'master' platforms :ruby do gem 'sqlite3' diff --git a/README.md b/README.md index 5b05c251..a0bbd282 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ which provides the glue that ties all the parts together: * [**Hanami::Helpers**](https://github.com/hanami/helpers) - View helpers for Ruby applications * [**Hanami::Mailer**](https://github.com/hanami/mailer) - Mail for Ruby applications * [**Hanami::Assets**](https://github.com/hanami/assets) - Assets management for Ruby -* [**Hanami::CLI**](https://github.com/hanami/cli) - Ruby command line interface * [**Hanami::Utils**](https://github.com/hanami/utils) - Ruby core extensions and class utilities These components are designed to be used independently or together in a Hanami application. diff --git a/bin/hanami b/bin/hanami index 3c7d754b..5154efc9 100755 --- a/bin/hanami +++ b/bin/hanami @@ -3,4 +3,4 @@ require 'bundler' require 'hanami/cli/commands' ::Bundler.require(:plugins) if File.exist?(ENV["BUNDLE_GEMFILE"] || "Gemfile") -Hanami::CLI.new(Hanami::CLI::Commands).call +Dry::CLI.new(Hanami::CLI::Commands).call diff --git a/hanami.gemspec b/hanami.gemspec index 378418cf..4f2320a2 100644 --- a/hanami.gemspec +++ b/hanami.gemspec @@ -29,7 +29,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'hanami-helpers', '~> 1.3' spec.add_dependency 'hanami-mailer', '~> 1.3' spec.add_dependency 'hanami-assets', '~> 1.3' - spec.add_dependency 'hanami-cli', '~> 0.3' + spec.add_dependency 'dry-cli', '~> 0.5' spec.add_dependency 'concurrent-ruby', '~> 1.0' spec.add_dependency 'bundler', '>= 1.6', '< 3' diff --git a/lib/hanami/cli/commands.rb b/lib/hanami/cli/commands.rb index f056daed..43cb0bc9 100644 --- a/lib/hanami/cli/commands.rb +++ b/lib/hanami/cli/commands.rb @@ -1,4 +1,4 @@ -require 'hanami/cli' +require 'dry/cli' require 'ostruct' module Hanami @@ -54,7 +54,7 @@ module Hanami # @since 1.1.0 # @api private module Commands - extend Hanami::CLI::Registry + extend Dry::CLI::Registry # CLI command context # diff --git a/lib/hanami/cli/commands/command.rb b/lib/hanami/cli/commands/command.rb index 8a17b78a..e1843ad5 100644 --- a/lib/hanami/cli/commands/command.rb +++ b/lib/hanami/cli/commands/command.rb @@ -1,7 +1,7 @@ require 'hanami' require 'hanami/environment' require 'hanami/components' -require 'hanami/cli/command' +require 'dry/cli/command' require 'hanami/cli/commands/project' require 'hanami/cli/commands/templates' require 'concurrent' @@ -17,7 +17,7 @@ module Hanami # Abstract command # # @since 1.1.0 - class Command < Hanami::CLI::Command + class Command < Dry::CLI::Command # @since 1.1.0 # @api private def self.inherited(component) diff --git a/lib/hanami/cli/commands/new/Gemfile.erb b/lib/hanami/cli/commands/new/Gemfile.erb index d32a2cfa..bd291a21 100644 --- a/lib/hanami/cli/commands/new/Gemfile.erb +++ b/lib/hanami/cli/commands/new/Gemfile.erb @@ -10,7 +10,6 @@ gem 'hanami-controller', require: false, git: 'https://github.com/hanami/contro gem 'hanami-view', require: false, git: 'https://github.com/hanami/view.git', branch: 'develop' gem 'hanami-helpers', require: false, git: 'https://github.com/hanami/helpers.git', branch: 'develop' gem 'hanami-mailer', require: false, git: 'https://github.com/hanami/mailer.git', branch: 'develop' -gem 'hanami-cli', require: false, git: 'https://github.com/hanami/cli.git', branch: 'develop' gem 'hanami-assets', require: false, git: 'https://github.com/hanami/assets.git', branch: 'develop' gem 'hanami-model', require: false, git: 'https://github.com/hanami/model.git', branch: 'develop' gem 'hanami', git: 'https://github.com/hanami/hanami.git', branch: 'develop' diff --git a/lib/hanami/rake_helper.rb b/lib/hanami/rake_helper.rb index 77a1cffd..08f7e604 100644 --- a/lib/hanami/rake_helper.rb +++ b/lib/hanami/rake_helper.rb @@ -71,7 +71,7 @@ module Hanami # @api private def run_hanami_command(command) require "hanami/cli/commands" - Hanami::CLI.new(Hanami::CLI::Commands).call(arguments: command.split(/[[:space:]]/)) + Dry::CLI.new(Hanami::CLI::Commands).call(arguments: command.split(/[[:space:]]/)) end # rubocop:enable Metrics/MethodLength end diff --git a/script/setup b/script/setup index e2f6418c..541cf178 100755 --- a/script/setup +++ b/script/setup @@ -20,7 +20,7 @@ bundle_package() { } install_hanami_frameworks() { - declare -a frameworks=(utils validations router helpers model view controller mailer assets cli webconsole) + declare -a frameworks=(utils validations router helpers model view controller mailer assets webconsole) for framework in "${frameworks[@]}" do diff --git a/script/teardown b/script/teardown index 1b5bd504..82899528 100755 --- a/script/teardown +++ b/script/teardown @@ -3,7 +3,7 @@ set -euo pipefail IFS=$'\n\t' uninstall_hanami_gems() { - declare -a frameworks=(hanami hanami-assets hanami-mailer hanami-controller hanami-view hanami-model hanami-helpers hanami-router hanami-validations hanami-cli hanami-webconsole hanami-utils) + declare -a frameworks=(hanami hanami-assets hanami-mailer hanami-controller hanami-view hanami-model hanami-helpers hanami-router hanami-validations hanami-webconsole hanami-utils) for framework in "${frameworks[@]}" do diff --git a/spec/integration/cli/db/apply_spec.rb b/spec/integration/cli/db/apply_spec.rb index 8c8c818f..e241fc9c 100644 --- a/spec/integration/cli/db/apply_spec.rb +++ b/spec/integration/cli/db/apply_spec.rb @@ -1,6 +1,6 @@ RSpec.describe "hanami db", type: :integration do describe "apply" do - it "migrates, dumps structure, deletes migrations" do + it "migrates, dumps structure, deletes migrations", if: RUBY_VERSION < '2.4' do with_project do versions = generate_migrations @@ -24,6 +24,31 @@ SQL end end + it "migrates, dumps structure, deletes migrations", if: RUBY_VERSION >= '2.4' do + with_project do + versions = generate_migrations + + hanami "db apply" + + hanami "db version" + expect(out).to include(versions.last.to_s) + + db = Pathname.new('db') + schema = db.join('schema.sql').to_s + migrations = db.join('migrations') + + expect(schema).to have_file_content <<-SQL +CREATE TABLE `schema_migrations` (`filename` varchar(255) NOT NULL PRIMARY KEY); +CREATE TABLE `users` (`id` integer NOT NULL PRIMARY KEY AUTOINCREMENT, `name` varchar(255), `age` integer); +CREATE TABLE sqlite_sequence(name,seq); +INSERT INTO schema_migrations VALUES('#{versions.first}_create_users.rb'); +INSERT INTO schema_migrations VALUES('#{versions.last}_add_age_to_users.rb'); +SQL + + expect(migrations.children).to be_empty + end + end + it "prints help message" do with_project do output = <<-OUT diff --git a/spec/integration/cli/new/hanami_head_spec.rb b/spec/integration/cli/new/hanami_head_spec.rb index 6eef0ee8..be6ed26a 100644 --- a/spec/integration/cli/new/hanami_head_spec.rb +++ b/spec/integration/cli/new/hanami_head_spec.rb @@ -16,7 +16,6 @@ RSpec.describe "hanami new", type: :integration do expect('Gemfile').to have_file_content(%r{gem 'hanami-view', require: false, git: 'https://github.com/hanami/view.git', branch: 'develop'}) expect('Gemfile').to have_file_content(%r{gem 'hanami-helpers', require: false, git: 'https://github.com/hanami/helpers.git', branch: 'develop'}) expect('Gemfile').to have_file_content(%r{gem 'hanami-mailer', require: false, git: 'https://github.com/hanami/mailer.git', branch: 'develop'}) - expect('Gemfile').to have_file_content(%r{gem 'hanami-cli', require: false, git: 'https://github.com/hanami/cli.git', branch: 'develop'}) expect('Gemfile').to have_file_content(%r{gem 'hanami-assets', require: false, git: 'https://github.com/hanami/assets.git', branch: 'develop'}) expect('Gemfile').to have_file_content(%r{gem 'hanami-model', require: false, git: 'https://github.com/hanami/model.git', branch: 'develop'}) expect('Gemfile').to have_file_content(%r{gem 'hanami', git: 'https://github.com/hanami/hanami.git', branch: 'develop'}) From da2ef9157bc9fb6d443e5989bf35e5f8e8b73749 Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Sun, 2 Feb 2020 18:54:28 +0100 Subject: [PATCH 28/33] Don't pass `command_name:` to `dry-cli` --- lib/hanami/cli/commands/command.rb | 6 ++---- lib/hanami/cli/commands/new.rb | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/hanami/cli/commands/command.rb b/lib/hanami/cli/commands/command.rb index e1843ad5..5a4ccca6 100644 --- a/lib/hanami/cli/commands/command.rb +++ b/lib/hanami/cli/commands/command.rb @@ -82,7 +82,7 @@ module Hanami options = environment.to_options.merge(options) end - super(options) + super(**options) rescue StandardError => e warn e.message warn e.backtrace.join("\n\t") @@ -92,9 +92,7 @@ module Hanami # @since 1.1.0 # @api private - def initialize(command_name:, out: $stdout, files: Utils::Files) - super(command_name: command_name) - + def initialize(out: $stdout, files: Utils::Files) @out = out @files = files @templates = Templates.new(self.class) diff --git a/lib/hanami/cli/commands/new.rb b/lib/hanami/cli/commands/new.rb index 2d6324c2..acaf9afa 100644 --- a/lib/hanami/cli/commands/new.rb +++ b/lib/hanami/cli/commands/new.rb @@ -502,7 +502,7 @@ module Hanami # @since 1.1.0 # @api private def generate_app(context) - Hanami::CLI::Commands::New::App.new(command_name: "generate app", out: @out, files: @files).call(app: context.application_name, application_base_url: context.application_base_url, **context.options) + Hanami::CLI::Commands::New::App.new(out: @out, files: @files).call(app: context.application_name, application_base_url: context.application_base_url, **context.options) end # @since 1.1.0 @@ -565,8 +565,8 @@ module Hanami # @since 1.1.0 # @api private - def initialize(*) - super + def initialize(*args, **kwargs) + super(*args, **kwargs) @templates = Templates.new(self.class.superclass) end end From 77c47ccfc5b96c44226ec15096d2ab07d9b831f3 Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Sun, 2 Feb 2020 20:05:37 +0100 Subject: [PATCH 29/33] Fix build --- spec/integration/cli/db/apply_spec.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/integration/cli/db/apply_spec.rb b/spec/integration/cli/db/apply_spec.rb index e241fc9c..4205b16c 100644 --- a/spec/integration/cli/db/apply_spec.rb +++ b/spec/integration/cli/db/apply_spec.rb @@ -40,9 +40,8 @@ SQL expect(schema).to have_file_content <<-SQL CREATE TABLE `schema_migrations` (`filename` varchar(255) NOT NULL PRIMARY KEY); CREATE TABLE `users` (`id` integer NOT NULL PRIMARY KEY AUTOINCREMENT, `name` varchar(255), `age` integer); -CREATE TABLE sqlite_sequence(name,seq); -INSERT INTO schema_migrations VALUES('#{versions.first}_create_users.rb'); -INSERT INTO schema_migrations VALUES('#{versions.last}_add_age_to_users.rb'); +INSERT INTO "schema_migrations" VALUES('#{versions.first}_create_users.rb'); +INSERT INTO "schema_migrations" VALUES('#{versions.last}_add_age_to_users.rb'); SQL expect(migrations.children).to be_empty From b68ab002ec0c4a8f3c0de4560fd7e7265aa66f19 Mon Sep 17 00:00:00 2001 From: Mike Rogers Date: Tue, 10 Mar 2020 20:49:07 +0000 Subject: [PATCH 30/33] Correcting documentation typos (#1033) --- CHANGELOG.md | 12 ++++++------ FEATURES.md | 2 +- lib/hanami/components/app/assets.rb | 2 +- lib/hanami/components/app/controller.rb | 2 +- lib/hanami/components/app/routes.rb | 2 +- lib/hanami/components/app/view.rb | 2 +- lib/hanami/early_hints.rb | 2 +- spec/integration/cli/generate/action_spec.rb | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b65e44d9..3481047a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ The web, with simplicity. ### Fixed - [Aidan Coyle] Remove from app generator support for deprecated `force_ssl` setting - [Alessandro Caporrini] Remove from app generator support for deprecated `body_parsers` setting -- [Daphne Rouw & Sean Collins] Make app generator to work when code in `config/enviroment.rb` uses double quotes +- [Daphne Rouw & Sean Collins] Make app generator to work when code in `config/environment.rb` uses double quotes ## v1.3.0 - 2018-10-24 ### Added @@ -41,7 +41,7 @@ The web, with simplicity. ### Fixed - [Anton Davydov] Make possible to pass extra settings for custom logger instances (eg. `logger SemanticLogger.new, :foo, :bar`) -- [graywolf] Ensure `hanami generate app` to work without `require_relative` entries in `config/enviroment.rb` +- [graywolf] Ensure `hanami generate app` to work without `require_relative` entries in `config/environment.rb` - [Makoto Tajitsu & Luca Guidi] Fixed regression for `hanami new .` that used to generate a broken project ### Fixed @@ -158,7 +158,7 @@ The web, with simplicity. - [Luca Guidi] Make compatible with Rack 2.0 only - [Luca Guidi] Removed `logger` settings from Hanami applications - [Luca Guidi] Removed logger for Hanami applications (eg `Web.logger`) -- [Luca Guidi] Changed mailer syntax in `config/enviroment.rb` +- [Luca Guidi] Changed mailer syntax in `config/environment.rb` ## v0.9.2 - 2016-12-19 ## Added @@ -247,11 +247,11 @@ The web, with simplicity. ## v0.7.2 - 2016-02-09 ### Fixed -- [Alfonso Uceda Pompa] Fixed routing issue when static assets server tried to hijiack paths that are matching directories in public directory +- [Alfonso Uceda Pompa] Fixed routing issue when static assets server tried to hijack paths that are matching directories in public directory ## v0.7.1 - 2016-02-05 ### Fixed -- [Anton Davydov] Fixed routing issue when static assets server tried to hijiack requests belonging to dynamic endpoints +- [Anton Davydov] Fixed routing issue when static assets server tried to hijack requests belonging to dynamic endpoints - [Anatolii Didukh] Ensure to fallback to default engine for `hanami console` ## v0.7.0 - 2016-01-22 @@ -386,7 +386,7 @@ The web, with simplicity. ## v0.3.0 - 2015-03-23 ### Added - [Luca Guidi] Introduced action generator. Eg. `bundle exec lotus generate action web dashboard#index` -- [Alfonso Uceda Pompa] Allow to specify default coookies options in application configuration. Eg. `cookies true, { domain: 'lotusrb.org' }` +- [Alfonso Uceda Pompa] Allow to specify default cookies options in application configuration. Eg. `cookies true, { domain: 'lotusrb.org' }` - [Tom Kadwill] Include `Lotus::Helpers` in views. - [Linus Pettersson] Allow to specify `--database` CLI option when generate a new project. Eg. `lotus new bookshelf --database=postgresql` - [Linus Pettersson] Initialize a Git repository when generating a new project diff --git a/FEATURES.md b/FEATURES.md index 3e81a241..9d5e5c70 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -26,7 +26,7 @@ - Unobtrusive JavaScript (UJS) (via `hanami-ujs` gem) - Interactive console for development error page (via `hanami-webconsole` gem) - CLI: register callbacks for `hanami` commands (`Hanami::CLI.after("db migrate", MyCallback.new)` or `Hanami::CLI.after("db migrate") { ... }`) -- Project level Rack middleware stack (`Hanami.configure { middleware.use MyRackMiddlewre }`) +- Project level Rack middleware stack (`Hanami.configure { middleware.use MyRackMiddleware }`) - Plugins can hook into project configuration (`Hanami.plugin { middleware.use AnotherRackMiddleware }`) - Custom repository commands - Coloured logging diff --git a/lib/hanami/components/app/assets.rb b/lib/hanami/components/app/assets.rb index 67e90f44..4aa6137a 100644 --- a/lib/hanami/components/app/assets.rb +++ b/lib/hanami/components/app/assets.rb @@ -5,7 +5,7 @@ module Hanami # @since 0.9.0 # @api private module App - # hanami-assets configuration for a sigle Hanami application in the project. + # hanami-assets configuration for a single Hanami application in the project. # # @since 0.9.0 # @api private diff --git a/lib/hanami/components/app/controller.rb b/lib/hanami/components/app/controller.rb index 71b26c91..b3767224 100644 --- a/lib/hanami/components/app/controller.rb +++ b/lib/hanami/components/app/controller.rb @@ -8,7 +8,7 @@ module Hanami # @since 0.9.0 # @api private module App - # hanami-controller configuration for a sigle Hanami application in the project. + # hanami-controller configuration for a single Hanami application in the project. # # @since 0.9.0 # @api private diff --git a/lib/hanami/components/app/routes.rb b/lib/hanami/components/app/routes.rb index f23bfd18..bbdf2ee8 100644 --- a/lib/hanami/components/app/routes.rb +++ b/lib/hanami/components/app/routes.rb @@ -8,7 +8,7 @@ module Hanami # @since 0.9.0 # @api private module App - # hanami-router configuration for a sigle Hanami application in the project. + # hanami-router configuration for a single Hanami application in the project. # # @since 0.9.0 # @api private diff --git a/lib/hanami/components/app/view.rb b/lib/hanami/components/app/view.rb index 077f9c41..7a460b5a 100644 --- a/lib/hanami/components/app/view.rb +++ b/lib/hanami/components/app/view.rb @@ -5,7 +5,7 @@ module Hanami # @since 0.9.0 # @api private module App - # hanami-view configuration for a sigle Hanami application in the project. + # hanami-view configuration for a single Hanami application in the project. # # @since 0.9.0 # @api private diff --git a/lib/hanami/early_hints.rb b/lib/hanami/early_hints.rb index 4cc8e987..80ee73df 100644 --- a/lib/hanami/early_hints.rb +++ b/lib/hanami/early_hints.rb @@ -3,7 +3,7 @@ module Hanami # HTTP/2 Early Hints Rack middleware # - # It sends extra responses **before** the main reponse is sent. + # It sends extra responses **before** the main response is sent. # These extra responses are HTTP/2 Early Hints (103). # They specify the web assets (javascripts, stylesheets, etc..) to be "pushed", # so modern browsers pre-fetch them in parallel with the main HTTP response. diff --git a/spec/integration/cli/generate/action_spec.rb b/spec/integration/cli/generate/action_spec.rb index 07b785e7..5c0dfb54 100644 --- a/spec/integration/cli/generate/action_spec.rb +++ b/spec/integration/cli/generate/action_spec.rb @@ -262,7 +262,7 @@ RSpec.describe "hanami generate", type: :integration do end it "fails with unknown argument" do - with_project('bookshelf_generate_action_uknown_method') do + with_project('bookshelf_generate_action_unknown_method') do output = "`FOO' is not a valid HTTP method. Please use one of: `GET' `POST' `PUT' `DELETE' `HEAD' `OPTIONS' `TRACE' `PATCH' `OPTIONS' `LINK' `UNLINK'" run_cmd "hanami generate action web books#create --method=FOO", output, exit_status: 1 end From df741d123a0a1774b21474d9a201b5387e5830d4 Mon Sep 17 00:00:00 2001 From: Tim Riley Date: Wed, 8 Apr 2020 01:02:06 +1000 Subject: [PATCH 31/33] Point to 1.x-master branch of hanami-view (#1037) This is the new default branch for the 1.x series of releases (the master branch now contains the full history of dry-view, now renamed to hanami-view). --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 85cc31fb..2a1af3e5 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'hanami-utils', '~> 1.3', require: false, git: 'https://github.com/han gem 'hanami-validations', '~> 1.3', require: false, git: 'https://github.com/hanami/validations.git', branch: 'master' gem 'hanami-router', '~> 1.3', require: false, git: 'https://github.com/hanami/router.git', branch: 'master' gem 'hanami-controller', '~> 1.3', require: false, git: 'https://github.com/hanami/controller.git', branch: 'master' -gem 'hanami-view', '~> 1.3', require: false, git: 'https://github.com/hanami/view.git', branch: 'master' +gem 'hanami-view', '~> 1.3', require: false, git: 'https://github.com/hanami/view.git', branch: '1.x-master' gem 'hanami-model', '~> 1.3', require: false, git: 'https://github.com/hanami/model.git', branch: 'master' gem 'hanami-helpers', '~> 1.3', require: false, git: 'https://github.com/hanami/helpers.git', branch: 'master' gem 'hanami-mailer', '~> 1.3', require: false, git: 'https://github.com/hanami/mailer.git', branch: 'master' From 80fd6ad37955a9e8f8088dcad7206fa328a9cc4d Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Thu, 12 Nov 2020 13:59:05 +0100 Subject: [PATCH 32/33] Remove `&&` in `script/ci` --- script/ci | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/script/ci b/script/ci index e16e82d1..7355ca30 100755 --- a/script/ci +++ b/script/ci @@ -63,11 +63,11 @@ upload_code_coverage() { } main() { - setup && - run_unit_tests && - run_isolation_tests && - run_integration_tests && - upload_code_coverage + setup + run_unit_tests + run_isolation_tests + run_integration_tests + upload_code_coverage } trap teardown EXIT From ddac765fb045974d4dbb8c96c89f62191d9de850 Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Fri, 15 Jan 2021 21:17:42 +0100 Subject: [PATCH 33/33] GitHub Actions (#1090) --- .drone.yml | 349 -------------------------- .github/workflows/ci.yml | 43 ++++ .travis.yml | 24 -- LICENSE.md | 2 +- README.md | 4 +- spec/integration/cli/db/apply_spec.rb | 5 +- 6 files changed, 49 insertions(+), 378 deletions(-) delete mode 100644 .drone.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 50d2837b..00000000 --- a/.drone.yml +++ /dev/null @@ -1,349 +0,0 @@ -kind: pipeline -name: ruby-2-6 -group: build - -steps: -- name: install - image: hanami/ruby-2.6-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - path: /usr/local/bundle - commands: - - ruby -v - - gem install bundler - - bundle install --jobs=3 --retry=3 - -- name: unit - image: hanami/ruby-2.6-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - path: /usr/local/bundle - commands: - - COVERAGE=true bundle exec rake spec:unit - -- name: isolation - image: hanami/ruby-2.6-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - # path: /drone/src/vendor/cache - path: /usr/local/bundle - commands: - - ./script/test isolation - -- name: integration - image: hanami/ruby-2.6-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - # path: /drone/src/vendor/cache - path: /usr/local/bundle - commands: - - ./script/test integration - -- name: quality - image: hanami/ruby-2.6-full - docker: - stdin_open: true - tty: true - environment: - CI: true - CODECOV_TOKEN: - from_secret: codecov - volumes: - - name: bundle - # path: /drone/src/vendor/cache - path: /usr/local/bundle - commands: - - CI=true bundle exec rake codecov:upload - -volumes: -- name: bundle - temp: {} - ---- -kind: pipeline -name: ruby-2-5 -group: build - -steps: -- name: install - image: hanami/ruby-2.5-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - path: /usr/local/bundle - commands: - - ruby -v - - gem install bundler - - bundle install --jobs=3 --retry=3 - -- name: unit - image: hanami/ruby-2.5-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - path: /usr/local/bundle - commands: - - COVERAGE=true bundle exec rake spec:unit - -- name: isolation - image: hanami/ruby-2.5-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - # path: /drone/src/vendor/cache - path: /usr/local/bundle - commands: - - ./script/test isolation - -- name: integration - image: hanami/ruby-2.5-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - # path: /drone/src/vendor/cache - path: /usr/local/bundle - commands: - - ./script/test integration - -- name: quality - image: hanami/ruby-2.5-full - docker: - stdin_open: true - tty: true - environment: - CI: true - CODECOV_TOKEN: - from_secret: codecov - volumes: - - name: bundle - # path: /drone/src/vendor/cache - path: /usr/local/bundle - commands: - - CI=true bundle exec rake codecov:upload - -volumes: -- name: bundle - temp: {} - ---- -kind: pipeline -name: ruby-2-4 -group: build - -steps: -- name: install - image: hanami/ruby-2.4-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - path: /usr/local/bundle - commands: - - ruby -v - - gem install bundler - - bundle install --jobs=3 --retry=3 - -- name: unit - image: hanami/ruby-2.4-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - path: /usr/local/bundle - commands: - - COVERAGE=true bundle exec rake spec:unit - -- name: isolation - image: hanami/ruby-2.4-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - # path: /drone/src/vendor/cache - path: /usr/local/bundle - commands: - - ./script/test isolation - -- name: integration - image: hanami/ruby-2.4-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - # path: /drone/src/vendor/cache - path: /usr/local/bundle - commands: - - ./script/test integration - -- name: quality - image: hanami/ruby-2.4-full - docker: - stdin_open: true - tty: true - environment: - CI: true - CODECOV_TOKEN: - from_secret: codecov - volumes: - - name: bundle - # path: /drone/src/vendor/cache - path: /usr/local/bundle - commands: - - CI=true bundle exec rake codecov:upload - -volumes: -- name: bundle - temp: {} - ---- -kind: pipeline -name: ruby-2-3 -group: build - -steps: -- name: install - image: hanami/ruby-2.3-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - path: /usr/local/bundle - commands: - - ruby -v - - gem install bundler - - bundle install --jobs=3 --retry=3 - -- name: unit - image: hanami/ruby-2.3-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - path: /usr/local/bundle - commands: - - COVERAGE=true bundle exec rake spec:unit - -- name: isolation - image: hanami/ruby-2.3-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - # path: /drone/src/vendor/cache - path: /usr/local/bundle - commands: - - ./script/test isolation - -- name: integration - image: hanami/ruby-2.3-full - docker: - stdin_open: true - tty: true - environment: - CI: true - volumes: - - name: bundle - # path: /drone/src/vendor/cache - path: /usr/local/bundle - commands: - - ./script/test integration - -- name: quality - image: hanami/ruby-2.3-full - docker: - stdin_open: true - tty: true - environment: - CI: true - CODECOV_TOKEN: - from_secret: codecov - volumes: - - name: bundle - # path: /drone/src/vendor/cache - path: /usr/local/bundle - commands: - - CI=true bundle exec rake codecov:upload - -volumes: -- name: bundle - temp: {} - ---- -kind: pipeline -name: slack -group: build - -clone: - disable: true - -depends_on: - - ruby-2-3 - -steps: -- name: slack - image: plugins/slack - settings: - link_names: true - webhook: - from_secret: slack - channel: dev - when: - event: - - push diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..40238fe6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: ci + +"on": + push: + paths: + - ".github/workflows/ci.yml" + - "lib/**" + - "*.gemspec" + - "spec/**" + - "Rakefile" + - "Gemfile" + - ".rubocop.yml" + pull_request: + branches: + - master + create: + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: + - "2.7" + - "2.6" + - "2.5" + - "2.4" + steps: + - uses: actions/checkout@v1 + - name: Install package dependencies + run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS" + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{matrix.ruby}} + - name: Install latest bundler + run: | + gem install bundler --no-document + - name: Bundle install + run: bundle install --jobs 4 --retry 3 + - name: Run all tests + run: script/ci diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index afe27da6..00000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: ruby -sudo: false -cache: bundler -install: true -before_install: - - mkdir $PWD/vendor/phantomjs && tar -xjf $PWD/vendor/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/vendor/phantomjs --strip-components=1 - - export PATH=$PWD/vendor/phantomjs/bin:$PATH - - phantomjs --version - - gem update --system # Required to install rainbow 2.2.1 https://github.com/sickill/rainbow/issues/44#issuecomment-274412027 -script: - - './script/ci' -rvm: - - 2.3.8 - - 2.4.5 - - 2.5.3 - - 2.6.0 - -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/fde2367248d53de4fe70 - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: never # options: [always|never|change] default: always diff --git a/LICENSE.md b/LICENSE.md index 2e763592..ebdf22bb 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright © 2014-2019 Luca Guidi +Copyright © 2014-2021 Luca Guidi MIT License diff --git a/README.md b/README.md index a0bbd282..5a7e713e 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ These components are designed to be used independently or together in a Hanami a ## Status [![Gem Version](https://badge.fury.io/rb/hanami.svg)](https://badge.fury.io/rb/hanami) -[![TravisCI](https://travis-ci.org/hanami/hanami.svg?branch=master)](https://travis-ci.org/hanami/hanami) +[![CI](https://github.com/hanami/hanami/workflows/ci/badge.svg?branch=master)](https://github.com/hanami/hanami/actions?query=workflow%3Aci+branch%3Amaster) [![Test Coverage](https://codecov.io/gh/hanami/hanami/branch/master/graph/badge.svg)](https://codecov.io/gh/hanami/hanami) [![Depfu](https://badges.depfu.com/badges/ba000e0f69e6ef1c44cd3038caaa1841/overview.svg)](https://depfu.com/github/hanami/hanami?project=Bundler) [![Inline Docs](http://inch-ci.org/github/hanami/hanami.svg)](http://inch-ci.org/github/hanami/hanami) @@ -136,4 +136,4 @@ Released under MIT License. This project was formerly known as Lotus (`lotusrb`). -Copyright © 2014-2019 Luca Guidi. +Copyright © 2014-2021 Luca Guidi. diff --git a/spec/integration/cli/db/apply_spec.rb b/spec/integration/cli/db/apply_spec.rb index 4205b16c..e241fc9c 100644 --- a/spec/integration/cli/db/apply_spec.rb +++ b/spec/integration/cli/db/apply_spec.rb @@ -40,8 +40,9 @@ SQL expect(schema).to have_file_content <<-SQL CREATE TABLE `schema_migrations` (`filename` varchar(255) NOT NULL PRIMARY KEY); CREATE TABLE `users` (`id` integer NOT NULL PRIMARY KEY AUTOINCREMENT, `name` varchar(255), `age` integer); -INSERT INTO "schema_migrations" VALUES('#{versions.first}_create_users.rb'); -INSERT INTO "schema_migrations" VALUES('#{versions.last}_add_age_to_users.rb'); +CREATE TABLE sqlite_sequence(name,seq); +INSERT INTO schema_migrations VALUES('#{versions.first}_create_users.rb'); +INSERT INTO schema_migrations VALUES('#{versions.last}_add_age_to_users.rb'); SQL expect(migrations.children).to be_empty