File tree Expand file tree Collapse file tree 4 files changed +23
-12
lines changed
Expand file tree Collapse file tree 4 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,9 @@ Rake::TestTask.new do |t|
77end
88
99task :build do
10- system "mkdir -p dist"
10+ system "mkdir dist"
1111 system "gem build browserstack-local.gemspec"
12- system "mv browserstack-local-*.gem dist"
12+ move_command = RbConfig ::CONFIG [ 'host_os' ] . match ( /mswin|msys|mingw|cygwin|bccwin|wince|emc|win32/ ) ? "move" : "mv" ;
13+ system "#{ move_command } browserstack-local-*.gem dist"
1314 system "gem install ./dist/browserstack-local-*.gem"
1415end
Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ class Local
99 def initialize ( key = ENV [ "BROWSERSTACK_ACCESS_KEY" ] )
1010 @key = key
1111 @logfile = File . join ( Dir . pwd , "local.log" )
12- @exec = RbConfig ::CONFIG [ 'host_os' ] . match ( /mswin|msys|mingw|cygwin|bccwin|wince|emc/ ) ? "call" : "exec" ;
12+ @is_windows = RbConfig ::CONFIG [ 'host_os' ] . match ( /mswin|msys|mingw|cygwin|bccwin|wince|emc|win32/ )
13+ @exec = @is_windows ? "call" : "exec" ;
1314 end
1415
1516 def add_args ( key , value = nil )
@@ -58,7 +59,12 @@ def start(options = {})
5859 @binary_path
5960 end
6061
61- system ( "echo '' > '#{ @logfile } '" )
62+ if @is_windows
63+ system ( "echo > #{ @logfile } " )
64+ else
65+ system ( "echo '' > '#{ @logfile } '" )
66+ end
67+
6268 if defined? spawn
6369 @process = IO . popen ( command_args )
6470 else
@@ -98,8 +104,9 @@ def isRunning
98104
99105 def stop
100106 return if @pid . nil?
101- Process . kill ( "TERM" , @pid )
107+ Process . kill ( "TERM" , @pid ) rescue Process . kill ( 9 , @pid )
102108 @process . close
109+ @pid = nil if @is_windows
103110 while self . isRunning
104111 sleep 1
105112 end
Original file line number Diff line number Diff line change @@ -13,14 +13,14 @@ def initialize
1313 @http_path = case host_os
1414 when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
1515 @windows = true
16- "https://s3.amazonaws.com/bs-automate-prod/ local/BrowserStackLocal-win32 .exe"
16+ "https://s3.amazonaws.com/browserStack/browserstack- local/BrowserStackLocal.exe"
1717 when /darwin|mac os/
18- "https://s3.amazonaws.com/bs-automate-prod/ local/BrowserStackLocal-darwin-x64"
18+ "https://s3.amazonaws.com/browserStack/browserstack- local/BrowserStackLocal-darwin-x64"
1919 when /linux/
2020 if 1 . size == 8
21- "https://s3.amazonaws.com/bs-automate-prod/ local/BrowserStackLocal-linux-x64"
21+ "https://s3.amazonaws.com/browserStack/browserstack- local/BrowserStackLocal-linux-x64"
2222 else
23- "https://s3.amazonaws.com/bs-automate-prod/ local/BrowserStackLocal-linux-ia32"
23+ "https://s3.amazonaws.com/browserStack/browserstack- local/BrowserStackLocal-linux-ia32"
2424 end
2525 end
2626
@@ -79,10 +79,10 @@ def make_path(path)
7979 begin
8080 FileUtils . mkdir_p path if !File . directory? ( path )
8181 return true
82- rescue Exception => e
82+ rescue Exception
8383 return false
8484 end
8585 end
8686end
8787
88- end
88+ end
Original file line number Diff line number Diff line change 11require 'rubygems'
2+ require 'minitest'
23require 'minitest/autorun'
34require 'browserstack/local'
45
@@ -20,9 +21,11 @@ def test_is_running
2021 def test_multiple_binary
2122 @bs_local . start
2223 bs_local_2 = BrowserStack ::Local . new
24+ second_log_file = File . join ( Dir . pwd , 'local2.log' )
2325 assert_raises BrowserStack ::LocalException do
24- bs_local_2 . start
26+ bs_local_2 . start ( { 'logfile' => second_log_file } )
2527 end
28+ File . delete ( second_log_file )
2629 end
2730
2831 def test_enable_verbose
You can’t perform that action at this time.
0 commit comments