Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

Windows suppport #61

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1a6974a
Update meteor apps
Mar 28, 2016
2380794
Use cross-spawn to add support for windows
Mar 28, 2016
8fc8ca7
Merge with refactor branch
May 20, 2016
b9245e0
Wip windows support
May 20, 2016
5915c11
Fix ../lib/log.coffee not found #55 #56
serut May 26, 2016
dd4d033
Merge branch 'fix-refactor' of https://github.com/serut/spacejam into…
Jun 24, 2016
c3bed38
Merge branch 'master' into windows-suppport
Jun 24, 2016
8868704
Update to latest meteor version
Jun 29, 2016
9dbfc37
Fix tests for path.delimiter
Jun 29, 2016
276e8a3
Add appveyor.yml configuration file
Jun 29, 2016
19772ed
Bump version to 1.6.2-rc.1
Jun 29, 2016
c3c60c2
Find out the good meteor and mongodb pid and add coffee-script as a p…
serut Jul 7, 2016
46104a0
Support latest update of practicalmeteor:mocha
Jul 7, 2016
f799d0f
Cleanup logging
Jul 7, 2016
b28d172
Solve conflicts with @serut fork
Jul 7, 2016
4bd7434
Bump version to 1.6.2-rc.2
Jul 7, 2016
ca184de
Add prepublish script again
Jul 7, 2016
40cdf8a
Bump version to 1.6.2-rc.4
Jul 7, 2016
948fe10
Skipt scripts tests if you are running in windows
Jul 7, 2016
b73d751
Add try-thread-sleep (cross-spawn + spacejam supports the node versio…
serut Jul 8, 2016
4dd9fc3
Merge branch 'windows-suppport-pr' of github.com:serut/spacejam into …
Jul 8, 2016
b1d4c17
Fix functional tests
Jul 11, 2016
efe92c6
Add mainTests file
Jul 14, 2016
80bbdf9
Update tests apps to latest meteor version
Jul 14, 2016
9bed040
Add bin/npm-test.sh as npm test script
Jul 14, 2016
070f659
Update to latest practicalmeteor:mocha
Jul 14, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ChildProcess = require './lib/ChildProcess'

mochaCmdLine = "mocha --colors --compilers coffee:coffee-script/register --reporter spec tests/lib/*Test.coffee"
mochaCmdLine = "mocha --colors --compilers coffee:coffee-script/register --reporter spec tests/lib/*Test*.coffee"

task "compile", "Compile coffee-script library sources", ->
child = new ChildProcess()
Expand Down
21 changes: 21 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Test against this version of Node.js
environment:
nodejs_version: "0.10.25"

# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install modules
- npm install

# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# run tests
- npm test

# Don't actually build.
build: off
2 changes: 2 additions & 0 deletions bin/spacejam
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env node

require('coffee-script/register');

require('../lib/log');

require('../lib/CLI').get().exec();
2 changes: 1 addition & 1 deletion lib/ChildProcess.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ path = require 'path'
class ChildProcess

# Design for testability - so we can spy on them / stub them in tests
@_spawn: require("child_process").spawn
@_spawn: require('cross-spawn')
@_exec: require("child_process").exec

child: null
Expand Down
55 changes: 43 additions & 12 deletions lib/MeteorMongodb.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,49 @@ class MeteorMongodb extends EventEmitter
findAllChildren: ->
log.debug "MeteorMongodb.findAllChildren()", arguments
log.debug "@meteorPid", @meteorPid
ps.lookup
command: 'mongod'
psargs: '-l'
ppid: @meteorPid
, (err, resultList )=>
@mongodChilds = resultList
if (err)
log.warn "spacjam: Warning: Couldn't find any mongod children:\n", err
else if resultList.length > 1
log.warn "spacjam: Warning: Found more than one mongod child:\n", resultList
else
log.debug "Found meteor mongod child with pid: ", resultList[0].pid
if process.platform is 'win32'
resultList = [];

bat = require('child_process').spawn('cmd.exe', [
'/c'
"#{__dirname}\\get_children.bat #{@meteorPid}"
])

bat.stdout.setEncoding "utf8"
bat.stderr.setEncoding "utf8"

bat.stdout.on 'data', (data) ->

childPid = data.toString().trim()
resultList.push pid: parseInt(childPid)

bat.stderr.on 'data', (data) ->
log.warn 'spacejam: Warning: Error enumerating mongod children:\n', data

bat.on 'exit', (code) =>
if code != 0
return log.warn('spacejam: Warning: Enumerating mongod children returned with error code: ', code)
log.info 'MongoDB children:\n', resultList
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace log.info into log.debug

@mongodChilds = resultList
if resultList.length == 0
log.warn 'spacejam: Warning: Couldn\'t find any mongod children:\n', err
else if resultList.length > 1
log.warn 'spacejam: Warning: Found more than one mongod child:\n', resultList
else
log.debug 'Found meteor mongod child with pid: ', resultList[0].pid
else
ps.lookup
command: 'mongod'
psargs: '-l'
ppid: @meteorPid
, (err, resultList )=>
@mongodChilds = resultList
if (err)
log.warn "spacjam: Warning: Couldn't find any mongod children:\n", err
else if resultList.length > 1
log.warn "spacjam: Warning: Found more than one mongod child:\n", resultList
else
log.debug "Found meteor mongod child with pid: ", resultList[0]?.pid


kill: ->
Expand Down
2 changes: 1 addition & 1 deletion lib/Phantomjs.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Phantomjs extends EventEmitter
if useSystemPhantomjs
process.env.PATH = DEFAULT_PATH
else
process.env.PATH = path.dirname(phantomjs.path) + ':' + DEFAULT_PATH
process.env.PATH = path.dirname(phantomjs.path) + path.delimiter + DEFAULT_PATH
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice !


@childProcess = new ChildProcess()
@childProcess.spawn("phantomjs", spawnArgs, spawnOptions, pipeClass, pipeClassOptions)
Expand Down
5 changes: 5 additions & 0 deletions lib/get_children.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off & setlocal enabledelayedexpansion
set PPID=%1
for /F "skip=1 tokens=1" %%a in ('wmic process where "ParentProcessID=%PPID%" get processid') do for %%b in (%%a) do (
echo %%a
)
5 changes: 3 additions & 2 deletions package.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "spacejam",
"version": "1.6.1",
"version": "1.6.2-rc.1",
"dependencies": {
"chai": "1.9.2",
"cross-spawn": "^2.1.5",
"glob": "4.0.6",
"loglevel": "1.1.0",
"phantomjs-prebuilt": "^2.1.7",
Expand All @@ -21,7 +22,7 @@
},
"main": "lib/main.js",
"scripts": {
"test": "bin/npm-test.sh",
"test": "cake test",
"compile": "cake compile",
"prepublish": "cake compile"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/apps/failing-app-tests/.meteor/release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[email protected]
[email protected].4.1
6 changes: 6 additions & 0 deletions tests/apps/leaderboard/.meteor/.finished-upgraders
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@
notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
notices-for-facebook-graph-api-2
1.2.0-standard-minifiers-package
1.2.0-meteor-platform-split
1.2.0-cordova-changes
1.2.0-breaking-changes
1.3.0-split-minifiers-package
2 changes: 2 additions & 0 deletions tests/apps/leaderboard/.meteor/packages
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ success
settings
failure
timeout
standard-minifier-css
standard-minifier-js
2 changes: 1 addition & 1 deletion tests/apps/leaderboard/.meteor/release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
METEOR@1.0.2
METEOR@1.3.4.1
2 changes: 1 addition & 1 deletion tests/apps/passing-app-tests/.meteor/release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[email protected]
[email protected].4.1
6 changes: 6 additions & 0 deletions tests/apps/todos/.meteor/.finished-upgraders
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@
notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
notices-for-facebook-graph-api-2
1.2.0-standard-minifiers-package
1.2.0-meteor-platform-split
1.2.0-cordova-changes
1.2.0-breaking-changes
1.3.0-split-minifiers-package
2 changes: 2 additions & 0 deletions tests/apps/todos/.meteor/packages
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ jquery
preserve-inputs
insecure
appfails
standard-minifier-css
standard-minifier-js
2 changes: 1 addition & 1 deletion tests/apps/todos/.meteor/release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
METEOR@1.0.2
METEOR@1.3.4.1
2 changes: 1 addition & 1 deletion tests/apps/todos/client/todos.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h3>Todo Lists</h3>
{{else}}
<div class="destroy"></div>
<div class="display">
<input class="check" name="markdone" type="checkbox" {{{done_checkbox}}} />
<input class="check" name="markdone" type="checkbox" {{done_checkbox}} />
<div class="todo-text">{{text}}</div>
</div>
{{/if}}
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/CLITest.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ChildProcess = require '../../lib/ChildProcess'


describe "CLI", ->
@timeout 30000
@timeout 60000

processArgv = null

Expand Down Expand Up @@ -99,7 +99,7 @@ describe "CLI", ->
try
if code is 0 then done() else done("spacejam.done=#{code}")

firstPathEntry = process.env.PATH.split(":")[0]
firstPathEntry = process.env.PATH.split(path.delimiter)[0]
expect(firstPathEntry).to.equal(path.dirname(phantomjs.path))
catch err
done(err)
Expand Down