browser_app_base 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vscode/launch.json +15 -0
- data/README.md +29 -4
- data/bin/create_browser_app.rb +2 -1
- data/lib/browser_app_base/version.rb +1 -1
- data/lib/browser_app_base.rb +35 -4
- data/lib/template/app_load.rb +2 -0
- data/lib/template/config.ru +1 -1
- data/lib/template/css/index.css +25 -0
- data/lib/template/index.html +23 -6
- data/lib/template/js/main.js +58 -37
- data/lib/template/{server_app.rb → my_app_sample.rb} +9 -7
- data/lib/template/server.rb +28 -11
- data/lib/template/server_app_base.rb +27 -0
- data/lib/template/start.rb +6 -6
- data/lib/template/wsserver.rb +10 -4
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4b88262d08f7de37833b5e1fafb1051947ff7f0d7eb4c62c11fc906d5869ede
|
4
|
+
data.tar.gz: ca22c6db6f9788d0c098edffc25fabbdde4fcbfa43d15032f6a2a2ec72b16aec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c761441fa372ee9c4dfb924991852d706348685315b30704865c70e28fb728586f3509b55d28cc951849879a3f39f6b67bb9abe49d73f3261f79449459b5202
|
7
|
+
data.tar.gz: 1c02f7dcd2e3b6225762ae66182b4de6d4a1923f6918a19f962337b961e659cced031a714cbdf9949daef94a9c9a7a01262ae0a37a95af68f1e73e2ac7786eca
|
data/.vscode/launch.json
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
// IntelliSense を使用して利用可能な属性を学べます。
|
3
|
+
// 既存の属性の説明をホバーして表示します。
|
4
|
+
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
|
5
|
+
"version": "0.2.0",
|
6
|
+
"configurations": [
|
7
|
+
{
|
8
|
+
"name": "Debug Local File",
|
9
|
+
"type": "Ruby",
|
10
|
+
"request": "launch",
|
11
|
+
"cwd": "${workspaceRoot}/lib/template/",
|
12
|
+
"program": "${workspaceRoot}/lib/template/start.rb"
|
13
|
+
}
|
14
|
+
]
|
15
|
+
}
|
data/README.md
CHANGED
@@ -24,16 +24,41 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
create_browser_app [options]
|
26
26
|
-d, --dir dir_name application directory
|
27
|
+
-a, --app app_name application name
|
27
28
|
-h, --help command help
|
28
29
|
|
29
30
|
|
30
|
-
|
31
|
+
## Create app templat
|
31
32
|
|
32
|
-
$ create_browser_app -d ~/test/
|
33
|
+
$ create_browser_app -d ~/test/ -a MyApp
|
33
34
|
|
34
|
-
|
35
|
+
## add application code
|
36
|
+
$ cd ~/test/
|
37
|
+
$ vi my_app.rb
|
35
38
|
|
36
|
-
|
39
|
+
```ruby
|
40
|
+
class MyApp < AppMainBase
|
41
|
+
def start(argv)
|
42
|
+
super
|
43
|
+
# add application code
|
44
|
+
end
|
45
|
+
|
46
|
+
def stop()
|
47
|
+
super
|
48
|
+
# add application code
|
49
|
+
end
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
ui application sample
|
54
|
+
|
55
|
+
index.html
|
56
|
+
css/index.css
|
57
|
+
js/main.js
|
58
|
+
|
59
|
+
## Start application
|
60
|
+
|
61
|
+
$ cd ~/test/
|
37
62
|
$ ruby start.rb
|
38
63
|
|
39
64
|
## Development
|
data/bin/create_browser_app.rb
CHANGED
@@ -7,6 +7,7 @@ require "optparse"
|
|
7
7
|
opt = OptionParser.new
|
8
8
|
o = {}
|
9
9
|
opt.on("-d dir_name", "--dir dir_name", "application directory") { |v| o[:dir] = v }
|
10
|
+
opt.on("-a app_name", "--app app_name", "application name") { |v| o[:app] = v }
|
10
11
|
opt.on("-h", "--help", "command help") { puts opt; exit }
|
11
12
|
begin
|
12
13
|
opt.parse!(ARGV)
|
@@ -20,4 +21,4 @@ if o[:dir] == nil
|
|
20
21
|
exit
|
21
22
|
end
|
22
23
|
|
23
|
-
BrowserAppBase.create o
|
24
|
+
BrowserAppBase.create o
|
data/lib/browser_app_base.rb
CHANGED
@@ -1,20 +1,51 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "browser_app_base/version"
|
4
|
-
|
5
4
|
require "fileutils"
|
6
5
|
|
7
6
|
module BrowserAppBase
|
8
7
|
class Error < StandardError; end
|
9
8
|
|
10
|
-
|
9
|
+
def self.get_app_file(app)
|
10
|
+
app_file_name = ""
|
11
|
+
app.each_char do |s|
|
12
|
+
if s =~ /[A-Z]/
|
13
|
+
app_file_name += "_" if app_file_name.size != 0
|
14
|
+
app_file_name += s.downcase
|
15
|
+
else
|
16
|
+
app_file_name += s
|
17
|
+
end
|
18
|
+
end
|
19
|
+
return app_file_name + ".rb"
|
20
|
+
end
|
11
21
|
|
12
|
-
def self.create(
|
22
|
+
def self.create(arg)
|
23
|
+
dir = arg[:dir]
|
24
|
+
app = arg[:app]
|
13
25
|
puts "create application base #{dir}"
|
14
26
|
|
15
27
|
FileUtils.mkdir_p dir
|
16
28
|
|
17
29
|
path = File.dirname(File.expand_path(__FILE__))
|
18
|
-
|
30
|
+
Dir.glob("#{path}/template/*") do |f|
|
31
|
+
puts "#{f} => #{dir}"
|
32
|
+
FileUtils.cp_r f, "#{dir}/"
|
33
|
+
end
|
34
|
+
|
35
|
+
if app
|
36
|
+
app_file = get_app_file(app)
|
37
|
+
|
38
|
+
load_app = <<"EOS"
|
39
|
+
require '#{app_file}'
|
40
|
+
$app = MyApp.new
|
41
|
+
EOS
|
42
|
+
|
43
|
+
File.open("#{dir}/app_load.rb", "w") do |f|
|
44
|
+
f.write load_app
|
45
|
+
end
|
46
|
+
|
47
|
+
puts "create #{app_file}"
|
48
|
+
FileUtils.cp "#{dir}/my_app_sample.rb", "#{dir}/#{app_file}"
|
49
|
+
end
|
19
50
|
end
|
20
51
|
end
|
data/lib/template/config.ru
CHANGED
data/lib/template/css/index.css
CHANGED
@@ -50,3 +50,28 @@ textarea.long {
|
|
50
50
|
height: 50vh;
|
51
51
|
}
|
52
52
|
|
53
|
+
.ui-autocomplete {
|
54
|
+
max-height: 200px;
|
55
|
+
max-width: 500px;
|
56
|
+
overflow-y: auto;
|
57
|
+
overflow-x: hidden;
|
58
|
+
padding-right: 20px;
|
59
|
+
}
|
60
|
+
#jquery-ui-autocomplete label {
|
61
|
+
float: left;
|
62
|
+
margin-right: 0.5em;
|
63
|
+
color: black;
|
64
|
+
font-size: 15px;
|
65
|
+
}
|
66
|
+
|
67
|
+
.ui-dialog {
|
68
|
+
position: absolute;
|
69
|
+
top: 0;
|
70
|
+
left: 0;
|
71
|
+
padding: .2em;
|
72
|
+
outline: 0;
|
73
|
+
}
|
74
|
+
|
75
|
+
.long {
|
76
|
+
width: 90%;
|
77
|
+
}
|
data/lib/template/index.html
CHANGED
@@ -11,8 +11,8 @@
|
|
11
11
|
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
|
12
12
|
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
|
13
13
|
|
14
|
-
<script src="http://localhost:
|
15
|
-
<link rel="stylesheet" href="http://localhost:
|
14
|
+
<script src="http://localhost:62857/js/main.js"></script>
|
15
|
+
<link rel="stylesheet" href="http://localhost:62857/css/index.css" type="text/css">
|
16
16
|
</head>
|
17
17
|
|
18
18
|
<body>
|
@@ -28,11 +28,28 @@
|
|
28
28
|
</td>
|
29
29
|
</tr>
|
30
30
|
</table>
|
31
|
-
<input class="inarea" type="text" value="ファイル名を入力" name="search_str" id="search_str">
|
32
|
-
<input class="inarea" type="file" id="upFile" name="upFile" value="upFile"><br>
|
33
|
-
<input type="button" value="確認" onclick="dispFile()">
|
34
31
|
|
35
|
-
<
|
32
|
+
<div id="dialog1" style="display:none;">
|
33
|
+
<input class="inarea" type="text" name="search_str" id="search_str">
|
34
|
+
</div>
|
35
|
+
<table>
|
36
|
+
<tr>
|
37
|
+
<td class="long"><input class="inarea" type="text" id="upFile" name="upFile"></td>
|
38
|
+
<td><input type="button" id="select_file" value="ファイル選択" /></td>
|
39
|
+
</tr>
|
40
|
+
</table>
|
41
|
+
|
42
|
+
<div id="dialog2" style="display:none;">
|
43
|
+
<input class="inarea" type="text" name="search_str2" id="search_str2">
|
44
|
+
</div>
|
45
|
+
<table>
|
46
|
+
<tr>
|
47
|
+
<td class="long"><input class="inarea" type="text" id="upDir" name="upDir"></td>
|
48
|
+
<td><input type="button" id="select_dir" value="フォルダ選択" /></td>
|
49
|
+
</tr>
|
50
|
+
</table>
|
51
|
+
|
52
|
+
<textarea name="log" id="log" class="outarea"></textarea><br />
|
36
53
|
|
37
54
|
</body>
|
38
55
|
|
data/lib/template/js/main.js
CHANGED
@@ -13,9 +13,6 @@ function server_connect(url) {
|
|
13
13
|
if (evt.data.match(/^startup:/)) {
|
14
14
|
file_name = evt.data.replace(/^startup:/, "");
|
15
15
|
//alert(file_name);
|
16
|
-
var fs = new ActiveXObject("Scripting.FileSystemObject");
|
17
|
-
var file = fs.CreateTextFile(file_name);
|
18
|
-
file.Close();
|
19
16
|
} else {
|
20
17
|
var log = $('#log').val() + evt.data + "\n";
|
21
18
|
$('#log').val(log);
|
@@ -24,7 +21,7 @@ function server_connect(url) {
|
|
24
21
|
psconsole[0].scrollHeight - psconsole.height()
|
25
22
|
);
|
26
23
|
}
|
27
|
-
|
24
|
+
|
28
25
|
};
|
29
26
|
ws.onclose = function () {
|
30
27
|
alert("アプリケーションが終了しました!!");
|
@@ -41,11 +38,20 @@ function send_message(msg) {
|
|
41
38
|
}
|
42
39
|
}
|
43
40
|
|
44
|
-
function autocomp(id,
|
41
|
+
function autocomp(id, file_kind) {
|
45
42
|
$("#" + id).autocomplete({
|
43
|
+
autoFocus: true,
|
44
|
+
minLength: 0,
|
45
|
+
delay: 0,
|
46
|
+
select: function (event, ui) {
|
47
|
+
console.log(ui.item.value);
|
48
|
+
jQuery("#" + id).val(ui.item.value);
|
49
|
+
//jQuery(this).autocomplete("search", "");
|
50
|
+
$(this).keydown();
|
51
|
+
},
|
46
52
|
source: function (req, resp) {
|
47
53
|
$.ajax({
|
48
|
-
url:
|
54
|
+
url: "http://localhost:62857/search?path=" + $("#" + id).val() + "&kind=" + file_kind,
|
49
55
|
type: "GET",
|
50
56
|
cache: false,
|
51
57
|
dataType: "json",
|
@@ -61,6 +67,42 @@ function autocomp(id, url) {
|
|
61
67
|
});
|
62
68
|
|
63
69
|
}
|
70
|
+
}).focus(function () {
|
71
|
+
console.log("forcus");
|
72
|
+
//jQuery(this).autocomplete("search", "");
|
73
|
+
$(this).keydown();
|
74
|
+
});
|
75
|
+
}
|
76
|
+
|
77
|
+
function select_file_dialog(search_id, file_kind, dialog_id, select_file, file_name) {
|
78
|
+
console.log("select_file_dialog select_file=" + select_file);
|
79
|
+
$("#" + select_file).click(function () {
|
80
|
+
autocomp(search_id, file_kind);
|
81
|
+
console.log("open dialog dialog_id=", dialog_id);
|
82
|
+
$(".ui-autocomplete").css("z-index", 1000);
|
83
|
+
$("#" + search_id).val("/");
|
84
|
+
$("#" + dialog_id).dialog({
|
85
|
+
modal: true
|
86
|
+
, show: "slide" //表示時のアニメーション
|
87
|
+
, hide: "explode" //閉じた時のアニメーション
|
88
|
+
, title: "Select File" //ダイアログのタイトル
|
89
|
+
, width: 580 //ダイアログの横幅
|
90
|
+
, height: 400 //ダイアログの高さ
|
91
|
+
, resizable: false //リサイズ不可
|
92
|
+
, closeOnEscape: false //[ESC]キーで閉じられなくする
|
93
|
+
, draggable: false //ダイアログの移動を不可に
|
94
|
+
, buttons: {
|
95
|
+
"OK": function () { //OKボタン
|
96
|
+
$("#" + file_name).val($("#" + search_id).val());
|
97
|
+
$(this).dialog("close");
|
98
|
+
$("#" + search_id).autocomplete("destroy");
|
99
|
+
},
|
100
|
+
"Cancel": function () { //Cancelボタン
|
101
|
+
$(this).dialog("close");
|
102
|
+
$("#" + search_id).autocomplete("destroy");
|
103
|
+
}
|
104
|
+
}
|
105
|
+
});
|
64
106
|
});
|
65
107
|
}
|
66
108
|
|
@@ -72,22 +114,6 @@ function get_dirname(path) {
|
|
72
114
|
return result.replace(/\//g, "\\");
|
73
115
|
}
|
74
116
|
|
75
|
-
function select_file(id) {
|
76
|
-
var file = $("#" + id).val();
|
77
|
-
var dir = get_dirname(file);
|
78
|
-
if (dir != "") {
|
79
|
-
dir = dir + "\\*.*";
|
80
|
-
} else {
|
81
|
-
dir = "c:\\*.*";
|
82
|
-
}
|
83
|
-
var path = "";
|
84
|
-
//alert(dir);
|
85
|
-
//path = HtmlDlgHelper.openfiledlg(dir,"*.db","database(*.db)|*.db|all(*.*)|*.*|Text file(*.txt)|*.txt|");
|
86
|
-
path = HtmlDlgHelper.openfiledlg(dir, "", "all(*.*)|*.*|Text file(*.txt)|*.txt|");
|
87
|
-
$("#" + id).val(path);
|
88
|
-
return (path);
|
89
|
-
}
|
90
|
-
|
91
117
|
function dispFile() {
|
92
118
|
var fName = $("#upFile").val();
|
93
119
|
alert('選択したファイルの値は' + fName + 'です');
|
@@ -96,10 +122,10 @@ function dispFile() {
|
|
96
122
|
// 起動時の処理
|
97
123
|
$(document).ready(function () {
|
98
124
|
// サーバに接続
|
99
|
-
server_connect("ws://localhost:
|
125
|
+
server_connect("ws://localhost:62857/wsserver")
|
100
126
|
// ウインドウサイズ
|
101
|
-
var width =
|
102
|
-
var height =
|
127
|
+
var width = 800;
|
128
|
+
var height = 600;
|
103
129
|
// ウインドウの位置
|
104
130
|
$(function () {
|
105
131
|
window.resizeTo(width, height);
|
@@ -107,23 +133,18 @@ $(document).ready(function () {
|
|
107
133
|
//window.moveTo(0,0);
|
108
134
|
});
|
109
135
|
|
110
|
-
// オートコンプリート設定
|
111
|
-
var getUrl = function () {
|
112
|
-
var url = "http://localhost:61820/search?path=" + $("#search_str").val();
|
113
|
-
return url;
|
114
|
-
};
|
115
|
-
autocomp("search_str", getUrl);
|
116
|
-
|
117
136
|
// ハンドラ登録
|
118
|
-
$("#
|
119
|
-
|
137
|
+
$("#stop").click(function () {
|
138
|
+
send_message("stop");
|
120
139
|
});
|
140
|
+
|
121
141
|
$("#exec").click(function () {
|
122
142
|
send_message("exec:" + $("#upFile").val());
|
123
143
|
});
|
124
|
-
|
125
|
-
|
126
|
-
|
144
|
+
|
145
|
+
select_file_dialog("search_str", "file", "dialog1", "select_file", "upFile");
|
146
|
+
|
147
|
+
select_file_dialog("search_str2", "dir", "dialog2", "select_dir", "upDir");
|
127
148
|
|
128
149
|
});
|
129
150
|
|
@@ -1,13 +1,15 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
def initialize
|
4
|
-
@aboet = false
|
5
|
-
end
|
2
|
+
require "server_app_base.rb"
|
6
3
|
|
7
|
-
|
4
|
+
class MyApp < AppMainBase
|
5
|
+
def start(argv)
|
6
|
+
super
|
8
7
|
begin
|
9
8
|
@abort = false
|
10
|
-
puts
|
9
|
+
puts argv
|
10
|
+
argv.each do |v|
|
11
|
+
yield v if block_given?
|
12
|
+
end
|
11
13
|
while true
|
12
14
|
yield Time.now.to_s if block_given?
|
13
15
|
sleep 1
|
@@ -20,6 +22,6 @@ class AppMain
|
|
20
22
|
end
|
21
23
|
|
22
24
|
def stop()
|
23
|
-
|
25
|
+
super
|
24
26
|
end
|
25
27
|
end
|
data/lib/template/server.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "json"
|
2
|
+
require "kconv"
|
3
3
|
|
4
4
|
class Search < Sinatra::Base
|
5
5
|
helpers Sinatra::Streaming
|
6
|
-
get
|
6
|
+
get "" do
|
7
7
|
q_hash = {}
|
8
8
|
puts request.query_string
|
9
9
|
request.query_string.split("&").each do |q|
|
@@ -14,27 +14,44 @@ class Search < Sinatra::Base
|
|
14
14
|
q_hash[work[0]] = ""
|
15
15
|
end
|
16
16
|
end
|
17
|
-
str = q_hash["path"].gsub(/\\/,"/")
|
17
|
+
str = q_hash["path"].gsub(/\\/, "/")
|
18
18
|
puts "str=#{str}"
|
19
|
+
kind = q_hash["kind"].gsub(/\\/, "/")
|
20
|
+
puts "kind=#{kind}"
|
19
21
|
res = []
|
20
22
|
str = str.gsub(/\\/, "/")
|
21
23
|
dir = File.dirname(str)
|
22
|
-
dir = "c:/" if dir == nil
|
23
24
|
file = File.basename(str)
|
24
|
-
|
25
|
+
puts "dir=#{dir}"
|
26
|
+
puts "file=#{file}"
|
27
|
+
|
28
|
+
kernel = Facter.value(:kernel)
|
29
|
+
if kernel == "windows"
|
30
|
+
dir = "c:/" if dir == nil
|
31
|
+
dir = "c:/" if dir == "/"
|
32
|
+
elsif kernel == "Linux"
|
33
|
+
dir = "/" if dir == nil
|
34
|
+
else
|
35
|
+
dir = "c:/" if dir == nil
|
36
|
+
dir = "c:/" if dir == "/"
|
37
|
+
end
|
38
|
+
|
25
39
|
path = "#{dir}/#{file}"
|
26
|
-
if File.
|
40
|
+
if File.directory?(path)
|
27
41
|
path = path + "/*"
|
28
42
|
else
|
29
43
|
path = path + "*"
|
30
44
|
end
|
45
|
+
path.gsub!(/[\/]+/, "/")
|
31
46
|
puts path
|
32
|
-
Dir.glob(path).each do |file|
|
47
|
+
Dir.glob(path, File::FNM_DOTMATCH).each do |file|
|
33
48
|
data = {}
|
34
|
-
|
35
|
-
|
49
|
+
next if File.basename(file) == "."
|
50
|
+
next if kind == "dir" and !File.directory?(file)
|
51
|
+
data["label"] = File.expand_path(file)
|
52
|
+
data["value"] = File.expand_path(file)
|
36
53
|
res.push data
|
37
54
|
end
|
38
|
-
JSON.generate res
|
55
|
+
JSON.generate res.sort { |a, b| a["value"] <=> b["value"] }
|
39
56
|
end
|
40
57
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
class AppMainBase
|
3
|
+
def initialize
|
4
|
+
@aboet = false
|
5
|
+
@exec = false
|
6
|
+
@suspend = false
|
7
|
+
end
|
8
|
+
|
9
|
+
def start(argv)
|
10
|
+
@exec = true
|
11
|
+
end
|
12
|
+
|
13
|
+
def stop()
|
14
|
+
@abort = true
|
15
|
+
@exec = false
|
16
|
+
end
|
17
|
+
|
18
|
+
def suspend()
|
19
|
+
@suspend = true
|
20
|
+
end
|
21
|
+
|
22
|
+
def resume()
|
23
|
+
@suspend = false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
require "app_load.rb"
|
data/lib/template/start.rb
CHANGED
@@ -22,19 +22,19 @@ port = get_unused_port
|
|
22
22
|
puts "port=#{port}"
|
23
23
|
|
24
24
|
# config.ruの編集
|
25
|
-
buf = File.
|
25
|
+
buf = File.binread("config.ru").toutf8
|
26
26
|
buf.gsub!(/port [0-9]+/, "port #{port}")
|
27
|
-
File.
|
27
|
+
File.binwrite("config.ru", buf)
|
28
28
|
|
29
29
|
# main.jsの編集
|
30
|
-
buf = File.
|
30
|
+
buf = File.binread("js/main.js").toutf8
|
31
31
|
buf.gsub!(/localhost:[0-9]+\//, "localhost:#{port}/")
|
32
|
-
File.
|
32
|
+
File.binwrite("js/main.js", buf)
|
33
33
|
|
34
34
|
# index.htaの編集
|
35
|
-
buf = File.
|
35
|
+
buf = File.binread("index.html").toutf8
|
36
36
|
buf.gsub!(/localhost:[0-9]+\//, "localhost:#{port}/")
|
37
|
-
File.
|
37
|
+
File.binwrite("index.html", buf)
|
38
38
|
|
39
39
|
Thread.start {
|
40
40
|
puts "start browser"
|
data/lib/template/wsserver.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require "./
|
2
|
-
$app = AppMain.new
|
1
|
+
require "./server_app_base"
|
3
2
|
|
4
3
|
class WsServer < Sinatra::Base
|
5
4
|
$ws_list = []
|
@@ -15,9 +14,9 @@ class WsServer < Sinatra::Base
|
|
15
14
|
ws.onmessage do |msg|
|
16
15
|
puts msg
|
17
16
|
if msg =~ /^exec:/
|
18
|
-
|
17
|
+
argv = msg.gsub(/^exec:/, "")
|
19
18
|
Thread.new {
|
20
|
-
$app.start
|
19
|
+
$app.start(argv.split(",")) do |out|
|
21
20
|
ws.send(out)
|
22
21
|
end
|
23
22
|
}
|
@@ -25,6 +24,13 @@ class WsServer < Sinatra::Base
|
|
25
24
|
if msg =~ /^stop/
|
26
25
|
$app.stop
|
27
26
|
end
|
27
|
+
if msg =~ /^suspend/
|
28
|
+
$app.suspend
|
29
|
+
end
|
30
|
+
if msg =~ /^resume/
|
31
|
+
$app.resume
|
32
|
+
end
|
33
|
+
|
28
34
|
if msg == "exit"
|
29
35
|
unless ENV["OCRA"] == "true"
|
30
36
|
halt
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browser_app_base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- masataka kuwayama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -104,6 +104,7 @@ extra_rdoc_files: []
|
|
104
104
|
files:
|
105
105
|
- ".gitignore"
|
106
106
|
- ".rspec"
|
107
|
+
- ".vscode/launch.json"
|
107
108
|
- Gemfile
|
108
109
|
- LICENSE.txt
|
109
110
|
- README.md
|
@@ -112,13 +113,15 @@ files:
|
|
112
113
|
- browser_app_base.gemspec
|
113
114
|
- lib/browser_app_base.rb
|
114
115
|
- lib/browser_app_base/version.rb
|
116
|
+
- lib/template/app_load.rb
|
115
117
|
- lib/template/config.ru
|
116
118
|
- lib/template/config/browser.json
|
117
119
|
- lib/template/css/index.css
|
118
120
|
- lib/template/index.html
|
119
121
|
- lib/template/js/main.js
|
122
|
+
- lib/template/my_app_sample.rb
|
120
123
|
- lib/template/server.rb
|
121
|
-
- lib/template/
|
124
|
+
- lib/template/server_app_base.rb
|
122
125
|
- lib/template/start.rb
|
123
126
|
- lib/template/wsserver.rb
|
124
127
|
homepage: https://github.com/kuwayama1971/BrowserAppBase
|