From c4a1a49be31b18219f400e0453694c3fd08ebacf Mon Sep 17 00:00:00 2001
From: Volodymyr Zaets <vzaets@magento.com>
Date: Tue, 23 Aug 2016 15:57:00 +0300
Subject: [PATCH] MAGETWO-55345: Grunt uses actual theme's list

---
 Gruntfile.js.sample                   |  2 +-
 dev/tools/grunt/configs/clean.js      |  2 +-
 dev/tools/grunt/configs/combo.js      |  2 +-
 dev/tools/grunt/configs/exec.js       |  2 +-
 dev/tools/grunt/configs/less.js       |  2 +-
 dev/tools/grunt/configs/watch.js      |  2 +-
 dev/tools/grunt/tools/files-router.js | 12 ++++++------
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/Gruntfile.js.sample b/Gruntfile.js.sample
index ec0cd43ec3c..1e9c191ba11 100644
--- a/Gruntfile.js.sample
+++ b/Gruntfile.js.sample
@@ -11,7 +11,7 @@ module.exports = function (grunt) {
 
     var _ = require('underscore'),
         path = require('path'),
-        themes = require('./dev/tools/grunt/tools/files-router').getThemes(),
+        themes = require('./dev/tools/grunt/tools/files-router').get('themes'),
         configDir = './dev/tools/grunt/configs',
         tasks = grunt.file.expand('./dev/tools/grunt/tasks/*');
 
diff --git a/dev/tools/grunt/configs/clean.js b/dev/tools/grunt/configs/clean.js
index d984620feb6..53bcd8a1d83 100644
--- a/dev/tools/grunt/configs/clean.js
+++ b/dev/tools/grunt/configs/clean.js
@@ -5,7 +5,7 @@
 
 'use strict';
 
-var themes = require('../tools/files-router').getThemes(),
+var themes = require('../tools/files-router').get('themes'),
     _      = require('underscore');
 
 var themeOptions = {};
diff --git a/dev/tools/grunt/configs/combo.js b/dev/tools/grunt/configs/combo.js
index 7dca3a268db..6dcbe7e36a6 100644
--- a/dev/tools/grunt/configs/combo.js
+++ b/dev/tools/grunt/configs/combo.js
@@ -5,7 +5,7 @@
 
 'use strict';
 
-var theme = require('../tools/files-router').getThemes(),
+var theme = require('../tools/files-router').get('themes'),
     path = require('./path');
 
 /**
diff --git a/dev/tools/grunt/configs/exec.js b/dev/tools/grunt/configs/exec.js
index ee06b371347..3e675ff9b5d 100644
--- a/dev/tools/grunt/configs/exec.js
+++ b/dev/tools/grunt/configs/exec.js
@@ -6,7 +6,7 @@
 'use strict';
 
 var combo = require('./combo'),
-    themes = require('../tools/files-router').getThemes(),
+    themes = require('../tools/files-router').get('themes'),
     _      = require('underscore');
 
 var themeOptions = {};
diff --git a/dev/tools/grunt/configs/less.js b/dev/tools/grunt/configs/less.js
index 6f3b0f7ae6d..7a849577127 100644
--- a/dev/tools/grunt/configs/less.js
+++ b/dev/tools/grunt/configs/less.js
@@ -6,7 +6,7 @@
 'use strict';
 
 var combo  = require('./combo'),
-    themes = require('../tools/files-router').getThemes(),
+    themes = require('../tools/files-router').get('themes'),
     _      = require('underscore');
 
 var themeOptions = {};
diff --git a/dev/tools/grunt/configs/watch.js b/dev/tools/grunt/configs/watch.js
index 880b7f7e392..84657ae7c4d 100644
--- a/dev/tools/grunt/configs/watch.js
+++ b/dev/tools/grunt/configs/watch.js
@@ -6,7 +6,7 @@
 'use strict';
 
 var combo  = require('./combo'),
-    themes = require('../tools/files-router').getThemes(),
+    themes = require('../tools/files-router').get('themes'),
     _      = require('underscore');
 
 var themeOptions = {};
diff --git a/dev/tools/grunt/tools/files-router.js b/dev/tools/grunt/tools/files-router.js
index dad794004ec..c120af31df6 100644
--- a/dev/tools/grunt/tools/files-router.js
+++ b/dev/tools/grunt/tools/files-router.js
@@ -23,7 +23,7 @@ module.exports = {
     })(),
 
     /**
-     * Loads "themes" file.
+     * Loads file.
      * Load priority:
      *      From user config;
      *      From default config with ".loc" suffix ;
@@ -31,15 +31,15 @@ module.exports = {
      *
      * @returns themes file or error
      */
-    getThemes: function () {
-        if (this.userConfig && this.userConfig.themes) {
-            return require(this.getFullPath(this.userConfig.themes));
+    get: function (file) {
+        if (this.userConfig && this.userConfig[file]) {
+            return require(this.getFullPath(this.userConfig[file]));
         } else {
             try {
-                return require(this.getFullPath(this.defaultConfig.themes + '.loc'));
+                return require(this.getFullPath(this.defaultConfig[file] + '.loc'));
             } catch (error) {
                 try {
-                    return require(this.getFullPath(this.defaultConfig.themes));
+                    return require(this.getFullPath(this.defaultConfig[file]));
                 } catch (error) {
                     throw  error;
                 }
-- 
GitLab