hanami 1.3.1 → 2.0.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +110 -6
- data/FEATURES.md +9 -1
- data/LICENSE.md +1 -1
- data/README.md +4 -5
- data/hanami.gemspec +26 -30
- data/lib/hanami.rb +40 -243
- data/lib/hanami/application.rb +338 -174
- data/lib/hanami/application/autoloader/inflector_adapter.rb +22 -0
- data/lib/hanami/application/container/boot/inflector.rb +7 -0
- data/lib/hanami/application/container/boot/logger.rb +8 -0
- data/lib/hanami/application/container/boot/rack_logger.rb +19 -0
- data/lib/hanami/application/container/boot/rack_monitor.rb +12 -0
- data/lib/hanami/application/container/boot/settings.rb +7 -0
- data/lib/hanami/application/router.rb +59 -0
- data/lib/hanami/application/routing/middleware/stack.rb +89 -0
- data/lib/hanami/application/routing/resolver.rb +82 -0
- data/lib/hanami/application/routing/resolver/node.rb +50 -0
- data/lib/hanami/application/routing/resolver/trie.rb +59 -0
- data/lib/hanami/application/settings.rb +23 -0
- data/lib/hanami/application/settings/definition.rb +26 -0
- data/lib/hanami/application/settings/loader.rb +97 -0
- data/lib/hanami/application/settings/struct.rb +65 -0
- data/lib/hanami/boot.rb +5 -0
- data/lib/hanami/cli/application/cli.rb +40 -0
- data/lib/hanami/cli/application/command.rb +47 -0
- data/lib/hanami/cli/application/commands.rb +16 -0
- data/lib/hanami/cli/application/commands/console.rb +81 -0
- data/lib/hanami/cli/base_command.rb +48 -0
- data/lib/hanami/cli/commands.rb +6 -42
- data/lib/hanami/cli/commands/command.rb +20 -30
- data/lib/hanami/cli/commands/server.rb +63 -14
- data/lib/hanami/configuration.rb +248 -190
- data/lib/hanami/configuration/middleware.rb +8 -28
- data/lib/hanami/configuration/router.rb +50 -0
- data/lib/hanami/configuration/sessions.rb +50 -0
- data/lib/hanami/init.rb +5 -0
- data/lib/hanami/server.rb +5 -69
- data/lib/hanami/setup.rb +8 -2
- data/lib/hanami/slice.rb +138 -0
- data/lib/hanami/version.rb +3 -1
- data/lib/hanami/web/rack_logger.rb +96 -0
- metadata +84 -228
- data/bin/hanami +0 -6
- data/lib/hanami/action/csrf_protection.rb +0 -211
- data/lib/hanami/action/routing_helpers.rb +0 -40
- data/lib/hanami/app.rb +0 -96
- data/lib/hanami/application_configuration.rb +0 -1495
- data/lib/hanami/application_name.rb +0 -108
- data/lib/hanami/application_namespace.rb +0 -14
- data/lib/hanami/assets/asset.rb +0 -72
- data/lib/hanami/assets/static.rb +0 -102
- data/lib/hanami/cli/commands/assets.rb +0 -16
- data/lib/hanami/cli/commands/assets/precompile.rb +0 -42
- data/lib/hanami/cli/commands/console.rb +0 -95
- data/lib/hanami/cli/commands/db.rb +0 -32
- data/lib/hanami/cli/commands/db/apply.rb +0 -32
- data/lib/hanami/cli/commands/db/console.rb +0 -44
- data/lib/hanami/cli/commands/db/create.rb +0 -32
- data/lib/hanami/cli/commands/db/drop.rb +0 -32
- data/lib/hanami/cli/commands/db/migrate.rb +0 -39
- data/lib/hanami/cli/commands/db/prepare.rb +0 -32
- data/lib/hanami/cli/commands/db/rollback.rb +0 -59
- data/lib/hanami/cli/commands/db/version.rb +0 -32
- data/lib/hanami/cli/commands/destroy.rb +0 -26
- data/lib/hanami/cli/commands/destroy/action.rb +0 -137
- data/lib/hanami/cli/commands/destroy/app.rb +0 -159
- data/lib/hanami/cli/commands/destroy/mailer.rb +0 -74
- data/lib/hanami/cli/commands/destroy/migration.rb +0 -51
- data/lib/hanami/cli/commands/destroy/model.rb +0 -84
- data/lib/hanami/cli/commands/generate.rb +0 -28
- data/lib/hanami/cli/commands/generate/action.rb +0 -321
- data/lib/hanami/cli/commands/generate/action/action.erb +0 -7
- data/lib/hanami/cli/commands/generate/action/action_spec.minitest.erb +0 -11
- data/lib/hanami/cli/commands/generate/action/action_spec.rspec.erb +0 -9
- data/lib/hanami/cli/commands/generate/action/action_without_view.erb +0 -7
- data/lib/hanami/cli/commands/generate/action/view.erb +0 -7
- data/lib/hanami/cli/commands/generate/action/view_spec.minitest.erb +0 -12
- data/lib/hanami/cli/commands/generate/action/view_spec.rspec.erb +0 -10
- data/lib/hanami/cli/commands/generate/app.rb +0 -243
- data/lib/hanami/cli/commands/generate/app/application.erb +0 -313
- data/lib/hanami/cli/commands/generate/app/favicon.ico +0 -0
- data/lib/hanami/cli/commands/generate/app/gitkeep.erb +0 -0
- data/lib/hanami/cli/commands/generate/app/layout.erb +0 -7
- data/lib/hanami/cli/commands/generate/app/layout_spec.minitest.erb +0 -10
- data/lib/hanami/cli/commands/generate/app/layout_spec.rspec.erb +0 -10
- data/lib/hanami/cli/commands/generate/app/routes.erb +0 -5
- data/lib/hanami/cli/commands/generate/app/template.erb.erb +0 -10
- data/lib/hanami/cli/commands/generate/app/template.haml.erb +0 -7
- data/lib/hanami/cli/commands/generate/app/template.slim.erb +0 -8
- data/lib/hanami/cli/commands/generate/mailer.rb +0 -104
- data/lib/hanami/cli/commands/generate/mailer/mailer.erb +0 -9
- data/lib/hanami/cli/commands/generate/mailer/mailer_spec.minitest.erb +0 -7
- data/lib/hanami/cli/commands/generate/mailer/mailer_spec.rspec.erb +0 -5
- data/lib/hanami/cli/commands/generate/migration.rb +0 -41
- data/lib/hanami/cli/commands/generate/migration/migration.erb +0 -4
- data/lib/hanami/cli/commands/generate/model.rb +0 -125
- data/lib/hanami/cli/commands/generate/model/entity.erb +0 -2
- data/lib/hanami/cli/commands/generate/model/entity_spec.minitest.erb +0 -5
- data/lib/hanami/cli/commands/generate/model/entity_spec.rspec.erb +0 -3
- data/lib/hanami/cli/commands/generate/model/migration.erb +0 -10
- data/lib/hanami/cli/commands/generate/model/repository.erb +0 -5
- data/lib/hanami/cli/commands/generate/model/repository_spec.minitest.erb +0 -5
- data/lib/hanami/cli/commands/generate/model/repository_spec.rspec.erb +0 -3
- data/lib/hanami/cli/commands/generate/secret.rb +0 -48
- data/lib/hanami/cli/commands/new.rb +0 -578
- data/lib/hanami/cli/commands/new/.env.development.erb +0 -3
- data/lib/hanami/cli/commands/new/.env.test.erb +0 -3
- data/lib/hanami/cli/commands/new/.gitkeep.erb +0 -0
- data/lib/hanami/cli/commands/new/Gemfile.erb +0 -58
- data/lib/hanami/cli/commands/new/README.md.erb +0 -33
- data/lib/hanami/cli/commands/new/config.ru.erb +0 -3
- data/lib/hanami/cli/commands/new/config/boot.erb +0 -2
- data/lib/hanami/cli/commands/new/config/environment.erb +0 -49
- data/lib/hanami/cli/commands/new/gitignore.erb +0 -2
- data/lib/hanami/cli/commands/new/gitignore_with_sqlite.erb +0 -3
- data/lib/hanami/cli/commands/new/hanamirc.erb +0 -3
- data/lib/hanami/cli/commands/new/lib/project.erb +0 -2
- data/lib/hanami/cli/commands/new/minitest/Rakefile.erb +0 -12
- data/lib/hanami/cli/commands/new/minitest/features_helper.erb +0 -11
- data/lib/hanami/cli/commands/new/minitest/spec_helper.erb +0 -7
- data/lib/hanami/cli/commands/new/rspec/Rakefile.erb +0 -9
- data/lib/hanami/cli/commands/new/rspec/capybara.erb +0 -8
- data/lib/hanami/cli/commands/new/rspec/features_helper.erb +0 -12
- data/lib/hanami/cli/commands/new/rspec/rspec.erb +0 -2
- data/lib/hanami/cli/commands/new/rspec/spec_helper.erb +0 -103
- data/lib/hanami/cli/commands/new/schema.sql.erb +0 -0
- data/lib/hanami/cli/commands/project.rb +0 -421
- data/lib/hanami/cli/commands/routes.rb +0 -21
- data/lib/hanami/cli/commands/templates.rb +0 -31
- data/lib/hanami/cli/commands/version.rb +0 -19
- data/lib/hanami/common_logger.rb +0 -93
- data/lib/hanami/components.rb +0 -156
- data/lib/hanami/components/app/assets.rb +0 -59
- data/lib/hanami/components/app/controller.rb +0 -74
- data/lib/hanami/components/app/routes.rb +0 -59
- data/lib/hanami/components/app/view.rb +0 -44
- data/lib/hanami/components/component.rb +0 -182
- data/lib/hanami/components/components.rb +0 -479
- data/lib/hanami/components/routes_inspector.rb +0 -72
- data/lib/hanami/config/cookies.rb +0 -69
- data/lib/hanami/config/framework_configuration.rb +0 -43
- data/lib/hanami/config/load_paths.rb +0 -46
- data/lib/hanami/config/mapper.rb +0 -47
- data/lib/hanami/config/routes.rb +0 -20
- data/lib/hanami/config/security.rb +0 -110
- data/lib/hanami/config/sessions.rb +0 -103
- data/lib/hanami/configuration/app.rb +0 -18
- data/lib/hanami/early_hints.rb +0 -129
- data/lib/hanami/env.rb +0 -69
- data/lib/hanami/environment.rb +0 -513
- data/lib/hanami/environment_application_configurations.rb +0 -37
- data/lib/hanami/frameworks.rb +0 -22
- data/lib/hanami/hanamirc.rb +0 -169
- data/lib/hanami/mailer/glue.rb +0 -27
- data/lib/hanami/middleware_stack.rb +0 -172
- data/lib/hanami/rake_helper.rb +0 -78
- data/lib/hanami/rake_tasks.rb +0 -2
- data/lib/hanami/rendering_policy.rb +0 -95
- data/lib/hanami/routes.rb +0 -219
- data/lib/hanami/routing/default.rb +0 -32
- data/lib/hanami/static.rb +0 -63
- data/lib/hanami/templates/default.html.erb +0 -30
- data/lib/hanami/templates/welcome.html.erb +0 -52
- data/lib/hanami/views/default.rb +0 -37
- data/lib/hanami/views/default_template_finder.rb +0 -22
- data/lib/hanami/views/null_view.rb +0 -15
- data/lib/hanami/welcome.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3c6a367cfd05f2b18ae080da80b75a08a8680bd922ac8b00433e0c59f53f2b
|
4
|
+
data.tar.gz: 2de0d4102bf80606d130c04d83716370fe2c1c985986cd034ce232ff08e9be61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7d143ccf35f088d91fa1702d40b5aac22b3cada72cf566b239403d97fdd22b0839f93a1c20286853ae440ea4898902605b0bfbd3b05854f149de98ef9a78a83
|
7
|
+
data.tar.gz: 8f512b014ed54456df5beb0d3ecccbe260f0186d3ebfba7fb2fc51f9d80956b511ab87e08e1149dd2dd02d94939a1b260059f2cfcaa1ee34ca6681aee1408434
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,110 @@
|
|
1
1
|
# Hanami
|
2
2
|
The web, with simplicity.
|
3
3
|
|
4
|
+
## v2.0.0.alpha2 - 2021-05-04
|
5
|
+
### Added
|
6
|
+
- [Luca Guidi] Official support for Ruby: MRI 3.0
|
7
|
+
- [Tim Riley] Code autoloading via Zeitwerk
|
8
|
+
- [Tim Riley] `Hanami::Application` subclasses generate and configure a `Dry::System::Container`, accessible via `.container` and `AppNamespace::Container`, with several common container methods available directly via the application subclass (e.g. `Bookshelf::Application["foo"]` or `Hanami.application["foo"]`)
|
9
|
+
- [Tim Riley] Introduced `Hanami::Application.register_bootable` to register custom components
|
10
|
+
- [Tim Riley] Introduced `Hanami::Application.keys` to get the list of resolved components
|
11
|
+
- [Tim Riley] Dynamically create an auto-injection mixin (e.g. `Bookshelf::Deps`)
|
12
|
+
```ruby
|
13
|
+
# frozen_string_literal: true
|
14
|
+
|
15
|
+
module Bookshelf
|
16
|
+
class CreateThing
|
17
|
+
include Deps[service_client: "some_service.client"]
|
18
|
+
|
19
|
+
def call(attrs)
|
20
|
+
# Validate attrs, etc.
|
21
|
+
service_client.create(attrs)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
```
|
26
|
+
- [Tim Riley] Introduced application settings. They are accessible via `Hanami.application.settings` in `config/settings.rb`
|
27
|
+
- [Tim Riley] Introduced application slices to organise high-level application concerns. Slices are generated based on subdirectories of `slices/`, and map onto corresponding ruby module namespaces, e.g. `slices/main` -> `Main`, with the slice instance itself being `Main::Slice` (as well as being accessible via `Hanami.application.slices[:main]`)
|
28
|
+
- [Tim Riley] Each slice generates and configures has its own `Dry::System::Container`, accessible via the slice instance (e.g. `Main::Slice.container`) as well as via its own constant (e.g. `Main::Container`)
|
29
|
+
- [Tim Riley] Slice containers automatically import the application container, under the `"application"` namespace
|
30
|
+
- [Tim Riley] Allow slice containers to be imported by other slice containers
|
31
|
+
|
32
|
+
### Changed
|
33
|
+
- [Luca Guidi] Drop support for Ruby: MRI 2.5
|
34
|
+
- [Tim Riley] Removed `config.cookies` in favor of `config.actions.cookies`
|
35
|
+
- [Tim Riley] Removed `config.sessions` in favor of `config.actions.sessions`
|
36
|
+
- [Tim Riley] Removed `config.security` settings
|
37
|
+
|
38
|
+
## v2.0.0.alpha1 - 2019-01-30
|
39
|
+
### Added
|
40
|
+
- [Luca Guidi] Implemented from scratch `hanami version`
|
41
|
+
- [Luca Guidi] Implemented from scratch `hanami server`
|
42
|
+
- [Luca Guidi] Main configuration is opinionated: when a setting is not specified in generated code, it uses a framework default.
|
43
|
+
- [Luca Guidi] Main configuration setting `environment`: to yield env based settings (e.g. `config.environment(:production) { |c| c.logger = {...} }`)
|
44
|
+
- [Luca Guidi] Main configuration setting `base_url`: to set the base URL of the app (e.g. `config.base_url = "https://example.com"`)
|
45
|
+
- [Luca Guidi] Main configuration setting `logger`: to set the logger options (e.g. `config.logger = { level: :info, format: :json }`)
|
46
|
+
- [Luca Guidi] Main configuration setting `routes`: to set the path to routes file (e.g. `config.routes = "path/to/routes"`)
|
47
|
+
- [Luca Guidi] Main configuration setting `cookies`: to set cookies options (e.g. `config.cookies = { max_age: 300 }`)
|
48
|
+
- [Luca Guidi] Main configuration setting `sessions`: to set session options (e.g. `config.sessions = :cookie, { secret: "abc" }`)
|
49
|
+
- [Luca Guidi] Main configuration setting `default_request_format`: to set the fallback for request format (aka MIME Type) (e.g. `config.default_request_format = :json`)
|
50
|
+
- [Luca Guidi] Main configuration setting `default_response_format`: to set the default response format (aka MIME Type) (e.g. `config.default_response_format = :json`)
|
51
|
+
- [Luca Guidi] Main configuration setting `middleware` to mount Rack middleware (e.g. `config.middleware.use MyMiddleware, "argument"`)
|
52
|
+
- [Luca Guidi] Main configuration setting `security` to set security settings (see below)
|
53
|
+
- [Luca Guidi] Main configuration setting `inflections` to configure inflections (e.g. `config.inflections { |i| i.plural "virus", "viruses" }`)
|
54
|
+
- [Luca Guidi] Main configuration security setting `x_frame_options`: defaults to `"deny"` (e.g. `config.security.x_frame_options = "sameorigin"`)
|
55
|
+
- [Luca Guidi] Main configuration security setting `x_content_type_options`: defaults to `"nosniff"` (e.g. `config.security.x_content_type_options = nil`)
|
56
|
+
- [Luca Guidi] Main configuration security setting `x_xss_protection`: defaults to `"1; mode=block"` (e.g. `config.security.x_xss_protection = "1"`)
|
57
|
+
- [Luca Guidi] Main configuration security setting `content_security_policy`: defaults to `"form-action 'self'; frame-ancestors 'self'; base-uri 'self'; default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self' https: data:; style-src 'self' 'unsafe-inline' https:; font-src 'self'; object-src 'none'; plugin-types application/pdf; child-src 'self'; frame-src 'self'; media-src 'self'"`
|
58
|
+
(e.g. `config.security.content_security_policy[:style_src] += " https://my.cdn.example"` to add another source)
|
59
|
+
(e.g. `config.security.content_security_policy[:plugin_types] = nil` to override the settings)
|
60
|
+
|
61
|
+
### Changed
|
62
|
+
- [Luca Guidi] Drop support for Ruby: MRI 2.3, and 2.4.
|
63
|
+
- [Luca Guidi] `Hanami::Application` must be used as superclass for main application under `config/application.rb` (e.g. `Bookshelf::Application`)
|
64
|
+
- [Luca Guidi] Main configuration is available at `config/application.rb` instead of `config/enviroment.rb`
|
65
|
+
- [Luca Guidi] Removed `Hanami.configure` in favor of main application configuration (e.g. `Bookshelf::Application.config`)
|
66
|
+
- [Luca Guidi] Removed DSL syntax for main configuration (from `cookies max_age: 600` to `config.cookies = { max_age: 600 }`)
|
67
|
+
- [Luca Guidi] Per enviroment settings must be wrapped in a block (e.g. `config.enviroment(:production) { |c| c.logger = {} }`)
|
68
|
+
- [Luca Guidi] Concrete applications are no longer supported (e.g. `Web::Application` in `apps/web/application.rb`)
|
69
|
+
- [Luca Guidi] Main routes must be configured at `config/routes.rb`:
|
70
|
+
```ruby
|
71
|
+
# frozen_string_literal: true
|
72
|
+
|
73
|
+
Hanami.application.routes do
|
74
|
+
mount :web, at: "/" do
|
75
|
+
root to: "home#index"
|
76
|
+
end
|
77
|
+
|
78
|
+
mount :admin, at: "/admin" do
|
79
|
+
root to: "home#index"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
```
|
83
|
+
- [Luca Guidi] Per application routes are no longer supported (e.g. `apps/web/config/routes.rb`)
|
84
|
+
- [Luca Guidi] Removed `shotgun` and code reloading from the core. Code reloading is implemented by `hanami-reloader` gem.
|
85
|
+
- [Luca Guidi] Removed support for `.hanamirc`
|
86
|
+
|
87
|
+
## v1.3.4 - 2021-05-02
|
88
|
+
### Fixed
|
89
|
+
- [Slava Kardakov] Fix generated `config.ru` `require_relative` statement
|
90
|
+
- [Armin] Fix `Hanami::CommonLogger` elapsed time compatibility with `rack` 2.1.0+
|
91
|
+
- [Adam Daniels] Fix generated tests compatibility with `minitest` 6.0+
|
92
|
+
|
93
|
+
## v1.3.3 - 2019-09-20
|
94
|
+
### Added
|
95
|
+
- [Gray Manley] Standardize file loading for `.env` files (see: https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use)
|
96
|
+
|
97
|
+
### Fixed
|
98
|
+
- [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"`)
|
99
|
+
|
100
|
+
## v1.3.2 - 2019-07-26
|
101
|
+
### Added
|
102
|
+
- [Luca Guidi] Support both `hanami-validations` 1 and 2
|
103
|
+
|
104
|
+
### Fixed
|
105
|
+
- [Wisnu Adi Nurcahyo] Ensure `hanami generate` syntax for Welcome page is compatible with ZSH
|
106
|
+
- [Luca Guidi] Don't let `hanami` to crash when called without `bundle exec`
|
107
|
+
|
4
108
|
## v1.3.1 - 2019-01-18
|
5
109
|
### Added
|
6
110
|
- [Luca Guidi] Official support for Ruby: MRI 2.6
|
@@ -9,7 +113,7 @@ The web, with simplicity.
|
|
9
113
|
### Fixed
|
10
114
|
- [Aidan Coyle] Remove from app generator support for deprecated `force_ssl` setting
|
11
115
|
- [Alessandro Caporrini] Remove from app generator support for deprecated `body_parsers` setting
|
12
|
-
- [Daphne Rouw & Sean Collins] Make app generator to work when code in `config/
|
116
|
+
- [Daphne Rouw & Sean Collins] Make app generator to work when code in `config/environment.rb` uses double quotes
|
13
117
|
|
14
118
|
## v1.3.0 - 2018-10-24
|
15
119
|
### Added
|
@@ -26,7 +130,7 @@ The web, with simplicity.
|
|
26
130
|
|
27
131
|
### Fixed
|
28
132
|
- [Anton Davydov] Make possible to pass extra settings for custom logger instances (eg. `logger SemanticLogger.new, :foo, :bar`)
|
29
|
-
- [graywolf] Ensure `hanami generate app` to work without `require_relative` entries in `config/
|
133
|
+
- [graywolf] Ensure `hanami generate app` to work without `require_relative` entries in `config/environment.rb`
|
30
134
|
- [Makoto Tajitsu & Luca Guidi] Fixed regression for `hanami new .` that used to generate a broken project
|
31
135
|
|
32
136
|
### Fixed
|
@@ -143,7 +247,7 @@ The web, with simplicity.
|
|
143
247
|
- [Luca Guidi] Make compatible with Rack 2.0 only
|
144
248
|
- [Luca Guidi] Removed `logger` settings from Hanami applications
|
145
249
|
- [Luca Guidi] Removed logger for Hanami applications (eg `Web.logger`)
|
146
|
-
- [Luca Guidi] Changed mailer syntax in `config/
|
250
|
+
- [Luca Guidi] Changed mailer syntax in `config/environment.rb`
|
147
251
|
|
148
252
|
## v0.9.2 - 2016-12-19
|
149
253
|
## Added
|
@@ -232,11 +336,11 @@ The web, with simplicity.
|
|
232
336
|
|
233
337
|
## v0.7.2 - 2016-02-09
|
234
338
|
### Fixed
|
235
|
-
- [Alfonso Uceda Pompa] Fixed routing issue when static assets server tried to
|
339
|
+
- [Alfonso Uceda Pompa] Fixed routing issue when static assets server tried to hijack paths that are matching directories in public directory
|
236
340
|
|
237
341
|
## v0.7.1 - 2016-02-05
|
238
342
|
### Fixed
|
239
|
-
- [Anton Davydov] Fixed routing issue when static assets server tried to
|
343
|
+
- [Anton Davydov] Fixed routing issue when static assets server tried to hijack requests belonging to dynamic endpoints
|
240
344
|
- [Anatolii Didukh] Ensure to fallback to default engine for `hanami console`
|
241
345
|
|
242
346
|
## v0.7.0 - 2016-01-22
|
@@ -371,7 +475,7 @@ The web, with simplicity.
|
|
371
475
|
## v0.3.0 - 2015-03-23
|
372
476
|
### Added
|
373
477
|
- [Luca Guidi] Introduced action generator. Eg. `bundle exec lotus generate action web dashboard#index`
|
374
|
-
- [Alfonso Uceda Pompa] Allow to specify default
|
478
|
+
- [Alfonso Uceda Pompa] Allow to specify default cookies options in application configuration. Eg. `cookies true, { domain: 'lotusrb.org' }`
|
375
479
|
- [Tom Kadwill] Include `Lotus::Helpers` in views.
|
376
480
|
- [Linus Pettersson] Allow to specify `--database` CLI option when generate a new project. Eg. `lotus new bookshelf --database=postgresql`
|
377
481
|
- [Linus Pettersson] Initialize a Git repository when generating a new project
|
data/FEATURES.md
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
|
4
4
|
## Features
|
5
5
|
|
6
|
+
## v2.0.0.alpha1 - 2019-01-30
|
7
|
+
|
8
|
+
## v1.3.3 - 2019-09-20
|
9
|
+
|
10
|
+
- Standardize file loading for `.env` files (see: https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use)
|
11
|
+
|
12
|
+
## v1.3.2 - 2019-07-26
|
13
|
+
|
6
14
|
## v1.3.1 - 2019-01-18
|
7
15
|
|
8
16
|
## v1.3.0 - 2018-10-24
|
@@ -20,7 +28,7 @@
|
|
20
28
|
- Unobtrusive JavaScript (UJS) (via `hanami-ujs` gem)
|
21
29
|
- Interactive console for development error page (via `hanami-webconsole` gem)
|
22
30
|
- CLI: register callbacks for `hanami` commands (`Hanami::CLI.after("db migrate", MyCallback.new)` or `Hanami::CLI.after("db migrate") { ... }`)
|
23
|
-
- Project level Rack middleware stack (`Hanami.configure { middleware.use
|
31
|
+
- Project level Rack middleware stack (`Hanami.configure { middleware.use MyRackMiddleware }`)
|
24
32
|
- Plugins can hook into project configuration (`Hanami.plugin { middleware.use AnotherRackMiddleware }`)
|
25
33
|
- Custom repository commands
|
26
34
|
- Coloured logging
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -18,7 +18,6 @@ which provides the glue that ties all the parts together:
|
|
18
18
|
* [**Hanami::Helpers**](https://github.com/hanami/helpers) - View helpers for Ruby applications
|
19
19
|
* [**Hanami::Mailer**](https://github.com/hanami/mailer) - Mail for Ruby applications
|
20
20
|
* [**Hanami::Assets**](https://github.com/hanami/assets) - Assets management for Ruby
|
21
|
-
* [**Hanami::CLI**](https://github.com/hanami/cli) - Ruby command line interface
|
22
21
|
* [**Hanami::Utils**](https://github.com/hanami/utils) - Ruby core extensions and class utilities
|
23
22
|
|
24
23
|
These components are designed to be used independently or together in a Hanami application.
|
@@ -26,14 +25,14 @@ These components are designed to be used independently or together in a Hanami a
|
|
26
25
|
## Status
|
27
26
|
|
28
27
|
[![Gem Version](https://badge.fury.io/rb/hanami.svg)](https://badge.fury.io/rb/hanami)
|
29
|
-
[![
|
30
|
-
[![Test Coverage](https://codecov.io/gh/hanami/hanami/branch/
|
28
|
+
[![CI](https://github.com/hanami/hanami/workflows/ci/badge.svg?branch=unstable)](https://github.com/hanami/hanami/actions?query=workflow%3Aci+branch%3Aunstable)
|
29
|
+
[![Test Coverage](https://codecov.io/gh/hanami/hanami/branch/unstable/graph/badge.svg)](https://codecov.io/gh/hanami/hanami)
|
31
30
|
[![Depfu](https://badges.depfu.com/badges/ba000e0f69e6ef1c44cd3038caaa1841/overview.svg)](https://depfu.com/github/hanami/hanami?project=Bundler)
|
32
31
|
[![Inline Docs](http://inch-ci.org/github/hanami/hanami.svg)](http://inch-ci.org/github/hanami/hanami)
|
33
32
|
|
34
33
|
## Installation
|
35
34
|
|
36
|
-
__Hanami__ supports Ruby (MRI) 2.
|
35
|
+
__Hanami__ supports Ruby (MRI) 2.6+
|
37
36
|
|
38
37
|
```shell
|
39
38
|
gem install hanami
|
@@ -137,4 +136,4 @@ Released under MIT License.
|
|
137
136
|
|
138
137
|
This project was formerly known as Lotus (`lotusrb`).
|
139
138
|
|
140
|
-
Copyright © 2014-
|
139
|
+
Copyright © 2014-2021 Luca Guidi.
|
data/hanami.gemspec
CHANGED
@@ -1,40 +1,36 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
+
require "hanami/version"
|
5
6
|
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
8
|
+
spec.name = "hanami"
|
8
9
|
spec.version = Hanami::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
10
|
+
spec.authors = ["Luca Guidi"]
|
11
|
+
spec.email = ["me@lucaguidi.com"]
|
12
|
+
spec.summary = "The web, with simplicity"
|
13
|
+
spec.description = "Hanami is a web framework for Ruby"
|
14
|
+
spec.homepage = "http://hanamirb.org"
|
15
|
+
spec.license = "MIT"
|
15
16
|
|
16
17
|
spec.files = `git ls-files -c -o --exclude-standard -z -- lib/* bin/* LICENSE.md README.md CODE_OF_CONDUCT.md CHANGELOG.md FEATURES.md hanami.gemspec`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test)/})
|
19
|
-
spec.require_paths = [
|
20
|
-
spec.required_ruby_version =
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
spec.required_ruby_version = ">= 2.6.0"
|
21
21
|
|
22
|
-
spec.metadata[
|
22
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
23
23
|
|
24
|
-
spec.add_dependency
|
25
|
-
spec.add_dependency
|
26
|
-
spec.add_dependency
|
27
|
-
spec.add_dependency
|
28
|
-
spec.add_dependency
|
29
|
-
spec.add_dependency
|
30
|
-
spec.add_dependency
|
31
|
-
spec.add_dependency
|
32
|
-
spec.add_dependency 'hanami-cli', '~> 0.3'
|
33
|
-
spec.add_dependency 'concurrent-ruby', '~> 1.0'
|
34
|
-
spec.add_dependency 'bundler', '>= 1.6', '< 3'
|
24
|
+
spec.add_dependency "bundler", ">= 1.16", "< 3"
|
25
|
+
spec.add_dependency "dry-core", "~> 0.4"
|
26
|
+
spec.add_dependency "dry-inflector", "~> 0.1", ">= 0.1.2"
|
27
|
+
spec.add_dependency "dry-monitor"
|
28
|
+
spec.add_dependency "dry-system", "~> 0.19", ">= 0.19.0"
|
29
|
+
spec.add_dependency "hanami-cli", "~> 2.0.alpha"
|
30
|
+
spec.add_dependency "hanami-utils", "~> 2.0.alpha"
|
31
|
+
spec.add_dependency "zeitwerk", "~> 2.4"
|
35
32
|
|
36
|
-
spec.add_development_dependency
|
37
|
-
spec.add_development_dependency
|
38
|
-
spec.add_development_dependency
|
39
|
-
spec.add_development_dependency 'rake', '~> 12.0'
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.8"
|
34
|
+
spec.add_development_dependency "rack-test", "~> 1.1"
|
35
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
40
36
|
end
|
data/lib/hanami.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# A complete web framework for Ruby
|
4
4
|
#
|
@@ -6,277 +6,74 @@ require 'thread'
|
|
6
6
|
#
|
7
7
|
# @see http://hanamirb.org
|
8
8
|
module Hanami
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require 'hanami/environment'
|
12
|
-
require 'hanami/app'
|
13
|
-
require 'hanami/application'
|
14
|
-
require 'hanami/components'
|
15
|
-
require 'hanami/configuration'
|
9
|
+
require "hanami/version"
|
10
|
+
require "hanami/application"
|
16
11
|
|
17
|
-
# @api private
|
18
|
-
# @since 0.6.0
|
19
|
-
DEFAULT_PUBLIC_DIRECTORY = 'public'.freeze
|
20
|
-
|
21
|
-
# @api private
|
22
|
-
# @since 0.9.0
|
23
12
|
@_mutex = Mutex.new
|
24
|
-
@_plugins = Concurrent::Array.new
|
25
13
|
|
26
|
-
|
27
|
-
#
|
28
|
-
# Please note that the code for this method is generated by `hanami new`.
|
29
|
-
#
|
30
|
-
# @param blk [Proc] the configuration block
|
31
|
-
#
|
32
|
-
# @since 0.9.0
|
33
|
-
#
|
34
|
-
# @example
|
35
|
-
# # config/environment.rb
|
36
|
-
#
|
37
|
-
# # ...
|
38
|
-
#
|
39
|
-
# Hanami.configure do
|
40
|
-
# mount Admin::Application, at: "/admin"
|
41
|
-
# mount Web::Application, at: "/"
|
42
|
-
#
|
43
|
-
# model do
|
44
|
-
# adapter :sql, ENV['DATABASE_URL']
|
45
|
-
#
|
46
|
-
# migrations "db/migrations"
|
47
|
-
# schema "db/schema.sql"
|
48
|
-
# end
|
49
|
-
#
|
50
|
-
# mailer do
|
51
|
-
# root "lib/bookshelf/mailers"
|
52
|
-
#
|
53
|
-
# delivery do
|
54
|
-
# development :test
|
55
|
-
# test :test
|
56
|
-
# # production :smtp, address: ENV['SMTP_HOST'], port: ENV['SMTP_PORT']
|
57
|
-
# end
|
58
|
-
# end
|
59
|
-
# end
|
60
|
-
def self.configure(&blk)
|
14
|
+
def self.application
|
61
15
|
@_mutex.synchronize do
|
62
|
-
|
63
|
-
end
|
64
|
-
end
|
16
|
+
raise "Hanami.application not configured" unless defined?(@_application)
|
65
17
|
|
66
|
-
|
67
|
-
#
|
68
|
-
# @return [Hanami::Configuration] the configuration
|
69
|
-
#
|
70
|
-
# @see Hanami.configure
|
71
|
-
#
|
72
|
-
# @since 0.9.0
|
73
|
-
# @api private
|
74
|
-
def self.configuration
|
75
|
-
@_mutex.synchronize do
|
76
|
-
raise "Hanami not configured" unless defined?(@_configuration)
|
77
|
-
@_configuration
|
18
|
+
@_application
|
78
19
|
end
|
79
20
|
end
|
80
21
|
|
81
|
-
|
82
|
-
|
83
|
-
# @see Hanami.configure
|
84
|
-
#
|
85
|
-
# @since 1.2.0
|
86
|
-
def self.plugin(&blk)
|
87
|
-
@_plugins << blk
|
22
|
+
def self.application?
|
23
|
+
defined?(@_application)
|
88
24
|
end
|
89
25
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
#
|
94
|
-
# Plugins are loaded when Bundler requires `Gemfile` gems.
|
95
|
-
# During this phase the `Components` that we can resolve are erased by the
|
96
|
-
# first incoming request in development.
|
97
|
-
# They are erased by a workaround that we had to put in place in `Hanami.boot`.
|
98
|
-
# This workaround is `Components.release` and it was introduced because
|
99
|
-
# `shotgun` failed to reload components, so we have to release for each
|
100
|
-
# incoming request.
|
101
|
-
# After the `Components` registry is cleared up, Hanami is able to resolve all
|
102
|
-
# the components from scratch.
|
103
|
-
#
|
104
|
-
# When we'll switch to `hanami-reloader` for development, we can remove
|
105
|
-
# `Components.release` and we'll be able to store plugins in `Components` and
|
106
|
-
# remove `Hanami.plugins` as well.
|
107
|
-
#
|
108
|
-
# @since 1.2.0
|
109
|
-
# @api private
|
110
|
-
def self.plugins
|
111
|
-
@_plugins
|
112
|
-
end
|
26
|
+
def self.application=(klass)
|
27
|
+
@_mutex.synchronize do
|
28
|
+
raise "Hanami.application already configured" if defined?(@_application)
|
113
29
|
|
114
|
-
|
115
|
-
|
116
|
-
# NOTE: In case this is invoked many times, it guarantees that the boot
|
117
|
-
# process happens only once.
|
118
|
-
#
|
119
|
-
# NOTE: This MUST NOT be wrapped by a Mutex, because it would cause a deadlock.
|
120
|
-
#
|
121
|
-
# @return [NilClass]
|
122
|
-
#
|
123
|
-
# @since 0.9.0
|
124
|
-
def self.boot
|
125
|
-
Components.release if code_reloading?
|
126
|
-
Components.resolve('all')
|
127
|
-
Hanami::Model.disconnect if defined?(Hanami::Model)
|
128
|
-
nil
|
30
|
+
@_application = klass unless klass.name.nil?
|
31
|
+
end
|
129
32
|
end
|
130
33
|
|
131
|
-
# Main application that mounts many Rack and/or Hanami applications.
|
132
|
-
#
|
133
|
-
# This is used as integration point for:
|
134
|
-
#
|
135
|
-
# * `config.ru` (`run Hanami.app`)
|
136
|
-
# * Feature tests (`Capybara.app = Hanami.app`)
|
137
|
-
#
|
138
|
-
#
|
139
|
-
#
|
140
|
-
# It lazily loads your Hanami project, in case it wasn't booted on before.
|
141
|
-
# This is the case when `hanami server` isn't invoked, but we use different
|
142
|
-
# ways to run the project (eg. `rackup`).
|
143
|
-
#
|
144
|
-
# @return [Hanami::App] the app
|
145
|
-
#
|
146
|
-
# @since 0.9.0
|
147
|
-
# @api private
|
148
|
-
#
|
149
|
-
# @see Hanami.boot
|
150
34
|
def self.app
|
151
|
-
|
152
|
-
|
153
|
-
end
|
154
|
-
|
155
|
-
# Check if an application is allowed to load.
|
156
|
-
#
|
157
|
-
# The list of applications to be loaded can be set via the `HANAMI_APPS`
|
158
|
-
# env variable. If the HANAMI_APPS env variable is not set, it defaults
|
159
|
-
# to loading all applications.
|
160
|
-
#
|
161
|
-
# @return [TrueClass,FalseClass] the result of the check
|
162
|
-
#
|
163
|
-
# @since 1.1.0
|
164
|
-
#
|
165
|
-
# @example
|
166
|
-
#
|
167
|
-
# # Mount hanami app for specific app
|
168
|
-
# Hanami.configure do
|
169
|
-
# if Hanami.app?(:web)
|
170
|
-
# require_relative '../apps/web/application'
|
171
|
-
# mount Web::Application, at: '/'
|
172
|
-
# end
|
173
|
-
# end
|
174
|
-
#
|
175
|
-
def self.app?(app)
|
176
|
-
return true unless ENV.key?('HANAMI_APPS')
|
35
|
+
@_mutex.synchronize do
|
36
|
+
raise "Hanami.app not configured" unless defined?(@_app)
|
177
37
|
|
178
|
-
|
179
|
-
|
38
|
+
@_app
|
39
|
+
end
|
180
40
|
end
|
181
41
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
#
|
186
|
-
# @since 0.3.2
|
187
|
-
#
|
188
|
-
# @example
|
189
|
-
# Hanami.root # => #<Pathname:/Users/luca/Code/bookshelf>
|
190
|
-
def self.root
|
191
|
-
environment.root
|
192
|
-
end
|
42
|
+
def self.app=(app)
|
43
|
+
@_mutex.synchronize do
|
44
|
+
raise "Hanami.app already configured" if defined?(@_app)
|
193
45
|
|
194
|
-
|
195
|
-
|
196
|
-
# @return [Pathname] public directory
|
197
|
-
#
|
198
|
-
# @since 0.6.0
|
199
|
-
#
|
200
|
-
# @example
|
201
|
-
# Hanami.public_directory # => #<Pathname:/Users/luca/Code/bookshelf/public>
|
202
|
-
def self.public_directory
|
203
|
-
root.join(DEFAULT_PUBLIC_DIRECTORY)
|
46
|
+
@_app = app
|
47
|
+
end
|
204
48
|
end
|
205
49
|
|
206
|
-
# Return the current environment
|
207
|
-
#
|
208
|
-
# @return [String] the current environment
|
209
|
-
#
|
210
|
-
# @since 0.3.1
|
211
|
-
#
|
212
|
-
# @see Hanami::Environment#environment
|
213
|
-
#
|
214
|
-
# @example
|
215
|
-
# Hanami.env => "development"
|
216
50
|
def self.env
|
217
|
-
|
51
|
+
(ENV["HANAMI_ENV"] || "development").to_sym
|
218
52
|
end
|
219
53
|
|
220
|
-
# Check to see if specified environment(s) matches the current environment.
|
221
|
-
#
|
222
|
-
# If multiple names are given, it returns true, if at least one of them
|
223
|
-
# matches the current environment.
|
224
|
-
#
|
225
|
-
# @return [TrueClass,FalseClass] the result of the check
|
226
|
-
#
|
227
|
-
# @since 0.3.1
|
228
|
-
#
|
229
|
-
# @see Hanami.env
|
230
|
-
#
|
231
|
-
# @example Single name
|
232
|
-
# puts ENV['HANAMI_ENV'] # => "development"
|
233
|
-
#
|
234
|
-
# Hanami.env?(:development) # => true
|
235
|
-
# Hanami.env?('development') # => true
|
236
|
-
#
|
237
|
-
# Hanami.env?(:production) # => false
|
238
|
-
#
|
239
|
-
# @example Multiple names
|
240
|
-
# puts ENV['HANAMI_ENV'] # => "development"
|
241
|
-
#
|
242
|
-
# Hanami.env?(:development, :test) # => true
|
243
|
-
# Hanami.env?(:production, :staging) # => false
|
244
54
|
def self.env?(*names)
|
245
|
-
|
55
|
+
names.map(&:to_sym).include?(env)
|
246
56
|
end
|
247
57
|
|
248
|
-
|
249
|
-
|
250
|
-
# @return [Hanami::Environment] environment
|
251
|
-
#
|
252
|
-
# @api private
|
253
|
-
# @since 0.3.2
|
254
|
-
def self.environment
|
255
|
-
Components.resolved('environment') do
|
256
|
-
Environment.new
|
257
|
-
end
|
58
|
+
def self.logger
|
59
|
+
application[:logger]
|
258
60
|
end
|
259
61
|
|
260
|
-
|
261
|
-
|
262
|
-
# @return [TrueClass,FalseClass] the result of the check
|
263
|
-
#
|
264
|
-
# @since 1.0.0
|
265
|
-
# @api private
|
266
|
-
#
|
267
|
-
# @see http://hanamirb.org/guides/projects/code-reloading/
|
268
|
-
def self.code_reloading?
|
269
|
-
environment
|
270
|
-
Components.resolve('code_reloading')
|
271
|
-
Components['code_reloading']
|
62
|
+
def self.init
|
63
|
+
application.init
|
272
64
|
end
|
273
65
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
66
|
+
def self.boot(web: true)
|
67
|
+
if defined?(@_app)
|
68
|
+
@_app
|
69
|
+
else
|
70
|
+
application.boot
|
71
|
+
|
72
|
+
@_app = application.new if web
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.bundler_groups
|
77
|
+
[:plugins]
|
281
78
|
end
|
282
79
|
end
|