Skip to content
Permalink
Browse files

Merge pull request #141 from wezm/lucky-0.19

Upgrade to Lucky 0.19
  • Loading branch information
wezm committed Mar 15, 2020
2 parents 9eb1a7d + 305acb2 commit 3c1c2fba75250bb98992cf26728b64f84e956300
@@ -1 +1 @@
0.32.1
0.33.0
@@ -7,6 +7,12 @@ Lucky::Server.configure do |settings|
settings.secret_key_base = secret_key_from_env
settings.host = "0.0.0.0"
settings.port = ENV["PORT"].to_i
settings.gzip_enabled = true
# By default certain content types will be gzipped.
# For a full list look in
# https://github.com/luckyframework/lucky/blob/master/src/lucky/server.cr
# To add additional extensions do something like this:
# config.gzip_content_types << "content/type"
else
settings.secret_key_base = "WApyjU7WpnLzzf0juoe2Kx0VZKsyM+l8q5XQqrSPRM8="
# Change host/port in config/watch.yml
@@ -12,6 +12,7 @@
},
"devDependencies": {
"browser-sync": "^2.18.13",
"compression-webpack-plugin": "^3.0.0",
"laravel-mix": "^4.0.0",
"resolve-url-loader": "2.3.1",
"sass": "1.17.1",
@@ -2,11 +2,15 @@ version: 1.0
shards:
authentic:
github: luckyframework/authentic
version: 0.5.0
version: 0.5.2

avram:
github: luckyframework/avram
version: 0.12.0
version: 0.12.4

bindata:
github: spider-gazelle/bindata
version: 1.2.0

blank:
github: kostya/blank
@@ -18,43 +22,43 @@ shards:

cry:
github: paulcsmith/cry
version: 0.4.1
version: 0.4.2

db:
github: crystal-lang/crystal-db
version: 0.7.0
version: 0.8.0

dexter:
github: luckyframework/dexter
version: 0.1.2
version: 0.1.3

dotenv:
github: gdotdesign/cr-dotenv
version: 0.3.0

exception_page:
github: crystal-loot/exception_page
version: 0.1.2
version: 0.1.4

habitat:
github: luckyframework/habitat
version: 0.4.3

jwt:
github: crystal-community/jwt
version: 1.1.1
version: 1.4.0

lucky:
github: luckyframework/lucky
version: 0.18.0
version: 0.19.0

lucky_cli:
github: luckyframework/lucky_cli
version: 0.18.0
version: 0.18.4

lucky_flow:
github: luckyframework/lucky_flow
version: 0.6.0
version: 0.6.2

lucky_router:
github: luckyframework/lucky_router
@@ -66,11 +70,11 @@ shards:

openssl_ext:
github: stakach/openssl_ext
version: 1.0.0
version: 1.2.0

pg:
github: will/crystal-pg
version: 0.19.0
version: 0.20.0

selenium:
github: ysbaddaden/selenium-webdriver-crystal
@@ -8,15 +8,15 @@ targets:
read_rust:
main: src/read_rust.cr

crystal: 0.32.1
crystal: 0.33.0

dependencies:
lucky:
github: luckyframework/lucky
version: ~> 0.18.0
version: ~> 0.19.0
authentic:
github: luckyframework/authentic
version: ~> 0.5.0
version: ~> 0.5.1
carbon:
github: luckyframework/carbon
version: ~> 0.1.1
@@ -25,10 +25,10 @@ dependencies:
version: 0.3.0
lucky_flow:
github: luckyframework/lucky_flow
version: ~> 0.6.0
version: ~> 0.6.1
jwt:
github: crystal-community/jwt
version: ~> 1.1.1%
version: ~> 1.4.0%
markd:
github: icyleaf/markd
version: ~> 0.2.0
@@ -14,6 +14,11 @@ class Categories::Show < BrowserAction
end

private def last_modified(category)
PostQuery.new.last_modified_in_category(category)
time = PostQuery.new.last_modified_in_category(category)
if time.nil?
Time.utc
else
time
end
end
end
@@ -10,6 +10,11 @@ class Creators::Index < BrowserAction
end

private def last_modified
CreatorQuery.new.updated_at.select_max
time = CreatorQuery.new.updated_at.select_max
if time.nil?
Time.utc
else
time
end
end
end
@@ -12,6 +12,11 @@ class Home::Index < BrowserAction
end

private def last_modified
PostQuery.new.updated_at.select_max
time = PostQuery.new.updated_at.select_max
if time.nil?
Time.utc
else
time
end
end
end
@@ -11,6 +11,11 @@ class JsonFeed::Show < BrowserAction
end

private def last_modified
PostQuery.new.last_modified_in_category(category)
time = PostQuery.new.last_modified_in_category(category)
if time.nil?
Time.utc
else
time
end
end
end
@@ -9,7 +9,12 @@ class Posts::Index < BrowserAction
html Posts::IndexPage, posts: PostQuery.new.created_at.desc_order
end

private def last_modified
PostQuery.new.updated_at.select_max
private def last_modified : Time
time = PostQuery.new.updated_at.select_max
if time.nil?
Time.utc
else
time
end
end
end
@@ -37,6 +37,11 @@ class RssFeed::Show < BrowserAction
end

private def last_modified
PostQuery.new.last_modified_in_category(category)
time = PostQuery.new.last_modified_in_category(category)
if time.nil?
Time.utc
else
time
end
end
end
@@ -23,12 +23,12 @@ class Tags::Show < BrowserAction
end

private def last_modified(tag)
PostQuery.new.where_post_tags(PostTagQuery.new.tag_id(tag.id)).updated_at.select_max
rescue TypeCastError
# Workaround error: cast from Nil to Time failed
# originating in Avram
# https://github.com/luckyframework/avram/pull/287
Time.utc
time = PostQuery.new.where_post_tags(PostTagQuery.new.tag_id(tag.id)).updated_at.select_max
if time.nil?
Time.utc
else
time
end
end

private def respond_with_html(tag : Tag, posts : PostQuery)
@@ -8,6 +8,7 @@ class AppServer < Lucky::BaseAppServer
Lucky::FlashHandler.new,
Lucky::ErrorHandler.new(action: Errors::Show),
Lucky::RouteHandler.new,
Lucky::StaticCompressionHandler.new("./public", file_ext: "gz", content_encoding: "gzip"),
Lucky::StaticFileHandler.new("./public", false),
Lucky::RouteNotFoundHandler.new,
] of HTTP::Handler
@@ -4,11 +4,7 @@ abstract class MainLayout
# 'needs current_user : User' makes it so that the current_user
# is always required for pages using MainLayout
needs current_user : User?
# FIXME: Enable when there's a Lucky release with this fix in it
# https://github.com/luckyframework/lucky/pull/993
# needs query : String = ""

@query : String = ""
needs query : String = ""

abstract def content
abstract def page_title
@@ -1,5 +1,4 @@
class Search::ShowPage < MainLayout
needs query : String
needs results : SearchResults

quick_def page_title, "Search Results"
@@ -8,6 +8,7 @@
*/

let mix = require("laravel-mix");
let plugins = [];

// Customize the notifier to be less noisy
let WebpackNotifierPlugin = require('webpack-notifier');
@@ -16,6 +17,29 @@ let webpackNotifier = new WebpackNotifierPlugin({
skipFirstNotification: true
})

plugins.push(webpackNotifier)

// Compress static assets in production
if (mix.inProduction()) {
let CompressionWepackPlugin = require('compression-webpack-plugin');
let gzipCompression = new CompressionWepackPlugin({
compressionOptions: { level: 9 },
test: /\.js$|\.css$|\.html$|\.svg$|\.opml$|\.ico$/
})
plugins.push(gzipCompression)

// Add additional compression plugins here. For example
// if you want to add Brotli compression...

// let brotliCompression = new CompressionWepackPlugin({
// compressionOptions: { level: 11 },
// filename: '[path].br[query]',
// algorithm: 'brotliCompress',
// test: /\.js$|\.css$|\.html$|\.svg$/
// })
// plugins.push(brotliCompression)
}

mix
// JS entry file. Supports Vue, and uses Babel
//

0 comments on commit 3c1c2fb

Please sign in to comment.
You can’t perform that action at this time.