Sha256: f052286691c8d274c76dad4e5e6eed846aa74384233ddbc1e8e926ab6abb21d2

Contents?: true

Size: 1.18 KB

Versions: 126

Compression:

Stored size: 1.18 KB

Contents

/**
* This is a simple task runner that formats the JSON config file.  This should only be neccessary if you've edited it by 
* hand and want to get it back into the proper format as far as spacing and indentation goes.  This follows the same format as `configlet fmt`
*/
component {
	
	function run() {
		// Determine the root of the repo based on the location of this task runner
		var repoRootPath = expandPath( getDirectoryFromPath( getCurrentTemplatePath() ) & '../' );
		// Read in the current JSON config file
		var configJSONRaw = fileRead( repoRootPath & '/config.json' );
		
		// Format JSON file to spec
		var newConfigJSONRaw = formatterUtil.formatJSON( json=configJSONRaw, indent='  ' , lineEnding=chr( 10 ), spaceAfterColon=true );
		
		// Only save if it's different to avoid touching the file needlessly
		if( newConfigJSONRaw != configJSONRaw ) {
			
			// Write it back out with the proper formatting styles applied
			fileWrite( repoRootPath & '/config.json', newConfigJSONRaw );
		
			print.greenLine( 'Config file [#repoRootPath#config.json] formatted!' );
		} else {
			print.whiteLine( 'Config file [#repoRootPath#config.json] is already formatted!  No Chanages needed.' );
		}
	}
	
}

Version data entries

126 entries across 126 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.179 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.178 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.177 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.176 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.175 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.174 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.173 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.172 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.171 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.170 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.169 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.167 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.166 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.165 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.164 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.163 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.162 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.161 tracks/cfml/tasks/FormatConfig.cfc
trackler-2.2.1.160 tracks/cfml/tasks/FormatConfig.cfc