hanami 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +8 -0
- data/FEATURES.md +3 -1
- data/README.md +1 -1
- data/lib/hanami/application_configuration.rb +5 -4
- data/lib/hanami/cli/commands/generate/action/view_spec.minitest.erb +3 -6
- data/lib/hanami/cli/commands/generate/action/view_spec.rspec.erb +3 -6
- data/lib/hanami/cli/commands/generate/mailer.rb +16 -6
- data/lib/hanami/cli/commands/generate/mailer/mailer.erb +3 -3
- data/lib/hanami/cli/commands/new/README.md.erb +1 -1
- data/lib/hanami/rendering_policy.rb +10 -7
- data/lib/hanami/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d87fe440f006e096c96ad18f1c20428ba4a279df2ee1dbce4ee122cf9ff59b12
|
4
|
+
data.tar.gz: 8f40361860a2eef0fdbf9eea31cc88588cc3caa2bcc509b1fa40d6817060b951
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3228003ed57778a29753c440948cc82b2b4a93f9f201ec5836372bf33a3ca8af1535acd36d4ca94eb55c227df3c2503409e2ac9c8972809184e7eafa1e3f855e
|
7
|
+
data.tar.gz: b57b87929454289abc9ce08d8ddcb35ab57ece912b12fd66791e486785187a222fa36a425d89853589c63e0e40950b6afca3a73f93a80f0cf5f6d540d6690c43
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Hanami
|
2
2
|
The web, with simplicity.
|
3
3
|
|
4
|
+
## v1.1.1 - 2018-02-27
|
5
|
+
### Added
|
6
|
+
- [Luca Guidi] Official support for Ruby MRI 2.5+
|
7
|
+
|
8
|
+
### Fixed
|
9
|
+
- [Alfonso Uceda] Fixed regression for mailer generator: when using options like `--from` and `--to` the generated Ruby code isn't valid as it was missing string quotes.
|
10
|
+
- [Luca Guidi] Generate tests for views including `:format` in `exposures`. This fixes view unit tests when the associated template renders a partial.
|
11
|
+
|
4
12
|
## v1.1.0 - 2017-10-25
|
5
13
|
### Fixed
|
6
14
|
- [Luca Guidi] Ensure `hanami db rollback` steps to be a positive integer
|
data/FEATURES.md
CHANGED
data/README.md
CHANGED
@@ -91,7 +91,7 @@ If you want to test Hanami's HEAD to try a new feature or to test a bug fix, her
|
|
91
91
|
```
|
92
92
|
git clone https://github.com/hanami/hanami.git
|
93
93
|
cd hanami && bundle
|
94
|
-
bundle exec hanami new --hanami-head
|
94
|
+
bundle exec hanami new bookshelf --hanami-head
|
95
95
|
cd bookshelf
|
96
96
|
vim Gemfile # edit with: gem 'hanami', path: '..'
|
97
97
|
bundle
|
@@ -40,10 +40,11 @@ module Hanami
|
|
40
40
|
# @since 0.1.0
|
41
41
|
# @api private
|
42
42
|
def initialize(namespace, configurations, path_prefix, env: Environment.new)
|
43
|
-
@namespace
|
44
|
-
@configurations
|
45
|
-
@path_prefix
|
46
|
-
@env
|
43
|
+
@namespace = namespace
|
44
|
+
@configurations = configurations
|
45
|
+
@path_prefix = path_prefix
|
46
|
+
@env = env
|
47
|
+
@handle_exceptions = true
|
47
48
|
|
48
49
|
evaluate_configurations!
|
49
50
|
end
|
@@ -1,15 +1,12 @@
|
|
1
1
|
require_relative '../../../spec_helper'
|
2
2
|
|
3
3
|
describe <%= app.classify %>::Views::<%= classified_controller_name %>::<%= action.classify %> do
|
4
|
-
let(:exposures) { Hash[
|
4
|
+
let(:exposures) { Hash[format: :html] }
|
5
5
|
let(:template) { Hanami::View::Template.new('<%= template %>') }
|
6
6
|
let(:view) { <%= app.classify %>::Views::<%= classified_controller_name %>::<%= action.classify %>.new(template, exposures) }
|
7
7
|
let(:rendered) { view.render }
|
8
8
|
|
9
|
-
it 'exposes #
|
10
|
-
|
11
|
-
|
12
|
-
# Example
|
13
|
-
view.foo.must_equal exposures.fetch(:foo)
|
9
|
+
it 'exposes #format' do
|
10
|
+
view.format.must_equal exposures.fetch(:format)
|
14
11
|
end
|
15
12
|
end
|
@@ -1,13 +1,10 @@
|
|
1
1
|
RSpec.describe <%= app.classify %>::Views::<%= classified_controller_name %>::<%= action.classify %>, type: :view do
|
2
|
-
let(:exposures) { Hash[
|
2
|
+
let(:exposures) { Hash[format: :html] }
|
3
3
|
let(:template) { Hanami::View::Template.new('<%= template %>') }
|
4
4
|
let(:view) { described_class.new(template, exposures) }
|
5
5
|
let(:rendered) { view.render }
|
6
6
|
|
7
|
-
it 'exposes #
|
8
|
-
|
9
|
-
|
10
|
-
# Example
|
11
|
-
expect(view.foo).to eq exposures.fetch(:foo)
|
7
|
+
it 'exposes #format' do
|
8
|
+
expect(view.format).to eq exposures.fetch(:format)
|
12
9
|
end
|
13
10
|
end
|
@@ -25,9 +25,9 @@ module Hanami
|
|
25
25
|
# @since 1.1.0
|
26
26
|
# @api private
|
27
27
|
def call(mailer:, **options)
|
28
|
-
from = options.fetch(:from, DEFAULT_FROM)
|
29
|
-
to = options.fetch(:to, DEFAULT_TO)
|
30
|
-
subject = options.fetch(:subject, DEFAULT_SUBJECT)
|
28
|
+
from = clean_option(options.fetch(:from, DEFAULT_FROM))
|
29
|
+
to = clean_option(options.fetch(:to, DEFAULT_TO))
|
30
|
+
subject = clean_option(options.fetch(:subject, DEFAULT_SUBJECT))
|
31
31
|
context = Context.new(mailer: mailer, test: options.fetch(:test), from: from, to: to, subject: subject, options: options)
|
32
32
|
|
33
33
|
generate_mailer(context)
|
@@ -40,15 +40,19 @@ module Hanami
|
|
40
40
|
|
41
41
|
# @since 1.1.0
|
42
42
|
# @api private
|
43
|
-
DEFAULT_FROM = "
|
43
|
+
DEFAULT_FROM = "<from>".freeze
|
44
44
|
|
45
45
|
# @since 1.1.0
|
46
46
|
# @api private
|
47
|
-
DEFAULT_TO = "
|
47
|
+
DEFAULT_TO = "<to>".freeze
|
48
48
|
|
49
49
|
# @since 1.1.0
|
50
50
|
# @api private
|
51
|
-
DEFAULT_SUBJECT = "
|
51
|
+
DEFAULT_SUBJECT = "Hello".freeze
|
52
|
+
|
53
|
+
# @sice x.x.x
|
54
|
+
# @api private
|
55
|
+
QUOTES_REGEX = /^("|')|("|')$/
|
52
56
|
|
53
57
|
# @since 1.1.0
|
54
58
|
# @api private
|
@@ -87,6 +91,12 @@ module Hanami
|
|
87
91
|
files.touch(destination)
|
88
92
|
say(:create, destination)
|
89
93
|
end
|
94
|
+
|
95
|
+
# @since x.x.x
|
96
|
+
# @api private
|
97
|
+
def clean_option(option)
|
98
|
+
option.gsub(QUOTES_REGEX, '')
|
99
|
+
end
|
90
100
|
end
|
91
101
|
end
|
92
102
|
end
|
@@ -30,4 +30,4 @@ How to prepare (create and migrate) DB for `development` and `test` environments
|
|
30
30
|
% HANAMI_ENV=test bundle exec hanami db prepare
|
31
31
|
```
|
32
32
|
|
33
|
-
Explore Hanami [guides](http://hanamirb.org/guides/), [API docs](http://hanamirb.org
|
33
|
+
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! 🌸
|
@@ -24,13 +24,13 @@ module Hanami
|
|
24
24
|
SUCCESSFUL_STATUSES = (200..201).freeze
|
25
25
|
# @api private
|
26
26
|
RENDERABLE_FORMATS = [:all, :html].freeze
|
27
|
+
# @api private
|
28
|
+
ERROR_STATUS = 500
|
27
29
|
|
28
30
|
# @api private
|
29
31
|
def initialize(configuration)
|
30
32
|
@controller_pattern = %r{#{ configuration.controller_pattern.gsub(/\%\{(controller|action)\}/) { "(?<#{ $1 }>(.*))" } }}
|
31
|
-
@
|
32
|
-
@namespace = configuration.namespace
|
33
|
-
@templates = configuration.templates
|
33
|
+
@configuration = configuration
|
34
34
|
end
|
35
35
|
|
36
36
|
# @api private
|
@@ -56,16 +56,19 @@ module Hanami
|
|
56
56
|
view_for(action, response).render(
|
57
57
|
action.exposures
|
58
58
|
)
|
59
|
-
rescue => e
|
59
|
+
rescue StandardError => e
|
60
60
|
env[RACK_EXCEPTION] = e
|
61
|
-
raise e
|
61
|
+
raise e unless @configuration.handle_exceptions
|
62
|
+
|
63
|
+
response[STATUS] = ERROR_STATUS
|
64
|
+
false
|
62
65
|
end
|
63
66
|
end
|
64
67
|
|
65
68
|
# @api private
|
66
69
|
def _render_status_page(action, response)
|
67
70
|
if render_status_page?(action, response)
|
68
|
-
Hanami::Views::Default.render(@templates, response[STATUS], response: response, format: :html)
|
71
|
+
Hanami::Views::Default.render(@configuration.templates, response[STATUS], response: response, format: :html)
|
69
72
|
end
|
70
73
|
end
|
71
74
|
|
@@ -83,7 +86,7 @@ module Hanami
|
|
83
86
|
def view_for(action, response)
|
84
87
|
view = if response[BODY].respond_to?(:empty?) && response[BODY].empty?
|
85
88
|
captures = @controller_pattern.match(action.class.name)
|
86
|
-
Utils::Class.load(@view_pattern % { controller: captures[:controller], action: captures[:action] }, @namespace)
|
89
|
+
Utils::Class.load(@configuration.view_pattern % { controller: captures[:controller], action: captures[:action] }, @configuration.namespace)
|
87
90
|
end
|
88
91
|
|
89
92
|
view || Views::NullView.new
|
data/lib/hanami/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hanami-utils
|
@@ -387,7 +387,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
387
387
|
version: '0'
|
388
388
|
requirements: []
|
389
389
|
rubyforge_project:
|
390
|
-
rubygems_version: 2.
|
390
|
+
rubygems_version: 2.7.5
|
391
391
|
signing_key:
|
392
392
|
specification_version: 4
|
393
393
|
summary: The web, with simplicity
|