blue-jay / blueprint

Blueprint for your next web application in Go.
https://blue-jay.github.io/
MIT License
482 stars 77 forks source link

adding gulp-go support to gulpfile, allowing rebuild / rerun server o… #55

Closed stowelly closed 7 years ago

stowelly commented 7 years ago

…n the fly

Obviously this adds the requirement of "gulp-go"

but at the same time this allows the user to just type "gulp go" and continue working without restarting the server for any reason.

this is my first time using gulp so maybe you know of a nicer way to do this?

thanks

stowelly commented 7 years ago

im certain this CI fail isnt me!

josephspurrier commented 7 years ago

@stowelly The CI fail isn't you. I need to fix that.

josephspurrier commented 7 years ago

@stowelly Update your branch from master and it should fix the CI. Also, add some comments to your code make sure the spacing matches the gulp file. You also need to update the package.json file with the package.

stowelly commented 7 years ago

@josephspurrier added a new commit

coveralls commented 7 years ago

Coverage Status

Changes Unknown when pulling 17dd139e4ba97136407029362cdd63388918d6a4 on stowelly:master into on blue-jay:master.

josephspurrier commented 7 years ago

I tested out this library and go this error: [15:04:42] Finished 'go' after 52 s [go-run] [10228] restarting process... [go-run] [10228] stopping process... [go-run] [10228] restarting process... [go-run] [10228] stopping process... [go-run] uncaught exception { Error: spawn ps ENOENT at exports._errnoException (util.js:1007:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32) at onErrorNT (internal/child_process.js:348:16) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn ps', path: 'ps', spawnargs: [ '-A', '-o', 'ppid,pid' ] }

I think livereload is going to be a better way of restarting since more people are using it and it's been around better. Thoughts?

http://struct.cc/blog/2015/05/08/building-web-applications-in-golang-with-gulp-and-livereload/

josephspurrier commented 7 years ago

How about this instead?

https://github.com/blue-jay/blueprint/commit/9e33d14e79a610e4135c675542e74ec30fd4a957

stowelly commented 7 years ago

Yes I think I prefer your change much better than mine. been using it for the last day and seems good to me. however is it possible to make it use "go run" instead of running the executable? as yours defaults to running blueprint.exe, obviously that only works for windows

josephspurrier commented 7 years ago

Go run won't work on Windows because it creates a temp file everytime that requires you to allow it through the firewall. We should probably add an OS specific call for each OS.

stowelly commented 7 years ago

its probably reasonable to expect people to fill that in with their executable name anyway right?

stowelly commented 7 years ago

Noticed an issue. thought i was going mad with my changes not executing...... it runs the exe from where your go env variable points to, which only gets written to with "go install", but your script just does "go build", therefore it never runs the new changes... should change it to "go install"

josephspurrier commented 7 years ago

This should take care the naming piece: https://github.com/blue-jay/blueprint/commit/6ecd1d12feb9bf59b9490b7eba15c23aebbed471

I don't see the issue with Go build? Don't you run gulp watch from the same directory as the gulpfile.js?

stowelly commented 7 years ago

yes, same directory.

typing "which blueprint" in the shell finds the executable in my go path rather than the one sitting in the directory next to it :D not sure why, maybe its my setup? or a general linux thing?

josephspurrier commented 7 years ago

This should fix it now: https://github.com/blue-jay/blueprint/commit/8aa2fe9b55908b03a02932217d81aaae4523a766

I'd like to default to go build. If you want it to do go install, you can make the change in your own copy. Go Install will take longer because of the move and then the cache of packages.

josephspurrier commented 7 years ago

I merged in the changes. Let me know if you have any issues!