hanami 0.0.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +214 -0
  3. data/FEATURES.md +156 -0
  4. data/LICENSE.md +22 -0
  5. data/README.md +80 -15
  6. data/bin/hanami +5 -0
  7. data/hanami.gemspec +27 -12
  8. data/lib/hanami.rb +78 -2
  9. data/lib/hanami/action/csrf_protection.rb +167 -0
  10. data/lib/hanami/action/routing_helpers.rb +40 -0
  11. data/lib/hanami/application.rb +244 -0
  12. data/lib/hanami/application_name.rb +101 -0
  13. data/lib/hanami/cli.rb +119 -0
  14. data/lib/hanami/cli_sub_commands/assets.rb +29 -0
  15. data/lib/hanami/cli_sub_commands/db.rb +124 -0
  16. data/lib/hanami/cli_sub_commands/destroy.rb +102 -0
  17. data/lib/hanami/cli_sub_commands/generate.rb +127 -0
  18. data/lib/hanami/commands/assets/precompile.rb +35 -0
  19. data/lib/hanami/commands/console.rb +90 -0
  20. data/lib/hanami/commands/db/abstract.rb +19 -0
  21. data/lib/hanami/commands/db/apply.rb +14 -0
  22. data/lib/hanami/commands/db/console.rb +50 -0
  23. data/lib/hanami/commands/db/create.rb +14 -0
  24. data/lib/hanami/commands/db/drop.rb +14 -0
  25. data/lib/hanami/commands/db/migrate.rb +19 -0
  26. data/lib/hanami/commands/db/prepare.rb +14 -0
  27. data/lib/hanami/commands/db/version.rb +14 -0
  28. data/lib/hanami/commands/generate/abstract.rb +63 -0
  29. data/lib/hanami/commands/generate/action.rb +262 -0
  30. data/lib/hanami/commands/generate/app.rb +116 -0
  31. data/lib/hanami/commands/generate/mailer.rb +118 -0
  32. data/lib/hanami/commands/generate/migration.rb +63 -0
  33. data/lib/hanami/commands/generate/model.rb +96 -0
  34. data/lib/hanami/commands/new/abstract.rb +128 -0
  35. data/lib/hanami/commands/new/app.rb +116 -0
  36. data/lib/hanami/commands/new/container.rb +102 -0
  37. data/lib/hanami/commands/routes.rb +41 -0
  38. data/lib/hanami/commands/server.rb +79 -0
  39. data/lib/hanami/config/configure.rb +17 -0
  40. data/lib/hanami/config/cookies.rb +68 -0
  41. data/lib/hanami/config/framework_configuration.rb +42 -0
  42. data/lib/hanami/config/load_paths.rb +27 -0
  43. data/lib/hanami/config/mapper.rb +36 -0
  44. data/lib/hanami/config/mapping.rb +12 -0
  45. data/lib/hanami/config/routes.rb +16 -0
  46. data/lib/hanami/config/security.rb +58 -0
  47. data/lib/hanami/config/sessions.rb +97 -0
  48. data/lib/hanami/configuration.rb +1728 -0
  49. data/lib/hanami/container.rb +59 -0
  50. data/lib/hanami/environment.rb +485 -0
  51. data/lib/hanami/frameworks.rb +14 -0
  52. data/lib/hanami/generators/action/action.rb.tt +8 -0
  53. data/lib/hanami/generators/action/action_spec.minitest.tt +12 -0
  54. data/lib/hanami/generators/action/action_spec.rspec.tt +11 -0
  55. data/lib/hanami/generators/action/action_without_view.rb.tt +9 -0
  56. data/lib/hanami/generators/action/template.tt +0 -0
  57. data/lib/hanami/generators/action/view.rb.tt +5 -0
  58. data/lib/hanami/generators/action/view_spec.minitest.tt +13 -0
  59. data/lib/hanami/generators/action/view_spec.rspec.tt +12 -0
  60. data/lib/hanami/generators/app/.gitkeep.tt +1 -0
  61. data/lib/hanami/generators/app/application.rb.tt +273 -0
  62. data/lib/hanami/generators/app/config/initializers/.gitkeep +0 -0
  63. data/lib/hanami/generators/app/config/routes.rb.tt +2 -0
  64. data/lib/hanami/generators/app/favicon.ico +0 -0
  65. data/lib/hanami/generators/app/templates/application.html.erb.tt +10 -0
  66. data/lib/hanami/generators/app/views/application_layout.rb.tt +7 -0
  67. data/lib/hanami/generators/application/app/.env.development.tt +4 -0
  68. data/lib/hanami/generators/application/app/.env.test.tt +4 -0
  69. data/lib/hanami/generators/application/app/.env.tt +1 -0
  70. data/lib/hanami/generators/application/app/.gitignore +0 -0
  71. data/lib/hanami/generators/application/app/.gitkeep +1 -0
  72. data/lib/hanami/generators/application/app/Gemfile.tt +37 -0
  73. data/lib/hanami/generators/application/app/Rakefile.minitest.tt +11 -0
  74. data/lib/hanami/generators/application/app/Rakefile.rspec.tt +6 -0
  75. data/lib/hanami/generators/application/app/apps/.gitkeep.tt +1 -0
  76. data/lib/hanami/generators/application/app/capybara.rb.rspec.tt +8 -0
  77. data/lib/hanami/generators/application/app/config.ru.tt +3 -0
  78. data/lib/hanami/generators/application/app/config/application.rb.tt +270 -0
  79. data/lib/hanami/generators/application/app/config/environment.rb.tt +5 -0
  80. data/lib/hanami/generators/application/app/config/initializers/.gitkeep +0 -0
  81. data/lib/hanami/generators/application/app/config/routes.rb.tt +2 -0
  82. data/lib/hanami/generators/application/app/db/.gitkeep +1 -0
  83. data/lib/hanami/generators/application/app/favicon.ico +0 -0
  84. data/lib/hanami/generators/application/app/features_helper.rb.minitest.tt +11 -0
  85. data/lib/hanami/generators/application/app/features_helper.rb.rspec.tt +12 -0
  86. data/lib/hanami/generators/application/app/gitignore.tt +2 -0
  87. data/lib/hanami/generators/application/app/gitignore_with_db.tt +4 -0
  88. data/lib/hanami/generators/application/app/hanamirc.tt +3 -0
  89. data/lib/hanami/generators/application/app/lib/app_name.rb.tt +59 -0
  90. data/lib/hanami/generators/application/app/lib/chirp/entities/.gitkeep +1 -0
  91. data/lib/hanami/generators/application/app/lib/chirp/repositories/.gitkeep +1 -0
  92. data/lib/hanami/generators/application/app/lib/config/mapping.rb.tt +7 -0
  93. data/lib/hanami/generators/application/app/rspec.rspec.tt +2 -0
  94. data/lib/hanami/generators/application/app/schema.sql.tt +0 -0
  95. data/lib/hanami/generators/application/app/spec_helper.rb.minitest.tt +7 -0
  96. data/lib/hanami/generators/application/app/spec_helper.rb.rspec.tt +104 -0
  97. data/lib/hanami/generators/application/app/templates/application.html.erb.tt +10 -0
  98. data/lib/hanami/generators/application/app/views/application_layout.rb.tt +7 -0
  99. data/lib/hanami/generators/application/container/.env.development.tt +3 -0
  100. data/lib/hanami/generators/application/container/.env.test.tt +3 -0
  101. data/lib/hanami/generators/application/container/.env.tt +1 -0
  102. data/lib/hanami/generators/application/container/.gitignore +0 -0
  103. data/lib/hanami/generators/application/container/.gitkeep +1 -0
  104. data/lib/hanami/generators/application/container/Gemfile.tt +36 -0
  105. data/lib/hanami/generators/application/container/Rakefile.minitest.tt +11 -0
  106. data/lib/hanami/generators/application/container/Rakefile.rspec.tt +6 -0
  107. data/lib/hanami/generators/application/container/capybara.rb.rspec.tt +8 -0
  108. data/lib/hanami/generators/application/container/config.ru.tt +3 -0
  109. data/lib/hanami/generators/application/container/config/environment.rb.tt +7 -0
  110. data/lib/hanami/generators/application/container/config/initializers/.gitkeep +0 -0
  111. data/lib/hanami/generators/application/container/db/.gitkeep +1 -0
  112. data/lib/hanami/generators/application/container/features_helper.rb.minitest.tt +11 -0
  113. data/lib/hanami/generators/application/container/features_helper.rb.rspec.tt +12 -0
  114. data/lib/hanami/generators/application/container/gitignore.tt +2 -0
  115. data/lib/hanami/generators/application/container/gitignore_with_db.tt +4 -0
  116. data/lib/hanami/generators/application/container/hanamirc.tt +3 -0
  117. data/lib/hanami/generators/application/container/lib/app_name.rb.tt +60 -0
  118. data/lib/hanami/generators/application/container/lib/chirp/entities/.gitkeep +1 -0
  119. data/lib/hanami/generators/application/container/lib/chirp/mailers/.gitkeep +0 -0
  120. data/lib/hanami/generators/application/container/lib/chirp/mailers/templates/.gitkeep +0 -0
  121. data/lib/hanami/generators/application/container/lib/chirp/repositories/.gitkeep +1 -0
  122. data/lib/hanami/generators/application/container/lib/config/mapping.rb.tt +7 -0
  123. data/lib/hanami/generators/application/container/rspec.rspec.tt +2 -0
  124. data/lib/hanami/generators/application/container/schema.sql.tt +0 -0
  125. data/lib/hanami/generators/application/container/spec_helper.rb.minitest.tt +7 -0
  126. data/lib/hanami/generators/application/container/spec_helper.rb.rspec.tt +104 -0
  127. data/lib/hanami/generators/database_config.rb +99 -0
  128. data/lib/hanami/generators/generatable.rb +51 -0
  129. data/lib/hanami/generators/generator.rb +35 -0
  130. data/lib/hanami/generators/mailer/mailer.rb.tt +7 -0
  131. data/lib/hanami/generators/mailer/mailer_spec.rb.tt +7 -0
  132. data/lib/hanami/generators/mailer/template.html.tt +0 -0
  133. data/lib/hanami/generators/mailer/template.txt.tt +0 -0
  134. data/lib/hanami/generators/migration/migration.rb.tt +4 -0
  135. data/lib/hanami/generators/model/entity.rb.tt +3 -0
  136. data/lib/hanami/generators/model/entity_spec.minitest.tt +5 -0
  137. data/lib/hanami/generators/model/entity_spec.rspec.tt +3 -0
  138. data/lib/hanami/generators/model/repository.rb.tt +3 -0
  139. data/lib/hanami/generators/model/repository_spec.minitest.tt +5 -0
  140. data/lib/hanami/generators/model/repository_spec.rspec.tt +3 -0
  141. data/lib/hanami/generators/test_framework.rb +42 -0
  142. data/lib/hanami/hanamirc.rb +152 -0
  143. data/lib/hanami/loader.rb +258 -0
  144. data/lib/hanami/mailer/glue.rb +68 -0
  145. data/lib/hanami/middleware.rb +143 -0
  146. data/lib/hanami/rake_helper.rb +68 -0
  147. data/lib/hanami/rake_tasks.rb +2 -0
  148. data/lib/hanami/rendering_policy.rb +77 -0
  149. data/lib/hanami/repositories/car_repository.rb +3 -0
  150. data/lib/hanami/repositories/name_repository.rb +3 -0
  151. data/lib/hanami/root.rb +7 -0
  152. data/lib/hanami/routes.rb +151 -0
  153. data/lib/hanami/routing/default.rb +25 -0
  154. data/lib/hanami/setup.rb +3 -0
  155. data/lib/hanami/static.rb +77 -0
  156. data/lib/hanami/templates/default.html.erb +9 -0
  157. data/lib/hanami/templates/welcome.html.erb +52 -0
  158. data/lib/hanami/version.rb +4 -1
  159. data/lib/hanami/views/default.rb +34 -0
  160. data/lib/hanami/views/default_template_finder.rb +20 -0
  161. data/lib/hanami/views/null_view.rb +17 -0
  162. data/lib/hanami/welcome.rb +40 -0
  163. metadata +357 -16
  164. data/.gitignore +0 -9
  165. data/Gemfile +0 -4
  166. data/Rakefile +0 -2
  167. data/bin/console +0 -14
  168. data/bin/setup +0 -8
@@ -0,0 +1,14 @@
1
+ require 'hanami/router'
2
+ require 'hanami/view'
3
+ require 'hanami/controller'
4
+ require 'hanami/action/glue'
5
+ require 'hanami/action/csrf_protection'
6
+ require 'hanami/mailer'
7
+ require 'hanami/mailer/glue'
8
+ require 'hanami/assets'
9
+
10
+ Hanami::Controller.configure do
11
+ prepare do
12
+ include Hanami::Action::Glue
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ module <%= config[:app] %>::Controllers::<%= config[:controller] %>
2
+ class <%= config[:action] %>
3
+ include <%= config[:app] %>::Action
4
+
5
+ def call(params)
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+ require_relative '<%= config[:relative_action_path] %>'
3
+
4
+ describe <%= config[:app] %>::Controllers::<%= config[:controller] %>::<%= config[:action] %> do
5
+ let(:action) { <%= config[:app] %>::Controllers::<%= config[:controller] %>::<%= config[:action] %>.new }
6
+ let(:params) { Hash[] }
7
+
8
+ it 'is successful' do
9
+ response = action.call(params)
10
+ response[0].must_equal 200
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ require_relative '<%= config[:relative_action_path] %>'
2
+
3
+ RSpec.describe <%= config[:app] %>::Controllers::<%= config[:controller] %>::<%= config[:action] %> do
4
+ let(:action) { described_class.new }
5
+ let(:params) { Hash[] }
6
+
7
+ it 'is successful' do
8
+ response = action.call(params)
9
+ expect(response[0]).to eq 200
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module <%= config[:app] %>::Controllers::<%= config[:controller] %>
2
+ class <%= config[:action] %>
3
+ include <%= config[:app] %>::Action
4
+
5
+ def call(params)
6
+ self.body = 'OK'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module <%= config[:app] %>::Views::<%= config[:controller] %>
2
+ class <%= config[:action] %>
3
+ include <%= config[:app] %>::View
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+ require_relative '<%= config[:relative_view_path] %>'
3
+
4
+ describe <%= config[:app] %>::Views::<%= config[:controller] %>::<%= config[:action] %> do
5
+ let(:exposures) { Hash[foo: 'bar'] }
6
+ let(:template) { Hanami::View::Template.new('<%= config[:template_path] %>') }
7
+ let(:view) { <%= config[:app] %>::Views::<%= config[:controller] %>::<%= config[:action] %>.new(template, exposures) }
8
+ let(:rendered) { view.render }
9
+
10
+ it 'exposes #foo' do
11
+ view.foo.must_equal exposures.fetch(:foo)
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '<%= config[:relative_view_path] %>'
2
+
3
+ RSpec.describe <%= config[:app] %>::Views::<%= config[:controller] %>::<%= config[:action] %> do
4
+ let(:exposures) { Hash[foo: 'bar'] }
5
+ let(:template) { Hanami::View::Template.new('<%= config[:template_path] %>') }
6
+ let(:view) { described_class.new(template, exposures) }
7
+ let(:rendered) { view.render }
8
+
9
+ it 'exposes #foo' do
10
+ expect(view.foo).to eq exposures.fetch(:foo)
11
+ end
12
+ end
@@ -0,0 +1,273 @@
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
+ 'controllers',
21
+ '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/#Exceptions_management
27
+ #
28
+ # handle_exceptions true
29
+
30
+ ##
31
+ # HTTP
32
+ #
33
+
34
+ # Routes definitions for this application
35
+ # See: http://www.rubydoc.info/gems/hanami-router#Usage
36
+ #
37
+ routes 'config/routes'
38
+
39
+ # URI scheme used by the routing system to generate absolute URLs
40
+ # Defaults to "http"
41
+ #
42
+ # scheme 'https'
43
+
44
+ # URI host used by the routing system to generate absolute URLs
45
+ # Defaults to "localhost"
46
+ #
47
+ # host 'example.org'
48
+
49
+ # URI port used by the routing system to generate absolute URLs
50
+ # Argument: An object coercible to integer, default to 80 if the scheme is http and 443 if it's https
51
+ # This SHOULD be configured only in case the application listens to that non standard ports
52
+ #
53
+ # port 443
54
+
55
+ # Enable cookies
56
+ # Argument: boolean to toggle the feature
57
+ # A Hash with options
58
+ #
59
+ # Options: :domain - The domain (String - nil by default, not required)
60
+ # :path - Restrict cookies to a relative URI (String - nil by default)
61
+ # :max_age - Cookies expiration expressed in seconds (Integer - nil by default)
62
+ # :secure - Restrict cookies to secure connections
63
+ # (Boolean - Automatically set on true if currenlty using a secure connection)
64
+ # See #scheme and #ssl?
65
+ # :httponly - Prevent JavaScript access (Boolean - true by default)
66
+ #
67
+ # cookies true
68
+ # or
69
+ # cookies max_age: 300
70
+
71
+ # Enable sessions
72
+ # Argument: Symbol the Rack session adapter
73
+ # A Hash with options
74
+ #
75
+ # See: http://www.rubydoc.info/gems/rack/Rack/Session/Cookie
76
+ #
77
+ # sessions :cookie, secret: ENV['<%= config[:upcase_app_name] %>_SESSIONS_SECRET']
78
+
79
+ # Configure Rack middleware for this application
80
+ #
81
+ # middleware.use Rack::Protection
82
+
83
+ # Default format for the requests that don't specify an HTTP_ACCEPT header
84
+ # Argument: A symbol representation of a mime type, default to :html
85
+ #
86
+ # default_request_format :html
87
+
88
+ # Default format for responses that doesn't take into account the request format
89
+ # Argument: A symbol representation of a mime type, default to :html
90
+ #
91
+ # default_response_format :html
92
+
93
+ # HTTP Body parsers
94
+ # Parse non GET responses body for a specific mime type
95
+ # Argument: Symbol, which represent the format of the mime type (only `:json` is supported)
96
+ # Object, the parser
97
+ #
98
+ # body_parsers :json
99
+
100
+ # When it's true and the router receives a non-encrypted request (http),
101
+ # it redirects to the secure equivalent resource (https). Default disabled.
102
+ #
103
+ # force_ssl true
104
+
105
+ ##
106
+ # TEMPLATES
107
+ #
108
+
109
+ # The layout to be used by all views
110
+ #
111
+ layout :application # It will load <%= config[:classified_app_name] %>::Views::ApplicationLayout
112
+
113
+ # The relative path to templates
114
+ #
115
+ templates 'templates'
116
+
117
+ ##
118
+ # ASSETS
119
+ #
120
+ assets do
121
+ # JavaScript compressor
122
+ #
123
+ # Supported engines:
124
+ #
125
+ # * :builtin
126
+ # * :uglifier
127
+ # * :yui
128
+ # * :closure
129
+ #
130
+ # See: http://hanamirb.org/guides/assets/compressors
131
+ #
132
+ # In order to skip JavaScript compression comment the following line
133
+ javascript_compressor :builtin
134
+
135
+ # Stylesheet compressor
136
+ #
137
+ # Supported engines:
138
+ #
139
+ # * :builtin
140
+ # * :yui
141
+ # * :sass
142
+ #
143
+ # See: http://hanamirb.org/guides/assets/compressors
144
+ #
145
+ # In order to skip stylesheet compression comment the following line
146
+ stylesheet_compressor :builtin
147
+
148
+ # Specify sources for assets
149
+ #
150
+ sources << [
151
+ 'assets'
152
+ ]
153
+ end
154
+
155
+ ##
156
+ # SECURITY
157
+ #
158
+
159
+ # X-Frame-Options is a HTTP header supported by modern browsers.
160
+ # It determines if a web page can or cannot be included via <frame> and
161
+ # <iframe> tags by untrusted domains.
162
+ #
163
+ # Web applications can send this header to prevent Clickjacking attacks.
164
+ #
165
+ # Read more at:
166
+ #
167
+ # * https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options
168
+ # * https://www.owasp.org/index.php/Clickjacking
169
+ #
170
+ security.x_frame_options "DENY"
171
+
172
+ # Content-Security-Policy (CSP) is a HTTP header supported by modern browsers.
173
+ # It determines trusted sources of execution for dynamic contents
174
+ # (JavaScript) or other web related assets: stylesheets, images, fonts,
175
+ # plugins, etc.
176
+ #
177
+ # Web applications can send this header to mitigate Cross Site Scripting
178
+ # (XSS) attacks.
179
+ #
180
+ # The default value allows images, scripts, AJAX, fonts and CSS from the same
181
+ # origin, and does not allow any other resources to load (eg object,
182
+ # frame, media, etc).
183
+ #
184
+ # Inline JavaScript is NOT allowed. To enable it, please use:
185
+ # "script-src 'unsafe-inline'".
186
+ #
187
+ # Content Security Policy introduction:
188
+ #
189
+ # * http://www.html5rocks.com/en/tutorials/security/content-security-policy/
190
+ # * https://www.owasp.org/index.php/Content_Security_Policy
191
+ # * https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29
192
+ #
193
+ # Inline and eval JavaScript risks:
194
+ #
195
+ # * http://www.html5rocks.com/en/tutorials/security/content-security-policy/#inline-code-considered-harmful
196
+ # * http://www.html5rocks.com/en/tutorials/security/content-security-policy/#eval-too
197
+ #
198
+ # Content Security Policy usage:
199
+ #
200
+ # * http://content-security-policy.com/
201
+ # * https://developer.mozilla.org/en-US/docs/Web/Security/CSP/Using_Content_Security_Policy
202
+ #
203
+ security.content_security_policy "default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self'; font-src 'self';"
204
+
205
+ ##
206
+ # FRAMEWORKS
207
+ #
208
+
209
+ # Configure the code that will yield each time <%= config[:classified_app_name] %>::Action is included
210
+ # This is useful for sharing common functionality
211
+ #
212
+ # See: http://www.rubydoc.info/gems/hanami-controller#Configuration
213
+ controller.prepare do
214
+ # include MyAuthentication # included in all the actions
215
+ # before :authenticate! # run an authentication before callback
216
+ end
217
+
218
+ # Configure the code that will yield each time <%= config[:classified_app_name] %>::View is included
219
+ # This is useful for sharing common functionality
220
+ #
221
+ # See: http://www.rubydoc.info/gems/hanami-view#Configuration
222
+ view.prepare do
223
+ include Hanami::Helpers
224
+ include <%= config[:classified_app_name] %>::Assets::Helpers
225
+ end
226
+ end
227
+
228
+ ##
229
+ # DEVELOPMENT
230
+ #
231
+ configure :development do
232
+ # Don't handle exceptions, render the stack trace
233
+ handle_exceptions false
234
+ end
235
+
236
+ ##
237
+ # TEST
238
+ #
239
+ configure :test do
240
+ # Don't handle exceptions, render the stack trace
241
+ handle_exceptions false
242
+ end
243
+
244
+ ##
245
+ # PRODUCTION
246
+ #
247
+ configure :production do
248
+ # scheme 'https'
249
+ # host 'example.org'
250
+ # port 443
251
+
252
+ assets do
253
+ # Don't compile static assets in production mode (eg. Sass, ES6)
254
+ #
255
+ # See: http://www.rubydoc.info/gems/hanami-assets#Configuration
256
+ compile false
257
+
258
+ # Use digest file name for asset paths
259
+ #
260
+ # See: http://hanamirb.org/guides/assets/digest
261
+ digest true
262
+
263
+ # Content Delivery Network (CDN)
264
+ #
265
+ # See: http://hanamirb.org/guides/assets/content-delivery-network
266
+ #
267
+ # scheme 'https'
268
+ # host 'cdn.example.org'
269
+ # port 443
270
+ end
271
+ end
272
+ end
273
+ end
@@ -0,0 +1,2 @@
1
+ # Configure your routes here
2
+ # See: http://www.rubydoc.info/gems/hanami-router/#Usage
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= config[:classified_app_name] %></title>
5
+ <%%= favicon %>
6
+ </head>
7
+ <body>
8
+ <%%= yield %>
9
+ </body>
10
+ </html>
@@ -0,0 +1,7 @@
1
+ module <%= config[:classified_app_name] %>
2
+ module Views
3
+ class ApplicationLayout
4
+ include <%= config[:classified_app_name] %>::Layout
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ # Define ENV variables for development environment
2
+ <%= config[:upcase_app_name] %>_DATABASE_URL="<%= config[:database_config][:uri][:development] %>"
3
+ <%= config[:upcase_app_name] %>_SESSIONS_SECRET="<%= SecureRandom.hex(32) %>"
4
+ SERVE_STATIC_ASSETS="true"
@@ -0,0 +1,4 @@
1
+ # Define ENV variables for test environment
2
+ <%= config[:app_name].to_env_s %>_DATABASE_URL="<%= config[:database_config][:uri][:test] %>"
3
+ <%= config[:upcase_app_name] %>_SESSIONS_SECRET="<%= SecureRandom.hex(32) %>"
4
+ SERVE_STATIC_ASSETS="true"
@@ -0,0 +1 @@
1
+ # Define ENV variables
@@ -0,0 +1,37 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'bundler'
4
+ gem 'rake'
5
+
6
+ <%- if config[:hanami_head] -%>
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', '<%= Hanami::VERSION %>'
19
+ gem 'hanami-model', '<%= config[:hanami_model_version] %>'
20
+ <%- end -%>
21
+
22
+ <%- if config[:database_config][:gem] -%>
23
+ gem '<%= config[:database_config][:gem] %>'
24
+ <%- end -%>
25
+
26
+ group :test do
27
+ <%- if config[:test] == 'rspec' -%>
28
+ gem 'rspec'
29
+ <%- else -%>
30
+ gem 'minitest'
31
+ <%- end -%>
32
+ gem 'capybara'
33
+ end
34
+
35
+ group :production do
36
+ # gem 'puma'
37
+ end