Add content🆕talk command

This commit is contained in:
Oliver Davies 2018-07-25 22:44:11 +01:00
parent 6083b78a7c
commit d8e75fe3fb
7 changed files with 251 additions and 1 deletions

View file

@ -5,6 +5,7 @@ use Opdavies\Sculpin\Bundle\ContentGeneratorBundle\SculpinContentGeneratorBundle
use Opdavies\Sculpin\Bundle\GistEmbedBundle\SculpinGistEmbedBundle;
use Opdavies\Sculpin\Bundle\TwigMarkdownBundle\SculpinTwigMarkdownBundle;
use Sculpin\Bundle\SculpinBundle\HttpKernel\AbstractKernel;
use WebsiteBundle\SculpinWebsiteBundle;
class SculpinKernel extends AbstractKernel
{
@ -19,6 +20,7 @@ class SculpinKernel extends AbstractKernel
SculpinTwigMarkdownBundle::class,
SculpinFormatTalksBundle::class,
SculpinWebsiteBundle::class,
];
}
}

View file

@ -23,7 +23,8 @@
},
"autoload": {
"psr-4": {
"FormatTalksBundle\\": "src/FormatTalksBundle"
"FormatTalksBundle\\": "src/FormatTalksBundle",
"WebsiteBundle\\": "src/WebsiteBundle"
},
"files": ["src/helpers.php"]
},

162
composer.lock generated
View file

@ -6,6 +6,56 @@
],
"content-hash": "077bd67921b19ca9f0e2dbb0b3389f85",
"packages": [
{
"name": "anahkiasen/underscore-php",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/Anahkiasen/underscore-php.git",
"reference": "48f97b295c82d99c1fe10d8b0684c43f051b5580"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Anahkiasen/underscore-php/zipball/48f97b295c82d99c1fe10d8b0684c43f051b5580",
"reference": "48f97b295c82d99c1fe10d8b0684c43f051b5580",
"shasum": ""
},
"require": {
"doctrine/inflector": "^1.0",
"patchwork/utf8": "^1.2",
"php": ">=5.4.0"
},
"require-dev": {
"fabpot/php-cs-fixer": "2.0.*@dev",
"phpunit/phpunit": "^4.6"
},
"type": "library",
"autoload": {
"psr-4": {
"Underscore\\": [
"src",
"tests"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maxime Fabre",
"email": "ehtnam6@gmail.com"
}
],
"description": "A redacted port of Underscore.js for PHP",
"keywords": [
"internals",
"laravel",
"toolkit"
],
"time": "2015-05-16T19:24:58+00:00"
},
{
"name": "composer/ca-bundle",
"version": "1.0.7",
@ -1086,6 +1136,65 @@
],
"time": "2017-03-18T10:39:19+00:00"
},
{
"name": "patchwork/utf8",
"version": "v1.3.1",
"source": {
"type": "git",
"url": "https://github.com/tchwork/utf8.git",
"reference": "30ec6451aec7d2536f0af8fe535f70c764f2c47a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tchwork/utf8/zipball/30ec6451aec7d2536f0af8fe535f70c764f2c47a",
"reference": "30ec6451aec7d2536f0af8fe535f70c764f2c47a",
"shasum": ""
},
"require": {
"lib-pcre": ">=7.3",
"php": ">=5.3.0"
},
"suggest": {
"ext-iconv": "Use iconv for best performance",
"ext-intl": "Use Intl for best performance",
"ext-mbstring": "Use Mbstring for best performance",
"ext-wfio": "Use WFIO for UTF-8 filesystem access on Windows"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Patchwork\\": "src/Patchwork/"
},
"classmap": [
"src/Normalizer.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"(Apache-2.0 or GPL-2.0)"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
}
],
"description": "Portable and performant UTF-8, Unicode and Grapheme Clusters for PHP",
"homepage": "https://github.com/tchwork/utf8",
"keywords": [
"grapheme",
"i18n",
"unicode",
"utf-8",
"utf8"
],
"time": "2016-05-18T13:57:10+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
@ -1731,6 +1840,59 @@
],
"time": "2015-10-13T18:44:15+00:00"
},
{
"name": "spatie/string",
"version": "2.2.2",
"source": {
"type": "git",
"url": "https://github.com/spatie/string.git",
"reference": "28607b9925b4f0499d48570553ca419c6298e26b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/string/zipball/28607b9925b4f0499d48570553ca419c6298e26b",
"reference": "28607b9925b4f0499d48570553ca419c6298e26b",
"shasum": ""
},
"require": {
"anahkiasen/underscore-php": "^2.0",
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "5.*",
"scrutinizer/ocular": "~1.1"
},
"type": "library",
"autoload": {
"files": [
"src/string_functions.php"
],
"psr-4": {
"Spatie\\String\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://murze.be",
"role": "Developer"
}
],
"description": "String handling evolved",
"homepage": "https://github.com/spatie/string",
"keywords": [
"handling",
"handy",
"spatie",
"string"
],
"time": "2017-11-08T14:28:57+00:00"
},
{
"name": "symfony/config",
"version": "v2.8.27",

View file

@ -0,0 +1,55 @@
<?php
namespace WebsiteBundle\Command;
use Sculpin\Core\Console\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class NewTalkCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('content:new:talk')
->setDescription('Create a new talk')
->addArgument(
'title',
InputArgument::REQUIRED,
'The title of the post'
);
// ->addOption(
// 'filename',
// null,
// InputOption::VALUE_OPTIONAL,
// 'The name of the file to generate'
// )
// ->addOption(
// 'force',
// 'f',
// InputOption::VALUE_NONE,
// 'Overwrite the file if it already exists'
// )
;
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$title = $input->getArgument('title');
$contents = file_get_contents(__DIR__.'/../Resources/stubs/talk.md');
$contents = str_replace('{{ title }}', $title, $contents);
file_put_contents(__DIR__.'/../../../source/_talks/' . string($title)->slugify() .'.md', $contents);
}
}

View file

@ -0,0 +1,16 @@
---
title: "{{ title }}"
speakerdeck:
id: ~
ratio: ~
url: ~
youtube:
id: ~
tags: []
events: []
---
{% block excerpt %}
{% endblock %}
{% block content %}
{% endblock %}

View file

@ -0,0 +1,9 @@
<?php
namespace WebsiteBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class SculpinWebsiteBundle extends Bundle
{
}

View file

@ -0,0 +1,5 @@
{
"require": {
"spatie/string": "^2.2"
}
}