diff --git a/lib/command/config.js b/lib/command/config.js deleted file mode 100644 index fe6df1de..00000000 --- a/lib/command/config.js +++ /dev/null @@ -1,57 +0,0 @@ -var copyConfig, register; - -copyConfig = function(opts) { - var buildConfig, conf, currDefaultsPath, defaultsConf, fs, logger, mimosaConfigPath, mimosaConfigPathCoffee, modArray, modObj, moduleManager, outConfigText, path; - path = require('path'); - fs = require('fs'); - logger = require('logmimosa'); - buildConfig = require('../util/config-builder'); - moduleManager = require('../modules'); - if (opts.mdebug) { - opts.debug = true; - logger.setDebug(); - process.env.DEBUG = true; - } - conf = buildConfig(); - currDefaultsPath = path.join(path.resolve(''), "mimosa-config-documented.coffee"); - logger.debug("Writing config defaults file to " + currDefaultsPath); - defaultsConf = "# The following is a version of the mimosa-config with all of\n# the defaults listed. This file is meant for reference only.\n\n" + conf; - fs.writeFileSync(currDefaultsPath, defaultsConf, 'ascii'); - if (!opts.suppress) { - logger.success("Copied [[ mimosa-config-documented.coffee ]] into current directory."); - } - mimosaConfigPath = path.join(path.resolve(''), "mimosa-config.js"); - mimosaConfigPathCoffee = path.join(path.resolve(''), "mimosa-config.coffee"); - if (fs.existsSync(mimosaConfigPath) || fs.existsSync(mimosaConfigPathCoffee)) { - if (!opts.suppress) { - logger.info("Not writing mimosa-config file as one exists already."); - } - } else { - logger.debug("Writing config file to " + mimosaConfigPath); - outConfigText = moduleManager.configModuleString ? (modArray = JSON.parse(moduleManager.configModuleString), modObj = { - modules: modArray - }, "exports.config = " + JSON.stringify(modObj, null, 2)) : (modObj = { - modules: ['copy', 'jshint', 'csslint', 'server', 'require', 'minify-js', 'minify-css', 'live-reload', 'bower'] - }, "exports.config = " + JSON.stringify(modObj, null, 2)); - fs.writeFileSync(mimosaConfigPath, outConfigText, 'ascii'); - if (!opts.suppress) { - logger.success("Copied [[ mimosa-config.js ]] into current directory."); - } - } - return process.exit(0); -}; - -register = function(program, callback) { - return program.command('config').option("-D, --mdebug", "run in debug mode").option("-s, --suppress", "suppress info message").description("copy the default Mimosa config into the current folder").action(callback).on('--help', function() { - var logger; - logger = require('logmimosa'); - logger.green(' The config command will create a mimosa-config.js in the current directory. It will'); - logger.green(' also create a mimosa-config-documented.coffee which contains all of the various'); - logger.green(' configuration documentation for each module that is a part of your project.'); - return logger.blue('\n $ mimosa config\n'); - }); -}; - -module.exports = function(program) { - return register(program, copyConfig); -}; diff --git a/lib/index.js b/lib/index.js index 8011355c..0b18721b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -14,7 +14,6 @@ var modCommands = function() { require( './command/module/install' )( program ); require( './command/module/uninstall' )( program ); require( './command/module/list') ( program ); - require( './command/module/config' )( program ); } modCommandsAdded = true; }; @@ -40,7 +39,6 @@ var makeTopLevelHelp = function() { }; require( './command/watch' )( program ); -require( './command/config' )( program ); require( './command/build' )( program ); require( './command/clean' )( program ); require( './command/external' )( program ); diff --git a/lib/modules/index.js b/lib/modules/index.js index 52dfdad7..4d385753 100644 --- a/lib/modules/index.js +++ b/lib/modules/index.js @@ -1,5 +1,5 @@ "use strict"; -var all, allInstalled, builtIns, compilers, configModuleString, configured, configuredModules, exec, file, fs, independentlyInstalled, isMimosaModuleName, locallyInstalled, locallyInstalledNames, logger, meta, metaNames, mimosaPackage, modulesWithCommands, names, newmod, path, projectNodeModules, skels, standardlyInstalled, _, +var all, allInstalled, builtIns, compilers, configured, configuredModules, exec, file, fs, independentlyInstalled, isMimosaModuleName, locallyInstalled, locallyInstalledNames, logger, meta, mimosaPackage, modulesWithCommands, newmod, path, projectNodeModules, skels, standardlyInstalled, _, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; fs = require('fs'); @@ -99,12 +99,6 @@ meta = _.map(allInstalled, function(modInfo) { } }); -metaNames = _.pluck(meta, 'name'); - -configModuleString = _.difference(metaNames, builtIns).length > 0 ? (names = metaNames.map(function(name) { - return name.replace('mimosa-', ''); -}), JSON.stringify(names)) : void 0; - configured = function(moduleNames, callback) { var index, processModule; if (configuredModules) { @@ -203,6 +197,5 @@ module.exports = { installedMetadata: meta, getConfiguredModules: configured, all: all, - configModuleString: configModuleString, modulesWithCommands: modulesWithCommands }; diff --git a/lib/util/config-builder.js b/lib/util/config-builder.js deleted file mode 100644 index 086f30af..00000000 --- a/lib/util/config-builder.js +++ /dev/null @@ -1,29 +0,0 @@ -var buildConfigText, moduleManager, _configTop; - -moduleManager = require('../modules'); - -_configTop = function() { - return "exports.config = {\n\n minMimosaVersion:null # The minimum Mimosa version that must be installed to use the project.\n requiredMimosaVersion:null # The Mimosa version that must be installed to use the project.\n\n ###\n The list of Mimosa modules to use for this application. The defaults come bundled with Mimosa\n and do not need to be installed. If a module is listed here that Mimosa is unaware of, Mimosa\n will attempt to install it.\n ###\n modules: ['copy', 'jshint', 'csslint', 'server', 'require', 'minify-js', 'minify-css', 'live-reload', 'bower']\n\n watch:\n sourceDir: \"assets\" # directory location of web assets, can be relative to\n # the project root, or absolute\n compiledDir: \"public\" # directory location of compiled web assets, can be\n # relative to the project root, or absolute\n javascriptDir: \"javascripts\" # Location of precompiled javascript (i.e.\n # coffeescript), must be relative to sourceDir\n exclude: [/[/\\\\](\\.|~)[^/\\\\]+$/] # regexes or strings matching the files to be\n # ignored by mimosa, the default matches all sorts of\n # dot files and temp files. Strings are paths and can\n # be relative to sourceDir or absolute.\n throttle: 0 # number of file adds the watcher handles before\n # taking a 100 millisecond pause to let those files\n # finish their processing. This helps avoid EMFILE\n # issues for projects containing large numbers of\n # files that all get copied at once. If the throttle\n # is set to 0, no throttling is performed. Recommended\n # to leave this set at 0, thedefault, until you start\n # encountering EMFILE problems. throttle has no effect\n # if usePolling is set to false.\n usePolling: true # WARNING: Do not change this default if you are on\n # *Nix. Windows users, read on.\n # Whether or not to poll for system file changes.\n # Unless you have a lot files and your CPU starts\n # running hot, it is best to leave this setting alone.\n interval: 100 # Interval of file system polling.\n binaryInterval: 300 # Interval of file system polling for binary files\n delay: 0 # For file adds/updates, a forced delay before Mimosa\n # begins processing a file. This helps solve cases when\n # a file system event is created before the file system\n # is actually finished writing the file. Delay is in millis.\n\n vendor: # settings for vendor assets\n javascripts: \"javascripts/vendor\" # location, relative to the watch.sourceDir, of vendor\n # javascript assets. Unix style slashes please.\n stylesheets: \"stylesheets/vendor\" # location, relative to the watch.sourceDir, of vendor\n # stylesheet assets. Unix style slashes please.\n"; -}; - -buildConfigText = function() { - var configText, mod, modules, ph, _i, _len; - modules = moduleManager.all; - configText = _configTop(); - for (_i = 0, _len = modules.length; _i < _len; _i++) { - mod = modules[_i]; - if (mod.placeholder != null) { - ph = mod.placeholder(); - if (ph != null) { - configText += ph; - } - } - } - configText += "\n}"; - if (moduleManager.configModuleString != null) { - configText = configText.replace(" modules: ['copy', 'jshint', 'csslint', 'server', 'require', 'minify-js', 'minify-css', 'live-reload', 'bower']", " modules: " + moduleManager.configModuleString); - } - return configText; -}; - -module.exports = buildConfigText; diff --git a/src/command/config.coffee b/src/command/config.coffee deleted file mode 100644 index c24f3d1a..00000000 --- a/src/command/config.coffee +++ /dev/null @@ -1,68 +0,0 @@ -copyConfig = (opts) -> - path = require 'path' - fs = require 'fs' - logger = require 'logmimosa' - buildConfig = require '../util/config-builder' - moduleManager = require '../modules' - - if opts.mdebug - opts.debug = true - logger.setDebug() - process.env.DEBUG = true - - conf = buildConfig() - - currDefaultsPath = path.join path.resolve(''), "mimosa-config-documented.coffee" - logger.debug "Writing config defaults file to #{currDefaultsPath}" - defaultsConf = """ - - # The following is a version of the mimosa-config with all of - # the defaults listed. This file is meant for reference only. - - #{conf} - """ - - fs.writeFileSync currDefaultsPath, defaultsConf, 'ascii' - - unless opts.suppress - logger.success "Copied [[ mimosa-config-documented.coffee ]] into current directory." - - mimosaConfigPath = path.join path.resolve(''), "mimosa-config.js" - mimosaConfigPathCoffee = path.join path.resolve(''), "mimosa-config.coffee" - - if fs.existsSync(mimosaConfigPath) or fs.existsSync(mimosaConfigPathCoffee) - unless opts.suppress - logger.info "Not writing mimosa-config file as one exists already." - else - logger.debug "Writing config file to #{mimosaConfigPath}" - outConfigText = if moduleManager.configModuleString - modArray = JSON.parse(moduleManager.configModuleString) - modObj = modules:modArray - "exports.config = " + JSON.stringify( modObj, null, 2 ) - else - modObj = modules: ['copy', 'jshint', 'csslint', 'server', 'require', 'minify-js', 'minify-css', 'live-reload', 'bower'] - "exports.config = " + JSON.stringify( modObj, null, 2 ) - - fs.writeFileSync mimosaConfigPath, outConfigText, 'ascii' - - unless opts.suppress - logger.success "Copied [[ mimosa-config.js ]] into current directory." - - process.exit 0 - -register = (program, callback) -> - program - .command('config') - .option("-D, --mdebug", "run in debug mode") - .option("-s, --suppress", "suppress info message") - .description("copy the default Mimosa config into the current folder") - .action(callback) - .on '--help', -> - logger = require 'logmimosa' - logger.green(' The config command will create a mimosa-config.js in the current directory. It will') - logger.green(' also create a mimosa-config-documented.coffee which contains all of the various') - logger.green(' configuration documentation for each module that is a part of your project.') - logger.blue( '\n $ mimosa config\n') - -module.exports = (program) -> - register(program, copyConfig) diff --git a/src/index.js b/src/index.js index a432784b..0b18721b 100644 --- a/src/index.js +++ b/src/index.js @@ -39,7 +39,6 @@ var makeTopLevelHelp = function() { }; require( './command/watch' )( program ); -require( './command/config' )( program ); require( './command/build' )( program ); require( './command/clean' )( program ); require( './command/external' )( program ); diff --git a/src/modules/index.coffee b/src/modules/index.coffee index 396d8d8b..b4ed9642 100644 --- a/src/modules/index.coffee +++ b/src/modules/index.coffee @@ -86,11 +86,6 @@ meta = _.map allInstalled, (modInfo) -> logger.error "Unable to read file at [[ #{resolvedPath} ]], possibly a permission issue? \nsystem error : #{err}" process.exit 1 -metaNames = _.pluck meta, 'name' -configModuleString = if _.difference(metaNames, builtIns).length > 0 - names = metaNames.map (name) -> name.replace 'mimosa-', '' - JSON.stringify names - configured = (moduleNames, callback) -> return configuredModules if configuredModules @@ -180,5 +175,4 @@ module.exports = installedMetadata: meta getConfiguredModules: configured all: all - configModuleString: configModuleString modulesWithCommands: modulesWithCommands diff --git a/src/util/config-builder.coffee b/src/util/config-builder.coffee deleted file mode 100644 index dbffbeaa..00000000 --- a/src/util/config-builder.coffee +++ /dev/null @@ -1,71 +0,0 @@ -moduleManager = require '../modules' - -_configTop = -> - """ - exports.config = { - - minMimosaVersion:null # The minimum Mimosa version that must be installed to use the project. - requiredMimosaVersion:null # The Mimosa version that must be installed to use the project. - - ### - The list of Mimosa modules to use for this application. The defaults come bundled with Mimosa - and do not need to be installed. If a module is listed here that Mimosa is unaware of, Mimosa - will attempt to install it. - ### - modules: ['copy', 'jshint', 'csslint', 'server', 'require', 'minify-js', 'minify-css', 'live-reload', 'bower'] - - watch: - sourceDir: "assets" # directory location of web assets, can be relative to - # the project root, or absolute - compiledDir: "public" # directory location of compiled web assets, can be - # relative to the project root, or absolute - javascriptDir: "javascripts" # Location of precompiled javascript (i.e. - # coffeescript), must be relative to sourceDir - exclude: [/[/\\\\](\\.|~)[^/\\\\]+$/] # regexes or strings matching the files to be - # ignored by mimosa, the default matches all sorts of - # dot files and temp files. Strings are paths and can - # be relative to sourceDir or absolute. - throttle: 0 # number of file adds the watcher handles before - # taking a 100 millisecond pause to let those files - # finish their processing. This helps avoid EMFILE - # issues for projects containing large numbers of - # files that all get copied at once. If the throttle - # is set to 0, no throttling is performed. Recommended - # to leave this set at 0, thedefault, until you start - # encountering EMFILE problems. throttle has no effect - # if usePolling is set to false. - usePolling: true # WARNING: Do not change this default if you are on - # *Nix. Windows users, read on. - # Whether or not to poll for system file changes. - # Unless you have a lot files and your CPU starts - # running hot, it is best to leave this setting alone. - interval: 100 # Interval of file system polling. - binaryInterval: 300 # Interval of file system polling for binary files - delay: 0 # For file adds/updates, a forced delay before Mimosa - # begins processing a file. This helps solve cases when - # a file system event is created before the file system - # is actually finished writing the file. Delay is in millis. - - vendor: # settings for vendor assets - javascripts: "javascripts/vendor" # location, relative to the watch.sourceDir, of vendor - # javascript assets. Unix style slashes please. - stylesheets: "stylesheets/vendor" # location, relative to the watch.sourceDir, of vendor - # stylesheet assets. Unix style slashes please. - - """ - -buildConfigText = -> - modules = moduleManager.all - configText = _configTop() - for mod in modules - if mod.placeholder? - ph = mod.placeholder() - configText += ph if ph? - configText += "\n}" - - if moduleManager.configModuleString? - configText = configText.replace(" modules: ['copy', 'jshint', 'csslint', 'server', 'require', 'minify-js', 'minify-css', 'live-reload', 'bower']", " modules: " + moduleManager.configModuleString) - - configText - -module.exports = buildConfigText