Fork me on GitHub
#gorilla2015-11-19
>
jonyepsilon20:11:29

@pez Sounds like Gorilla isn't serving up the files ... I wonder whether you're seeing the menu because of browser caching. Is there anything in the project which might interfere with Gorilla's server?

pez20:11:54

@jonyepsilon: I don’t know what in the project that could interfere… Or even how it could interfere. But yes, since it works in a fresh project I am leaning towards that as well.

pez20:11:26

As for caching, clearing the cache doesn’t make a difference. Running fresh in another browser gives the same errors and the same behaviour.

jonyepsilon20:11:21

Huh. Would be interesting to look at http://127.0.0.1:8990/js/utils.js and see what returns (adjusting the port number to suit).

pez21:11:36

'use strict';

/**
 * Get a deep value from an object by a string path
 * For example:
 * var foo = {'bar': {'lurker': 'someValue'}}
 * getValByPath(foo, 'bar.lurker') returns 'someValue'
 *
 * @param obj obj
 * @param str path
 * @return mixed
 */
exports.getValByPath = function(obj, path) {
	var p;

	if (typeof path === 'string') {
		path = path.split('.');
	}

	if (path.length > 1) {
		p = path.shift();

		if (typeof obj[p] === 'object') {
			return exports.getValByPath(obj[p], path);
		} else {
			return undefined;
		}

	} else {
		return obj[path[0]];
	}
};

jonyepsilon21:11:08

That's very odd ... that's not Gorilla REPL code! Should be:

jonyepsilon21:11:12

/*
 * This file is part of gorilla-repl. Copyright (C) 2014-, Jony Hudson.
 *
 * gorilla-repl is licenced to you under the MIT licence. See the file LICENCE.txt for full details.
 */

// takes a string and prefixes every line with ';; '
var makeClojureComment = function (code) {
    return code.split('\n').map(function (x) {
        return ";;; " + x;
    }).join("\n")
};

// the funny name indicates that it undoes what the above function does. It doesn't check whether the line is actually
// commented, so will break text that isn't in the format it expects.
var unmakeClojureComment = function (code) {
    if (code) {
        return code.split('\n').map(function (x) {
            return x.slice(4);
        }).join("\n");
    }
    else return null;
};


var makeHipNSName = function () {
    // The word lists are taken from Raymond Chan's MIT-licensed 
    var adj = ["affectionate", "amiable", "arrogant", "balmy", "barren", "benevolent", "billowing", "blessed", "breezy", "calm", "celestial", "charming", "combative", "composed", "condemned", "divine", "dry", "energized", "enigmatic", "exuberant", "flowing", "fluffy", "fluttering", "frightened", "fuscia", "gentle", "greasy", "grieving", "harmonious", "hollow", "homeless", "icy", "indigo", "inquisitive", "itchy", "joyful", "jubilant", "juicy", "khaki", "limitless", "lush", "mellow", "merciful", "merry", "mirthful", "moonlit", "mysterious", "natural", "outrageous", "pacific", "parched", "placid", "pleasant", "poised", "purring", "radioactive", "resilient", "scenic", "screeching", "sensitive", "serene", "snowy", "solitary", "spacial", "squealing", "stark", "stunning", "sunset", "talented", "tasteless", "teal", "thoughtless", "thriving", "tranquil", "tropical", "undisturbed", "unsightly", "unwavering", "uplifting", "voiceless", "wandering", "warm", "wealthy", "whispering", "withered", "wooden", "zealous"];
    var things = ["abyss", "atoll", "aurora", "autumn", "badlands", "beach", "briars", "brook", "canopy", "canyon", "cavern", "chasm", "cliff", "cove", "crater", "creek", "darkness", "dawn", "desert", "dew", "dove", "drylands", "dusk", "farm", "fern", "firefly", "flowers", "fog", "foliage", "forest", "galaxy", "garden", "geyser", "grove", "hurricane", "iceberg", "lagoon", "lake", "leaves", "marsh", "meadow", "mist", "moss", "mountain", "oasis", "ocean", "peak", "pebble", "pine", "plateau", "pond", "reef", "reserve", "resonance", "sanctuary", "sands", "shelter", "silence", "smokescreen", "snowflake", "spring", "storm", "stream", "summer", "summit", "sunrise", "sunset", "sunshine", "surf", "swamp", "temple", "thorns", "tsunami", "tundra", "valley", "volcano", "waterfall", "willow", "winds", "winter"];
    var adjI = Math.floor(Math.random() * adj.length);
    var thingsI = Math.floor(Math.random() * things.length);
    return adj[adjI] + "-" + things[thingsI];
};

pez21:11:05

Looks very different from the same in the working project.

pez21:11:32

Yes, that is what it looks like.

jonyepsilon21:11:39

Wonder where that code is coming from ... don't find getValByPath(foo, 'bar.lurker') returns 'someValue' on Google anywhere.

jonyepsilon21:11:23

Key will be figuring out where that comes from, I guess. Any plugins in your profiles.clj that could be messing with ring routes etc?

pez21:11:29

I find it in my project actually.

pez21:11:08

(lurker, that is)

jonyepsilon21:11:18

Oh, I wonder ... Gorilla serves its files out of the jar's resources. If you're project has resources with the same path (that is resources\public\js\utils.js then this could happen. Never thought of that!

pez21:11:21

resources/public/js … i guess that somehow overshadows whatever js/ path gorilla uses

jonyepsilon21:11:42

Probably Gorilla should put it's resources somewhere with an unlikely name to avoid this sort of clash.

pez21:11:56

ha, you figured it out even without looking in my project!

pez21:11:46

Maybe Gorilla can just load from gorilla-repl/js/...

jonyepsilon21:11:06

Yeah, that would work. Should be an easy fix. Was hoping to get a new version out soonish and will put it in that.

pez21:11:10

Anyway, I can move stuff around and make this work. Many thanks!

jonyepsilon21:11:22

Glad we got to the bottom of it simple_smile

pez21:11:18

And we have an issue to track. 😃

pez21:11:19

Your videos on how to get started are awesome by the way. Not to mention Gorilla itself.

jonyepsilon21:11:07

Thanks simple_smile Glad you find them useful!