Upgrade Crystal to 1.2.1 and Lucky to 0.29.0
This commit is contained in:
parent
e365ee8be5
commit
1449acc500
29 changed files with 121 additions and 91 deletions
|
@ -1 +1 @@
|
||||||
0.36.1
|
1.2.1
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
nodejs 12.14.1
|
nodejs 12.14.1
|
||||||
crystal 1.0.0
|
crystal 1.2.1
|
||||||
|
|
9
config/application.cr
Normal file
9
config/application.cr
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module Application
|
||||||
|
Habitat.create do
|
||||||
|
setting name : String
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Application.configure do |settings|
|
||||||
|
settings.name = "Scribe"
|
||||||
|
end
|
|
@ -3,7 +3,8 @@ require "./server"
|
||||||
Authentic.configure do |settings|
|
Authentic.configure do |settings|
|
||||||
settings.secret_key = Lucky::Server.settings.secret_key_base
|
settings.secret_key = Lucky::Server.settings.secret_key_base
|
||||||
|
|
||||||
unless Lucky::Env.production?
|
unless LuckyEnv.production?
|
||||||
|
# This value can be between 4 and 31
|
||||||
fastest_encryption_possible = 4
|
fastest_encryption_possible = 4
|
||||||
settings.encryption_cost = fastest_encryption_possible
|
settings.encryption_cost = fastest_encryption_possible
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# This enables the color output when in development or test
|
# This enables the color output when in development or test
|
||||||
# Check out the Colorize docs for more information
|
# Check out the Colorize docs for more information
|
||||||
# https://crystal-lang.org/api/Colorize.html
|
# https://crystal-lang.org/api/Colorize.html
|
||||||
Colorize.enabled = Lucky::Env.development? || Lucky::Env.test?
|
Colorize.enabled = LuckyEnv.development? || LuckyEnv.test?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
database_name = "scribe_#{Lucky::Env.name}"
|
database_name = "scribe_#{LuckyEnv.environment}"
|
||||||
|
|
||||||
AppDatabase.configure do |settings|
|
AppDatabase.configure do |settings|
|
||||||
if Lucky::Env.production?
|
if LuckyEnv.production?
|
||||||
settings.credentials = Avram::Credentials.parse(ENV["DATABASE_URL"])
|
settings.credentials = Avram::Credentials.parse(ENV["DATABASE_URL"])
|
||||||
else
|
else
|
||||||
settings.credentials = Avram::Credentials.parse?(ENV["DATABASE_URL"]?) || Avram::Credentials.new(
|
settings.credentials = Avram::Credentials.parse?(ENV["DATABASE_URL"]?) || Avram::Credentials.new(
|
||||||
|
@ -16,5 +16,9 @@ end
|
||||||
|
|
||||||
Avram.configure do |settings|
|
Avram.configure do |settings|
|
||||||
settings.database_to_migrate = AppDatabase
|
settings.database_to_migrate = AppDatabase
|
||||||
settings.lazy_load_enabled = Lucky::Env.production?
|
settings.lazy_load_enabled = LuckyEnv.production?
|
||||||
|
|
||||||
|
# Always parse `Time` values with these specific formats.
|
||||||
|
# Used for both database values, and datetime input fields.
|
||||||
|
# settings.time_formats << "%F"
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,24 +1,3 @@
|
||||||
module Lucky::Env
|
# Environments are managed using `LuckyEnv`. By default, development, production
|
||||||
extend self
|
# and test are supported. See
|
||||||
|
# https://luckyframework.org/guides/getting-started/configuration for details.
|
||||||
{% for env in [:development, :test, :production] %}
|
|
||||||
def {{ env.id }}?
|
|
||||||
name == {{ env.id.stringify }}
|
|
||||||
end
|
|
||||||
{% end %}
|
|
||||||
|
|
||||||
def name
|
|
||||||
ENV["LUCKY_ENV"]? || "development"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns true if a task is being run through the `lucky` cli
|
|
||||||
#
|
|
||||||
# Use this method to only run (or avoid running) code when a task is executed.
|
|
||||||
def task?
|
|
||||||
ENV["LUCKY_TASK"]? == "true"
|
|
||||||
end
|
|
||||||
|
|
||||||
def use_local?
|
|
||||||
ENV.fetch("USE_LOCAL", "false") == "true"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
Lucky::ErrorHandler.configure do |settings|
|
Lucky::ErrorHandler.configure do |settings|
|
||||||
settings.show_debug_output = !Lucky::Env.production?
|
settings.show_debug_output = !LuckyEnv.production?
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
Lucky::HTMLPage.configure do |settings|
|
Lucky::HTMLPage.configure do |settings|
|
||||||
settings.render_component_comments = !Lucky::Env.production?
|
settings.render_component_comments = !LuckyEnv.production?
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
require "file_utils"
|
require "file_utils"
|
||||||
|
|
||||||
if Lucky::Env.test?
|
if LuckyEnv.test?
|
||||||
# Logs to `tmp/test.log`
|
# Logs to `tmp/test.log`
|
||||||
FileUtils.mkdir_p("tmp")
|
FileUtils.mkdir_p("tmp")
|
||||||
|
|
||||||
backend = Log::IOBackend.new(File.new("tmp/test.log", mode: "w"))
|
backend = Log::IOBackend.new(File.new("tmp/test.log", mode: "w"))
|
||||||
backend.formatter = Lucky::PrettyLogFormatter.proc
|
backend.formatter = Lucky::PrettyLogFormatter.proc
|
||||||
Log.dexter.configure(:debug, backend)
|
Log.dexter.configure(:debug, backend)
|
||||||
elsif Lucky::Env.production?
|
elsif LuckyEnv.production?
|
||||||
backend = Log::IOBackend.new
|
backend = Log::IOBackend.new
|
||||||
backend.formatter = Dexter::JSONLogFormatter.proc
|
backend.formatter = Dexter::JSONLogFormatter.proc
|
||||||
Log.dexter.configure(:info, backend)
|
Log.dexter.configure(:info, backend)
|
||||||
|
@ -26,7 +26,7 @@ Avram::QueryLog.dexter.configure(:none)
|
||||||
|
|
||||||
# Skip logging static assets requests in development
|
# Skip logging static assets requests in development
|
||||||
Lucky::LogHandler.configure do |settings|
|
Lucky::LogHandler.configure do |settings|
|
||||||
if Lucky::Env.development?
|
if LuckyEnv.development?
|
||||||
settings.skip_if = ->(context : HTTP::Server::Context) {
|
settings.skip_if = ->(context : HTTP::Server::Context) {
|
||||||
context.request.method.downcase == "get" &&
|
context.request.method.downcase == "get" &&
|
||||||
context.request.resource.starts_with?(/\/css\/|\/js\/|\/assets\/|\/favicon\.ico/)
|
context.request.resource.starts_with?(/\/css\/|\/js\/|\/assets\/|\/favicon\.ico/)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Lucky::RouteHelper.configure do |settings|
|
Lucky::RouteHelper.configure do |settings|
|
||||||
if Lucky::Env.production?
|
if LuckyEnv.production?
|
||||||
# Example: https://my_app.com
|
# Example: https://my_app.com
|
||||||
settings.base_uri = ENV.fetch("APP_DOMAIN")
|
settings.base_uri = ENV.fetch("APP_DOMAIN")
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Lucky::Server.configure do |settings|
|
Lucky::Server.configure do |settings|
|
||||||
if Lucky::Env.production?
|
if LuckyEnv.production?
|
||||||
settings.secret_key_base = secret_key_from_env
|
settings.secret_key_base = secret_key_from_env
|
||||||
settings.host = "0.0.0.0"
|
settings.host = "0.0.0.0"
|
||||||
settings.port = ENV["PORT"].to_i
|
settings.port = ENV["PORT"].to_i
|
||||||
|
@ -19,13 +19,23 @@ Lucky::ForceSSLHandler.configure do |settings|
|
||||||
# To force SSL in production, uncomment the lines below.
|
# To force SSL in production, uncomment the lines below.
|
||||||
# This will cause http requests to be redirected to https:
|
# This will cause http requests to be redirected to https:
|
||||||
#
|
#
|
||||||
# settings.enabled = Lucky::Env.production?
|
# settings.enabled = LuckyEnv.production?
|
||||||
# settings.strict_transport_security = {max_age: 1.year, include_subdomains: true}
|
# settings.strict_transport_security = {max_age: 1.year, include_subdomains: true}
|
||||||
#
|
#
|
||||||
# Or, leave it disabled:
|
# Or, leave it disabled:
|
||||||
settings.enabled = false
|
settings.enabled = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Set a uniuqe ID for each HTTP request.
|
||||||
|
Lucky::RequestIdHandler.configure do |settings|
|
||||||
|
# To enable the request ID, uncomment the lines below.
|
||||||
|
# You can set your own custom String, or use a random UUID.
|
||||||
|
#
|
||||||
|
# settings.set_request_id = ->(context : HTTP::Server::Context) {
|
||||||
|
# UUID.random.to_s
|
||||||
|
# }
|
||||||
|
end
|
||||||
|
|
||||||
private def secret_key_from_env
|
private def secret_key_from_env
|
||||||
ENV["SECRET_KEY_BASE"]? || raise_missing_secret_key_in_production
|
ENV["SECRET_KEY_BASE"]? || raise_missing_secret_key_in_production
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
"@rails/ujs": "^6.0.0",
|
"@rails/ujs": "^6.0.0",
|
||||||
"compression-webpack-plugin": "^8.0.1",
|
"compression-webpack-plugin": "^8.0.1",
|
||||||
"laravel-mix": "^6.0.28",
|
"laravel-mix": "^6.0.28",
|
||||||
"normalize-scss": "^7.0.1",
|
"modern-normalize": "^1.1.0",
|
||||||
"postcss": "^8.3.6",
|
"postcss": "^8.3.6",
|
||||||
"tufte-css": "^1.8.0",
|
"tufte-css": "^1.8.0",
|
||||||
"turbolinks": "^5.2.0"
|
"turbolinks": "^5.2.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"heroku-postbuild": "yarn prod",
|
"heroku-postbuild": "yarn prod",
|
||||||
"dev": "mix",
|
"dev": "yarn run mix",
|
||||||
"watch": "mix watch",
|
"watch": "yarn run mix watch",
|
||||||
"prod": "mix --production"
|
"prod": "yarn run mix --production"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/compat-data": "^7.9.0",
|
"@babel/compat-data": "^7.9.0",
|
||||||
|
|
46
shard.lock
46
shard.lock
|
@ -2,15 +2,19 @@ version: 2.0
|
||||||
shards:
|
shards:
|
||||||
authentic:
|
authentic:
|
||||||
git: https://github.com/luckyframework/authentic.git
|
git: https://github.com/luckyframework/authentic.git
|
||||||
version: 0.7.3
|
version: 0.8.1
|
||||||
|
|
||||||
avram:
|
avram:
|
||||||
git: https://github.com/luckyframework/avram.git
|
git: https://github.com/luckyframework/avram.git
|
||||||
version: 0.20.0
|
version: 0.22.0
|
||||||
|
|
||||||
|
backtracer:
|
||||||
|
git: https://github.com/sija/backtracer.cr.git
|
||||||
|
version: 1.2.1
|
||||||
|
|
||||||
carbon:
|
carbon:
|
||||||
git: https://github.com/luckyframework/carbon.git
|
git: https://github.com/luckyframework/carbon.git
|
||||||
version: 0.1.4
|
version: 0.2.0
|
||||||
|
|
||||||
cry:
|
cry:
|
||||||
git: https://github.com/luckyframework/cry.git
|
git: https://github.com/luckyframework/cry.git
|
||||||
|
@ -28,17 +32,9 @@ shards:
|
||||||
git: https://github.com/luckyframework/dexter.git
|
git: https://github.com/luckyframework/dexter.git
|
||||||
version: 0.3.3
|
version: 0.3.3
|
||||||
|
|
||||||
dotenv:
|
|
||||||
git: https://github.com/gdotdesign/cr-dotenv.git
|
|
||||||
version: 1.0.0
|
|
||||||
|
|
||||||
exception_page:
|
exception_page:
|
||||||
git: https://github.com/crystal-loot/exception_page.git
|
git: https://github.com/crystal-loot/exception_page.git
|
||||||
version: 0.1.5
|
version: 0.2.1
|
||||||
|
|
||||||
future:
|
|
||||||
git: https://github.com/crystal-community/future.cr.git
|
|
||||||
version: 1.0.0+git.commit.9fe168418c6884cb3552c13b004763eb4815ceb9
|
|
||||||
|
|
||||||
habitat:
|
habitat:
|
||||||
git: https://github.com/luckyframework/habitat.git
|
git: https://github.com/luckyframework/habitat.git
|
||||||
|
@ -46,7 +42,15 @@ shards:
|
||||||
|
|
||||||
lucky:
|
lucky:
|
||||||
git: https://github.com/luckyframework/lucky.git
|
git: https://github.com/luckyframework/lucky.git
|
||||||
version: 0.27.2
|
version: 0.29.0
|
||||||
|
|
||||||
|
lucky_cache:
|
||||||
|
git: https://github.com/luckyframework/lucky_cache.git
|
||||||
|
version: 0.1.0
|
||||||
|
|
||||||
|
lucky_env:
|
||||||
|
git: https://github.com/luckyframework/lucky_env.git
|
||||||
|
version: 0.1.4
|
||||||
|
|
||||||
lucky_flow:
|
lucky_flow:
|
||||||
git: https://github.com/luckyframework/lucky_flow.git
|
git: https://github.com/luckyframework/lucky_flow.git
|
||||||
|
@ -54,11 +58,11 @@ shards:
|
||||||
|
|
||||||
lucky_router:
|
lucky_router:
|
||||||
git: https://github.com/luckyframework/lucky_router.git
|
git: https://github.com/luckyframework/lucky_router.git
|
||||||
version: 0.4.2
|
version: 0.5.1
|
||||||
|
|
||||||
lucky_task:
|
lucky_task:
|
||||||
git: https://github.com/luckyframework/lucky_task.git
|
git: https://github.com/luckyframework/lucky_task.git
|
||||||
version: 0.1.0
|
version: 0.1.1
|
||||||
|
|
||||||
monads:
|
monads:
|
||||||
git: https://github.com/alex-lairan/monads.git
|
git: https://github.com/alex-lairan/monads.git
|
||||||
|
@ -66,7 +70,7 @@ shards:
|
||||||
|
|
||||||
pg:
|
pg:
|
||||||
git: https://github.com/will/crystal-pg.git
|
git: https://github.com/will/crystal-pg.git
|
||||||
version: 0.23.2
|
version: 0.24.0
|
||||||
|
|
||||||
pulsar:
|
pulsar:
|
||||||
git: https://github.com/luckyframework/pulsar.git
|
git: https://github.com/luckyframework/pulsar.git
|
||||||
|
@ -78,11 +82,15 @@ shards:
|
||||||
|
|
||||||
shell-table:
|
shell-table:
|
||||||
git: https://github.com/luckyframework/shell-table.cr.git
|
git: https://github.com/luckyframework/shell-table.cr.git
|
||||||
version: 0.9.2+git.commit.ad72379f241ba28698ca2873d9b43785324a7932
|
version: 0.9.3
|
||||||
|
|
||||||
|
splay_tree_map:
|
||||||
|
git: https://github.com/wyhaines/splay_tree_map.cr.git
|
||||||
|
version: 0.2.2
|
||||||
|
|
||||||
teeplate:
|
teeplate:
|
||||||
git: https://github.com/luckyframework/teeplate.git
|
git: https://github.com/luckyframework/teeplate.git
|
||||||
version: 0.8.3
|
version: 0.8.5
|
||||||
|
|
||||||
webdrivers:
|
webdrivers:
|
||||||
git: https://github.com/matthewmcgarvey/webdrivers.cr.git
|
git: https://github.com/matthewmcgarvey/webdrivers.cr.git
|
||||||
|
@ -90,5 +98,5 @@ shards:
|
||||||
|
|
||||||
wordsmith:
|
wordsmith:
|
||||||
git: https://github.com/luckyframework/wordsmith.git
|
git: https://github.com/luckyframework/wordsmith.git
|
||||||
version: 0.2.2
|
version: 0.3.0
|
||||||
|
|
||||||
|
|
16
shard.yml
16
shard.yml
|
@ -1,5 +1,5 @@
|
||||||
name: scribe
|
name: scribe
|
||||||
version: 0.1.0
|
version: 1.0.0
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
- Edward Loveall <edward@edwardloveall.com>
|
- Edward Loveall <edward@edwardloveall.com>
|
||||||
|
@ -8,24 +8,24 @@ targets:
|
||||||
scribe:
|
scribe:
|
||||||
main: src/scribe.cr
|
main: src/scribe.cr
|
||||||
|
|
||||||
crystal: 1.0.0
|
crystal: 1.2.1
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
lucky:
|
lucky:
|
||||||
github: luckyframework/lucky
|
github: luckyframework/lucky
|
||||||
version: ~> 0.27.0
|
version: ~> 0.29.0
|
||||||
authentic:
|
authentic:
|
||||||
github: luckyframework/authentic
|
github: luckyframework/authentic
|
||||||
version: ~> 0.7.3
|
version: ~> 0.8.1
|
||||||
carbon:
|
carbon:
|
||||||
github: luckyframework/carbon
|
github: luckyframework/carbon
|
||||||
|
version: ~> 0.2.0
|
||||||
|
lucky_env:
|
||||||
|
github: luckyframework/lucky_env
|
||||||
version: ~> 0.1.4
|
version: ~> 0.1.4
|
||||||
dotenv:
|
|
||||||
github: gdotdesign/cr-dotenv
|
|
||||||
version: ~> 1.0.0
|
|
||||||
lucky_task:
|
lucky_task:
|
||||||
github: luckyframework/lucky_task
|
github: luckyframework/lucky_task
|
||||||
version: ~> 0.1.0
|
version: ~> 0.1.1
|
||||||
monads:
|
monads:
|
||||||
github: alex-lairan/monads
|
github: alex-lairan/monads
|
||||||
development_dependencies:
|
development_dependencies:
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
|
# For more detailed documentation, visit
|
||||||
|
# https://luckyframework.org/guides/testing/html-and-interactivity
|
||||||
|
|
||||||
LuckyFlow.configure do |settings|
|
LuckyFlow.configure do |settings|
|
||||||
settings.stop_retrying_after = 200.milliseconds
|
settings.stop_retrying_after = 200.milliseconds
|
||||||
settings.base_uri = Lucky::RouteHelper.settings.base_uri
|
settings.base_uri = Lucky::RouteHelper.settings.base_uri
|
||||||
|
|
||||||
|
# By default, LuckyFlow is set in "headless" mode (no browser window shown).
|
||||||
|
# Uncomment this to enable running `LuckyFlow` in a Google Chrome window instead.
|
||||||
|
# Be sure to disable for CI.
|
||||||
|
# settings.driver = LuckyFlow::Drivers::Chrome
|
||||||
end
|
end
|
||||||
Spec.before_each { LuckyFlow::Server::INSTANCE.reset }
|
Spec.before_each { LuckyFlow::Server::INSTANCE.reset }
|
||||||
|
|
|
@ -2,4 +2,8 @@ abstract class ApiAction < Lucky::Action
|
||||||
# Remove this line if you want to send cookies in the response header.
|
# Remove this line if you want to send cookies in the response header.
|
||||||
disable_cookies
|
disable_cookies
|
||||||
accepted_formats [:json]
|
accepted_formats [:json]
|
||||||
|
|
||||||
|
# By default all actions are required to use underscores to separate words.
|
||||||
|
# Add 'include Lucky::SkipRouteStyleCheck' to your actions if you wish to ignore this check for specific routes.
|
||||||
|
include Lucky::EnforceUnderscoredRoute
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Articles::Show < BrowserAction
|
||||||
html(
|
html(
|
||||||
Errors::ShowPage,
|
Errors::ShowPage,
|
||||||
message: "Error parsing the URL",
|
message: "Error parsing the URL",
|
||||||
status: 500,
|
status_code: 500,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -39,10 +39,14 @@ class Articles::Show < BrowserAction
|
||||||
end
|
end
|
||||||
|
|
||||||
def client_class
|
def client_class
|
||||||
if Lucky::Env.use_local?
|
if use_local?
|
||||||
LocalClient
|
LocalClient
|
||||||
else
|
else
|
||||||
MediumClient
|
MediumClient
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def use_local?
|
||||||
|
ENV.fetch("USE_LOCAL", "false") == "true"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
abstract class BrowserAction < Lucky::Action
|
abstract class BrowserAction < Lucky::Action
|
||||||
include Lucky::ProtectFromForgery
|
include Lucky::ProtectFromForgery
|
||||||
|
include Lucky::EnforceUnderscoredRoute
|
||||||
|
include Lucky::SecureHeaders::DisableFLoC
|
||||||
|
|
||||||
accepted_formats [:html, :json], default: :html
|
accepted_formats [:html, :json], default: :html
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Errors::Show < Lucky::ErrorAction
|
||||||
|
|
||||||
private def error_html(message : String, status : Int)
|
private def error_html(message : String, status : Int)
|
||||||
context.response.status_code = status
|
context.response.status_code = status
|
||||||
html Errors::ShowPage, message: message, status: status
|
html_with_status Errors::ShowPage, status, message: message, status_code: status
|
||||||
end
|
end
|
||||||
|
|
||||||
private def error_json(message : String, status : Int, details = nil, param = nil)
|
private def error_json(message : String, status : Int, details = nil, param = nil)
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
require "./shards"
|
require "./shards"
|
||||||
|
|
||||||
Lucky::AssetHelpers.load_manifest
|
# Load the asset manifest
|
||||||
|
Lucky::AssetHelpers.load_manifest "public/mix-manifest.json"
|
||||||
|
|
||||||
|
require "../config/server"
|
||||||
|
require "../config/**"
|
||||||
require "./app_database"
|
require "./app_database"
|
||||||
require "./constants"
|
require "./constants"
|
||||||
require "./models/base_model"
|
require "./models/base_model"
|
||||||
|
@ -20,7 +23,5 @@ require "./components/**"
|
||||||
require "./classes/**"
|
require "./classes/**"
|
||||||
require "./clients/**"
|
require "./clients/**"
|
||||||
require "./pages/**"
|
require "./pages/**"
|
||||||
require "../config/env"
|
|
||||||
require "../config/**"
|
|
||||||
require "../db/migrations/**"
|
require "../db/migrations/**"
|
||||||
require "./app_server"
|
require "./app_server"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
class AppServer < Lucky::BaseAppServer
|
class AppServer < Lucky::BaseAppServer
|
||||||
def middleware : Array(HTTP::Handler)
|
def middleware : Array(HTTP::Handler)
|
||||||
[
|
[
|
||||||
|
Lucky::RequestIdHandler.new,
|
||||||
Lucky::ForceSSLHandler.new,
|
Lucky::ForceSSLHandler.new,
|
||||||
Lucky::HttpMethodOverrideHandler.new,
|
Lucky::HttpMethodOverrideHandler.new,
|
||||||
Lucky::LogHandler.new,
|
Lucky::LogHandler.new,
|
||||||
|
@ -18,7 +19,6 @@ class AppServer < Lucky::BaseAppServer
|
||||||
end
|
end
|
||||||
|
|
||||||
def listen
|
def listen
|
||||||
server.bind_tcp(host, port, reuse_port: false)
|
server.listen(host, port, reuse_port: false)
|
||||||
server.listen
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
class Shared::LayoutHead < BaseComponent
|
class Shared::LayoutHead < BaseComponent
|
||||||
needs page_title : String
|
needs page_title : String
|
||||||
needs context : HTTP::Server::Context
|
|
||||||
|
|
||||||
def render
|
def render
|
||||||
head do
|
head do
|
||||||
|
|
|
@ -2,7 +2,7 @@ class Errors::ShowPage
|
||||||
include Lucky::HTMLPage
|
include Lucky::HTMLPage
|
||||||
|
|
||||||
needs message : String
|
needs message : String
|
||||||
needs status : Int32
|
needs status_code : Int32
|
||||||
|
|
||||||
def render
|
def render
|
||||||
html_doctype
|
html_doctype
|
||||||
|
@ -17,7 +17,7 @@ class Errors::ShowPage
|
||||||
|
|
||||||
body do
|
body do
|
||||||
div class: "container" do
|
div class: "container" do
|
||||||
h2 status, class: "status-code"
|
h2 status_code, class: "status-code"
|
||||||
h1 message, class: "message"
|
h1 message, class: "message"
|
||||||
|
|
||||||
ul class: "helpful-links" do
|
ul class: "helpful-links" do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class Home::IndexPage < MainLayout
|
class Home::IndexPage < MainLayout
|
||||||
def page_title
|
def page_title
|
||||||
"Scribe"
|
Application.settings.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def content
|
def content
|
||||||
|
|
|
@ -12,7 +12,7 @@ abstract class MainLayout
|
||||||
html_doctype
|
html_doctype
|
||||||
|
|
||||||
html lang: "en" do
|
html lang: "en" do
|
||||||
mount Shared::LayoutHead, page_title: page_title, context: context
|
mount Shared::LayoutHead, page_title: page_title
|
||||||
|
|
||||||
body do
|
body do
|
||||||
mount Shared::FlashMessages, context.flash
|
mount Shared::FlashMessages, context.flash
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Load .env file before any other config or app code
|
# Load .env file before any other config or app code
|
||||||
require "dotenv"
|
require "lucky_env"
|
||||||
Dotenv.load?
|
LuckyEnv.load?(".env")
|
||||||
|
|
||||||
# Require your shards here
|
# Require your shards here
|
||||||
require "avram"
|
require "avram"
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "./app"
|
||||||
|
|
||||||
Habitat.raise_if_missing_settings!
|
Habitat.raise_if_missing_settings!
|
||||||
|
|
||||||
if Lucky::Env.development?
|
if LuckyEnv.development?
|
||||||
Avram::Migrator::Runner.new.ensure_migrated!
|
Avram::Migrator::Runner.new.ensure_migrated!
|
||||||
Avram::SchemaEnforcer.ensure_correct_column_mappings!
|
Avram::SchemaEnforcer.ensure_correct_column_mappings!
|
||||||
end
|
end
|
||||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -4036,6 +4036,11 @@ mkdirp@^0.5.5:
|
||||||
dependencies:
|
dependencies:
|
||||||
minimist "^1.2.5"
|
minimist "^1.2.5"
|
||||||
|
|
||||||
|
modern-normalize@^1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/modern-normalize/-/modern-normalize-1.1.0.tgz#da8e80140d9221426bd4f725c6e11283d34f90b7"
|
||||||
|
integrity sha512-2lMlY1Yc1+CUy0gw4H95uNN7vjbpoED7NNRSBHE25nWfLBdmMzFCsPshlzbxHz+gYMcBEUN8V4pU16prcdPSgA==
|
||||||
|
|
||||||
ms@2.0.0:
|
ms@2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||||
|
@ -4158,11 +4163,6 @@ normalize-range@^0.1.2:
|
||||||
resolved "https://registry.yarnpkg.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942"
|
resolved "https://registry.yarnpkg.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942"
|
||||||
integrity sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=
|
integrity sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=
|
||||||
|
|
||||||
normalize-scss@^7.0.1:
|
|
||||||
version "7.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/normalize-scss/-/normalize-scss-7.0.1.tgz#74485e82bb5d0526371136422a09fdb868ffc1a4"
|
|
||||||
integrity sha512-qj16bWnYs+9/ac29IgGjySg4R5qQTp1lXfm7ApFOZNVBYFY8RZ3f8+XQNDDLHeDtI3Ba7Jj4+LuPgz9v/fne2A==
|
|
||||||
|
|
||||||
normalize-url@^6.0.1:
|
normalize-url@^6.0.1:
|
||||||
version "6.1.0"
|
version "6.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a"
|
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a"
|
||||||
|
|
Loading…
Reference in a new issue