Skip to content
This repository was archived by the owner on Nov 26, 2018. It is now read-only.

Rewrote a chunk of list_gruntfiles() - fixes #77#94

Open
rtpHarry wants to merge 1 commit into
tvooo:masterfrom
rtpHarry:patch-2
Open

Rewrote a chunk of list_gruntfiles() - fixes #77#94
rtpHarry wants to merge 1 commit into
tvooo:masterfrom
rtpHarry:patch-2

Conversation

@rtpHarry

Copy link
Copy Markdown

This is the first piece of Python I've ever written today. After getting stumped by what path to set up and seeing others had been affected I ended up solving it I think.

The original list_gruntfiles() just asked for self.window.folders() which isn't a recursive list of the folders in the project. This code replaces the shallow search with a recursive folder search of each of those top level project folders, looking for the Gruntfile.(js|coffee).

Instead of using self.window.folders(), my code fires off a search of the file system using os.walk. I'm concerned that I might have done something bad as I know hitting the file system could be slow in large projects although I don't see any way around it. If any Python experts have a better idea please tweak it. I'm not sure if this information can be cached either?

From testing on Windows 8.1 it appears that its not case-sensitive either, so Gruntfile.js and gruntfile.js both worked for me.

This is the first piece of Python I've written today after getting stumped by the issue and seeing others had been affected.

The original def just asked for self.window.folders() which isn't a recursive list of the folders in the project. This code replaces the shallow search with a recursive folder search for the `Gruntfile.(js|coffee)`

Instead, my code fires off a search of the file system using `os.walk`. I'm concerned that I might have done something bad as I know hitting the file system could be slow in large projects although I don't see any way around it. If any Python experts have a better idea please tweak it. I'm not sure if this information can be cached either.
@rtpHarry

Copy link
Copy Markdown
Author

Another note, I'm running Sublime 2 v2.0.2, Build 2221 on Windows 8.1.

I haven't tested on any other versions / operating systems.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant