Skip to content

Commit

Permalink
First draft
Browse files Browse the repository at this point in the history
  • Loading branch information
samwilson committed Sep 22, 2020
1 parent 0fd3da3 commit 78d29ba
Show file tree
Hide file tree
Showing 59 changed files with 23,541 additions and 1,190 deletions.
16 changes: 14 additions & 2 deletions .env
Expand Up @@ -14,8 +14,20 @@
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=46d0e7d518b79e7d3ea2b0e3aed42b84
APP_ENV=prod
APP_SECRET=changethis
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# For a PostgreSQL database, use: "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8"
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7
###< doctrine/doctrine-bundle ###

###> symfony/mailer ###
# MAILER_DSN=smtp://localhost
###< symfony/mailer ###
2 changes: 2 additions & 0 deletions .env.test
@@ -0,0 +1,2 @@
APP_ENV=test
DATABASE_URL=mysql://root:testpwd@127.0.0.1:3306/twyne_test?serverVersion=5.7
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,62 @@
name: CI

on: [push, pull_request]

jobs:
build:

services:
db:
image: ${{ matrix.db }}
env:
MYSQL_DATABASE: twyne_test
MYSQL_ROOT_PASSWORD: testpwd
ports:
- '3306:3306'
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
matrix:
os: [ 'ubuntu-latest' ]
# All supported PHP versions https://www.php.net/supported-versions.php
php: [ '7.2', '7.3', '7.4' ]
db: [ 'mariadb:10.4', 'mysql:5.7', 'mysql:8.0' ]

runs-on: ${{ matrix.os }}

name: PHP ${{ matrix.php }} on ${{ matrix.os }} with ${{ matrix.db }}

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{matrix.php}}
extensions: fileinfo, json, pdo, mbstring

- name: Install
env:
APP_ENV: test
# The database server version has to be specified in the format:
# ^(?:5\.5\.5-)?(mariadb-)?<major_version>.<minor_version>.<patch_version>
# This differs from what's in the matrix, so we do it manually below.
run: |
export SERVER_VERSION="8.0"
if [ "${{ matrix.db }}" = "mariadb:10.4" ]; then
SERVER_VERSION="mariadb-10.4.0"
elif [ "${{ matrix.db }}" = "mysql:5.7" ]; then
SERVER_VERSION="5.7"
fi
export DATABASE_URL="mysql://root:testpwd@127.0.0.1:3306/twyne_test?serverVersion=$SERVER_VERSION"
echo DATABASE_URL is: $DATABASE_URL
if [ "$SERVER_VERSION" = "8.0" ]; then
sudo mysql --host 127.0.0.1 -uroot -ptestpwd -e "ALTER USER root IDENTIFIED WITH mysql_native_password BY 'testpwd';"
fi
composer install
./bin/console doctrine:migrations:migrate
- name: Test
run: |
composer test
15 changes: 15 additions & 0 deletions .gitignore
Expand Up @@ -9,3 +9,18 @@
/var/
/vendor/
###< symfony/framework-bundle ###

###> symfony/webpack-encore-bundle ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###

###> squizlabs/php_codesniffer ###
/.phpcs-cache
/phpcs.xml
###< squizlabs/php_codesniffer ###

/.idea

16 changes: 16 additions & 0 deletions README.md
@@ -0,0 +1,16 @@
Twyne
=====

A web-based journal for writing and photography.

## Requirements

* PHP
* MariaDB or MySQL
* Shell access

## Installation

1. Clone: `git clone https://github.com/samwilson/twyne`
2. Install: `cd twyne` then `composer install` and `npm install`
3. Build assets: `npm run build`
49 changes: 49 additions & 0 deletions assets/css/app.less
@@ -0,0 +1,49 @@
@import "../../node_modules/normalize.css/normalize.css";

@font-color: #283434;
@font-family: serif;
@border-primary: 2px solid #789987;
@border-secondary: 1px solid #def3e6;

body { color:@font-color; font-family:@font-family }

a { color:#4e4efa; text-decoration:none }
a:hover { text-decoration:underline; color:#2c2cff }

article { max-width:66em; margin:auto }

body { display:flex; flex-direction:column }
body > header { flex:2; text-align:center; border-bottom:@border-primary; padding:0.5rem; background-color:#f1f8f2 }
body > header a { color:@font-color }
body > main { flex:10; padding:1rem }
body > header h1 { color:@font-color; margin:0; font-variant:small-caps; letter-spacing:0.1em }
body > header nav ul { display:flex; list-style-type:none; margin:0; padding:0 }
body > header nav ul li { flex:1 }
body > footer {
flex:1; text-align:right; font-size:smaller; border-top:@border-primary; padding:1rem;
ul {
list-style-type:none; margin:0; padding:0; display:flex;
li { flex:1 }
}
}


/*
* Forms
*/
form { background-color:#efefef; padding:1rem }
form p label { display:block }
form p { display:flex; align-items:center; margin-bottom:0.4rem }
form p .field.size-1 { flex:1 }
form p .field.size-2 { flex:2 }
form p .field.size-4 { flex:4 }
form p .field.size-6 { flex:6 }
form textarea,
form input[type="text"],
form input[type="password"],
form input[type="email"],
form select { width:100%; border:@border-secondary }
form input[type='submit'] { border:3px outset darkgrey; background-color:gray; border-radius:3px; color:white }

@import "post";
@import "security";
23 changes: 23 additions & 0 deletions assets/css/post.less
@@ -0,0 +1,23 @@
h1 { text-align:center }

.post-list {
width: 66em;
margin: auto;
list-style-type: none;
.post {
border: @border-secondary;
border-width: 1px 1px 0 1px;
header { display:flex; background-color:#f4f6fb; padding:0 1em 0.2em 1em; align-items:baseline }
header h2 { flex:2; margin:0; padding:0; font-size:medium }
header h2 a { color:@font-color }
header time { flex:1; font-size:smaller; text-align:right }
article { padding: 1em; }
footer {
text-align:center;
a { color:gray }
}
}
.post:last-child {
border-bottom: @border-secondary;
}
}
4 changes: 4 additions & 0 deletions assets/css/security.less
@@ -0,0 +1,4 @@
form.login,
form.register {
max-width:20rem; margin:4rem auto;
}
2 changes: 2 additions & 0 deletions assets/js/app.js
@@ -0,0 +1,2 @@
import '../css/app.less';

73 changes: 49 additions & 24 deletions composer.json
@@ -1,17 +1,49 @@
{
"name": "samwilson/twyne",
"type": "project",
"license": "proprietary",
"description": "A web-based journal for writing and photography.",
"license": "GPL-3.0-or-later",
"require": {
"php": ">=7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"composer/package-versions-deprecated": "^1.11",
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.7",
"sensio/framework-extra-bundle": "^5.6",
"symfony/console": "5.1.*",
"symfony/dotenv": "5.1.*",
"symfony/flex": "^1.3.1",
"symfony/framework-bundle": "5.1.*",
"symfony/yaml": "5.1.*"
"symfony/mailer": "5.1.*",
"symfony/process": "5.1.*",
"symfony/security-bundle": "5.1.*",
"symfony/twig-bundle": "5.1.*",
"symfony/webpack-encore-bundle": "^1.7",
"symfony/yaml": "5.1.*",
"symfonycasts/reset-password-bundle": "^1.1",
"twig/extra-bundle": "^2.12 || ^3.0",
"twig/twig": "^2.12 || ^3.0"
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php56": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php72": "*"
},
"conflict": {
"symfony/symfony": "*"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.5",
"squizlabs/php_codesniffer": "^3.3",
"symfony/maker-bundle": "^1.21",
"symfony/stopwatch": "^5.1",
"symfony/web-profiler-bundle": "^5.1"
},
"config": {
"optimize-autoloader": true,
Expand All @@ -20,6 +52,12 @@
},
"sort-packages": true
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.1.*"
}
},
"autoload": {
"psr-4": {
"App\\": "src/"
Expand All @@ -30,34 +68,21 @@
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
],
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"test": [
"composer validate",
"composer normalize --dry-run",
"phpcs"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.1.*"
}
}
}

0 comments on commit 78d29ba

Please sign in to comment.