Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for latest Lucky #547

Merged
merged 14 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
check_format:
runs-on: ubuntu-latest
container:
image: crystallang/crystal:0.35.0
image: crystallang/crystal:0.35.1
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Install shards
run: shards install
- name: Format
Expand All @@ -23,7 +23,7 @@ jobs:
specs:
runs-on: ubuntu-latest
container:
image: crystallang/crystal:0.35.0
image: crystallang/crystal:0.35.1
services:
postgres:
image: postgres
Expand Down Expand Up @@ -62,12 +62,12 @@ jobs:
crystal build src/lucky.cr --no-debug --release
cp lucky /usr/local/bin
- name: Cache Crystal
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.cache/crystal
key: ${{ runner.os }}-crystal
- name: Cache node modules
uses: actions/cache@v1
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
Expand Down
10 changes: 5 additions & 5 deletions shard.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

# NOTE: https://github.com/crystal-lang/shards/issues/432
# Until this is resolved, the default needs to be empty here.
dependencies: {}
#dependencies: {}
# Uncomment if you need to override
# dependencies:
# lucky:
# github: luckyframework/lucky
# branch: master
dependencies:
lucky:
github: luckyframework/lucky
branch: master
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.23.1
authors:
- Paul Smith <[email protected]>

crystal: 0.35.0
crystal: 0.35.1

license: MIT

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/init_web_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe "Initializing a new web project" do
should_run_successfully "crystal run src/lucky.cr -- init.custom test-project"

FileUtils.cd "test-project" do
should_run_successfully "shards install"
should_run_successfully "shards install --ignore-crystal-version"
should_run_successfully "lucky gen.action.api Api::Users::Show"
should_run_successfully "lucky gen.action.browser Users::Show"
should_run_successfully "lucky gen.migration CreateThings"
Expand Down
12 changes: 6 additions & 6 deletions src/browser_app_skeleton/src/components/shared/field.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
# ## Basic usage:
#
# # Renders a text input by default and will guess the label name "Name"
# m Shared::Field, op.name
# mount Shared::Field, op.name
# # Call any of the input methods on the block
# m Shared::Field, op.email, &.email_input
# mount Shared::Field, op.email, &.email_input
# # Add other HTML attributes
# m Shared::Field, op.email, &.email_input(autofocus: "true")
# mount Shared::Field, op.email, &.email_input(autofocus: "true")
# # Pass an explicit label name
# m Shared::Field, attribute: op.username, label_text: "Your username"
# mount Shared::Field, attribute: op.username, label_text: "Your username"
#
# ## Customization
#
Expand All @@ -22,7 +22,7 @@
# div class: "field-wrapper"
# label_for field
# yield field
# m Shared::FieldErrors, field
# mount Shared::FieldErrors, field
# end
#
# You may also want to have more components if your fields look
Expand All @@ -47,7 +47,7 @@ class Shared::Field(T) < BaseComponent
yield input_builder
end

m Shared::FieldErrors, attribute
mount Shared::FieldErrors, attribute
end

# Use a text_input by default
Expand Down
4 changes: 2 additions & 2 deletions src/browser_app_skeleton/src/pages/main_layout.cr
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ abstract class MainLayout
html_doctype

html lang: "en" do
m Shared::LayoutHead, page_title: page_title, context: context
mount Shared::LayoutHead, page_title: page_title, context: context

body do
m Shared::FlashMessages, context.flash
mount Shared::FlashMessages, context.flash
content
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ abstract class AuthLayout
html_doctype

html lang: "en" do
m Shared::LayoutHead, page_title: page_title, context: context
mount Shared::LayoutHead, page_title: page_title, context: context

body do
m Shared::FlashMessages, context.flash
mount Shared::FlashMessages, context.flash
content
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ abstract class MainLayout
html_doctype

html lang: "en" do
m Shared::LayoutHead, page_title: page_title, context: context
mount Shared::LayoutHead, page_title: page_title, context: context

body do
m Shared::FlashMessages, context.flash
mount Shared::FlashMessages, context.flash
render_signed_in_user
content
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class PasswordResetRequests::NewPage < AuthLayout

private def render_form(op)
form_for PasswordResetRequests::Create do
m Shared::Field, attribute: op.email, label_text: "Email", &.email_input
mount Shared::Field, attribute: op.email, label_text: "Email", &.email_input
submit "Reset Password", flow_id: "request-password-reset-button"
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class PasswordResets::NewPage < AuthLayout

private def render_password_reset_form(op)
form_for PasswordResets::Create.with(@user_id) do
m Shared::Field, attribute: op.password, label_text: "Password", &.password_input(autofocus: "true")
m Shared::Field, attribute: op.password_confirmation, label_text: "Confirm Password", &.password_input
mount Shared::Field, attribute: op.password, label_text: "Password", &.password_input(autofocus: "true")
mount Shared::Field, attribute: op.password_confirmation, label_text: "Confirm Password", &.password_input

submit "Update Password", flow_id: "update-password-button"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SignIns::NewPage < AuthLayout
end

private def sign_in_fields(op)
m Shared::Field, attribute: op.email, label_text: "Email", &.email_input(autofocus: "true")
m Shared::Field, attribute: op.password, label_text: "Password", &.password_input
mount Shared::Field, attribute: op.email, label_text: "Email", &.email_input(autofocus: "true")
mount Shared::Field, attribute: op.password, label_text: "Password", &.password_input
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class SignUps::NewPage < AuthLayout
end

private def sign_up_fields(op)
m Shared::Field, attribute: op.email, label_text: "Email", &.email_input(autofocus: "true")
m Shared::Field, attribute: op.password, label_text: "Password", &.password_input
m Shared::Field, attribute: op.password_confirmation, label_text: "Confirm Password", &.password_input
mount Shared::Field, attribute: op.email, label_text: "Email", &.email_input(autofocus: "true")
mount Shared::Field, attribute: op.password, label_text: "Password", &.password_input
mount Shared::Field, attribute: op.password_confirmation, label_text: "Confirm Password", &.password_input
end
end
6 changes: 3 additions & 3 deletions src/web_app_skeleton/config/database.cr.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ database_name = "<%= crystal_project_name %>_#{Lucky::Env.name}"

AppDatabase.configure do |settings|
if Lucky::Env.production?
settings.url = ENV.fetch("DATABASE_URL")
settings.credentials = Avram::Credentials.parse(ENV["DB_URL"])
else
settings.url = ENV["DATABASE_URL"]? || Avram::PostgresURL.build(
settings.credentials = Avram::Credentials.parse?(ENV["DB_URL"]?) || Avram::Credentials.new(
database: database_name,
hostname: ENV["DB_HOST"]? || "localhost",
port: ENV["DB_PORT"]? || "5432",
port: ENV["DB_PORT"]?.try(&.to_i) || 5432,
# Some common usernames are "postgres", "root", or your system username (run 'whoami')
username: ENV["DB_USERNAME"]? || "postgres",
# Some Postgres installations require no password. Use "" if that is the case.
Expand Down
2 changes: 1 addition & 1 deletion src/web_app_skeleton/script/setup.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ print_done
<%- end -%>

notice "Installing shards"
shards install | indent
shards install --ignore-crystal-version | indent

if [ ! -f ".env" ]; then
notice "No .env found. Creating one."
Expand Down