Skip to content

Commit 45e56fb

Browse files
Merge pull request #7 from phpwarks/site-revamp
Site revamp
2 parents 32f2912 + c507090 commit 45e56fb

File tree

452 files changed

+1578
-68384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

452 files changed

+1578
-68384
lines changed

.editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
insert_final_newline = false
16+
17+
[Makefile]
18+
indent_style = tab

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Vagrantfile
2+
VagrantProvisions/

.gitignore

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
vendor/*
2-
.vagrant/*
3-
vagrant.rb
4-
auth.json
5-
composer.json
1+
# Files
62
composer.lock
7-
provision.yml
8-
Vagrantfile
9-
ansible
3+
public/css/
4+
public/fonts/
5+
public/js/
6+
**/.DS_Store
7+
**/*.swp
8+
9+
# directories
10+
.idea/
11+
vendor/
12+
log/*
13+
cache/*
14+
.sass-cache
15+
node_modules

Makefile

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
##################################################################
2+
# Build script for the PHP Warks site
3+
#
4+
# @author Nigel Greenway <[email protected]>
5+
##################################################################
6+
7+
####
8+
## SASS variables
9+
####
10+
SASS_SRC=web/Core/Assets/Styles/main.scss
11+
SASS_DEST=public/css/style.css
12+
13+
####
14+
## Project variables
15+
####
16+
ENV?=dev
17+
PRODUCTION=prod
18+
PROJECT_DIRECTORY := $(shell pwd)
19+
## End of variable setup ##
20+
21+
# Defaults for running `make` on its own
22+
all: help
23+
24+
# Used for building the dependencies for the project
25+
build: _building _build composer-install yarn sass
26+
@echo "Build complete"
27+
@echo "Please add phpwarks.dev to your hosts file."
28+
29+
# Start the docker containers
30+
run:
31+
@docker-compose up $(ARGS)
32+
33+
# Used for continuous development of the project locally
34+
watch:
35+
sass --watch --style compressed --trace $(SASS_SRC):$(SASS_DEST) --sourcemap=none
36+
37+
composer-install:
38+
ifeq (${ENV},${PRODUCTION})
39+
@docker run --rm -v ${PROJECT_DIRECTORY}:/app composer/composer install -o
40+
else
41+
@docker run --rm -v ${PROJECT_DIRECTORY}:/app composer/composer install
42+
endif
43+
44+
yarn:
45+
@yarn
46+
@mkdir public/js
47+
@cp node_modules/bootstrap-sass/assets/javascripts/bootstrap.min.js public/js/
48+
@cp -R node_modules/font-awesome/fonts/ public/fonts/
49+
50+
# Compile SASS to a CSS file
51+
sass:
52+
@sass $(SASS_SRC):$(SASS_DEST) --sourcemap=none --style compressed --trace
53+
54+
help:
55+
@echo " PHPWarks build help"
56+
@echo ""
57+
@echo " help Show this help console"
58+
@echo " watch Watch the SASS"
59+
@echo " build Install all"
60+
@echo " run Run `docker-compose up`."
61+
@echo " You have the possibilities to pass docker-composer arguments like so:"
62+
@echo " `make ARGS=-d` will run the command but without tailing the logs"
63+
@echo " composer-install Update/Install composer vendors"
64+
@echo " sass Compile CSS from the SASS files"
65+
@echo ""
66+
@echo " Optional:"
67+
@echo ""
68+
@echo " env Used to set up the environment for production ready,"
69+
@echo " this will not install development dependencies. This defaults"
70+
@echo " to dev."
71+
@echo " example:"
72+
@echo " eg: env=prod"
73+
74+
clean:
75+
@rm -rf ./vendor
76+
@rm -f $(SASS_DEST)
77+
@echo "Removed `vendor` and `$(SASS_DEST)` successfully"
78+
79+
_building:
80+
@echo "Installing project dependencies"
81+
82+
_build:
83+
@docker-compose build

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Read me
2+
3+
This project is run fully on [Docker](https://docker.com), but don't worry you only have to install the [Docker engine](https://docker.github.io/engine/installation/) and [docker-compose](https://docs.docker.com/compose/install/).
4+
5+
#### Building the project
6+
7+
`make build`; yep, that's it in regards to getting the site containers provisioned. This will set up the site to run locally via [Docker](https://docker.com). It will pull all the images required ready for you to start building.
8+
9+
Next up, run `make composer-install`. If all goes according to plan you should be able to see the `vendor` directory appear in the project root.
10+
11+
#### Starting up the project
12+
13+
`make run` will start up the docker and allow you to see the site via `http://0.0.0.0/`.
14+
15+
On a side note, you will notice you terminal window is being populated with aggregated logs from all containers. TO hide this, simply run `make ARGS="-d" run`.
16+
17+
__Directories:__
18+
19+
#### /app
20+
21+
This is generally the application configurations of the site
22+
23+
#### /public
24+
25+
The entry point for the web server.
26+
27+
#### /web
28+
29+
Where the magic happens. A URI will be associated with an action.
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
/** @see license */
3+
namespace PHPWarks\API\Internal\Events;
4+
5+
use GuzzleHttp\Client;
6+
use Slim\Http\Request;
7+
use Slim\Http\Response;
8+
9+
10+
/**
11+
* @author Nigel Greenway <[email protected]>
12+
*/
13+
final class UpcomingAction
14+
{
15+
/** @var Client $meetupAPI */
16+
private $meetupAPI;
17+
18+
/**
19+
* @param Client $meetup
20+
* @param array $options
21+
*/
22+
public function __construct(
23+
Client $meetup,
24+
array $options
25+
) {
26+
$options['status'] = 'future';
27+
28+
$this->meetupAPI = $meetup;
29+
$this->options = $options;
30+
}
31+
32+
/**
33+
* @param Request $request
34+
* @param Response $response
35+
* @param array $args
36+
*
37+
* @return string
38+
*/
39+
public function dispatch(
40+
Request $request,
41+
Response $response,
42+
array $args
43+
) :string {
44+
return $this
45+
->meetupAPI
46+
->request('GET', '/PHP-Warwickshire/events', $this->options)
47+
->getBody()
48+
->getContents();
49+
}
50+
}

app/dependencies.php

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<?php
2+
// DIC configuration
3+
4+
/** @var \Pimple\Container $container */
5+
$container = $app->getContainer();
6+
7+
// -----------------------------------------------------------------------------
8+
// Service providers
9+
// -----------------------------------------------------------------------------
10+
11+
// Twig
12+
$container['view'] = function ($c) {
13+
$settings = $c->get('settings');
14+
$view = new \Slim\Views\Twig($settings['view']['template_path'], $settings['view']['twig']);
15+
16+
// Add extensions
17+
$view->addExtension(new Slim\Views\TwigExtension($c->get('router'), $c->get('request')->getUri()));
18+
$view->addExtension(new Twig_Extension_Debug());
19+
20+
return $view;
21+
};
22+
23+
// Flash messages
24+
$container['flash'] = function ($c) {
25+
return new \Slim\Flash\Messages;
26+
};
27+
28+
// -----------------------------------------------------------------------------
29+
// Service factories
30+
// -----------------------------------------------------------------------------
31+
32+
// monolog
33+
$container['logger'] = function ($c) {
34+
$settings = $c->get('settings');
35+
$logger = new \Monolog\Logger($settings['logger']['name']);
36+
$logger->pushProcessor(new \Monolog\Processor\UidProcessor());
37+
$logger->pushHandler(new \Monolog\Handler\StreamHandler($settings['logger']['path'], \Monolog\Logger::DEBUG));
38+
return $logger;
39+
};
40+
41+
$container['api.meetup'] = function ($c) {
42+
return new \GuzzleHttp\Client([
43+
'base_uri' => 'http://api.meetup.com',
44+
]);
45+
};
46+
47+
//$container['errorHandler'] = function ($c) {
48+
// return function ($request, $response, $exception) use ($c) {
49+
// return $c['response']->withStatus(500)
50+
// ->withHeader('Content-Type', 'text/html')
51+
// ->write('Something went wrong!');
52+
// };
53+
//};
54+
55+
// -----------------------------------------------------------------------------
56+
// Action factories
57+
// -----------------------------------------------------------------------------
58+
59+
// Welcome actions
60+
$container['PHPWarks\Welcome\HomeAction'] = function ($c) {
61+
return new PHPWarks\Welcome\HomeAction($c->get('view'));
62+
};
63+
64+
//// Event actions
65+
//$container['PHPWarks\Event\HomeAction'] = function ($c) {
66+
// return new PHPWarks\Event\HomeAction($c->get('view'));
67+
//};
68+
//$container['PHPWarks\Event\PastAction'] = function ($c) {
69+
// return new PHPWarks\Event\PastAction($c->get('view'));
70+
//};
71+
//$container['PHPWarks\Event\ProposeAction'] = function ($c) {
72+
// return new PHPWarks\Event\ProposeAction($c->get('view'));
73+
//};
74+
//$container['PHPWarks\Event\RequestAction'] = function ($c) {
75+
// return new PHPWarks\Event\RequestAction($c->get('view'));
76+
//};
77+
//$container['PHPWarks\Event\UpcomingAction'] = function ($c) {
78+
// return new PHPWarks\Event\UpcomingAction($c->get('view'));
79+
//};
80+
//$container['PHPWarks\Event\PastByYearAction'] = function ($c) {
81+
// return new PHPWarks\Event\PastByYearAction($c->get('view'));
82+
//};
83+
//$container['PHPWarks\Event\PastByYearAndMonthAction'] = function ($c) {
84+
// return new PHPWarks\Event\PastByYearAndMonthAction($c->get('view'));
85+
//};
86+
//
87+
//// Contact actions
88+
//$container['PHPWarks\Contact\ContactAction'] = function ($c) {
89+
// return new PHPWarks\Contact\ContactAction($c->get('view'));
90+
//};
91+
//
92+
//// Sponsor actions
93+
//$container['PHPWarks\Sponsors\OurSponsorsAction'] = function ($c) {
94+
// return new PHPWarks\Sponsors\OurSponsorsAction($c->get('view'));
95+
//};
96+
//
97+
//// Community actions
98+
//$container['PHPWarks\Community\HomeAction'] = function ($c) {
99+
// return new PHPWarks\Community\HomeAction($c->get('view'));
100+
//};
101+
//$container['PHPWarks\Community\GetInvolvedAction'] = function ($c) {
102+
// return new PHPWarks\Community\GetInvolvedAction($c->get('view'));
103+
//};
104+
105+
// -----------------------------------------------------------------------------
106+
// Action factories [API]
107+
// -----------------------------------------------------------------------------
108+
109+
// Events
110+
$container['PHPWarks\API\Internal\Events\UpcomingAction'] = function ($c) {
111+
return new PHPWarks\API\Internal\Events\UpcomingAction(
112+
$c->get('api.meetup'),
113+
[
114+
'sign' => true,
115+
'key' => '683d6d3f25744ae5d631c1a424437',
116+
]
117+
);
118+
};

app/middleware.php

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
// Application middleware
3+
4+
// e.g: $app->add(new \Slim\Csrf\Guard);

app/routes.php

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
// Routes
3+
4+
// Homepage
5+
$app->get('/', 'PHPWarks\Welcome\HomeAction:dispatch')
6+
->setName('homepage');
7+
8+
//// Events:
9+
//$app->get('/events', 'PHPWarks\Event\HomeAction:dispatch')
10+
// ->setName('event_home');
11+
//$app->get('/events/upcoming', 'PHPWarks\Event\UpcomingAction:dispatch')
12+
// ->setName('event_upcoming');
13+
//$app->get('/events/request-a-talk', 'PHPWarks\Event\RequestAction:dispatch')
14+
// ->setName('event_request');
15+
//$app->get('/events/propose-a-talk', 'PHPWarks\Event\ProposeAction:dispatch')
16+
// ->setName('event_propose');
17+
//$app->get('/events/past', 'PHPWarks\Event\PastAction:dispatch')
18+
// ->setName('event_past');
19+
//$app->get('/events/past/{year}', 'PHPWarks\Event\PastByYearAction:dispatch')
20+
// ->setName('event_past_by_year');
21+
//$app->get('/events/past/{year}/{month}', 'PHPWarks\Event\PastByYearAndMonthAction:dispatch')
22+
// ->setName('event_past_by_year_and_month');
23+
//
24+
//// Contact:
25+
//$app->map(['GET', 'POST'], '/contact', 'PHPWarks\Contact\ContactAction:dispatch')
26+
// ->setName('contact_us');
27+
//
28+
//// Sponsors
29+
//$app->get('/our-sponsors', 'PHPWarks\Sponsors\OurSponsorsAction:dispatch')
30+
// ->setName('our_sponsors');
31+
//
32+
//// Community:
33+
//$app->get('/communities', 'PHPWarks\Community\HomeAction:dispatch')
34+
// ->setName('communities');
35+
//$app->get('/get-involved', 'PHPWarks\Community\GetInvolvedAction:dispatch')
36+
// ->setName('get_involved');
37+
38+
39+
////////
40+
//// API
41+
////////
42+
43+
// Events
44+
$app->get('/api/events/upcoming', 'PHPWarks\API\Internal\Events\UpcomingAction:dispatch');

0 commit comments

Comments
 (0)