Skip to content

Commit a69677d

Browse files
committed
Merge pull request #1 from browserstack/travis
Travis configured
2 parents 601191b + 94177e2 commit a69677d

File tree

5 files changed

+24
-13
lines changed

5 files changed

+24
-13
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: ruby
22
rvm:
3-
- 1.8.7
3+
- 1.9.3
4+
- 2.2.1
45

56
before_install:
67
- true && `base64 --decode <<< ZXhwb3J0IEJST1dTRVJTVEFDS19BQ0NFU1NfS0VZPUh5VmZydXJvb3dYb041eGhLZEs2Cg==`

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# browserstack-local-ruby
22

3+
[![Build Status](https://travis-ci.org/browserstack/browserstack-local-ruby.svg?branch=master)](https://travis-ci.org/browserstack/browserstack-local-ruby)
4+
35
## Setup
46

57
```

lib/browserstack/local.rb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module BrowserStack
66
class Local
77
attr_reader :pid
88

9-
def initialize(key = nil)
9+
def initialize(key = ENV["BROWSERSTACK_ACCESS_KEY"])
1010
@key = key
1111
@logfile = File.join(Dir.pwd, "local.log")
1212
end
@@ -58,7 +58,9 @@ def start(options = {})
5858
end
5959

6060
system("echo '' > '#{@logfile}'")
61-
@process = IO.popen(command, "w+")
61+
#@pid = spawn()
62+
#Process.detach @pid
63+
@process = IO.popen(command_args)
6264
@stdout = File.open(@logfile, "r")
6365

6466
while true
@@ -95,15 +97,21 @@ def stop
9597
return if @pid.nil?
9698
Process.kill("TERM", @pid)
9799
@process.close
98-
while true
99-
break if !self.isRunning
100+
while self.isRunning
100101
sleep 1
101102
end
102103
end
103104

104105
def command
105106
"#{@binary_path} -logFile '#{@logfile}' #{@folder_flag} #{@key} #{@folder_path} #{@force_local_flag} #{@local_identifier_flag} #{@only_flag} #{@only_automate_flag} #{@proxy_host} #{@proxy_port} #{@proxy_user} #{@proxy_pass} #{@force_flag} #{@verbose_flag} #{@hosts}".strip
106107
end
108+
109+
def command_args
110+
args = ["#{@binary_path}", "-logFile", "#{@logfile}", "#{@key}", "#{@folder_flag}", "#{@folder_path}", "#{@force_local_flag}", "#{@local_identifier_flag}", "#{@only_flag}", "#{@only_automate_flag}", "#{@proxy_host}", "#{@proxy_port}", "#{@proxy_user}", "#{@proxy_pass}", "#{@force_flag}", "#{@verbose_flag}", "#{@hosts}"]
111+
args = args.select {|a| a.to_s != "" }
112+
args.push(:err => [:child, :out])
113+
args
114+
end
107115
end
108116

109117
end

lib/browserstack/localbinary.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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/browserStack/browserstack-local/BrowserStackLocal.exe"
16+
"https://s3.amazonaws.com/bs-automate-prod/local/BrowserStackLocal-win32.exe"
1717
when /darwin|mac os/
18-
"https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-darwin-x64"
18+
"https://s3.amazonaws.com/bs-automate-prod/local/BrowserStackLocal-darwin-x64"
1919
when /linux/
2020
if 1.size == 8
21-
"https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-linux-x64"
21+
"https://s3.amazonaws.com/bs-automate-prod/local/BrowserStackLocal-linux-x64"
2222
else
23-
"https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-linux-ia32"
23+
"https://s3.amazonaws.com/bs-automate-prod/local/BrowserStackLocal-linux-ia32"
2424
end
2525
end
2626

test/browserstack-local-test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ def setup
88
end
99

1010
def test_check_pid
11-
@bs_local.start({'key' => ENV["BROWSERSTACK_ACCESS_KEY"]})
11+
@bs_local.start
1212
refute_nil @bs_local.pid, 0
1313
end
1414

1515
def test_is_running
16-
@bs_local.start({'key' => ENV["BROWSERSTACK_ACCESS_KEY"]})
16+
@bs_local.start
1717
assert_equal true, @bs_local.isRunning
1818
end
1919

2020
def test_multiple_binary
21-
@bs_local.start({'key' => ENV["BROWSERSTACK_ACCESS_KEY"]})
21+
@bs_local.start
2222
bs_local_2 = BrowserStack::Local.new
2323
assert_raises BrowserStack::LocalException do
24-
bs_local_2.start({'key' => ENV["BROWSERSTACK_ACCESS_KEY"]})
24+
bs_local_2.start
2525
end
2626
end
2727

0 commit comments

Comments
 (0)