From 56c19e9eb239707ac1d6f72b47ae1b9d9a297288 Mon Sep 17 00:00:00 2001
From: Joan He <joan@x.com>
Date: Mon, 24 Aug 2015 17:23:32 -0500
Subject: [PATCH] MAGETWO-39386: Restrict var_generation directory permissions

 - create deploy module to contain the mode set command
 - added library functionality of recursively changing permissions
---
 .htaccess                                     |   3 +-
 .../Deploy/Console/Command/SetModeCommand.php | 115 ++++++
 .../Console/Command/ShowModeCommand.php       |  74 ++++
 app/code/Magento/Deploy/LICENSE.txt           |  48 +++
 app/code/Magento/Deploy/LICENSE_AFL.txt       |  48 +++
 app/code/Magento/Deploy/Model/Mode.php        | 372 +++++++++++++++++
 app/code/Magento/Deploy/README.md             |   8 +
 .../Console/Command/SetModeCommandTest.php    |  91 +++++
 .../Console/Command/ShowModeCommandTest.php   |  58 +++
 app/code/Magento/Deploy/composer.json         |  25 ++
 app/code/Magento/Deploy/etc/di.xml            |  17 +
 app/code/Magento/Deploy/etc/module.xml        |  14 +
 .../Console/Command/CssDeployCommand.php      |   3 +-
 .../Magento/Store/Model/Config/StoreView.php  | 112 +++++
 composer.json                                 |   1 +
 composer.lock                                 | 382 +++++++-----------
 .../Filesystem/Directory/WriteTest.php        |  13 +
 .../Magento/Framework/App/Bootstrap.php       |  10 +-
 .../Framework/App/Test/Unit/BootstrapTest.php |  13 +
 .../Framework/Filesystem/Directory/Write.php  |  15 +
 .../Filesystem/Directory/WriteInterface.php   |  11 +
 .../Framework/Filesystem/Driver/File.php      |  56 +++
 .../Framework/Filesystem/DriverInterface.php  |  11 +
 .../Magento/Setup/Model/ConfigGenerator.php   |  13 +
 .../Magento/Setup/Model/ConfigOptionsList.php |   1 +
 .../Unit/Module/ConfigOptionsListTest.php     |   4 +-
 26 files changed, 1274 insertions(+), 244 deletions(-)
 create mode 100644 app/code/Magento/Deploy/Console/Command/SetModeCommand.php
 create mode 100644 app/code/Magento/Deploy/Console/Command/ShowModeCommand.php
 create mode 100644 app/code/Magento/Deploy/LICENSE.txt
 create mode 100644 app/code/Magento/Deploy/LICENSE_AFL.txt
 create mode 100644 app/code/Magento/Deploy/Model/Mode.php
 create mode 100644 app/code/Magento/Deploy/README.md
 create mode 100644 app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php
 create mode 100644 app/code/Magento/Deploy/Test/Unit/Console/Command/ShowModeCommandTest.php
 create mode 100644 app/code/Magento/Deploy/composer.json
 create mode 100644 app/code/Magento/Deploy/etc/di.xml
 create mode 100644 app/code/Magento/Deploy/etc/module.xml
 create mode 100644 app/code/Magento/Store/Model/Config/StoreView.php

diff --git a/.htaccess b/.htaccess
index 9f630df0ae6..bef5869dd2f 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,5 +1,6 @@
 ############################################
-## uncomment the line below to enable developer mode
+## overrides deployment configuration mode value
+## use command bin/magento deploy:mode:set to switch modes
 
 #   SetEnv MAGE_MODE developer
 
diff --git a/app/code/Magento/Deploy/Console/Command/SetModeCommand.php b/app/code/Magento/Deploy/Console/Command/SetModeCommand.php
new file mode 100644
index 00000000000..0d6e790c593
--- /dev/null
+++ b/app/code/Magento/Deploy/Console/Command/SetModeCommand.php
@@ -0,0 +1,115 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Deploy\Console\Command;
+
+use Magento\Framework\Exception\LocalizedException;
+use Magento\TestFramework\Event\Magento;
+use Symfony\Component\Console\Command\Command;
+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 Magento\Framework\ObjectManagerInterface;
+use Magento\Framework\App\State;
+
+/**
+ * Command for change the Magento mode
+ */
+class SetModeCommand extends Command
+{
+
+    /**#@+
+     * Input arguments for mode setter command
+     */
+    const MODE_ARGUMENT = 'mode';
+    const SKIP_COMPILATION_OPTION = 'skip-compilation';
+    /**#@-*/
+
+    /**
+     * Object manager factory
+     *
+     * @var ObjectManagerInterface
+     */
+    private $objectManager;
+
+    /**
+     * Inject dependencies
+     *
+     * @param ObjectManagerInterface $objectManager
+     */
+    public function __construct(ObjectManagerInterface $objectManager)
+    {
+        $this->objectManager = $objectManager;
+        parent::__construct();
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function configure()
+    {
+        $description = 'Displays current application mode.';
+
+        $this->setName('deploy:mode:set')
+            ->setDescription($description)
+            ->setDefinition([
+                new InputArgument(
+                    self::MODE_ARGUMENT,
+                    InputArgument::REQUIRED,
+                    'The application mode to set. Available options are "developer" or "production"'
+                ),
+                new InputOption(
+                    self::SKIP_COMPILATION_OPTION,
+                    's',
+                    InputOption::VALUE_NONE,
+                    'Skips the clearing and regeneration of static content (generated code, preprocessed CSS, '
+                    . 'and assets in pub/static/)'
+                )
+            ]);
+        parent::configure();
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        try {
+            /** @var \Magento\Deploy\Model\Mode $modeController */
+            $modeController = $this->objectManager->create(
+                'Magento\Deploy\Model\Mode',
+                [
+                    'input' => $input,
+                    'output' => $output,
+                ]
+            );
+            $toMode = $input->getArgument(self::MODE_ARGUMENT);
+            $skipCompilation = $input->getOption(self::SKIP_COMPILATION_OPTION);
+            switch($toMode) {
+                case State::MODE_DEVELOPER:
+                    $modeController->enableDeveloperMode();
+                    break;
+                case State::MODE_PRODUCTION:
+                    if ($skipCompilation) {
+                        $modeController->enableProductionModeMinimal();
+                    } else {
+                        $modeController->enableProductionMode();
+                    }
+                    break;
+                default:
+                    throw new LocalizedException(__('Cannot switch into given mode "%1"', $toMode));
+            }
+            $output->writeln('Enabled ' . $toMode . ' mode.');
+        } catch (\Exception $e) {
+            $output->writeln('<error>' . $e->getMessage() . '</error>');
+            if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
+                $output->writeln($e->getTraceAsString());
+            }
+            return;
+        }
+    }
+}
diff --git a/app/code/Magento/Deploy/Console/Command/ShowModeCommand.php b/app/code/Magento/Deploy/Console/Command/ShowModeCommand.php
new file mode 100644
index 00000000000..b9bfddf5f0b
--- /dev/null
+++ b/app/code/Magento/Deploy/Console/Command/ShowModeCommand.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Deploy\Console\Command;
+
+use Magento\TestFramework\Event\Magento;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Magento\Framework\ObjectManagerInterface;
+use Magento\Framework\App\State;
+
+/**
+ * Command for change the Magento mode
+ */
+class ShowModeCommand extends Command
+{
+    /**
+     * Object manager factory
+     *
+     * @var ObjectManagerInterface
+     */
+    private $objectManager;
+
+    /**
+     * Inject dependencies
+     *
+     * @param ObjectManagerInterface $objectManager
+     */
+    public function __construct(ObjectManagerInterface $objectManager)
+    {
+        $this->objectManager = $objectManager;
+        parent::__construct();
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function configure()
+    {
+        $description = 'Displays current application mode.';
+
+        $this->setName('deploy:mode:show')->setDescription($description);
+        parent::configure();
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        try {
+            /** @var \Magento\Deploy\Model\Mode $mode */
+            $mode = $this->objectManager->create(
+                'Magento\Deploy\Model\Mode',
+                [
+                    'input' => $input,
+                    'output' => $output,
+                ]
+            );
+            $currentMode = $mode->getMode() ?: State::MODE_DEFAULT;
+            $output->writeln("Current application mode: $currentMode.");
+        } catch (\Exception $e) {
+            $output->writeln('<error>' . $e->getMessage() . '</error>');
+            if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
+                $output->writeln($e->getTraceAsString());
+            }
+            return;
+        }
+    }
+}
diff --git a/app/code/Magento/Deploy/LICENSE.txt b/app/code/Magento/Deploy/LICENSE.txt
new file mode 100644
index 00000000000..49525fd99da
--- /dev/null
+++ b/app/code/Magento/Deploy/LICENSE.txt
@@ -0,0 +1,48 @@
+
+Open Software License ("OSL") v. 3.0
+
+This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
+
+Licensed under the Open Software License version 3.0
+
+   1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
+
+         1. to reproduce the Original Work in copies, either alone or as part of a collective work;
+
+         2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
+
+         3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License;
+
+         4. to perform the Original Work publicly; and
+
+         5. to display the Original Work publicly. 
+
+   2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
+
+   3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
+
+   4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
+
+   5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
+
+   6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
+
+   7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
+
+   8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
+
+   9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
+
+  10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
+
+  11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
+
+  12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
+
+  13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
+
+  14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+  15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
+
+  16. Modification of This License. This License is Copyright (C) 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
\ No newline at end of file
diff --git a/app/code/Magento/Deploy/LICENSE_AFL.txt b/app/code/Magento/Deploy/LICENSE_AFL.txt
new file mode 100644
index 00000000000..87943b95d43
--- /dev/null
+++ b/app/code/Magento/Deploy/LICENSE_AFL.txt
@@ -0,0 +1,48 @@
+
+Academic Free License ("AFL") v. 3.0
+
+This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
+
+Licensed under the Academic Free License version 3.0
+
+   1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
+
+         1. to reproduce the Original Work in copies, either alone or as part of a collective work;
+
+         2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
+
+         3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
+
+         4. to perform the Original Work publicly; and
+
+         5. to display the Original Work publicly.
+
+   2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
+
+   3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
+
+   4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
+
+   5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
+
+   6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
+
+   7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
+
+   8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
+
+   9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
+
+  10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
+
+  11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
+
+  12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
+
+  13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
+
+  14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+  15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
+
+  16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
\ No newline at end of file
diff --git a/app/code/Magento/Deploy/Model/Mode.php b/app/code/Magento/Deploy/Model/Mode.php
new file mode 100644
index 00000000000..38fecde0b48
--- /dev/null
+++ b/app/code/Magento/Deploy/Model/Mode.php
@@ -0,0 +1,372 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Deploy\Model;
+
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Magento\Framework\Config\File\ConfigFilePool;
+use Magento\Framework\App\State;
+use Magento\Framework\App\DeploymentConfig\Reader;
+use Magento\Framework\App\DeploymentConfig\Writer;
+use Magento\Framework\App\Filesystem\DirectoryList;
+use Magento\Framework\ObjectManagerInterface;
+use Magento\Framework\Filesystem;
+use Magento\Framework\Filesystem\Driver\File;
+use Magento\Store\Model\Config\StoreView;
+use Magento\Developer\Console\Command\CssDeployCommand;
+
+/**
+ * A class to manage Magento modes
+ *
+ * @SuppressWarnings("PMD.CouplingBetweenObjects")
+ * @SuppressWarnings("PMD.ExcessiveParameterList")
+ */
+class Mode
+{
+    /**
+     * File access permissions
+     */
+    const PERMISSIONS_FILE = 0640;
+
+    /**
+     * Directory access permissions
+     */
+    const PERMISSIONS_DIR = 0750;
+
+    /**
+     * Default theme when no theme is stored in configuration
+     */
+    const DEFAULT_THEME = 'Magento/blank';
+
+    /** @var InputInterface */
+    private $input;
+
+    /** @var OutputInterface */
+    private $output;
+
+    /** @var \Magento\Framework\App\DeploymentConfig\Writer */
+    private $writer;
+
+    /** @var \Magento\Framework\App\DeploymentConfig\Reader */
+    private $reader;
+
+    /** @var ObjectManagerInterface */
+    private $objectManager;
+
+    /** @var Filesystem */
+    private $filesystem;
+
+    /** @var Filesystem */
+    private $directoryList;
+
+    /** @var File */
+    private $driverFile;
+
+    /** @var StoreView */
+    private $storeView;
+
+    /** @var \Magento\Framework\Shell */
+    private $shell;
+
+    /** @var  string */
+    private $functionCallPath;
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @param Writer $writer
+     * @param Reader $reader
+     * @param ObjectManagerInterface $objectManager
+     * @param Filesystem $filesystem
+     * @param DirectoryList $directoryList
+     * @param File $driverFile
+     * @param StoreView $storeView
+     * @param \Magento\Framework\Shell $shell
+     * @param \Magento\Framework\App\MaintenanceMode $maintenanceMode
+     */
+    public function __construct(
+        InputInterface $input,
+        OutputInterface $output,
+        Writer $writer,
+        Reader $reader,
+        ObjectManagerInterface $objectManager,
+        Filesystem $filesystem,
+        DirectoryList $directoryList,
+        File $driverFile,
+        StoreView $storeView,
+        \Magento\Framework\Shell $shell,
+        \Magento\Framework\App\MaintenanceMode $maintenanceMode
+    ) {
+        $this->input = $input;
+        $this->output = $output;
+        $this->writer = $writer;
+        $this->reader = $reader;
+        $this->objectManager = $objectManager;
+        $this->filesystem = $filesystem;
+        $this->directoryList = $directoryList;
+        $this->driverFile = $driverFile;
+        $this->storeView = $storeView;
+        $this->shell = $shell;
+        $this->maintenanceMode = $maintenanceMode;
+        $this->functionCallPath = 'php -f ' . BP . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'magento ';
+    }
+
+    /**
+     * Enable production mode
+     *
+     * @return void
+     */
+    public function enableProductionMode()
+    {
+        $this->enableMaintenanceMode($this->output);
+        // Сlean up /var/generation, /var/di/, /var/view_preprocessed and /pub/static directories
+        $this->cleanupFilesystem(
+            [
+                DirectoryList::CACHE,
+                DirectoryList::GENERATION,
+                DirectoryList::DI,
+                DirectoryList::TMP_MATERIALIZATION_DIR,
+                DirectoryList::STATIC_VIEW,
+            ]
+        );
+        // Trigger static assets compilation and deployment
+        $this->deployStaticContent($this->output);
+        $this->deployCss($this->output);
+        // Trigger code generation
+        $this->compile($this->output);
+        $this->disableMaintenanceMode($this->output);
+        $this->lockStaticResources();
+        $this->setStoreMode(State::MODE_PRODUCTION);
+    }
+
+    /**
+     * Only lock static resource locations and set store mode, without handling static content
+     *
+     * @return void
+     */
+    public function enableProductionModeMinimal()
+    {
+        $this->lockStaticResources();
+        $this->setStoreMode(State::MODE_PRODUCTION);
+    }
+
+    /**
+     * Enable Developer mode
+     *
+     * @return void
+     */
+    public function enableDeveloperMode()
+    {
+        $this->cleanupFilesystem(
+            [
+                DirectoryList::CACHE,
+                DirectoryList::GENERATION,
+                DirectoryList::DI,
+                DirectoryList::TMP_MATERIALIZATION_DIR,
+                DirectoryList::STATIC_VIEW,
+            ]
+        );
+        $this->setStoreMode(State::MODE_DEVELOPER);
+    }
+
+    /**
+     * Get current mode information
+     *
+     * @return string
+     * @throws \Exception
+     */
+    public function getMode()
+    {
+        $env = $this->reader->load(ConfigFilePool::APP_ENV);
+        return isset($env[State::PARAM_MODE]) ? $env[State::PARAM_MODE] : null;
+    }
+
+    /**
+     * Store mode in env.php
+     *
+     * @param string $mode
+     * @return void
+     */
+    protected function setStoreMode($mode)
+    {
+        $data = [
+            ConfigFilePool::APP_ENV => [
+                State::PARAM_MODE => $mode
+            ]
+        ];
+        $this->writer->saveConfig($data);
+    }
+
+    /**
+     * Enable maintenance mode
+     *
+     * @param OutputInterface $output
+     * @return void
+     */
+    protected function enableMaintenanceMode(OutputInterface $output)
+    {
+        $this->maintenanceMode->set(true);
+        $output->writeln('Enabled maintenance mode');
+    }
+
+    /**
+     * Disable maintenance mode
+     *
+     * @param OutputInterface $output
+     * @return void
+     */
+    protected function disableMaintenanceMode(OutputInterface $output)
+    {
+        $this->maintenanceMode->set(false);
+        $output->writeln('Disabled maintenance mode');
+    }
+
+    /**
+     * Deploy CSS
+     *
+     * @param OutputInterface $output
+     * @return void
+     */
+    private function deployCss(OutputInterface $output)
+    {
+        $themeLocalePairs = $this->storeView->retrieveThemeLocalePairs();
+        foreach ($themeLocalePairs as $themeLocalePair) {
+            $theme = $themeLocalePair['theme'] ?: self::DEFAULT_THEME;
+            $cmd = $this->functionCallPath . 'dev:css:deploy less'
+                . ' --' . CssDeployCommand::THEME_OPTION . '="' . $theme . '"'
+                . ' --' . CssDeployCommand::LOCALE_OPTION . '="' . $themeLocalePair['locale'] . '"';
+
+            /**
+             * @todo build a solution that does not depend on exec
+             */
+            $execOutput = $this->shell->execute($cmd);
+            $output->writeln($execOutput);
+        }
+        $output->writeln('CSS deployment complete');
+    }
+
+    /**
+     * Deploy static content
+     *
+     * @param OutputInterface $output
+     * @return void
+     * @throws \Exception
+     */
+    private function deployStaticContent(OutputInterface $output)
+    {
+        $cmd = $this->functionCallPath . 'setup:static-content:deploy '
+            . implode(' ', $this->storeView->retrieveLocales());
+
+        /**
+         * @todo build a solution that does not depend on exec
+         */
+        $execOutput = $this->shell->execute($cmd);
+        $output->writeln($execOutput);
+        $output->writeln('Static content deployment complete');
+    }
+
+    /**
+     * Runs code multi-tenant compiler to generate code and DI information
+     *
+     * @param OutputInterface $output
+     * @return void
+     */
+    private function compile(OutputInterface $output)
+    {
+        $this->cleanupFilesystem(
+            [
+                DirectoryList::CACHE,
+                DirectoryList::GENERATION,
+                DirectoryList::DI,
+            ]
+        );
+        $cmd = $this->functionCallPath . 'setup:di:compile-multi-tenant';
+
+        /**
+         * exec command is necessary for now to isolate the autoloaders in the compiler from the memory state
+         * of this process, which would prevent some classes from being generated
+         *
+         * @todo build a solution that does not depend on exec
+         */
+        $execOutput = $this->shell->execute($cmd);
+        $output->writeln($execOutput);
+        $output->writeln('Compilation complete');
+    }
+
+    /**
+     * Deletes specified directories by code
+     *
+     * @param array $directoryCodeList
+     * @return void
+     */
+    private function cleanupFilesystem($directoryCodeList)
+    {
+        $excludePatterns = ['#.htaccess#', '#deployed_version.txt#'];
+        foreach ($directoryCodeList as $code) {
+            if ($code == DirectoryList::STATIC_VIEW) {
+                $directoryPath = $this->directoryList->getPath(DirectoryList::STATIC_VIEW);
+                if ($this->driverFile->isExists($directoryPath)) {
+                    $files = $this->driverFile->readDirectory($directoryPath);
+                    foreach ($files as $file) {
+                        foreach ($excludePatterns as $pattern) {
+                            if (preg_match($pattern, $file)) {
+                                continue 2;
+                            }
+                        }
+                        if ($this->driverFile->isFile($file)) {
+                            $this->driverFile->deleteFile($file);
+                        } else {
+                            $this->driverFile->deleteDirectory($file);
+                        }
+                    }
+                }
+            } else {
+                $this->filesystem->getDirectoryWrite($code)
+                    ->delete();
+            }
+        }
+    }
+
+    /**
+     * Change permissions for directories by their code
+     *
+     * @param array $directoryCodeList
+     * @param int $dirPermissions
+     * @param int $filePermissions
+     * @return void
+     */
+    private function changePermissions($directoryCodeList, $dirPermissions, $filePermissions)
+    {
+        foreach ($directoryCodeList as $code) {
+            $directoryPath = $this->directoryList->getPath($code);
+            if ($this->driverFile->isExists($directoryPath)) {
+                $this->filesystem->getDirectoryWrite($code)
+                    ->changePermissionsRecursively('', $dirPermissions, $filePermissions);
+            } else {
+                $this->driverFile->createDirectory($directoryPath, $dirPermissions);
+            }
+        }
+    }
+
+    /**
+     * Chenge permissions on static resources
+     *
+     * @return void
+     */
+    private function lockStaticResources()
+    {
+        // Lock /var/generation, /var/di/ and /var/view_preprocessed directories
+        $this->changePermissions(
+            [
+                DirectoryList::GENERATION,
+                DirectoryList::DI,
+                DirectoryList::TMP_MATERIALIZATION_DIR,
+            ],
+            self::PERMISSIONS_DIR,
+            self::PERMISSIONS_FILE
+        );
+    }
+}
diff --git a/app/code/Magento/Deploy/README.md b/app/code/Magento/Deploy/README.md
new file mode 100644
index 00000000000..c263e8a5ee9
--- /dev/null
+++ b/app/code/Magento/Deploy/README.md
@@ -0,0 +1,8 @@
+Deploy module contains 2 commands that allows switching between application modes (for instance from development to
+production) and show current application mode. To change the mode run "bin/magento setup:mode:set [mode]".
+Where mode can be one of the following:
+ - development
+ - production
+When switching to production mode, you can pass optional parameter skip-compilation to do not compile static files, CSS 
+and do not run the compilation process.
+
diff --git a/app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php b/app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php
new file mode 100644
index 00000000000..58d7fc7efd1
--- /dev/null
+++ b/app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php
@@ -0,0 +1,91 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Deploy\Test\Unit\Console\Command;
+
+use Magento\Deploy\Console\Command\SetModeCommand;
+use Symfony\Component\Console\Tester\CommandTester;
+use Magento\Framework\App\State;
+
+/**
+ * @package Magento\Deploy\Test\Unit\Console\Command
+ */
+class SetModeCommandTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Deploy\Model\Mode|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $modeMock;
+
+    /**
+     * @var SetModeCommand
+     */
+    private $command;
+
+    /**
+     * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $objectManagerMock;
+
+    protected function setUp()
+    {
+        $this->objectManagerMock = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
+        $this->modeMock = $this->getMock('Magento\Deploy\Model\Mode', [], [], '', false);
+
+        $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+        $this->command = $objectManager->getObject(
+            'Magento\Deploy\Console\Command\SetModeCommand',
+            ['objectManager' => $this->objectManagerMock]
+        );
+
+        $this->objectManagerMock->expects($this->once())->method('create')->willReturn($this->modeMock);
+    }
+
+    public function testSetProductionMode()
+    {
+        $this->modeMock->expects($this->once())->method('enableProductionMode');
+
+        $tester = new CommandTester($this->command);
+        $tester->execute(['mode' => 'production']);
+        $this->assertContains(
+            "production mode",
+            $tester->getDisplay()
+        );
+    }
+
+    public function testSetDeveloperMode()
+    {
+        $this->modeMock->expects($this->once())->method('enableDeveloperMode');
+
+        $tester = new CommandTester($this->command);
+        $tester->execute(['mode' => 'developer']);
+        $this->assertContains(
+            "developer mode",
+            $tester->getDisplay()
+        );
+    }
+
+    public function testSetProductionSkipCompilation()
+    {
+        $this->modeMock->expects($this->once())->method('enableProductionModeMinimal');
+
+        $tester = new CommandTester($this->command);
+        $tester->execute(['mode' => 'production', '--skip-compilation' => true]);
+        $this->assertContains(
+            "production mode",
+            $tester->getDisplay()
+        );
+    }
+
+    public function testSetInvalidMode()
+    {
+        $tester = new CommandTester($this->command);
+        $tester->execute(['mode' => 'invalid-mode']);
+        $this->assertContains(
+            "Cannot switch into given mode",
+            $tester->getDisplay()
+        );
+    }
+}
diff --git a/app/code/Magento/Deploy/Test/Unit/Console/Command/ShowModeCommandTest.php b/app/code/Magento/Deploy/Test/Unit/Console/Command/ShowModeCommandTest.php
new file mode 100644
index 00000000000..ea1e99562e1
--- /dev/null
+++ b/app/code/Magento/Deploy/Test/Unit/Console/Command/ShowModeCommandTest.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Deploy\Test\Unit\Console\Command;
+
+use Magento\Deploy\Console\Command\ShowModeCommand;
+use Symfony\Component\Console\Tester\CommandTester;
+use Magento\Framework\App\State;
+
+/**
+ * @package Magento\Deploy\Test\Unit\Console\Command
+ */
+class ShowModeCommandTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Deploy\Model\Mode|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $modeMock;
+
+    /**
+     * @var ShowModeCommand
+     */
+    private $command;
+
+    /**
+     * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $objectManagerMock;
+
+    protected function setUp()
+    {
+        $this->objectManagerMock = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
+        $this->modeMock = $this->getMock('Magento\Deploy\Model\Mode', [], [], '', false);
+
+        $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+        $this->command = $objectManager->getObject(
+            'Magento\Deploy\Console\Command\ShowModeCommand',
+            ['objectManager' => $this->objectManagerMock]
+        );
+
+        $this->objectManagerMock->expects($this->once())->method('create')->willReturn($this->modeMock);
+    }
+
+    public function testExecute()
+    {
+        $currentMode = 'application-mode';
+        $this->modeMock->expects($this->once())->method('getMode')->willReturn($currentMode);
+
+        $tester = new CommandTester($this->command);
+        $tester->execute([]);
+        $this->assertContains(
+            $currentMode,
+            $tester->getDisplay()
+        );
+    }
+}
diff --git a/app/code/Magento/Deploy/composer.json b/app/code/Magento/Deploy/composer.json
new file mode 100644
index 00000000000..796a530b9fa
--- /dev/null
+++ b/app/code/Magento/Deploy/composer.json
@@ -0,0 +1,25 @@
+{
+    "name": "magento/module-deploy",
+    "description": "N/A",
+    "require": {
+        "php": "~5.5.0|~5.6.0",
+        "magento/framework": "1.0.0-beta",
+        "magento/magento-composer-installer": "*",
+        "magento/module-developer": "1.0.0-beta",
+        "magento/module-store": "1.0.0-beta"
+    },
+    "type": "magento2-module",
+    "version": "1.0.0-beta",
+    "license": [
+        "OSL-3.0",
+        "AFL-3.0"
+    ],
+    "extra": {
+        "map": [
+            [
+                "*",
+                "Magento/Deploy"
+            ]
+        ]
+    }
+}
diff --git a/app/code/Magento/Deploy/etc/di.xml b/app/code/Magento/Deploy/etc/di.xml
new file mode 100644
index 00000000000..d9dc3ba1711
--- /dev/null
+++ b/app/code/Magento/Deploy/etc/di.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+-->
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
+    <type name="Magento\Framework\Console\CommandList">
+        <arguments>
+            <argument name="commands" xsi:type="array">
+                <item name="setModeCommand" xsi:type="object">Magento\Deploy\Console\Command\SetModeCommand</item>
+                <item name="showModeCommand" xsi:type="object">Magento\Deploy\Console\Command\ShowModeCommand</item>
+            </argument>
+        </arguments>
+    </type>
+</config>
diff --git a/app/code/Magento/Deploy/etc/module.xml b/app/code/Magento/Deploy/etc/module.xml
new file mode 100644
index 00000000000..c44117227dc
--- /dev/null
+++ b/app/code/Magento/Deploy/etc/module.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+-->
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
+    <module name="Magento_Deploy" setup_version="2.0.0">
+        <sequence>
+            <module name="Magento_Store"/>
+        </sequence>
+    </module>
+</config>
diff --git a/app/code/Magento/Developer/Console/Command/CssDeployCommand.php b/app/code/Magento/Developer/Console/Command/CssDeployCommand.php
index ffa326bc08b..ffa70bbb9d4 100644
--- a/app/code/Magento/Developer/Console/Command/CssDeployCommand.php
+++ b/app/code/Magento/Developer/Console/Command/CssDeployCommand.php
@@ -226,7 +226,8 @@ class CssDeployCommand extends Command
                 [
                     'asset'           => $asset,
                     'origContent'     => $content,
-                    'origContentType' => $asset->getContentType()
+                    'origContentType' => $asset->getContentType(),
+                    'origAssetPath' => $asset->getFilePath()
                 ]
             );
 
diff --git a/app/code/Magento/Store/Model/Config/StoreView.php b/app/code/Magento/Store/Model/Config/StoreView.php
new file mode 100644
index 00000000000..8b564b5ac5a
--- /dev/null
+++ b/app/code/Magento/Store/Model/Config/StoreView.php
@@ -0,0 +1,112 @@
+<?php
+/***
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Store\Model\Config;
+
+use Magento\Directory\Helper\Data;
+use Magento\Framework\View\DesignInterface;
+use Magento\Store\Model\ScopeInterface;
+
+/**
+ * Retrieves theme and locale info associated with store-views
+ */
+class StoreView
+{
+    /** @var \Magento\Framework\App\Config\ScopeConfigInterface */
+    private $scopeConfig;
+    /** @var \Magento\Store\Model\StoreManagerInterface */
+    private $storeManager;
+    /** @var \Magento\Framework\View\Design\Theme\ThemeProviderInterface */
+    private $themeProvider;
+
+    /**
+     * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
+     * @param \Magento\Store\Model\StoreManagerInterface $storeManager
+     * @param \Magento\Framework\View\Design\Theme\ThemeProviderInterface $themeProvider
+     */
+    public function __construct(
+        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
+        \Magento\Store\Model\StoreManagerInterface $storeManager,
+        \Magento\Framework\View\Design\Theme\ThemeProviderInterface $themeProvider
+    ) {
+        $this->scopeConfig = $scopeConfig;
+        $this->storeManager = $storeManager;
+        $this->themeProvider = $themeProvider;
+    }
+
+    /**
+     * Retrieves a unique list of pairs representing the theme/locale for each store view
+     *
+     * @return array
+     */
+    public function retrieveThemeLocalePairs()
+    {
+        $stores = $this->storeManager->getStores();
+        $localeThemeData = [];
+
+        /** @var \Magento\Store\Api\Data\StoreInterface $store */
+        foreach ($stores as $store) {
+            $code = $store->getCode();
+            $themeId = $this->scopeConfig->getValue(
+                DesignInterface::XML_PATH_THEME_ID,
+                ScopeInterface::SCOPE_STORE,
+                $code
+            );
+            $localeThemeData[] = [
+                'theme' => $this->themeProvider->getThemeById($themeId)->getCode(),
+                'locale' => $this->scopeConfig->getValue(
+                    Data::XML_PATH_DEFAULT_LOCALE,
+                    ScopeInterface::SCOPE_STORE,
+                    $code
+                )
+            ];
+        }
+
+        return $this->removeDuplicates($localeThemeData);
+    }
+
+    /**
+     * Retrieves a unique list of locales that are used by store views
+     *
+     * @return array
+     */
+    public function retrieveLocales()
+    {
+        $stores = $this->storeManager->getStores();
+        $locales = [];
+
+        /** @var \Magento\Store\Api\Data\StoreInterface $store */
+        foreach ($stores as $store) {
+            $locales[] = $this->scopeConfig->getValue(
+                Data::XML_PATH_DEFAULT_LOCALE,
+                ScopeInterface::SCOPE_STORE,
+                $store->getCode()
+            );
+        }
+
+        return $this->removeDuplicates($locales);
+    }
+
+    /**
+     * Remove duplicate entries in an array
+     *
+     * @param array $arr
+     * @return array
+     */
+    private function removeDuplicates($arr)
+    {
+        $len = count($arr);
+        for ($out = 0; $out < $len; $out++) {
+            $outVal = $arr[$out];
+            for ($in = $out + 1; $in < $len; $in++) {
+                $inVal = $arr[$in];
+                if ($outVal === $inVal) {
+                    unset($arr[$out]);
+                }
+            }
+        }
+        return $arr;
+    }
+}
diff --git a/composer.json b/composer.json
index 0c33d06e596..d2cd72e19ea 100644
--- a/composer.json
+++ b/composer.json
@@ -97,6 +97,7 @@
         "magento/module-currency-symbol": "self.version",
         "magento/module-customer": "self.version",
         "magento/module-customer-import-export": "self.version",
+        "magento/module-deploy": "self.version",
         "magento/module-design-editor": "self.version",
         "magento/module-developer": "self.version",
         "magento/module-dhl": "self.version",
diff --git a/composer.lock b/composer.lock
index ead53470e36..ab209fef006 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1,10 +1,10 @@
 {
     "_readme": [
         "This file locks the dependencies of your project to a known state",
-        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+        "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "e4150d79f684532d0a9cded9b58ebf6b",
+    "hash": "d22beacc84c2c0a73b403370e7492600",
     "packages": [
         {
             "name": "braintree/braintree_php",
@@ -929,12 +929,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-code.git",
-                "reference": "0ed94f842ba60cdc900c46a61bdbd7ac95a3e140"
+                "reference": "cfd5951ff4348e4430850560416c7ddb755f95d3"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-code/zipball/0ed94f842ba60cdc900c46a61bdbd7ac95a3e140",
-                "reference": "0ed94f842ba60cdc900c46a61bdbd7ac95a3e140",
+                "reference": "cfd5951ff4348e4430850560416c7ddb755f95d3",
                 "shasum": ""
             },
             "require": {
@@ -943,9 +943,6 @@
             },
             "require-dev": {
                 "doctrine/common": ">=2.1",
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-stdlib": "self.version"
             },
             "suggest": {
@@ -961,7 +958,7 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Code\\": "src/"
+                    "Zend\\Code\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -969,12 +966,12 @@
                 "BSD-3-Clause"
             ],
             "description": "provides facilities to generate arbitrary code using an object oriented interface",
-            "homepage": "https://github.com/zendframework/zend-code",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "code",
                 "zf2"
             ],
-            "time": "2015-03-31 15:39:14"
+            "time": "2015-04-01 17:59:08"
         },
         {
             "name": "zendframework/zend-config",
@@ -982,12 +979,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-config.git",
-                "reference": "95f3a4b3fa85d49e6f060183122de4596fa6d29d"
+                "reference": "8682fe4e2923b383bb6472fc84b5796a07589163"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-config/zipball/95f3a4b3fa85d49e6f060183122de4596fa6d29d",
-                "reference": "95f3a4b3fa85d49e6f060183122de4596fa6d29d",
+                "reference": "8682fe4e2923b383bb6472fc84b5796a07589163",
                 "shasum": ""
             },
             "require": {
@@ -995,9 +992,6 @@
                 "zendframework/zend-stdlib": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-filter": "self.version",
                 "zendframework/zend-i18n": "self.version",
                 "zendframework/zend-json": "self.version",
@@ -1018,7 +1012,7 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Config\\": "src/"
+                    "Zend\\Config\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -1026,12 +1020,12 @@
                 "BSD-3-Clause"
             ],
             "description": "provides a nested object property based user interface for accessing this configuration data within application code",
-            "homepage": "https://github.com/zendframework/zend-config",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "config",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 17:59:31"
         },
         {
             "name": "zendframework/zend-console",
@@ -1039,23 +1033,18 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-console.git",
-                "reference": "54823d9ba6f8ce39046384ee5a043b5b3d5f56d7"
+                "reference": "94ab6663b07e19f20b3319ecf317bd72b6a72dca"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-console/zipball/54823d9ba6f8ce39046384ee5a043b5b3d5f56d7",
-                "reference": "54823d9ba6f8ce39046384ee5a043b5b3d5f56d7",
+                "reference": "94ab6663b07e19f20b3319ecf317bd72b6a72dca",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.3.23",
                 "zendframework/zend-stdlib": "self.version"
             },
-            "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master"
-            },
             "suggest": {
                 "zendframework/zend-filter": "To support DefaultRouteMatcher usage",
                 "zendframework/zend-validator": "To support DefaultRouteMatcher usage"
@@ -1069,19 +1058,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Console\\": "src/"
+                    "Zend\\Console\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-console",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "console",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 17:59:48"
         },
         {
             "name": "zendframework/zend-crypt",
@@ -1140,12 +1129,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-di.git",
-                "reference": "b9f8de081adecf71a003a569e9ba76c0a4c00bf2"
+                "reference": "0811f2a67ad0b50dfb8d602ed67cde0b82249190"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-di/zipball/b9f8de081adecf71a003a569e9ba76c0a4c00bf2",
-                "reference": "b9f8de081adecf71a003a569e9ba76c0a4c00bf2",
+                "reference": "0811f2a67ad0b50dfb8d602ed67cde0b82249190",
                 "shasum": ""
             },
             "require": {
@@ -1154,9 +1143,6 @@
                 "zendframework/zend-stdlib": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-servicemanager": "self.version"
             },
             "suggest": {
@@ -1171,19 +1157,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Di\\": "src/"
+                    "Zend\\Di\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-di",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "di",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:01:30"
         },
         {
             "name": "zendframework/zend-escaper",
@@ -1191,22 +1177,17 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-escaper.git",
-                "reference": "15e5769e4fcdb4bf07ebd76500810e7070e23a97"
+                "reference": "65b3328627362b0be1d5e9067bc846511d1fbc96"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/15e5769e4fcdb4bf07ebd76500810e7070e23a97",
-                "reference": "15e5769e4fcdb4bf07ebd76500810e7070e23a97",
+                "reference": "65b3328627362b0be1d5e9067bc846511d1fbc96",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.3.23"
             },
-            "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master"
-            },
             "type": "library",
             "extra": {
                 "branch-alias": {
@@ -1216,19 +1197,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Escaper\\": "src/"
+                    "Zend\\Escaper\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-escaper",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "escaper",
                 "zf2"
             ],
-            "time": "2015-03-23 18:29:14"
+            "time": "2015-04-01 18:02:07"
         },
         {
             "name": "zendframework/zend-eventmanager",
@@ -1236,23 +1217,18 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-eventmanager.git",
-                "reference": "58d21c95c7005a527262fd536499195f104e83f9"
+                "reference": "38df5b567d4ff4d22144745c503ba0502d0d5695"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/58d21c95c7005a527262fd536499195f104e83f9",
-                "reference": "58d21c95c7005a527262fd536499195f104e83f9",
+                "reference": "38df5b567d4ff4d22144745c503ba0502d0d5695",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.3.23",
                 "zendframework/zend-stdlib": "self.version"
             },
-            "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master"
-            },
             "type": "library",
             "extra": {
                 "branch-alias": {
@@ -1262,19 +1238,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\EventManager\\": "src/"
+                    "Zend\\EventManager\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-event-manager",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "eventmanager",
                 "zf2"
             ],
-            "time": "2015-03-23 18:29:14"
+            "time": "2015-04-01 18:05:26"
         },
         {
             "name": "zendframework/zend-filter",
@@ -1282,12 +1258,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-filter.git",
-                "reference": "6d8aed2da81b62a04747346c4370562cdbe34595"
+                "reference": "b13741a88553351fc52472de529b57b580b8f6f1"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/6d8aed2da81b62a04747346c4370562cdbe34595",
-                "reference": "6d8aed2da81b62a04747346c4370562cdbe34595",
+                "reference": "b13741a88553351fc52472de529b57b580b8f6f1",
                 "shasum": ""
             },
             "require": {
@@ -1295,9 +1271,6 @@
                 "zendframework/zend-stdlib": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-crypt": "self.version",
                 "zendframework/zend-servicemanager": "self.version",
                 "zendframework/zend-uri": "self.version"
@@ -1317,7 +1290,7 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Filter\\": "src/"
+                    "Zend\\Filter\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -1325,12 +1298,12 @@
                 "BSD-3-Clause"
             ],
             "description": "provides a set of commonly needed data filters",
-            "homepage": "https://github.com/zendframework/zend-filter",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "filter",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:09:25"
         },
         {
             "name": "zendframework/zend-form",
@@ -1338,12 +1311,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-form.git",
-                "reference": "bca0db55718355d25c2c10fdd41a83561f1c94b3"
+                "reference": "09f5bd46ffbf783df22281898e2175b291bd43a3"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-form/zipball/bca0db55718355d25c2c10fdd41a83561f1c94b3",
-                "reference": "bca0db55718355d25c2c10fdd41a83561f1c94b3",
+                "reference": "09f5bd46ffbf783df22281898e2175b291bd43a3",
                 "shasum": ""
             },
             "require": {
@@ -1352,9 +1325,6 @@
                 "zendframework/zend-stdlib": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-captcha": "self.version",
                 "zendframework/zend-code": "self.version",
                 "zendframework/zend-eventmanager": "self.version",
@@ -1385,19 +1355,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Form\\": "src/"
+                    "Zend\\Form\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-form",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "form",
                 "zf2"
             ],
-            "time": "2015-03-28 20:29:18"
+            "time": "2015-04-01 18:09:25"
         },
         {
             "name": "zendframework/zend-http",
@@ -1405,12 +1375,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-http.git",
-                "reference": "9c6047a0bdb3094d3ea07a215ff929cc47de4deb"
+                "reference": "ee6220609845b32d1b2873c9ac694aef56d508f5"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-http/zipball/9c6047a0bdb3094d3ea07a215ff929cc47de4deb",
-                "reference": "9c6047a0bdb3094d3ea07a215ff929cc47de4deb",
+                "reference": "ee6220609845b32d1b2873c9ac694aef56d508f5",
                 "shasum": ""
             },
             "require": {
@@ -1420,11 +1390,6 @@
                 "zendframework/zend-uri": "self.version",
                 "zendframework/zend-validator": "self.version"
             },
-            "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master"
-            },
             "type": "library",
             "extra": {
                 "branch-alias": {
@@ -1434,7 +1399,7 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Http\\": "src/"
+                    "Zend\\Http\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -1442,12 +1407,12 @@
                 "BSD-3-Clause"
             ],
             "description": "provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests",
-            "homepage": "https://github.com/zendframework/zend-http",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "http",
                 "zf2"
             ],
-            "time": "2015-03-27 15:46:30"
+            "time": "2015-04-01 18:09:25"
         },
         {
             "name": "zendframework/zend-i18n",
@@ -1455,12 +1420,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-i18n.git",
-                "reference": "9aebc5287373a802540d75fe5508417f866c2e52"
+                "reference": "33051775d9a8c341fe3b77d1f3daa0e921e2f4bd"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/9aebc5287373a802540d75fe5508417f866c2e52",
-                "reference": "9aebc5287373a802540d75fe5508417f866c2e52",
+                "reference": "33051775d9a8c341fe3b77d1f3daa0e921e2f4bd",
                 "shasum": ""
             },
             "require": {
@@ -1468,9 +1433,6 @@
                 "zendframework/zend-stdlib": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-cache": "self.version",
                 "zendframework/zend-config": "self.version",
                 "zendframework/zend-eventmanager": "self.version",
@@ -1499,19 +1461,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\I18n\\": "src/"
+                    "Zend\\I18n\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-i18n",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "i18n",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:09:26"
         },
         {
             "name": "zendframework/zend-inputfilter",
@@ -1519,12 +1481,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-inputfilter.git",
-                "reference": "4b1398f3635fae3cc5e873c5bb067274f3d10a93"
+                "reference": "16856fec61f285e41e5492235220a4dec06ab90f"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-inputfilter/zipball/4b1398f3635fae3cc5e873c5bb067274f3d10a93",
-                "reference": "4b1398f3635fae3cc5e873c5bb067274f3d10a93",
+                "reference": "16856fec61f285e41e5492235220a4dec06ab90f",
                 "shasum": ""
             },
             "require": {
@@ -1534,9 +1496,6 @@
                 "zendframework/zend-validator": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-servicemanager": "self.version"
             },
             "suggest": {
@@ -1551,19 +1510,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\InputFilter\\": "src/"
+                    "Zend\\InputFilter\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-input-filter",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "inputfilter",
                 "zf2"
             ],
-            "time": "2015-03-23 18:29:14"
+            "time": "2015-04-01 18:09:26"
         },
         {
             "name": "zendframework/zend-json",
@@ -1571,12 +1530,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-json.git",
-                "reference": "2d845e151c1b9a237cf1899ac31e17fb10bd1e3f"
+                "reference": "76aeb27e4baf39799e5ca3cf6f2fdd6748ee930c"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-json/zipball/2d845e151c1b9a237cf1899ac31e17fb10bd1e3f",
-                "reference": "2d845e151c1b9a237cf1899ac31e17fb10bd1e3f",
+                "reference": "76aeb27e4baf39799e5ca3cf6f2fdd6748ee930c",
                 "shasum": ""
             },
             "require": {
@@ -1584,9 +1543,6 @@
                 "zendframework/zend-stdlib": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-http": "self.version",
                 "zendframework/zend-server": "self.version"
             },
@@ -1604,7 +1560,7 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Json\\": "src/"
+                    "Zend\\Json\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -1612,12 +1568,12 @@
                 "BSD-3-Clause"
             ],
             "description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP",
-            "homepage": "https://github.com/zendframework/zend-json",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "json",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:09:26"
         },
         {
             "name": "zendframework/zend-loader",
@@ -1625,22 +1581,17 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-loader.git",
-                "reference": "65de2c7a56f8eee633c6bf1cfab73e45648880d4"
+                "reference": "6868b8a0c346f17fb97724c3a63aa2cbf6b94865"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-loader/zipball/65de2c7a56f8eee633c6bf1cfab73e45648880d4",
-                "reference": "65de2c7a56f8eee633c6bf1cfab73e45648880d4",
+                "reference": "6868b8a0c346f17fb97724c3a63aa2cbf6b94865",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.3.23"
             },
-            "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master"
-            },
             "type": "library",
             "extra": {
                 "branch-alias": {
@@ -1650,19 +1601,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Loader\\": "src/"
+                    "Zend\\Loader\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-loader",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "loader",
                 "zf2"
             ],
-            "time": "2015-03-23 18:29:14"
+            "time": "2015-04-01 18:09:26"
         },
         {
             "name": "zendframework/zend-log",
@@ -1670,12 +1621,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-log.git",
-                "reference": "002e3c810cad7e31e51c9895e9e3cb6fbd312cdd"
+                "reference": "2d5d20fd45470506bdaff727c46dc25fe953146e"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-log/zipball/002e3c810cad7e31e51c9895e9e3cb6fbd312cdd",
-                "reference": "002e3c810cad7e31e51c9895e9e3cb6fbd312cdd",
+                "reference": "2d5d20fd45470506bdaff727c46dc25fe953146e",
                 "shasum": ""
             },
             "require": {
@@ -1684,9 +1635,6 @@
                 "zendframework/zend-stdlib": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-console": "self.version",
                 "zendframework/zend-db": "self.version",
                 "zendframework/zend-escaper": "self.version",
@@ -1710,7 +1658,7 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Log\\": "src/"
+                    "Zend\\Log\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -1718,13 +1666,13 @@
                 "BSD-3-Clause"
             ],
             "description": "component for general purpose logging",
-            "homepage": "https://github.com/zendframework/zend-log",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "log",
                 "logging",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:09:26"
         },
         {
             "name": "zendframework/zend-math",
@@ -1732,22 +1680,17 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-math.git",
-                "reference": "f41fe4acfd809c14f2a802d1aa45dec8fcd2cc73"
+                "reference": "634123f83ca90b6613f132d0d100e6b5e9890a29"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-math/zipball/f41fe4acfd809c14f2a802d1aa45dec8fcd2cc73",
-                "reference": "f41fe4acfd809c14f2a802d1aa45dec8fcd2cc73",
+                "reference": "634123f83ca90b6613f132d0d100e6b5e9890a29",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.3.23"
             },
-            "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master"
-            },
             "suggest": {
                 "ext-bcmath": "If using the bcmath functionality",
                 "ext-gmp": "If using the gmp functionality",
@@ -1763,19 +1706,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Math\\": "src/"
+                    "Zend\\Math\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-math",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "math",
                 "zf2"
             ],
-            "time": "2015-03-23 18:29:14"
+            "time": "2015-04-01 18:09:27"
         },
         {
             "name": "zendframework/zend-modulemanager",
@@ -1783,12 +1726,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-modulemanager.git",
-                "reference": "af7ae3cd29a1efb73cc66ae1081e606039d5c20f"
+                "reference": "cbe16b0eafe734a062ed0182381e64b9c953dccf"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-modulemanager/zipball/af7ae3cd29a1efb73cc66ae1081e606039d5c20f",
-                "reference": "af7ae3cd29a1efb73cc66ae1081e606039d5c20f",
+                "reference": "cbe16b0eafe734a062ed0182381e64b9c953dccf",
                 "shasum": ""
             },
             "require": {
@@ -1797,9 +1740,6 @@
                 "zendframework/zend-stdlib": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-config": "self.version",
                 "zendframework/zend-console": "self.version",
                 "zendframework/zend-loader": "self.version",
@@ -1821,19 +1761,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\ModuleManager\\": "src/"
+                    "Zend\\ModuleManager\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-module-manager",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "modulemanager",
                 "zf2"
             ],
-            "time": "2015-03-23 18:29:14"
+            "time": "2015-04-01 18:09:27"
         },
         {
             "name": "zendframework/zend-mvc",
@@ -1841,12 +1781,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-mvc.git",
-                "reference": "0b4a4a829b30be510a3f215c4ff00c703ee8b431"
+                "reference": "bfff0f5f9e4d925ee13b8c159c9d6ae7e0db5412"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-mvc/zipball/0b4a4a829b30be510a3f215c4ff00c703ee8b431",
-                "reference": "0b4a4a829b30be510a3f215c4ff00c703ee8b431",
+                "reference": "bfff0f5f9e4d925ee13b8c159c9d6ae7e0db5412",
                 "shasum": ""
             },
             "require": {
@@ -1857,9 +1797,6 @@
                 "zendframework/zend-stdlib": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-authentication": "self.version",
                 "zendframework/zend-console": "self.version",
                 "zendframework/zend-di": "self.version",
@@ -1908,19 +1845,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Mvc\\": "src/"
+                    "Zend\\Mvc\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-mvc",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "mvc",
                 "zf2"
             ],
-            "time": "2015-03-26 18:55:14"
+            "time": "2015-04-01 18:09:27"
         },
         {
             "name": "zendframework/zend-serializer",
@@ -1928,12 +1865,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-serializer.git",
-                "reference": "3c531789a9882a5deb721356a7bd2642b65d4b09"
+                "reference": "a46960854d6326f0036d98c9abc7a79e36e25928"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-serializer/zipball/3c531789a9882a5deb721356a7bd2642b65d4b09",
-                "reference": "3c531789a9882a5deb721356a7bd2642b65d4b09",
+                "reference": "a46960854d6326f0036d98c9abc7a79e36e25928",
                 "shasum": ""
             },
             "require": {
@@ -1943,9 +1880,6 @@
                 "zendframework/zend-stdlib": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-servicemanager": "self.version"
             },
             "suggest": {
@@ -1960,7 +1894,7 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Serializer\\": "src/"
+                    "Zend\\Serializer\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -1968,12 +1902,12 @@
                 "BSD-3-Clause"
             ],
             "description": "provides an adapter based interface to simply generate storable representation of PHP types by different facilities, and recover",
-            "homepage": "https://github.com/zendframework/zend-serializer",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "serializer",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:09:28"
         },
         {
             "name": "zendframework/zend-server",
@@ -1981,12 +1915,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-server.git",
-                "reference": "d11ff0bd529d202022823d4accf5983cbd50fc49"
+                "reference": "fc73c34490908ba143af3c57c7e166b40c4b9f8e"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-server/zipball/d11ff0bd529d202022823d4accf5983cbd50fc49",
-                "reference": "d11ff0bd529d202022823d4accf5983cbd50fc49",
+                "reference": "fc73c34490908ba143af3c57c7e166b40c4b9f8e",
                 "shasum": ""
             },
             "require": {
@@ -1994,11 +1928,6 @@
                 "zendframework/zend-code": "self.version",
                 "zendframework/zend-stdlib": "self.version"
             },
-            "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master"
-            },
             "type": "library",
             "extra": {
                 "branch-alias": {
@@ -2008,19 +1937,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Server\\": "src/"
+                    "Zend\\Server\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-server",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "server",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:09:28"
         },
         {
             "name": "zendframework/zend-servicemanager",
@@ -2028,21 +1957,18 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-servicemanager.git",
-                "reference": "57cf99fa5ac08c05a135a8d0d676c52a5e450083"
+                "reference": "d3c27c708a148a30608f313a5b7a61a531bd9cb9"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/57cf99fa5ac08c05a135a8d0d676c52a5e450083",
-                "reference": "57cf99fa5ac08c05a135a8d0d676c52a5e450083",
+                "reference": "d3c27c708a148a30608f313a5b7a61a531bd9cb9",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.3.23"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-di": "self.version"
             },
             "suggest": {
@@ -2058,19 +1984,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\ServiceManager\\": "src/"
+                    "Zend\\ServiceManager\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-service-manager",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "servicemanager",
                 "zf2"
             ],
-            "time": "2015-03-23 18:29:14"
+            "time": "2015-04-01 18:09:28"
         },
         {
             "name": "zendframework/zend-soap",
@@ -2078,12 +2004,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-soap.git",
-                "reference": "a599463aba97ce247faf3fb443e3c7858b46449b"
+                "reference": "e42b900798ea95a9063fa4922da976d8b3a8ab6f"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-soap/zipball/a599463aba97ce247faf3fb443e3c7858b46449b",
-                "reference": "a599463aba97ce247faf3fb443e3c7858b46449b",
+                "reference": "e42b900798ea95a9063fa4922da976d8b3a8ab6f",
                 "shasum": ""
             },
             "require": {
@@ -2093,9 +2019,6 @@
                 "zendframework/zend-uri": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-http": "self.version"
             },
             "suggest": {
@@ -2110,19 +2033,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Soap\\": "src/"
+                    "Zend\\Soap\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-soap",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "soap",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:09:29"
         },
         {
             "name": "zendframework/zend-stdlib",
@@ -2130,21 +2053,18 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-stdlib.git",
-                "reference": "cf05c5ba75606e47ffee91cedc72778da46f74c3"
+                "reference": "eab586f4c18af3fa63c977611939f1f4a3cf1030"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cf05c5ba75606e47ffee91cedc72778da46f74c3",
-                "reference": "cf05c5ba75606e47ffee91cedc72778da46f74c3",
+                "reference": "eab586f4c18af3fa63c977611939f1f4a3cf1030",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.3.23"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-eventmanager": "self.version",
                 "zendframework/zend-filter": "self.version",
                 "zendframework/zend-serializer": "self.version",
@@ -2165,19 +2085,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Stdlib\\": "src/"
+                    "Zend\\Stdlib\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-stdlib",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "stdlib",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:09:29"
         },
         {
             "name": "zendframework/zend-text",
@@ -2185,12 +2105,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-text.git",
-                "reference": "d962ea25647b20527f3ca34ae225bbc885dabfc7"
+                "reference": "35f519e20e575a331c2ee554e5a555a59ce4b9e2"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-text/zipball/d962ea25647b20527f3ca34ae225bbc885dabfc7",
-                "reference": "d962ea25647b20527f3ca34ae225bbc885dabfc7",
+                "reference": "35f519e20e575a331c2ee554e5a555a59ce4b9e2",
                 "shasum": ""
             },
             "require": {
@@ -2198,11 +2118,6 @@
                 "zendframework/zend-servicemanager": "self.version",
                 "zendframework/zend-stdlib": "self.version"
             },
-            "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master"
-            },
             "type": "library",
             "extra": {
                 "branch-alias": {
@@ -2212,19 +2127,19 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Text\\": "src/"
+                    "Zend\\Text\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
                 "BSD-3-Clause"
             ],
-            "homepage": "https://github.com/zendframework/zend-text",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "text",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:09:29"
         },
         {
             "name": "zendframework/zend-uri",
@@ -2232,12 +2147,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-uri.git",
-                "reference": "bd9e625639415376f6a82551c73328448d7bc7d1"
+                "reference": "53f5b162b293f80de8b951eece8e08be83c4fe16"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-uri/zipball/bd9e625639415376f6a82551c73328448d7bc7d1",
-                "reference": "bd9e625639415376f6a82551c73328448d7bc7d1",
+                "reference": "53f5b162b293f80de8b951eece8e08be83c4fe16",
                 "shasum": ""
             },
             "require": {
@@ -2245,11 +2160,6 @@
                 "zendframework/zend-escaper": "self.version",
                 "zendframework/zend-validator": "self.version"
             },
-            "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master"
-            },
             "type": "library",
             "extra": {
                 "branch-alias": {
@@ -2259,7 +2169,7 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Uri\\": "src/"
+                    "Zend\\Uri\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -2267,12 +2177,12 @@
                 "BSD-3-Clause"
             ],
             "description": "a component that aids in manipulating and validating » Uniform Resource Identifiers (URIs)",
-            "homepage": "https://github.com/zendframework/zend-uri",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "uri",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:09:29"
         },
         {
             "name": "zendframework/zend-validator",
@@ -2280,12 +2190,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-validator.git",
-                "reference": "45fac2545a0f2eb66d71cb7966feee481e7c475f"
+                "reference": "eb678d20256f120a72ca27276bbb2875841701ab"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/45fac2545a0f2eb66d71cb7966feee481e7c475f",
-                "reference": "45fac2545a0f2eb66d71cb7966feee481e7c475f",
+                "reference": "eb678d20256f120a72ca27276bbb2875841701ab",
                 "shasum": ""
             },
             "require": {
@@ -2293,9 +2203,6 @@
                 "zendframework/zend-stdlib": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-db": "self.version",
                 "zendframework/zend-filter": "self.version",
                 "zendframework/zend-i18n": "self.version",
@@ -2323,7 +2230,7 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\Validator\\": "src/"
+                    "Zend\\Validator\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -2331,12 +2238,12 @@
                 "BSD-3-Clause"
             ],
             "description": "provides a set of commonly needed validators",
-            "homepage": "https://github.com/zendframework/zend-validator",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "validator",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:09:30"
         },
         {
             "name": "zendframework/zend-view",
@@ -2344,12 +2251,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/zend-view.git",
-                "reference": "37beb1ad46e530f627b4b6c3716efd728e976ba9"
+                "reference": "e119b4b5f082af58a96eb206e782b62c193227bf"
             },
             "dist": {
                 "type": "zip",
                 "url": "https://api.github.com/repos/zendframework/zend-view/zipball/37beb1ad46e530f627b4b6c3716efd728e976ba9",
-                "reference": "37beb1ad46e530f627b4b6c3716efd728e976ba9",
+                "reference": "e119b4b5f082af58a96eb206e782b62c193227bf",
                 "shasum": ""
             },
             "require": {
@@ -2359,9 +2266,6 @@
                 "zendframework/zend-stdlib": "self.version"
             },
             "require-dev": {
-                "fabpot/php-cs-fixer": "1.7.*",
-                "phpunit/phpunit": "~4.0",
-                "satooshi/php-coveralls": "dev-master",
                 "zendframework/zend-authentication": "self.version",
                 "zendframework/zend-escaper": "self.version",
                 "zendframework/zend-feed": "self.version",
@@ -2400,7 +2304,7 @@
             },
             "autoload": {
                 "psr-4": {
-                    "Zend\\View\\": "src/"
+                    "Zend\\View\\": ""
                 }
             },
             "notification-url": "https://packagist.org/downloads/",
@@ -2408,12 +2312,12 @@
                 "BSD-3-Clause"
             ],
             "description": "provides a system of helpers, output filters, and variable escaping",
-            "homepage": "https://github.com/zendframework/zend-view",
+            "homepage": "https://github.com/zendframework/zf2",
             "keywords": [
                 "view",
                 "zf2"
             ],
-            "time": "2015-03-25 20:55:48"
+            "time": "2015-04-01 18:09:30"
         }
     ],
     "packages-dev": [
@@ -2928,16 +2832,16 @@
         },
         {
             "name": "phpunit/php-token-stream",
-            "version": "1.4.3",
+            "version": "1.4.6",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/php-token-stream.git",
-                "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9"
+                "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/7a9b0969488c3c54fd62b4d504b3ec758fd005d9",
-                "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b",
+                "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b",
                 "shasum": ""
             },
             "require": {
@@ -2973,7 +2877,7 @@
             "keywords": [
                 "tokenizer"
             ],
-            "time": "2015-06-19 03:43:16"
+            "time": "2015-08-16 08:51:00"
         },
         {
             "name": "phpunit/phpunit",
@@ -3051,20 +2955,20 @@
         },
         {
             "name": "phpunit/phpunit-mock-objects",
-            "version": "2.3.6",
+            "version": "2.3.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
-                "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42"
+                "reference": "5e2645ad49d196e020b85598d7c97e482725786a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/18dfbcb81d05e2296c0bcddd4db96cade75e6f42",
-                "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a",
+                "reference": "5e2645ad49d196e020b85598d7c97e482725786a",
                 "shasum": ""
             },
             "require": {
-                "doctrine/instantiator": "~1.0,>=1.0.2",
+                "doctrine/instantiator": "^1.0.2",
                 "php": ">=5.3.3",
                 "phpunit/php-text-template": "~1.2",
                 "sebastian/exporter": "~1.2"
@@ -3103,7 +3007,7 @@
                 "mock",
                 "xunit"
             ],
-            "time": "2015-07-10 06:54:24"
+            "time": "2015-08-19 09:14:08"
         },
         {
             "name": "sebastian/comparator",
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Directory/WriteTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Directory/WriteTest.php
index 56ffb12eaf6..0388ee4f063 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Directory/WriteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Filesystem/Directory/WriteTest.php
@@ -231,6 +231,19 @@ class WriteTest extends \PHPUnit_Framework_TestCase
         $this->assertTrue($directory->changePermissions('test_directory', 0644));
     }
 
+    /**
+     * Test for changePermissionsRecursively method
+     */
+    public function testChangePermissionsRecursively()
+    {
+        $directory = $this->getDirectoryInstance('newDir1', 0777);
+        $directory->create('test_directory');
+        $directory->create('test_directory/subdirectory');
+        $directory->writeFile('test_directory/subdirectory/test_file.txt', 'Test Content');
+
+        $this->assertTrue($directory->changePermissionsRecursively('test_directory', 0750, 0640));
+    }
+
     /**
      * Test for touch method
      *
diff --git a/lib/internal/Magento/Framework/App/Bootstrap.php b/lib/internal/Magento/Framework/App/Bootstrap.php
index 05fd99ceaa7..8fff13c5e4c 100644
--- a/lib/internal/Magento/Framework/App/Bootstrap.php
+++ b/lib/internal/Magento/Framework/App/Bootstrap.php
@@ -403,7 +403,15 @@ class Bootstrap
      */
     public function isDeveloperMode()
     {
-        return isset($this->server[State::PARAM_MODE]) && $this->server[State::PARAM_MODE] == State::MODE_DEVELOPER;
+        if (isset($this->server[State::PARAM_MODE]) && $this->server[State::PARAM_MODE] == State::MODE_DEVELOPER) {
+            return true;
+        }
+        /** @var \Magento\Framework\App\DeploymentConfig $deploymentConfig */
+        $deploymentConfig = $this->getObjectManager()->get('Magento\Framework\App\DeploymentConfig');
+        if ($deploymentConfig->get(State::PARAM_MODE) == State::MODE_DEVELOPER) {
+            return true;
+        }
+        return false;
     }
 
     /**
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php b/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php
index 0b87b4db9b3..252b846e458 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php
@@ -169,6 +169,19 @@ class BootstrapTest extends \PHPUnit_Framework_TestCase
         $testParams = [State::PARAM_MODE => State::MODE_DEVELOPER];
         $bootstrap = self::createBootstrap($testParams);
         $this->assertTrue($bootstrap->isDeveloperMode());
+        $this->deploymentConfig->expects($this->any())->method('get')->willReturn(State::MODE_DEVELOPER);
+        $bootstrap = self::createBootstrap();
+        $this->assertTrue($bootstrap->isDeveloperMode());
+    }
+
+    public function testIsDeveloperModeСontradictoryValues()
+    {
+        $this->deploymentConfig->expects($this->any())->method('get')->willReturn(State::MODE_PRODUCTION);
+        $bootstrap = self::createBootstrap();
+        $this->assertFalse($bootstrap->isDeveloperMode());
+        $testParams = [State::PARAM_MODE => State::MODE_DEVELOPER];
+        $bootstrap = self::createBootstrap($testParams);
+        $this->assertTrue($bootstrap->isDeveloperMode());
     }
 
     public function testRunNoErrors()
diff --git a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php
index 2cd338bbb2a..2ec2a9d3c32 100644
--- a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php
+++ b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php
@@ -190,6 +190,21 @@ class Write extends Read implements WriteInterface
         return $this->driver->changePermissions($absolutePath, $permissions);
     }
 
+    /**
+     * Recursively change permissions of given path
+     *
+     * @param string $path
+     * @param int $dirPermissions
+     * @param int $filePermissions
+     * @return bool
+     * @throws FileSystemException
+     */
+    public function changePermissionsRecursively($path, $dirPermissions, $filePermissions)
+    {
+        $absolutePath = $this->driver->getAbsolutePath($this->path, $path);
+        return $this->driver->changePermissionsRecursively($absolutePath, $dirPermissions, $filePermissions);
+    }
+
     /**
      * Sets modification time of file, if file does not exist - creates file
      *
diff --git a/lib/internal/Magento/Framework/Filesystem/Directory/WriteInterface.php b/lib/internal/Magento/Framework/Filesystem/Directory/WriteInterface.php
index 71ac8bcba0a..6a058dc2326 100644
--- a/lib/internal/Magento/Framework/Filesystem/Directory/WriteInterface.php
+++ b/lib/internal/Magento/Framework/Filesystem/Directory/WriteInterface.php
@@ -68,6 +68,17 @@ interface WriteInterface extends ReadInterface
      */
     public function changePermissions($path, $permissions);
 
+    /**
+     * Change permissions of given path
+     *
+     * @param string $path
+     * @param int $dirPermissions
+     * @param int $filePermissions
+     * @return bool
+     * @throws \Magento\Framework\Exception\FileSystemException
+     */
+    public function changePermissionsRecursively($path, $dirPermissions, $filePermissions);
+
     /**
      * Sets access and modification time of file.
      *
diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/File.php b/lib/internal/Magento/Framework/Filesystem/Driver/File.php
index 1545206f3ca..0fc74eccc11 100644
--- a/lib/internal/Magento/Framework/Filesystem/Driver/File.php
+++ b/lib/internal/Magento/Framework/Filesystem/Driver/File.php
@@ -10,6 +10,11 @@ namespace Magento\Framework\Filesystem\Driver;
 use Magento\Framework\Exception\FileSystemException;
 use Magento\Framework\Filesystem\DriverInterface;
 
+/**
+ * Class File
+ * @package Magento\Framework\Filesystem\Driver
+ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
+ */
 class File implements DriverInterface
 {
     /**
@@ -408,6 +413,57 @@ class File implements DriverInterface
         return $result;
     }
 
+    /**
+     * Recursively change permissions of given path
+     *
+     * @param string $path
+     * @param int $dirPermissions
+     * @param int $filePermissions
+     * @return bool
+     * @throws FileSystemException
+     */
+    public function changePermissionsRecursively($path, $dirPermissions, $filePermissions)
+    {
+        $result = true;
+        if ($this->isFile($path)) {
+            $result = @chmod($path, $filePermissions);
+        } else {
+            $result = @chmod($path, $dirPermissions);
+        }
+        if (!$result) {
+            throw new FileSystemException(
+                new \Magento\Framework\Phrase(
+                    'Cannot change permissions for path "%1" %2',
+                    [$path, $this->getWarningMessage()]
+                )
+            );
+        }
+
+        $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS;
+
+        $iterator = new \RecursiveIteratorIterator(
+            new \RecursiveDirectoryIterator($path, $flags),
+            \RecursiveIteratorIterator::CHILD_FIRST
+        );
+        /** @var \FilesystemIterator $entity */
+        foreach ($iterator as $entity) {
+            if ($entity->isDir()) {
+                $result = @chmod($entity->getPathname(), $dirPermissions);
+            } else {
+                $result = @chmod($entity->getPathname(), $filePermissions);
+            }
+            if (!$result) {
+                throw new FileSystemException(
+                    new \Magento\Framework\Phrase(
+                        'Cannot change permissions for path "%1" %2',
+                        [$path, $this->getWarningMessage()]
+                    )
+                );
+            }
+        }
+        return $result;
+    }
+
     /**
      * Sets access and modification time of file.
      *
diff --git a/lib/internal/Magento/Framework/Filesystem/DriverInterface.php b/lib/internal/Magento/Framework/Filesystem/DriverInterface.php
index 66e544311a8..ac1ff792e33 100644
--- a/lib/internal/Magento/Framework/Filesystem/DriverInterface.php
+++ b/lib/internal/Magento/Framework/Filesystem/DriverInterface.php
@@ -185,6 +185,17 @@ interface DriverInterface
      */
     public function changePermissions($path, $permissions);
 
+    /**
+     * Recursively hange permissions of given path
+     *
+     * @param string $path
+     * @param int $dirPermissions
+     * @param int $filePermissions
+     * @return bool
+     * @throws FileSystemException
+     */
+    public function changePermissionsRecursively($path, $dirPermissions, $filePermissions);
+
     /**
      * Sets access and modification time of file.
      *
diff --git a/setup/src/Magento/Setup/Model/ConfigGenerator.php b/setup/src/Magento/Setup/Model/ConfigGenerator.php
index acfb1e2a804..491f60d9d26 100644
--- a/setup/src/Magento/Setup/Model/ConfigGenerator.php
+++ b/setup/src/Magento/Setup/Model/ConfigGenerator.php
@@ -11,6 +11,7 @@ use Magento\Framework\Config\File\ConfigFilePool;
 use Magento\Framework\Math\Random;
 use Magento\Framework\App\DeploymentConfig;
 use Magento\Framework\Config\ConfigOptionsListConstants;
+use Magento\Framework\App\State;
 use Magento\Framework\App\ObjectManagerFactory;
 
 /**
@@ -225,4 +226,16 @@ class ConfigGenerator
         }
         return $configData;
     }
+
+    /**
+     * Create default entry for mode config option
+     *
+     * @return ConfigData
+     */
+    public function createModeConfig()
+    {
+        $configData = new ConfigData(ConfigFilePool::APP_ENV);
+        $configData->set(State::PARAM_MODE, State::MODE_DEFAULT);
+        return $configData;
+    }
 }
diff --git a/setup/src/Magento/Setup/Model/ConfigOptionsList.php b/setup/src/Magento/Setup/Model/ConfigOptionsList.php
index 7c0b43aa0f8..18d89da6394 100644
--- a/setup/src/Magento/Setup/Model/ConfigOptionsList.php
+++ b/setup/src/Magento/Setup/Model/ConfigOptionsList.php
@@ -160,6 +160,7 @@ class ConfigOptionsList implements ConfigOptionsListInterface
         $configData[] = $this->configGenerator->createDbConfig($data);
         $configData[] = $this->configGenerator->createResourceConfig();
         $configData[] = $this->configGenerator->createXFrameConfig();
+        $configData[] = $this->configGenerator->createModeConfig();
         return $configData;
     }
 
diff --git a/setup/src/Magento/Setup/Test/Unit/Module/ConfigOptionsListTest.php b/setup/src/Magento/Setup/Test/Unit/Module/ConfigOptionsListTest.php
index d1281f7c30c..5047855476f 100644
--- a/setup/src/Magento/Setup/Test/Unit/Module/ConfigOptionsListTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Module/ConfigOptionsListTest.php
@@ -84,7 +84,7 @@ class ConfigOptionsListTest extends \PHPUnit_Framework_TestCase
         $this->generator->expects($this->once())->method('createResourceConfig')->willReturn($configDataMock);
         $this->generator->expects($this->once())->method('createXFrameConfig')->willReturn($configDataMock);
         $configData = $this->object->createConfig([], $this->deploymentConfig);
-        $this->assertEquals(7, count($configData));
+        $this->assertEquals(8, count($configData));
     }
 
     public function testCreateOptionsWithOptionalNull()
@@ -98,6 +98,6 @@ class ConfigOptionsListTest extends \PHPUnit_Framework_TestCase
         $this->generator->expects($this->once())->method('createResourceConfig')->willReturn($configDataMock);
         $this->generator->expects($this->once())->method('createXFrameConfig')->willReturn($configDataMock);
         $configData = $this->object->createConfig([], $this->deploymentConfig);
-        $this->assertEquals(6, count($configData));
+        $this->assertEquals(7, count($configData));
     }
 }
-- 
GitLab