Permalink
Browse files

Initial commit.

  • Loading branch information...
0 parents commit 335230f00611aeca800a27fd8d76193b45e4e2ae @simensen simensen committed Dec 21, 2011
@@ -0,0 +1,2 @@
+composer.phar
+vendor
26 LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2011, Dragonfly Development Inc
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Dragonfly Development Inc nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,55 @@
+Sculpin - Static Site Generator
+===============================
+
+Sculpin is a static site generator written in PHP.
+
+Requirements
+------------
+
+ * PHP 5.3+
+
+Getting Started
+---------------
+
+Clone the official repository. Or fork and clone your fork. Your call.
+
+ git clone https://github.com/dflydev/sculpin.git
+
+Dependencies are managed by the most excellent [Composer](http://packagist.org/).
+From inside your freshly cloned Sculpin, run the following commands to get
+Composer and install Sculpin's dependencies.
+
+ wget http://getcomposer.org/composer.phar
+ php composer.phar install
+
+For development, either get used to typing `/path/to/sculpin/bin/sculpin`
+or create an alias. For example:
+
+ alias sculpin=~/workspaces/sculpin/bin/sculpin
+
+To get started quickly, create a new directory for your Sculpin project
+and initialize it with the `init` command.
+
+ mkdir mysite
+ cd mysite
+ sculpin init
+
+To generate the site, issue the `generate` command.
+
+ sculpin generate
+
+License
+-------
+
+Sculpin is licensed under the New BSD License - see the LICENSE file for details.
+
+Not Invented Here
+-----------------
+
+There are other fine projects that are more mature than this one.
+If you are looking for a stable project with an established community,
+try something on admittedly incomplete list:
+
+ * [Jekyll](http://github.com/mojombo/jekyll) — Ruby
+ * [Hyde](http://ringce.com/hyde) — Python
+ * [Phrozn](http://phrozn.info) — PHP
@@ -0,0 +1,27 @@
+#!/usr/bin/env php
+<?php
+
+/*
+ * This file is a part of Sculpin.
+ *
+ * (c) Dragonfly Development Inc.
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+if (!@include __DIR__.'/../vendor/.composer/autoload.php') {
+ die('You must set up the project dependencies, run the following commands:
+
+ cd ' . dirname(__DIR__) . '
+ wget http://getcomposer.org/composer.phar
+ php composer.phar install
+
+');
+}
+
+use dflydev\sculpin\console\Application;
+
+// run the console application
+$application = new Application();
+$application->run();
@@ -0,0 +1,33 @@
+{
+ "name": "dflydev/sculpin",
+ "type": "application",
+ "description": "Static Site Generator",
+ "homepage": "http://github.com/dflydev/sculpin",
+ "keywords": ["static", "site", "generator"],
+ "license": "New BSD License",
+ "authors": [
+ {
+ "name": "Dragonfly Development Inc.",
+ "email": "info@dflydev.com",
+ "homepage": "http://dflydev.com"
+ },
+ {
+ "name": "Beau Simensen",
+ "email": "beau@dflydev.com",
+ "homepage": "http://beausimensen.com"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.0",
+ "symfony/console": ">2.0,<2.2-dev",
+ "symfony/dependency-injection": ">2.0,<2.2-dev",
+ "symfony/event-dispatcher": ">2.0,<2.2-dev",
+ "symfony/finder": ">2.0,<2.2-dev",
+ "symfony/process": ">2.0,<2.2-dev",
+ "symfony/yaml": ">2.0,<2.2-dev"
+ },
+ "autoload": {
+ "psr-0": { "dflydev\\sculpin": "src" }
+ },
+ "bin": ["bin/sculpin"]
+}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,25 @@
+<?php
+
+/*
+ * This file is a part of Sculpin.
+ *
+ * (c) Dragonfly Development Inc.
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace dflydev\sculpin;
+
+use dflydev\sculpin\configuration\Configuration;
+
+class Sculpin {
+
+ const VERSION = '@package_version@';
+
+ public function __construct(Configuration $configuration)
+ {
+ $this->configuration = $configuration;
+ }
+
+}
@@ -0,0 +1,80 @@
+<?php
+
+/*
+ * This file is a part of Sculpin.
+ *
+ * (c) Dragonfly Development Inc.
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace dflydev\sculpin\configuration;
+
+use Symfony\Component\Yaml\Yaml;
+
+class YamlConfigurationBuilder {
+
+ /**
+ * YAML Configuration Filenames
+ * @var array
+ */
+ private $yamlConfigurationFilenames;
+
+ public function __construct(array $yamlConfigurationFilenames)
+ {
+ $this->yamlConfigurationFilenames = $yamlConfigurationFilenames;
+ }
+
+ /**
+ * Build a configuration
+ * @return array
+ */
+ public function build()
+ {
+ $config = array();
+ foreach ( $this->yamlConfigurationFilenames as $yamlConfigurationFilename ) {
+ if ( file_exists($yamlConfigurationFilename) ) {
+ echo 'Including "' . $yamlConfigurationFilename . '"' . "\n";
+ $config = self::MERGE($config, Yaml::parse($yamlConfigurationFilename));
+ } else {
+ echo 'Skipping "' . $yamlConfigurationFilename . '" (missing)' . "\n";
+ }
+ }
+ return $config;
+ }
+
+ /**
+ * Test if array is an associative array
+ *
+ * Note that this function will return true if an array is empty. Meaning
+ * empty arrays will be treated as if they are associative arrays.
+ *
+ * @param array $arr
+ * @return boolean
+ */
+ static private function IS_ASSOC(array $arr)
+ {
+ return (is_array($arr) && (!count($arr) || count(array_filter(array_keys($arr),'is_string')) == count($arr)));
+ }
+
+ /**
+ * Merge the contents of one thingy into another thingy
+ * @param mixed $to
+ * @param mixed $from
+ */
+ static private function MERGE($to, $from)
+ {
+ if ( is_array($from) ) {
+ foreach ( $from as $k => $v ) {
+ if ( ! isset($to[$k]) ) { $to[$k] = $v; }
+ else {
+ $to[$k] = self::MERGE($to[$k], $v);
+ }
+ }
+ return $to;
+ }
+ return $from;
+ }
+
+}
@@ -0,0 +1,37 @@
+<?php
+
+/*
+ * This file is a part of Sculpin.
+ *
+ * (c) Dragonfly Development Inc.
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace dflydev\sculpin\console;
+
+use dflydev\sculpin\Sculpin;
+
+use Symfony\Component\Console\Application as BaseApplication;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class Application extends BaseApplication
+{
+ public function __construct()
+ {
+ parent::__construct('Sculpin', Sculpin::VERSION);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function doRun(InputInterface $input, OutputInterface $output)
+ {
+ $this->add(new command\InitCommand());
+ $this->add(new command\GenerateCommand());
+ return parent::doRun($input, $output);
+ }
+
+}
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is a part of Sculpin.
+ *
+ * (c) Dragonfly Development Inc.
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace dflydev\sculpin\console\command;
+
+use Symfony\Component\Console\Command\Command as BaseCommand;
+
+abstract class Command extends BaseCommand
+{
+}
@@ -0,0 +1,47 @@
+<?php
+
+/*
+ * This file is a part of Sculpin.
+ *
+ * (c) Dragonfly Development Inc.
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace dflydev\sculpin\console\command;
+
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class GenerateCommand extends Command
+{
+ protected function configure()
+ {
+ $this
+ ->setName('generate')
+ ->setDescription('Generate a site from source.')
+ ->setDefinition(array(
+ new InputOption('watch', null, InputOption::VALUE_NONE, 'Watch source and regenerate site as changes are made.'),
+ //new InputOption('server', null, InputOption::VALUE_NONE, 'Serve generated site.'),
+ //new InputOption('port', null, InputOption::VALUE_REQUIRED, 'Specify the port that the server should listen on.', 5000),
+ new InputOption('url', null, InputOption::VALUE_REQUIRED, 'Override site.url configuration.'),
+ ))
+ ->setHelp(<<<EOT
+The <info>generate</info> command generates a site from source.
+
+Sculpin can also watch the source for changes and regenerate parts of the site
+as changes are made to the source. This can be useful during development.
+EOT
+ )
+ ;
+ }
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $watch = (Boolean) $input->getOption('watch');
+ //$server = (Boolean) $input->getOption('server');
+ //$port = $input->getOption('port');
+ $url = $input->getOption('url');
+ }
+}
Oops, something went wrong.

0 comments on commit 335230f

Please sign in to comment.