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 all 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules/
*.pid
versions.json
.meteor/versions
.meteor/dev_bundle
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ before_install:
- export PATH="$HOME/.meteor:$PATH"
- meteor --version
- npm install -g [email protected]
- npm install -g [email protected]
- phantomjs -v
7 changes: 4 additions & 3 deletions Cakefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
require('coffee-script/register');
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()
child.exec "coffee -o lib -c lib"
# child = new ChildProcess()
# child.exec "coffee -o lib -c lib"
child = new ChildProcess()
child.exec "coffee -o tests/lib -c tests/lib"

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
18 changes: 13 additions & 5 deletions lib/Meteor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ class Meteor extends EventEmitter
expect(+options.port, "options.port is not a number.").to.be.ok
expect(options.packages, "options.packages is not an array of package names").to.be.an 'array'

# Always use 'practicalmeteor:mocha' package for xunit or console-runner
if options.mocha? or options['driver-package'] is 'practicalmeteor:mocha-console-runner'
options["driver-package"] = "practicalmeteor:mocha"

args = [
command
'--driver-package'
Expand All @@ -56,11 +60,7 @@ class Meteor extends EventEmitter
args.push(["--port", options.port])
args.push(["--settings", options.settings]) if options.settings
args.push("--production") if options.production

if options.mocha?
options["driver-package"] = "practicalmeteor:mocha-console-runner"



options["root-url"] ?= "http://localhost:#{options.port}/"

if command is 'test'
Expand Down Expand Up @@ -124,6 +124,14 @@ class Meteor extends EventEmitter
else
delete env.MONGO_URL if env.MONGO_URL?

if @options.mocha? or @options['driver-package'] is 'practicalmeteor:mocha'
if @options.xunit? or @options['xunit-out']?
env.MOCHA_REPORTER = 'xunit'
else
env.MOCHA_REPORTER = 'console'



options = {
cwd: cwd,
env: env,
Expand Down
64 changes: 53 additions & 11 deletions lib/MeteorMongodb.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,61 @@ 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
if process.platform is 'win32'
@getChildProcessOnWindows(@meteorPid, (childsPid, _this) ->
_this.meteorPid = childsPid[0].pid
log.debug "@meteorPid", _this.meteorPid
_this.getChildProcessOnWindows(childsPid[0].pid, (childsPid, _this) ->
_this.mongodChilds = childsPid
)
)

else
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

getChildProcessOnWindows: (processPid, onSuccess) ->
resultList = [];
bat = require('child_process').spawn('cmd.exe', [
'/c'
"#{__dirname}\\get_children.bat #{processPid}"
])

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 process children:\n', data

bat.on 'exit', (code) =>
if code != 0
return log.warn('spacejam: Warning: Enumerating child process returned with error code: ', code)
log.debug 'MongoDB children:\n', resultList
if resultList.length == 0
log.warn 'spacejam: Warning: Couldn\'t find any child process :\n', err
else if resultList.length > 1
log.warn "spacjam: Warning: Found more than one mongod child:\n", resultList
log.warn 'spacejam: Warning: Found more than one child process :\n', resultList
onSuccess(resultList, _this)
else
log.debug "Found meteor mongod child with pid: ", resultList[0].pid
log.debug 'Found meteor child process with pid: ', resultList[0].pid
onSuccess(resultList, _this)



kill: ->
Expand Down
8 changes: 6 additions & 2 deletions lib/Phantomjs.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ 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 !


# Get the cross-platform program name
# program = path.basename(phantomjs.path)
program = phantomjs.path

@childProcess = new ChildProcess()
@childProcess.spawn("phantomjs", spawnArgs, spawnOptions, pipeClass, pipeClassOptions)
@childProcess.spawn(program, spawnArgs, spawnOptions, pipeClass, pipeClassOptions)

@childProcess.child.on "exit", (code, signal) =>
@emit "exit", code, signal
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
)
9 changes: 6 additions & 3 deletions package.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spacejam",
"version": "1.6.1",
"version": "1.6.2-rc.4",
"dependencies": {
"chai": "1.9.2",
"glob": "4.0.6",
Expand All @@ -9,10 +9,13 @@
"psext": "0.0.4",
"rc": "0.5.1",
"semver": "4.1.0",
"underscore": "1.7.0"
"underscore": "1.7.0",
"sinon": "^1.17.4",
"coffee-script": "1.8.0",
"try-thread-sleep": "1.0.0",
"cross-spawn": "^4.0.0"
},
"devDependencies": {
"coffee-script": "1.8.0",
"mocha": "1.21.5",
"sinon-chai": "2.6.0",
"tmp": "0.0.25",
Expand Down
1 change: 1 addition & 0 deletions tests/apps/failing-app-tests/.meteor/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dev_bundle
local
3 changes: 1 addition & 2 deletions tests/apps/failing-app-tests/.meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ ecmascript # Enable ECMAScript2015+ syntax in app code

autopublish # Publish all data to the clients (for prototyping)
insecure # Allow all DB writes from clients (for prototyping)
practicalmeteor:[email protected]_2
practicalmeteor:[email protected]
practicalmeteor:[email protected]_6
practicalmeteor:chai
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.4
145 changes: 72 additions & 73 deletions tests/apps/failing-app-tests/.meteor/versions
Original file line number Diff line number Diff line change
@@ -1,77 +1,76 @@
[email protected].2
[email protected].5
[email protected].6
babel-compiler@6.5.2
[email protected].6
[email protected].6
[email protected].6
[email protected].5
[email protected].2
[email protected].6
[email protected].6
[email protected].2
[email protected].4
[email protected].6
check@1.1.2
coffeescript@1.0.15
[email protected].3
[email protected].3
[email protected].3
[email protected].4
[email protected].10
[email protected].3
[email protected].1
[email protected].8
[email protected].9
[email protected].8
[email protected].9
[email protected].6
[email protected].2
[email protected].7
[email protected].7
[email protected].3
[email protected].5
[email protected].5
[email protected].6
[email protected].8
[email protected].16
[email protected].10
[email protected].12
[email protected].2
[email protected].9
[email protected].9
[email protected].12
[email protected].2
[email protected].10
modules@0.5.1
[email protected].1
[email protected].5
[email protected].2
[email protected].41
[email protected].9
[email protected].5
[email protected].5
[email protected].7
[email protected].11
babel-compiler@6.8.4
[email protected].9_1
[email protected].9
[email protected].9
[email protected].8
[email protected].4
[email protected].9
[email protected].9
[email protected].6
[email protected].6
[email protected].9
check@1.2.3
coffeescript@1.1.3
[email protected].5
[email protected].9
[email protected].6
[email protected].9
[email protected].12
[email protected].6
[email protected].7
[email protected].12
[email protected].12
[email protected].13
[email protected].12
[email protected].9
[email protected].4
[email protected].10
[email protected].10
[email protected].8
[email protected].8
[email protected].7
[email protected].9
[email protected].12
[email protected].18
[email protected].14
[email protected].16
[email protected].4
[email protected].13
[email protected].13
[email protected].17
[email protected].4
[email protected].12
modules@0.6.5
[email protected].5
[email protected].9_1
[email protected].5
[email protected].45
[email protected].12
[email protected].8
practicalmeteor:[email protected]_1
practicalmeteor:[email protected]_2
practicalmeteor:[email protected]
practicalmeteor:[email protected]
practicalmeteor:[email protected]
practicalmeteor:[email protected]_3
practicalmeteor:[email protected]
practicalmeteor:[email protected]_2
promise@0.6.5
[email protected].7
[email protected].7
[email protected].6
[email protected].5
[email protected].8
[email protected].9
[email protected].9
[email protected].4
[email protected].4
[email protected].7
[email protected].2
promise@0.7.3
[email protected].10
[email protected].10
[email protected].10
[email protected].8
[email protected].11
[email protected].12
[email protected].12
[email protected].8
[email protected].8
[email protected].13
[email protected].4
tmeasday:[email protected]
[email protected].11
[email protected].9
[email protected].6
[email protected].7
[email protected].6
[email protected].7
[email protected].14
[email protected].11
[email protected].9
[email protected].10
[email protected].10
[email protected].9
Loading