jsoverson / grunt-open

Open urls and files from a grunt task
MIT License
110 stars 19 forks source link

Allow opening multiple destinations. #26

Closed fatihacet closed 9 years ago

fatihacet commented 9 years ago

My changes converts string dest to a single item array to be backward compatible. If you pass an array of destination in dest config in Gruntfile, it will loop on that array and open those destinations one by one.

Here is the screencast to screencast.

vitvad commented 9 years ago

:+1: looking for this functionality right now

fatihacet commented 9 years ago

@vitvad For the current version I found the following workaround.

Define multiple targets for open task in Gruntfile.

open        :
  dev       :
    path    : 'http://localhost:1111/public/debug'
  examples  :
    path    : 'http://localhost:1111/build/docs/examples/'
  coverage  :
    path    : 'http://localhost:1111/build/coverage/PhantomJS 1.9.8 (Mac OS X)/lcov-report/index.html'
  build     :
    path    : 'http://localhost:2222/public/compiled'

Then call the multiple targets like this.

grunt.registerTask 'default', 'Run tests and watch the stack for changes', ->
  grunt.task.run [
    'coffee'
    'karma:headless'
    'http-server:debug'
    'open:dev'
    'open:coverage'
    'watch'
  ]
vitvad commented 9 years ago

@fatihacet , I try to open dynamically generated files (reports from test runner + coverage) so this will now fit to me.

fatihacet commented 9 years ago

@vitvad Also for the current version you can define your path as a function if you need. See this line. I wanted to mention when you say dynamic generated urls. In case you missed it.

vitvad commented 9 years ago

@fatihacet , I saw that functionality. Here is example:

        path: function () {
            var reportPath = path.resolve(__dirname, '..', 'test/karma-report');
            var filePath = walk(reportPath);

            return filePath[0];
        }

walk return list of files in folder

folder structure: test\ -- karma-report\ -- -- Chrome version xx.xx.x\ -- -- -- index.html -- -- Phantom version xx.xx.x\ -- -- -- index.html

So open list of path could be useful. Anyway seems my case quite rare if no one else try to do this before :)

fatihacet commented 9 years ago

:) glad that you already figured it out.

fatihacet commented 9 years ago

ping