Merge pull request #57 from Xerkus/master
authorEvan Coury <me@evancoury.com>
Tue, 22 May 2012 21:10:17 +0000 (14:10 -0700)
committerEvan Coury <me@evancoury.com>
Tue, 22 May 2012 21:10:17 +0000 (14:10 -0700)
Added config/autoload/*local.php to gitignore

15 files changed:
.gitignore
README.md
composer.json [new file with mode: 0644]
composer.lock [new file with mode: 0644]
composer.phar [new file with mode: 0755]
config/application.config.php
module/Application/Module.php
module/Application/autoload_classmap.php [deleted file]
module/Application/autoload_function.php [deleted file]
module/Application/autoload_register.php [deleted file]
module/Application/config/module.config.php
public/index.php
vendor/.gitignore [new file with mode: 0644]
vendor/README.md
vendor/ZendFramework [deleted submodule]

index 77d8e16..f86d474 100644 (file)
@@ -5,5 +5,4 @@ nbproject
 .DS_Store
 .idea
 .project
-.settings
-
+.settings
\ No newline at end of file
index 5f21e53..531b01d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -10,33 +10,54 @@ looking to get their feet wet with ZF2.
 
 Installation
 ------------
-The easiest way to get a working copy of this project is to do a recursive
-clone:
 
-    git clone --recursive git://github.com/zendframework/ZendSkeletonApplication.git
-
-After the clone is complete, set up a virtual host to point to the public/
-directory of the project and you should be ready to go!
-
-If you're wondering what the `--recursive` flag is, keep reading:
-
-Git Submodules
---------------
-This project makes use of [Git submodules](http://book.git-scm.com/5_submodules.html).
-Utilizing Git submodules allows us to reference an exact commit in the upstream
-[zendframework/zf2](https://github.com/zendframework/zf2) repository and ensure
-that those who have cloned the project have that same commit checked out. This
-provides several benefits:
-
-* Developers do not have to worry about which commit of the zf2 project to have
-  checked out for this project to work.
-* No additional steps to "install" Zend Framework are needed; it "just works"
-  after a cloning the project.
-
-There are a couple of mild caveats to be aware of:
-
-* Be sure to always run `git submodule update` after pulling, as merge/rebase
-  does not automatically update the checked out commit in submodules if it has
-  been changed.
-* The initial clone will be a bit slower, due to it having to pull down a
-  separate copy of ZF2 from what you already have.
+Using Composer (recommended)
+----------------------------
+The recommended way to get a working copy of this project is to clone the repository
+and use composer to install dependencies:
+
+    cd my/project/dir
+    git clone git://github.com/zendframework/ZendSkeletonApplication.git
+    cd ZendSkeletonApplication
+    php composer.phar install
+
+Using Git submodules
+--------------------
+Alternatively, you can install using native git submodules. This method works fine but it is
+recommended that you use Composer due to the dependency management it provides.
+
+    git clone git://github.com/zendframework/ZendSkeletonApplication.git --recursive
+
+You will also need to update public/index.php and modules/Application/Module.php to enable autoloading.
+For public/index.php, replace lines 2-13 with:
+
+    use Zend\Loader\AutoloaderFactory,
+        Zend\ServiceManager\ServiceManager,
+        Zend\Mvc\Service\ServiceManagerConfiguration;
+
+    chdir(dirname(__DIR__));
+    require_once (getenv('ZF2_PATH') ?: 'vendor/ZendFramework/library') . '/Zend/Loader/AutoloaderFactory.php';
+
+    // Setup autoloader
+    AutoloaderFactory::factory();
+
+Within modules/Application/Module.php add this method to the Application class:
+
+    public function getAutoloaderConfig()
+    {
+        return array(
+            'Zend\Loader\ClassMapAutoloader' => array(
+                __DIR__ . '/autoload_classmap.php',
+            ),
+            'Zend\Loader\StandardAutoloader' => array(
+                'namespaces' => array(
+                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+                ),
+            ),
+        );
+    }
+
+Virtual Host
+------------
+Afterwards, set up a virtual host to point to the public/ directory of the
+project and you should be ready to go!
\ No newline at end of file
diff --git a/composer.json b/composer.json
new file mode 100644 (file)
index 0000000..6599bf5
--- /dev/null
@@ -0,0 +1,19 @@
+{
+    "name": "zendframework/skeleton-application",
+    "description": "Skeleton Application for ZF2",
+    "license": "BSD-3-Clause",
+    "keywords": [
+        "framework",
+        "zf2"
+    ],
+    "homepage": "http://framework.zend.com/",
+    "require": {
+        "php": ">=5.3.3",
+        "zendframework/zendframework": "dev-master#5188f29db00222584de2e775dbf7fd004a2600b5"
+    },
+    "autoload": {
+        "psr-0": {
+            "Application": "module/Application/src"
+        }
+    }
+}
diff --git a/composer.lock b/composer.lock
new file mode 100644 (file)
index 0000000..f0922d0
--- /dev/null
@@ -0,0 +1,39 @@
+{
+    "hash": "aeff3640d146b3542c567f85bb07ab23",
+    "packages": [
+        {
+            "package": "zendframework/zendframework",
+            "version": "dev-master",
+            "source-reference": "5188f29db00222584de2e775dbf7fd004a2600b5",
+            "alias-pretty-version": "2.0.x-dev",
+            "alias-version": "2.0.9999999.9999999-dev"
+        },
+        {
+            "package": "zendframework/zendframework",
+            "version": "dev-master",
+            "source-reference": "5188f29db00222584de2e775dbf7fd004a2600b5"
+        },
+        {
+            "package": "zendframework/zendframework",
+            "version": "dev-master",
+            "source-reference": "5188f29db00222584de2e775dbf7fd004a2600b5",
+            "alias-pretty-version": "2.0.x-dev",
+            "alias-version": "2.0.9999999.9999999-dev"
+        },
+        {
+            "package": "zendframework/zendframework",
+            "version": "dev-master",
+            "source-reference": "fedd11dce74ca2ec20c1370915be06615e91b9d2",
+            "alias-pretty-version": "2.0.x-dev",
+            "alias-version": "2.0.9999999.9999999-dev"
+        }
+    ],
+    "packages-dev": null,
+    "aliases": [
+
+    ],
+    "minimum-stability": "dev",
+    "stability-flags": {
+        "zendframework/zendframework": 20
+    }
+}
diff --git a/composer.phar b/composer.phar
new file mode 100755 (executable)
index 0000000..4b03778
Binary files /dev/null and b/composer.phar differ
index e8868a3..6e62784 100644 (file)
@@ -4,6 +4,9 @@ return array(
         'Application',
     ),
     'module_listener_options' => array( 
+        'config_glob_paths'    => array(
+            'config/autoload/{,*.}{global,local}.php',
+        ),
         'config_cache_enabled' => false,
         'cache_dir'            => 'data/cache',
         'module_paths' => array(
index a7dd66b..0ed2ef2 100644 (file)
@@ -4,20 +4,6 @@ namespace Application;
 
 class Module
 {
-    public function getAutoloaderConfig()
-    {
-        return array(
-            'Zend\Loader\ClassMapAutoloader' => array(
-                __DIR__ . '/autoload_classmap.php',
-            ),
-            'Zend\Loader\StandardAutoloader' => array(
-                'namespaces' => array(
-                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
-                ),
-            ),
-        );
-    }
-
     public function getConfig()
     {
         return include __DIR__ . '/config/module.config.php';
diff --git a/module/Application/autoload_classmap.php b/module/Application/autoload_classmap.php
deleted file mode 100644 (file)
index 156e8bd..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-return array(
-    'Application\Controller\IndexController' => __DIR__ . '/src/Application/Controller/IndexController.php',
-    'Application\Module'                     => __DIR__ . '/Module.php',
-);
diff --git a/module/Application/autoload_function.php b/module/Application/autoload_function.php
deleted file mode 100644 (file)
index 3ea81c4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-return function ($class) {
-    static $map;
-    if (!$map) {
-        $map = include __DIR__ . '/autoload_classmap.php';
-    }
-
-    if (!isset($map[$class])) {
-        return false;
-    }
-    return include $map[$class];
-};
diff --git a/module/Application/autoload_register.php b/module/Application/autoload_register.php
deleted file mode 100644 (file)
index a8dcbb4..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-<?php
-spl_autoload_register(include __DIR__ . '/autoload_function.php');
index b68e949..13643b9 100644 (file)
@@ -11,7 +11,7 @@ return array(
                         'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                     ),
                     'defaults' => array(
-                        'controller' => 'IndexController',
+                        'controller' => 'index',
                         'action'     => 'index',
                     ),
                 ),
@@ -21,7 +21,7 @@ return array(
                 'options' => array(
                     'route'    => '/',
                     'defaults' => array(
-                        'controller' => 'IndexController',
+                        'controller' => 'index',
                         'action'     => 'index',
                     ),
                 ),
@@ -30,7 +30,7 @@ return array(
     ),
     'controller' => array(
         'classes' => array(
-            'IndexController' => 'Application\Controller\IndexController'
+            'index' => 'Application\Controller\IndexController'
         ),
     ),
     'view_manager' => array(
@@ -46,7 +46,7 @@ return array(
             'error/index'   => __DIR__ . '/../view/error/index.phtml',
         ),
         'template_path_stack' => array(
-            'application' => __DIR__ . '/../view',
+            __DIR__ . '/../view',
         ),
     ),
 );
index 2868a5c..5408a8c 100644 (file)
@@ -1,21 +1,24 @@
 <?php
+use Zend\ServiceManager\ServiceManager,
+    Zend\Mvc\Service\ServiceManagerConfiguration;
+
 chdir(dirname(__DIR__));
-require_once (getenv('ZF2_PATH') ?: 'vendor/ZendFramework/library') . '/Zend/Loader/AutoloaderFactory.php';
 
-use Zend\Loader\AutoloaderFactory,
-Zend\ServiceManager\ServiceManager,
-Zend\Mvc\Service\ServiceManagerConfiguration;
+if (!file_exists('vendor/autoload.php')) {
+    throw new RuntimeException('vendor/autoload.php could not be found. Did you run php composer.phar install?');
+    exit;
+}
 
-// setup autoloader
-AutoloaderFactory::factory();
+// Composer autoloading
+require_once('vendor/autoload.php');
 
-// get application stack configuration
+// Get application stack configuration
 $configuration = include 'config/application.config.php';
 
-// setup service manager
+// Setup service manager
 $serviceManager = new ServiceManager(new ServiceManagerConfiguration($configuration['service_manager']));
 $serviceManager->setService('ApplicationConfiguration', $configuration);
 $serviceManager->get('ModuleManager')->loadModules();
 
-// run application
+// Run application
 $serviceManager->get('Application')->bootstrap()->run()->send();
diff --git a/vendor/.gitignore b/vendor/.gitignore
new file mode 100644 (file)
index 0000000..4578c85
--- /dev/null
@@ -0,0 +1,5 @@
+!.gitignore
+.composer
+composer
+zendframework
+autoload.php
index 77ae06b..52144c9 100644 (file)
@@ -1 +1 @@
-This `vendor/` directory is where third-party modules should be installed.
+This vendor/ directory is where third-party modules should be installed.
diff --git a/vendor/ZendFramework b/vendor/ZendFramework
deleted file mode 160000 (submodule)
index 8eb84d3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 8eb84d3957d69346bccd876a5dc0f4e2dbb91e9c