hanami 0.9.2 → 1.0.0.beta1
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 +4 -4
- data/CHANGELOG.md +26 -0
- data/FEATURES.md +5 -0
- data/hanami.gemspec +8 -8
- data/lib/hanami.rb +25 -1
- data/lib/hanami/app.rb +4 -0
- data/lib/hanami/application.rb +1 -14
- data/lib/hanami/application_configuration.rb +2 -37
- data/lib/hanami/cli_base.rb +15 -0
- data/lib/hanami/cli_sub_commands/destroy.rb +2 -2
- data/lib/hanami/cli_sub_commands/generate.rb +2 -1
- data/lib/hanami/commands/generate/abstract.rb +5 -0
- data/lib/hanami/commands/generate/mailer.rb +2 -2
- data/lib/hanami/commands/generate/model.rb +24 -8
- data/lib/hanami/commands/new/abstract.rb +1 -1
- data/lib/hanami/commands/new/container.rb +1 -0
- data/lib/hanami/common_logger.rb +73 -0
- data/lib/hanami/components.rb +11 -0
- data/lib/hanami/components/app/controller.rb +1 -0
- data/lib/hanami/components/components.rb +73 -20
- data/lib/hanami/configuration.rb +12 -0
- data/lib/hanami/env.rb +2 -0
- data/lib/hanami/environment.rb +5 -1
- data/lib/hanami/generators/app/application.rb.tt +0 -30
- data/lib/hanami/generators/application/container/Gemfile.tt +0 -1
- data/lib/hanami/generators/application/container/config/boot.rb.tt +2 -0
- data/lib/hanami/generators/application/container/config/environment.rb.tt +14 -5
- data/lib/hanami/generators/database_config.rb +1 -1
- data/lib/hanami/generators/mailer/{mailer_spec.rb.tt → mailer_spec.rb.minitest.tt} +0 -0
- data/lib/hanami/generators/mailer/mailer_spec.rb.rspec.tt +5 -0
- data/lib/hanami/generators/model/migration.rb.tt +10 -0
- data/lib/hanami/mailer/glue.rb +4 -46
- data/lib/hanami/server.rb +4 -12
- data/lib/hanami/static.rb +4 -8
- data/lib/hanami/version.rb +1 -1
- metadata +25 -62
- data/lib/hanami/components/app/logger.rb +0 -30
- data/lib/hanami/config/logger.rb +0 -200
- data/lib/hanami/generators/application/app/.env.development.tt +0 -4
- data/lib/hanami/generators/application/app/.env.test.tt +0 -4
- data/lib/hanami/generators/application/app/.gitignore +0 -0
- data/lib/hanami/generators/application/app/.gitkeep +0 -1
- data/lib/hanami/generators/application/app/Gemfile.tt +0 -57
- data/lib/hanami/generators/application/app/Rakefile.minitest.tt +0 -12
- data/lib/hanami/generators/application/app/Rakefile.rspec.tt +0 -9
- data/lib/hanami/generators/application/app/apps/.gitkeep.tt +0 -1
- data/lib/hanami/generators/application/app/capybara.rb.rspec.tt +0 -8
- data/lib/hanami/generators/application/app/config.ru.tt +0 -3
- data/lib/hanami/generators/application/app/config/application.rb.tt +0 -347
- data/lib/hanami/generators/application/app/config/environment.rb.tt +0 -4
- data/lib/hanami/generators/application/app/config/initializers/.gitkeep +0 -0
- data/lib/hanami/generators/application/app/config/routes.rb.tt +0 -5
- data/lib/hanami/generators/application/app/db/.gitkeep +0 -1
- data/lib/hanami/generators/application/app/favicon.ico +0 -0
- data/lib/hanami/generators/application/app/features_helper.rb.minitest.tt +0 -11
- data/lib/hanami/generators/application/app/features_helper.rb.rspec.tt +0 -12
- data/lib/hanami/generators/application/app/gitignore.tt +0 -2
- data/lib/hanami/generators/application/app/gitignore_with_db.tt +0 -4
- data/lib/hanami/generators/application/app/gitignore_with_sqlite.tt +0 -3
- data/lib/hanami/generators/application/app/hanamirc.tt +0 -4
- data/lib/hanami/generators/application/app/lib/app_name.rb.tt +0 -35
- data/lib/hanami/generators/application/app/lib/chirp/entities/.gitkeep +0 -1
- data/lib/hanami/generators/application/app/lib/chirp/repositories/.gitkeep +0 -1
- data/lib/hanami/generators/application/app/rspec.rspec.tt +0 -2
- data/lib/hanami/generators/application/app/schema.sql.tt +0 -0
- data/lib/hanami/generators/application/app/spec_helper.rb.minitest.tt +0 -7
- data/lib/hanami/generators/application/app/spec_helper.rb.rspec.tt +0 -104
- data/lib/hanami/generators/application/app/templates/application.html.erb.tt +0 -10
- data/lib/hanami/generators/application/app/templates/application.html.haml.tt +0 -7
- data/lib/hanami/generators/application/app/templates/application.html.slim.tt +0 -8
- data/lib/hanami/generators/application/app/views/application_layout.rb.tt +0 -7
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
#
|
@@ -1,57 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem 'bundler'
|
4
|
-
gem 'rake'
|
5
|
-
<%- if config[:hanami_head] -%>
|
6
|
-
|
7
|
-
gem 'hanami-utils', require: false, github: 'hanami/utils'
|
8
|
-
gem 'hanami-router', require: false, github: 'hanami/router'
|
9
|
-
gem 'hanami-validations', require: false, github: 'hanami/validations'
|
10
|
-
gem 'hanami-helpers', require: false, github: 'hanami/helpers'
|
11
|
-
gem 'hanami-controller', require: false, github: 'hanami/controller'
|
12
|
-
gem 'hanami-view', require: false, github: 'hanami/view'
|
13
|
-
gem 'hanami-model', require: false, github: 'hanami/model'
|
14
|
-
gem 'hanami-mailer', require: false, github: 'hanami/mailer'
|
15
|
-
gem 'hanami-assets', require: false, github: 'hanami/assets'
|
16
|
-
gem 'hanami', github: 'hanami/hanami'
|
17
|
-
<%- else -%>
|
18
|
-
gem 'hanami', '<%= config[:hanami_version] %>'
|
19
|
-
gem 'hanami-model', '<%= config[:hanami_model_version] %>'
|
20
|
-
<%- end -%>
|
21
|
-
<%- if config[:database_config][:gem] -%>
|
22
|
-
|
23
|
-
gem '<%= config[:database_config][:gem] %>'
|
24
|
-
<%- end -%>
|
25
|
-
<%- case config[:template] -%>
|
26
|
-
<%- when 'slim' -%>
|
27
|
-
|
28
|
-
gem 'slim'
|
29
|
-
<%- when 'haml' -%>
|
30
|
-
|
31
|
-
gem 'haml'
|
32
|
-
<%- end -%>
|
33
|
-
|
34
|
-
<%- unless Hanami::Utils.jruby? -%>
|
35
|
-
group :development do
|
36
|
-
# Code reloading
|
37
|
-
# See: http://hanamirb.org/guides/projects/code-reloading
|
38
|
-
gem 'shotgun'
|
39
|
-
end
|
40
|
-
|
41
|
-
<%- end -%>
|
42
|
-
group :test, :development do
|
43
|
-
gem 'dotenv', '~> 2.0'
|
44
|
-
end
|
45
|
-
|
46
|
-
group :test do
|
47
|
-
<%- if config[:test] == 'rspec' -%>
|
48
|
-
gem 'rspec'
|
49
|
-
<%- else -%>
|
50
|
-
gem 'minitest'
|
51
|
-
<%- end -%>
|
52
|
-
gem 'capybara'
|
53
|
-
end
|
54
|
-
|
55
|
-
group :production do
|
56
|
-
# gem 'puma'
|
57
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
#
|
@@ -1,347 +0,0 @@
|
|
1
|
-
require 'hanami/helpers'
|
2
|
-
require 'hanami/assets'
|
3
|
-
|
4
|
-
module <%= config[:classified_app_name] %>
|
5
|
-
class Application < Hanami::Application
|
6
|
-
configure do
|
7
|
-
##
|
8
|
-
# BASIC
|
9
|
-
#
|
10
|
-
|
11
|
-
# Define the root path of this application.
|
12
|
-
# All paths specified in this configuration are relative to path below.
|
13
|
-
#
|
14
|
-
root "#{ __dir__ }/.."
|
15
|
-
|
16
|
-
# Relative load paths where this application will recursively load the code.
|
17
|
-
# When you add new directories, remember to add them here.
|
18
|
-
#
|
19
|
-
load_paths << [
|
20
|
-
'app/controllers',
|
21
|
-
'app/views'
|
22
|
-
]
|
23
|
-
|
24
|
-
# Handle exceptions with HTTP statuses (true) or don't catch them (false).
|
25
|
-
# Defaults to true.
|
26
|
-
# See: http://www.rubydoc.info/gems/hanami-controller/
|
27
|
-
|
28
|
-
# Exceptions_management
|
29
|
-
#
|
30
|
-
# handle_exceptions true
|
31
|
-
|
32
|
-
##
|
33
|
-
# HTTP
|
34
|
-
#
|
35
|
-
|
36
|
-
# Routes definitions for this application
|
37
|
-
# See: http://www.rubydoc.info/gems/hanami-router#Usage
|
38
|
-
#
|
39
|
-
routes 'config/routes'
|
40
|
-
|
41
|
-
# URI scheme used by the routing system to generate absolute URLs
|
42
|
-
# Defaults to "http"
|
43
|
-
#
|
44
|
-
# scheme 'https'
|
45
|
-
|
46
|
-
# URI host used by the routing system to generate absolute URLs
|
47
|
-
# Defaults to "localhost"
|
48
|
-
#
|
49
|
-
# host 'example.org'
|
50
|
-
|
51
|
-
# URI port used by the routing system to generate absolute URLs
|
52
|
-
# Argument: An object coercible to integer, default to 80 if the scheme is http and 443 if it's https
|
53
|
-
# This SHOULD be configured only in case the application listens to that non standard ports
|
54
|
-
#
|
55
|
-
# port 443
|
56
|
-
|
57
|
-
# Enable cookies
|
58
|
-
# Argument: boolean to toggle the feature
|
59
|
-
# A Hash with options
|
60
|
-
#
|
61
|
-
# Options: :domain - The domain (String - nil by default, not required)
|
62
|
-
# :path - Restrict cookies to a relative URI (String - nil by default)
|
63
|
-
# :max_age - Cookies expiration expressed in seconds (Integer - nil by default)
|
64
|
-
# :secure - Restrict cookies to secure connections
|
65
|
-
# (Boolean - Automatically set on true if currently using a secure connection)
|
66
|
-
# See #scheme and #ssl?
|
67
|
-
# :httponly - Prevent JavaScript access (Boolean - true by default)
|
68
|
-
#
|
69
|
-
# cookies true
|
70
|
-
# or
|
71
|
-
# cookies max_age: 300
|
72
|
-
|
73
|
-
# Enable sessions
|
74
|
-
# Argument: Symbol the Rack session adapter
|
75
|
-
# A Hash with options
|
76
|
-
#
|
77
|
-
# See: http://www.rubydoc.info/gems/rack/Rack/Session/Cookie
|
78
|
-
#
|
79
|
-
# sessions :cookie, secret: ENV['<%= config[:upcase_app_name] %>_SESSIONS_SECRET']
|
80
|
-
|
81
|
-
# Configure Rack middleware for this application
|
82
|
-
#
|
83
|
-
# middleware.use Rack::Protection
|
84
|
-
|
85
|
-
# Default format for the requests that don't specify an HTTP_ACCEPT header
|
86
|
-
# Argument: A symbol representation of a mime type, default to :html
|
87
|
-
#
|
88
|
-
# default_request_format :html
|
89
|
-
|
90
|
-
# Default format for responses that doesn't take into account the request format
|
91
|
-
# Argument: A symbol representation of a mime type, default to :html
|
92
|
-
#
|
93
|
-
# default_response_format :html
|
94
|
-
|
95
|
-
# HTTP Body parsers
|
96
|
-
# Parse non GET responses body for a specific mime type
|
97
|
-
# Argument: Symbol, which represent the format of the mime type (only `:json` is supported)
|
98
|
-
# Object, the parser
|
99
|
-
#
|
100
|
-
# body_parsers :json
|
101
|
-
|
102
|
-
##
|
103
|
-
# TEMPLATES
|
104
|
-
#
|
105
|
-
|
106
|
-
# The layout to be used by all views
|
107
|
-
#
|
108
|
-
layout :application # It will load <%= config[:classified_app_name] %>::Views::ApplicationLayout
|
109
|
-
|
110
|
-
# The relative path to templates
|
111
|
-
#
|
112
|
-
templates 'app/templates'
|
113
|
-
|
114
|
-
##
|
115
|
-
# ASSETS
|
116
|
-
#
|
117
|
-
assets do
|
118
|
-
# JavaScript compressor
|
119
|
-
#
|
120
|
-
# Supported engines:
|
121
|
-
#
|
122
|
-
# * :builtin
|
123
|
-
# * :uglifier
|
124
|
-
# * :yui
|
125
|
-
# * :closure
|
126
|
-
#
|
127
|
-
# See: http://hanamirb.org/guides/assets/compressors
|
128
|
-
#
|
129
|
-
# In order to skip JavaScript compression comment the following line
|
130
|
-
javascript_compressor :builtin
|
131
|
-
|
132
|
-
# Stylesheet compressor
|
133
|
-
#
|
134
|
-
# Supported engines:
|
135
|
-
#
|
136
|
-
# * :builtin
|
137
|
-
# * :yui
|
138
|
-
# * :sass
|
139
|
-
#
|
140
|
-
# See: http://hanamirb.org/guides/assets/compressors
|
141
|
-
#
|
142
|
-
# In order to skip stylesheet compression comment the following line
|
143
|
-
stylesheet_compressor :builtin
|
144
|
-
|
145
|
-
# Specify sources for assets
|
146
|
-
#
|
147
|
-
sources << [
|
148
|
-
'app/assets'
|
149
|
-
]
|
150
|
-
end
|
151
|
-
|
152
|
-
##
|
153
|
-
# SECURITY
|
154
|
-
#
|
155
|
-
|
156
|
-
# X-Frame-Options is a HTTP header supported by modern browsers.
|
157
|
-
# It determines if a web page can or cannot be included via <frame> and
|
158
|
-
# <iframe> tags by untrusted domains.
|
159
|
-
#
|
160
|
-
# Web applications can send this header to prevent Clickjacking attacks.
|
161
|
-
#
|
162
|
-
# Read more at:
|
163
|
-
#
|
164
|
-
# * https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options
|
165
|
-
# * https://www.owasp.org/index.php/Clickjacking
|
166
|
-
#
|
167
|
-
security.x_frame_options 'DENY'
|
168
|
-
|
169
|
-
# X-Content-Type-Options prevents browsers from interpreting files as
|
170
|
-
# something else than declared by the content type in the HTTP headers.
|
171
|
-
#
|
172
|
-
# Read more at:
|
173
|
-
#
|
174
|
-
# * https://www.owasp.org/index.php/OWASP_Secure_Headers_Project#X-Content-Type-Options
|
175
|
-
# * https://msdn.microsoft.com/en-us/library/gg622941%28v=vs.85%29.aspx
|
176
|
-
# * https://blogs.msdn.microsoft.com/ie/2008/09/02/ie8-security-part-vi-beta-2-update
|
177
|
-
#
|
178
|
-
security.x_content_type_options 'nosniff'
|
179
|
-
|
180
|
-
# X-XSS-Protection is a HTTP header to determine the behavior of the browser
|
181
|
-
# in case an XSS attack is detected.
|
182
|
-
#
|
183
|
-
# Read more at:
|
184
|
-
#
|
185
|
-
# * https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)
|
186
|
-
# * https://www.owasp.org/index.php/OWASP_Secure_Headers_Project#X-XSS-Protection
|
187
|
-
#
|
188
|
-
security.x_xss_protection '1; mode=block'
|
189
|
-
|
190
|
-
# Content-Security-Policy (CSP) is a HTTP header supported by modern browsers.
|
191
|
-
# It determines trusted sources of execution for dynamic contents
|
192
|
-
# (JavaScript) or other web related assets: stylesheets, images, fonts,
|
193
|
-
# plugins, etc.
|
194
|
-
#
|
195
|
-
# Web applications can send this header to mitigate Cross Site Scripting
|
196
|
-
# (XSS) attacks.
|
197
|
-
#
|
198
|
-
# The default value allows images, scripts, AJAX, fonts and CSS from the same
|
199
|
-
# origin, and does not allow any other resources to load (eg object,
|
200
|
-
# frame, media, etc).
|
201
|
-
#
|
202
|
-
# Inline JavaScript is NOT allowed. To enable it, please use:
|
203
|
-
# "script-src 'unsafe-inline'".
|
204
|
-
#
|
205
|
-
# Content Security Policy introduction:
|
206
|
-
#
|
207
|
-
# * http://www.html5rocks.com/en/tutorials/security/content-security-policy/
|
208
|
-
# * https://www.owasp.org/index.php/Content_Security_Policy
|
209
|
-
# * https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29
|
210
|
-
#
|
211
|
-
# Inline and eval JavaScript risks:
|
212
|
-
#
|
213
|
-
# * http://www.html5rocks.com/en/tutorials/security/content-security-policy/#inline-code-considered-harmful
|
214
|
-
# * http://www.html5rocks.com/en/tutorials/security/content-security-policy/#eval-too
|
215
|
-
#
|
216
|
-
# Content Security Policy usage:
|
217
|
-
#
|
218
|
-
# * http://content-security-policy.com/
|
219
|
-
# * https://developer.mozilla.org/en-US/docs/Web/Security/CSP/Using_Content_Security_Policy
|
220
|
-
#
|
221
|
-
# Content Security Policy references:
|
222
|
-
#
|
223
|
-
# * https://developer.mozilla.org/en-US/docs/Web/Security/CSP/CSP_policy_directives
|
224
|
-
#
|
225
|
-
security.content_security_policy %{
|
226
|
-
form-action 'self';
|
227
|
-
referrer origin-when-cross-origin;
|
228
|
-
reflected-xss block;
|
229
|
-
frame-ancestors 'self';
|
230
|
-
base-uri 'self';
|
231
|
-
default-src 'none';
|
232
|
-
script-src 'self';
|
233
|
-
connect-src 'self';
|
234
|
-
img-src 'self';
|
235
|
-
style-src 'self';
|
236
|
-
font-src 'self';
|
237
|
-
object-src 'self';
|
238
|
-
plugin-types application/pdf;
|
239
|
-
child-src 'self';
|
240
|
-
frame-src 'self';
|
241
|
-
media-src 'self'
|
242
|
-
}
|
243
|
-
|
244
|
-
##
|
245
|
-
# FRAMEWORKS
|
246
|
-
#
|
247
|
-
|
248
|
-
# Configure the code that will yield each time <%= config[:classified_app_name] %>::Action is included
|
249
|
-
# This is useful for sharing common functionality
|
250
|
-
#
|
251
|
-
# See: http://www.rubydoc.info/gems/hanami-controller#Configuration
|
252
|
-
controller.prepare do
|
253
|
-
# include MyAuthentication # included in all the actions
|
254
|
-
# before :authenticate! # run an authentication before callback
|
255
|
-
end
|
256
|
-
|
257
|
-
# Configure the code that will yield each time <%= config[:classified_app_name] %>::View is included
|
258
|
-
# This is useful for sharing common functionality
|
259
|
-
#
|
260
|
-
# See: http://www.rubydoc.info/gems/hanami-view#Configuration
|
261
|
-
view.prepare do
|
262
|
-
include Hanami::Helpers
|
263
|
-
include <%= config[:classified_app_name] %>::Assets::Helpers
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
##
|
268
|
-
# DEVELOPMENT
|
269
|
-
#
|
270
|
-
configure :development do
|
271
|
-
# Don't handle exceptions, render the stack trace
|
272
|
-
handle_exceptions false
|
273
|
-
|
274
|
-
# Logger
|
275
|
-
# See: http://hanamirb.org/guides/projects/logging
|
276
|
-
#
|
277
|
-
# Logger stream. It defaults to STDOUT.
|
278
|
-
# logger.stream "log/development.log"
|
279
|
-
#
|
280
|
-
# Logger level. It defaults to DEBUG
|
281
|
-
# logger.level :debug
|
282
|
-
#
|
283
|
-
# Logger format. It defaults to DEFAULT
|
284
|
-
# logger.format :default
|
285
|
-
end
|
286
|
-
|
287
|
-
##
|
288
|
-
# TEST
|
289
|
-
#
|
290
|
-
configure :test do
|
291
|
-
# Don't handle exceptions, render the stack trace
|
292
|
-
handle_exceptions false
|
293
|
-
|
294
|
-
# Logger
|
295
|
-
# See: http://hanamirb.org/guides/projects/logging
|
296
|
-
#
|
297
|
-
# Logger level. It defaults to ERROR
|
298
|
-
logger.level :error
|
299
|
-
end
|
300
|
-
|
301
|
-
##
|
302
|
-
# PRODUCTION
|
303
|
-
#
|
304
|
-
configure :production do
|
305
|
-
# scheme 'https'
|
306
|
-
# host 'example.org'
|
307
|
-
# port 443
|
308
|
-
|
309
|
-
# Logger
|
310
|
-
# See: http://hanamirb.org/guides/projects/logging
|
311
|
-
#
|
312
|
-
# Logger stream. It defaults to STDOUT.
|
313
|
-
# logger.stream "log/production.log"
|
314
|
-
#
|
315
|
-
# Logger level. It defaults to INFO
|
316
|
-
logger.level :info
|
317
|
-
|
318
|
-
# Logger format.
|
319
|
-
logger.format :json
|
320
|
-
|
321
|
-
assets do
|
322
|
-
# Don't compile static assets in production mode (eg. Sass, ES6)
|
323
|
-
#
|
324
|
-
# See: http://www.rubydoc.info/gems/hanami-assets#Configuration
|
325
|
-
compile false
|
326
|
-
|
327
|
-
# Use fingerprint file name for asset paths
|
328
|
-
#
|
329
|
-
# See: http://hanamirb.org/guides/assets/overview
|
330
|
-
fingerprint true
|
331
|
-
|
332
|
-
# Content Delivery Network (CDN)
|
333
|
-
#
|
334
|
-
# See: http://hanamirb.org/guides/assets/content-delivery-network
|
335
|
-
#
|
336
|
-
# scheme 'https'
|
337
|
-
# host 'cdn.example.org'
|
338
|
-
# port 443
|
339
|
-
|
340
|
-
# Subresource Integrity
|
341
|
-
#
|
342
|
-
# See: http://hanamirb.org/guides/assets/content-delivery-network/#subresource-integrity
|
343
|
-
subresource_integrity :sha256
|
344
|
-
end
|
345
|
-
end
|
346
|
-
end
|
347
|
-
end
|