webview 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1358c823e6ab0054271f98c44f79c14b1044ac734c1236db84385068e806583e
4
- data.tar.gz: 6168d576afdb5ed4dadf25e3570215d54558e6f460b403b07ba43b8b626b232e
3
+ metadata.gz: 2ef23af7af89282bc314cb434fda468c1b90aa8ceeef46da9796a4cf7d123cc5
4
+ data.tar.gz: e95812999329317ce6567c536fa3dbf17a3d042b405c189567924d68cd8f1c82
5
5
  SHA512:
6
- metadata.gz: cbb2e2692d2d0783e56775a727236ba6112002b4543df5ca792f7059dff2370e46cb6936dfe247924aece81910c3039bffe092cb8caf40d4d85eab8bf437b498
7
- data.tar.gz: effe7f13a840a1cd5cf0aa1a8a2d9344c421b527849ad7c36d9cc24c6f78d6e6b10e22675a392c118cdc42f062ae543879797807a2fb7c4721091011a1de5057
6
+ metadata.gz: b20a1a7eead80f163afdba01f0fa13d25493eeb817075ea58f3d238e8f7770dc091058c42abfa40aff0e768db55640b4a59a8d529eca5cbf9a57cf95cd2396b3
7
+ data.tar.gz: 005020b674fa1e7109c854b508becf447cdfc14cb630fe5e906aea5aa073e048bdae0d8b591ee4e93f4734995ac147965e515f4f432d31780348e1593b9553ec
data/.gitignore CHANGED
@@ -11,8 +11,10 @@
11
11
  .rspec_status
12
12
 
13
13
  /ext/ext_package
14
- /ext/webview_app
14
+ /ext/webview_app*
15
+ /ext/webview/webview*
15
16
  mkmf.log
16
17
  /webview-*.gem
18
+ /spec/examples.txt
17
19
 
18
20
  *.swp
data/.travis.yml CHANGED
@@ -6,6 +6,8 @@ cache:
6
6
  - apt
7
7
  rvm:
8
8
  - 2.6.3
9
+ - 2.5.3
10
+ - 2.4.6
9
11
  before_install:
10
12
  - gem install bundler -v 2.0.1
11
13
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- webview (0.1.3)
4
+ webview (0.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -24,6 +24,7 @@ GEM
24
24
 
25
25
  PLATFORMS
26
26
  ruby
27
+ x64-mingw32
27
28
 
28
29
  DEPENDENCIES
29
30
  bundler (~> 2.0)
data/README.md CHANGED
@@ -5,9 +5,12 @@
5
5
 
6
6
  A webview GUI based on [zserge/webview](https://github.com/zserge/webview)
7
7
 
8
- ## Require
8
+
9
+ ## Requirements
9
10
 
10
11
  * `golang`
12
+ * `Cocoa`/`WebKit` on macOS, `gtk-webkit2` on Linux and `MSHTML` (IE10/11) on Windows.
13
+
11
14
 
12
15
  ## Installation
13
16
 
data/bin/build_ext CHANGED
File without changes
data/bin/console CHANGED
File without changes
data/bin/setup CHANGED
File without changes
data/examples/app.rb ADDED
@@ -0,0 +1,14 @@
1
+ $LOAD_PATH << File.expand_path('../../lib', __FILE__)
2
+
3
+ require 'webview'
4
+
5
+ app = Webview::App.new(title: 'Ruby Language')
6
+ app.open('https://www.ruby-lang.org?foo=bar')
7
+
8
+ at_exit { app.close }
9
+ begin
10
+ app.join
11
+ rescue Interrupt
12
+ app.close
13
+ end
14
+
data/lib/webview/app.rb CHANGED
@@ -5,6 +5,14 @@ module Webview
5
5
  class App
6
6
  attr_reader :app_out, :app_err, :app_process, :options
7
7
 
8
+ SIGNALS_MAPPING = if Gem.win_platform?
9
+ {
10
+ 'QUIT' => 'EXIT',
11
+ }
12
+ else
13
+ {} # don't map
14
+ end
15
+
8
16
  def initialize(title: nil, width: nil, height: nil, resizable: nil, debug: false)
9
17
  @options = {
10
18
  title: title,
@@ -21,11 +29,11 @@ module Webview
21
29
 
22
30
  def open(url)
23
31
  return true if @app_process
24
- cmd = [executable, "-url '#{url}'"]
32
+ cmd = [executable, "-url \"#{url}\""]
25
33
  @options.each do |k, v|
26
34
  case v
27
35
  when true, false then cmd << "-#{k}" if v
28
- else cmd << "-#{k} '#{v}'"
36
+ else cmd << "-#{k} \"#{v}\""
29
37
  end
30
38
  end
31
39
  exec_cmd(cmd.join(' '))
@@ -40,8 +48,10 @@ module Webview
40
48
  signal('QUIT')
41
49
  begin
42
50
  Timeout.timeout(3) do
43
- Process.wait(pid)
44
- rescue Errno::ECHILD, Errno::ESRCH
51
+ begin
52
+ Process.wait(pid)
53
+ rescue Errno::ECHILD, Errno::ESRCH, Errno::EINVAL
54
+ end
45
55
  end
46
56
  rescue Timeout::Error
47
57
  kill
@@ -57,12 +67,13 @@ module Webview
57
67
  end
58
68
 
59
69
  def kill
60
- signal('TERM')
70
+ signal('KILL')
61
71
  end
62
72
 
63
73
  def signal(name)
64
74
  return false unless app_process&.pid
65
- Process.kill(name, app_process.pid)
75
+ s = SIGNALS_MAPPING[name] || name
76
+ Process.kill(Signal.list[s], app_process.pid)
66
77
  true
67
78
  rescue Errno::ECHILD, Errno::ESRCH
68
79
  false
@@ -1,3 +1,3 @@
1
1
  module Webview
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiangzhi.xie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-10 00:00:00.000000000 Z
11
+ date: 2019-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -71,6 +71,7 @@ files:
71
71
  - bin/build_ext
72
72
  - bin/console
73
73
  - bin/setup
74
+ - examples/app.rb
74
75
  - ext/Makefile
75
76
  - ext/extconf.rb
76
77
  - ext/webview/main.go