Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 7194b6d

Browse files
Merge pull request #9 from groupon-testium/force-update
expose forceUpdate that removes all temp files
2 parents 73b6b91 + fb46f87 commit 7194b6d

File tree

3 files changed

+30
-15
lines changed

3 files changed

+30
-15
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,12 @@ are downloaded into that path.
3636
`update` forces
3737
the selenium.jar and chromedriver
3838
files to be the latest available versions.
39+
Pulls from temp directory if available.
40+
41+
### selenium.forceUpdate
42+
43+
`forceUpdate` forces
44+
the selenium.jar and chromedriver
45+
files to be the latest available versions.
46+
Clears temp directory before checking.
3947

lib/index.js

Lines changed: 12 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.coffee

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3030
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
###
3232

33-
{unlinkSync, existsSync} = require 'fs'
33+
{existsSync} = require 'fs'
34+
{rmrfSync} = require 'fs.extra'
3435
mkdirp = require 'mkdirp'
3536
async = require 'async'
3637
tempdir = require './tempdir'
@@ -43,8 +44,8 @@ makePaths = (binPath, tempPath) ->
4344
mkdirp.sync binPath
4445
mkdirp.sync tempPath
4546

46-
removeFile = (file) ->
47-
unlinkSync file if existsSync file
47+
removeDir = (dir) ->
48+
rmrfSync(dir)
4849

4950
binariesExist = (binPath) ->
5051
[ 'selenium.jar', 'chromedriver' ].every (binary) ->
@@ -61,10 +62,13 @@ ensure = (binPath, callback) ->
6162
], callback
6263

6364
update = (binPath, callback) ->
64-
removeFile "#{binPath}/selenium.jar"
65-
removeFile "#{binPath}/chromedriver"
65+
removeDir binPath
66+
ensure(binPath, callback)
6667

68+
forceUpdate = (binPath, callback) ->
69+
removeDir binPath
70+
removeDir TEMP_PATH
6771
ensure(binPath, callback)
6872

69-
module.exports = { update, ensure }
73+
module.exports = { update, forceUpdate, ensure }
7074

0 commit comments

Comments
 (0)