Sha256: 5061ca6078818006e0898245ffa1b552fd307bc190a6f11e8c9278f585bdc945

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

module Shift
	module Generator
		module JavaScriptTemplates

			IMPORT_JQNODE_STATEMENT = "var $ = require('jqNode').$;\n"
	
			IMPORT_UTIL_STATEMENT = "var util = require('util');\n"

			IMPORT_MU_STATEMENT = "var mu = require('mu2');\nmu.root = __dirname + '/views';\n"
	
			IMPORT_DB_STATEMENT = "_Schema = require('jugglingdb').Schema;\nvar schema = new _Schema('mongodb', {port : 27017});\n"

			UTILITY_FUNCTIONS = "
function writeTemplate(fileName, templateValues, response) {
	if(!templateValues) {
		$.writeFile('views/' + fileName);
	} else {
		var templateStream = mu.compileAndRender(fileName, templateValues);
		util.pump(templateStream, response);
	}
}"

			MODEL_NAME_TEMPLATE = "var <%= model_name %> = schema.define('<%= model_name %>', {"

			URL_HANDLER_DEFINITION = '$("<%= url %>").<%= method %>(function(request, response, data, urlData) {'

			REDIRECT_STATEMENT_TEMPLATE = "$.redirect(<%= url %>);"

			WRITE_DATA_TEMPLATE = "$.write(<%= write_data %>);"

			WRITE_FILE_TEMPLATE = "writeTemplate(<%= args %>);"

			APP_START_STATEMENT = "$.start({port : 8080});"

		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shift-lang-0.1.4 lib/shift-lang/generator/javascript_templates.rb
shift-lang-0.1.3 lib/shift-lang/generator/javascript_templates.rb
shift-lang-0.1.2 lib/shift-lang/generator/javascript_templates.rb
shift-lang-0.1.1 lib/shift-lang/generator/javascript_templates.rb