kokarn / atom-grunt-runner

Run Grunt tasks from Atom.
MIT License
31 stars 23 forks source link

gruntfile.js found, Gruntfile.js not found #58

Closed beejjorgensen closed 9 years ago

beejjorgensen commented 9 years ago

If I name the file gruntfile.js, everything's happy.

But naming it Gruntfile.js (capital G), results in the following in the grunt-runner log:

Error loading gruntfile: Gruntfile not found.

Atom 1.0.0 grunt-runner 0.10.0 Arch Linux

I can rename the file or symlink to it as a workaround, but I believe the capital G is canonical.

kokarn commented 9 years ago

Hmm, this is interesting. Because for me Gruntfile.js works so would assume it's something with your OS. Can you test the same file on another linux box and/or a win/osx box?

beejjorgensen commented 9 years ago

I'll try to get it set up on a Mac to test, but I think it will work fine there.

Changing "/gruntfile" to "/Gruntfile" grunt-runner-view.coffee causes it to work on my Linux box. I very much suspect that this is an issue related to the fact that filenames tend to be case-sensitive on Unix boxes, and case-insensitive on OSX/Windows.

If that's the case, maybe it makes more sense to refer to /Gruntfile? I'm out of my element on Mac/Windows, so I'll defer to someone else if that's a good or safe idea.

kokarn commented 9 years ago

I have a speculative fix for this.

Can you test it out for me? Replace lines 80 through 90 in grunt-runner-view.coffee

        else
            Task.once require.resolve('./parse-config-task'), @path+'/gruntfile', ({error, tasks})->

                # log error or add panel to workspace
                if error
                    view.addLine "Error loading gruntfile: #{error}", "error"
                    view.toggleLog()
                else
                    view.addLine "Grunt file parsed, found #{tasks.length} tasks"
                    view.tasks = tasks
                    view.togglePanel()

with this

        else
            Task.once require.resolve('./parse-config-task'), @path+'/Gruntfile', ({error, tasks})->

                if error
                    # failed to load Gruntfile.js, try gruntfile.js
                    Task.once require.resolve('./parse-config-task'), @path+'/gruntfile', ({error, tasks})->

                        # log error or add panel to workspace
                        if error
                            view.addLine "Error loading gruntfile: #{error}", "error"
                            view.toggleLog()
                        else
                            view.addLine "Grunt file parsed, found #{tasks.length} tasks"
                            view.tasks = tasks
                            view.togglePanel()
                else
                    view.addLine "Grunt file parsed, found #{tasks.length} tasks"
                    view.tasks = tasks
                    view.togglePanel()

If it fails for /Gruntfile it just tries with /gruntfile :)

beejjorgensen commented 9 years ago

Tested, works for me! :)

kokarn commented 9 years ago

Great! I'll add that then :)