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|
7
7
end
8
8
9
9
task :build do
10
- system "mkdir -p dist"
10
+ system "mkdir dist"
11
11
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"
13
14
system "gem install ./dist/browserstack-local-*.gem"
14
15
end
Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ class Local
9
9
def initialize ( key = ENV [ "BROWSERSTACK_ACCESS_KEY" ] )
10
10
@key = key
11
11
@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" ;
13
14
end
14
15
15
16
def add_args ( key , value = nil )
@@ -58,7 +59,12 @@ def start(options = {})
58
59
@binary_path
59
60
end
60
61
61
- system ( "echo '' > '#{ @logfile } '" )
62
+ if @is_windows
63
+ system ( "echo > #{ @logfile } " )
64
+ else
65
+ system ( "echo '' > '#{ @logfile } '" )
66
+ end
67
+
62
68
if defined? spawn
63
69
@process = IO . popen ( command_args )
64
70
else
@@ -98,8 +104,9 @@ def isRunning
98
104
99
105
def stop
100
106
return if @pid . nil?
101
- Process . kill ( "TERM" , @pid )
107
+ Process . kill ( "TERM" , @pid ) rescue Process . kill ( 9 , @pid )
102
108
@process . close
109
+ @pid = nil if @is_windows
103
110
while self . isRunning
104
111
sleep 1
105
112
end
Original file line number Diff line number Diff line change @@ -13,14 +13,14 @@ def initialize
13
13
@http_path = case host_os
14
14
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
15
15
@windows = true
16
- "https://s3.amazonaws.com/bs-automate-prod/ local/BrowserStackLocal-win32 .exe"
16
+ "https://s3.amazonaws.com/browserStack/browserstack- local/BrowserStackLocal.exe"
17
17
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"
19
19
when /linux/
20
20
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"
22
22
else
23
- "https://s3.amazonaws.com/bs-automate-prod/ local/BrowserStackLocal-linux-ia32"
23
+ "https://s3.amazonaws.com/browserStack/browserstack- local/BrowserStackLocal-linux-ia32"
24
24
end
25
25
end
26
26
@@ -79,10 +79,10 @@ def make_path(path)
79
79
begin
80
80
FileUtils . mkdir_p path if !File . directory? ( path )
81
81
return true
82
- rescue Exception => e
82
+ rescue Exception
83
83
return false
84
84
end
85
85
end
86
86
end
87
87
88
- end
88
+ end
Original file line number Diff line number Diff line change 1
1
require 'rubygems'
2
+ require 'minitest'
2
3
require 'minitest/autorun'
3
4
require 'browserstack/local'
4
5
@@ -20,9 +21,11 @@ def test_is_running
20
21
def test_multiple_binary
21
22
@bs_local . start
22
23
bs_local_2 = BrowserStack ::Local . new
24
+ second_log_file = File . join ( Dir . pwd , 'local2.log' )
23
25
assert_raises BrowserStack ::LocalException do
24
- bs_local_2 . start
26
+ bs_local_2 . start ( { 'logfile' => second_log_file } )
25
27
end
28
+ File . delete ( second_log_file )
26
29
end
27
30
28
31
def test_enable_verbose
You can’t perform that action at this time.
0 commit comments