browserstack-local 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/lib/browserstack/local.rb +35 -24
- metadata +21 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
|
4
|
-
|
5
|
-
SHA512:
|
6
|
-
|
7
|
-
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d541957388e64cbdad7bc093668847a766e7f9c5
|
4
|
+
data.tar.gz: f2bcb422bfc207099bd1c0b6850df622604c273c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 95efa89f9cfd3caae8aa800138560b5a77ba079d7d37664b92105dd1d6bb4097f620d4c0741ea13d4394a92be655f114b04276934a8fb7a7f5b93b5ecea81953
|
7
|
+
data.tar.gz: 437c1c49a5c1fbb67d80e326a7128a19c21cea2a30cbe72577987066d7b5a94cded3508ffa9bfe1dedb2a889364a0874a94c6b178b88dd5c25a6167408487ef9
|
data/lib/browserstack/local.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'browserstack/localbinary'
|
2
2
|
require 'browserstack/localexception'
|
3
|
+
require 'json'
|
3
4
|
|
4
5
|
module BrowserStack
|
5
6
|
|
@@ -75,36 +76,29 @@ class Local
|
|
75
76
|
end
|
76
77
|
|
77
78
|
if defined? spawn
|
78
|
-
@process = IO.popen(
|
79
|
+
@process = IO.popen(start_command_args)
|
79
80
|
else
|
80
|
-
@process = IO.popen(
|
81
|
+
@process = IO.popen(start_command)
|
81
82
|
end
|
82
|
-
@stdout = File.open(@logfile, "r")
|
83
83
|
|
84
84
|
while true
|
85
85
|
begin
|
86
|
-
line = @
|
86
|
+
line = @process.readline
|
87
87
|
rescue EOFError => e
|
88
88
|
sleep 1
|
89
89
|
next
|
90
90
|
end
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
|
92
|
+
data = JSON.parse(line) rescue {"message" => "Unable to parse daemon mode JSON output"}
|
93
|
+
if data['state'].to_s != "connected"
|
94
|
+
@process.close
|
95
|
+
raise BrowserStack::LocalException.new(data["message"])
|
95
96
|
return
|
96
|
-
|
97
|
-
|
98
|
-
@pid = @process.pid
|
99
|
-
@stdout.close
|
97
|
+
else
|
98
|
+
@pid = data["pid"]
|
100
99
|
break
|
101
100
|
end
|
102
101
|
end
|
103
|
-
|
104
|
-
while true
|
105
|
-
break if self.isRunning
|
106
|
-
sleep 1
|
107
|
-
end
|
108
102
|
end
|
109
103
|
|
110
104
|
def isRunning
|
@@ -113,20 +107,37 @@ class Local
|
|
113
107
|
|
114
108
|
def stop
|
115
109
|
return if @pid.nil?
|
116
|
-
Process.kill("TERM", @pid) rescue Process.kill(9, @pid)
|
117
110
|
@process.close
|
118
|
-
|
119
|
-
|
120
|
-
|
111
|
+
if defined? spawn
|
112
|
+
@process = IO.popen(stop_command_args)
|
113
|
+
else
|
114
|
+
@process = IO.popen(stop_command)
|
121
115
|
end
|
116
|
+
@process.close
|
117
|
+
@pid = nil
|
122
118
|
end
|
123
119
|
|
124
120
|
def command
|
125
|
-
|
121
|
+
start_command
|
122
|
+
end
|
123
|
+
|
124
|
+
def start_command
|
125
|
+
"#{@binary_path} -d start -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_proxy_flag} #{@force_flag} #{@verbose_flag} #{@hosts} #{@user_arguments.join(" ")} 2>&1".strip
|
126
|
+
end
|
127
|
+
|
128
|
+
def start_command_args
|
129
|
+
args = ["#{@binary_path}", "-d", "start", "-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_proxy_flag}","#{@force_flag}", "#{@verbose_flag}", "#{@hosts}", "#{@user_arguments.join(" ")}"]
|
130
|
+
args = args.select {|a| a.to_s != "" }
|
131
|
+
args.push(:err => [:child, :out])
|
132
|
+
args
|
133
|
+
end
|
134
|
+
|
135
|
+
def stop_command
|
136
|
+
"#{@binary_path} -d stop #{@local_identifier_flag}".strip
|
126
137
|
end
|
127
138
|
|
128
|
-
def
|
129
|
-
args = ["#{@binary_path}", "-
|
139
|
+
def stop_command_args
|
140
|
+
args = ["#{@binary_path}", "-d", "stop", "#{@local_identifier_flag}"]
|
130
141
|
args = args.select {|a| a.to_s != "" }
|
131
142
|
args.push(:err => [:child, :out])
|
132
143
|
args
|
metadata
CHANGED
@@ -1,54 +1,47 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: browserstack-local
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
-
|
6
|
+
authors:
|
7
|
+
- BrowserStack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
date: 2016-05-04 00:00:00 Z
|
11
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
|
-
|
15
13
|
description: Ruby bindings for BrowserStack Local
|
16
14
|
email: support@browserstack.com
|
17
15
|
executables: []
|
18
|
-
|
19
16
|
extensions: []
|
20
|
-
|
21
17
|
extra_rdoc_files: []
|
22
|
-
|
23
|
-
files:
|
18
|
+
files:
|
24
19
|
- lib/browserstack/local.rb
|
25
20
|
- lib/browserstack/localbinary.rb
|
26
21
|
- lib/browserstack/localexception.rb
|
27
22
|
homepage: http://rubygems.org/gems/browserstack-local
|
28
|
-
licenses:
|
23
|
+
licenses:
|
29
24
|
- MIT
|
30
25
|
metadata: {}
|
31
|
-
|
32
26
|
post_install_message:
|
33
27
|
rdoc_options: []
|
34
|
-
|
35
|
-
require_paths:
|
28
|
+
require_paths:
|
36
29
|
- lib
|
37
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
-
|
40
|
-
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
46
40
|
requirements: []
|
47
|
-
|
48
41
|
rubyforge_project:
|
49
|
-
rubygems_version: 2.
|
42
|
+
rubygems_version: 2.4.5
|
50
43
|
signing_key:
|
51
44
|
specification_version: 4
|
52
45
|
summary: BrowserStack Local
|
53
46
|
test_files: []
|
54
|
-
|
47
|
+
has_rdoc:
|