browser_gui 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,13 +7,15 @@ end
7
7
 
8
8
  module BrowserGui
9
9
  def self.open_browser(url)
10
- if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ then
11
- system("start '#{url}'")
12
- elsif RbConfig::CONFIG['host_os'] =~ /darwin/ then
13
- system("open '#{url}'")
14
- elsif RbConfig::CONFIG['host_os'] =~ /linux/ then
15
- system("xdg-open '#{url}'")
10
+ command = case RbConfig::CONFIG['host_os']
11
+ when /mswin|mingw|cygwin/ then "start '#{url}'"
12
+ when /darwin/ then "open '#{url}'"
13
+ when /linux/ then "xdg-open '#{url}'"
16
14
  end
15
+ # Spawn a process and return without waiting for it. Sleep 1 second to give Sinatra time to start up.
16
+ command = "sleep 1; #{command}"
17
+ pid = spawn(command)
18
+ Process.detach(pid)
17
19
  end
18
20
  end
19
21
 
@@ -1,3 +1,3 @@
1
1
  module BrowserGui
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browser_gui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-09 00:00:00.000000000 Z
12
+ date: 2013-05-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Use with Sinatra to create command-line scripts that open the browser
15
15
  as a GUI.