Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Koan are not re-evaluated when file is edited using emacs #33

Closed
doug-wade opened this issue Nov 29, 2013 · 7 comments
Closed

Koan are not re-evaluated when file is edited using emacs #33

doug-wade opened this issue Nov 29, 2013 · 7 comments
Assignees

Comments

@doug-wade
Copy link

I'm using the koans on Ubuntu 12.04 and started out using emacs, but the Koan evaluation loop doesn't work properly while using emacs (nano, vim, and gedit all seem to work as expected, so this isn't a show-stopper or anything). The Koans are evaluated properly initially, but after the file is edited and saved, an error is emitted and the Koans are not re-evaluated.

Here's the full output:
Ponder what's going wrong in the: AboutPrimitives class's wholeNumbersAreOfTypeInt method.

Line 12 may offer a clue as to how you may progress, now make haste!
What went wrong:
expected: but was:

Level: Novice
Progress [XXXX----------------------------------------------] 16/193
Passing Suites: AboutKoans, AboutAssertions, AboutEquality
Remaining Suites: AboutPrimitives, AboutStrings, AboutObjects, AboutLoops, AboutInheritance, AboutCasting, AboutConditionals, AboutConstructors, AboutEnums, AboutExceptions, AboutMethodPreference, AboutOperators, AboutArrays, AboutAutoboxing, AboutCollections, AboutComparison, AboutDates, AboutEquality, AboutFileIO, AboutInnerClasses, AboutLocale, AboutRegularExpressions, AboutSerialization, AboutMocks

Edit & save a koan to reload or enter 'Q' to exit

User edits AboutPrimitives.java and saves it at this point

Exception in thread "Thread-2" java.lang.RuntimeException: java.io.IOException: File or directory does not exist: /home/local/ANT/dougwade/java-koans-master/koans/src/beginner/.#AboutPrimitives.java
at com.sandwich.util.io.FileMonitor.notifyListeners(FileMonitor.java:61)
at com.sandwich.util.io.FileMonitorFactory$2.run(FileMonitorFactory.java:34)
at java.lang.Thread.run(Thread.java:701)
Caused by: java.io.IOException: File or directory does not exist: /home/local/ANT/dougwade/java-koans-master/koans/src/beginner/.#AboutPrimitives.java
at com.sandwich.util.io.FileUtils.forEachFile(FileUtils.java:57)
at com.sandwich.util.io.FileUtils.forEachFile(FileUtils.java:53)
at com.sandwich.util.io.FileUtils.forEachFile(FileUtils.java:53)
at com.sandwich.util.io.FileUtils.forEachFile(FileUtils.java:53)
at com.sandwich.util.io.FileMonitor.getFilesystemHashes(FileMonitor.java:67)
at com.sandwich.util.io.FileMonitor.notifyListeners(FileMonitor.java:47)
... 2 more

@ghost ghost assigned matyb Dec 2, 2013
@matyb
Copy link
Owner

matyb commented Dec 4, 2013

Thanks for the report. I think I've got this fixed. Tested on Ubuntu 13.10 with GNU Emacs 23.4.1 where I was able to reproduce your issue easily. Please update and let me know if this issue persists.

@matyb matyb closed this as completed Dec 4, 2013
@yubrshen
Copy link

yubrshen commented Feb 9, 2019

I got the same error when editing with emacs. Once I edit the file even before saving the edits. I would see the error, and when I actually saved my answer, the ./run.sh would not progress further. I'm running the latest master cloned on Feb. 9, 2019 with Ubuntu 18.04 and emacs 26.1.

I also tried to set
ignore_from_monitoring=#.*\.java
in ./koans/app/config.properties following your fix issue #72
but it didn't work.

@matyb
Copy link
Owner

matyb commented Feb 9, 2019

Ya think the problems here what I'm doing is pretty dumb - just checking if file ends with the string. Wish I'd just made it a regex. 🙈

nah - this is checking for the regex in that config file you mentioned. i've never been able to reproduce (even touch .#Whatever.java repetitively) and so this is kind of a stab in the dark. using gnu emacs 25.2.2 i get no errors going through first few koans. i need the error message.

@matyb matyb reopened this Feb 9, 2019
@yubrshen
Copy link

yubrshen commented Feb 9, 2019

Are you suggesting that if the following code can be more sophisticated with regular expression matching?
while(file != null){
String end = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf(System.getProperty("file.separator")) + 1);
for(String pathToIgnore: ignoredPaths){
ignore = end.matches(pathToIgnore);
if(ignore){
return true;
}
}
file = file.getParentFile();
}
return ignore;

I'll give it a try, as it's really painful for me.

@yubrshen
Copy link

yubrshen commented Feb 9, 2019

But I need help on how to rebuild the software written in Java. I have been using dynamic language far too long.

@yubrshen
Copy link

yubrshen commented Feb 9, 2019

Actually, for my case, I don't need such an eager evaluation before my edits are saved. Would it be simpler to implement?

@matyb
Copy link
Owner

matyb commented Feb 9, 2019

I haven't been in front of a PC, but I'd expirement with different regexes in that config file. The docker build can verify the change held and Gradle has tasks to build and copy the artifacts. That's if you're in a hurry, if not I can sort thru this when my kids are 😴. Initially I thought I was making a regex out of the file path, but the codes ok I think.

matyb added a commit that referenced this issue Feb 15, 2019
@matyb matyb closed this as completed in d443efa Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants