procon_bypass_man-web 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.node-version +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/bin/pbm_web +5 -0
- data/lib/procon_bypass_man/web/configuration.rb +40 -0
- data/lib/procon_bypass_man/web/db.rb +4 -4
- data/lib/procon_bypass_man/web/migration/002_insert_default_settings_rows.sql +3 -0
- data/lib/procon_bypass_man/web/models/setting.rb +1 -1
- data/lib/procon_bypass_man/web/public/bundle.js +1 -1
- data/lib/procon_bypass_man/web/server.rb +12 -2
- data/lib/procon_bypass_man/web/setting_parser/layer.rb +72 -0
- data/lib/procon_bypass_man/web/setting_parser/top_level_layer.rb +109 -0
- data/lib/procon_bypass_man/web/setting_parser.rb +4 -152
- data/lib/procon_bypass_man/web/storage.rb +4 -4
- data/lib/procon_bypass_man/web/version.rb +1 -1
- data/lib/procon_bypass_man/web.rb +14 -4
- data/src/components/button_setting.tsx +17 -34
- data/src/components/buttons_modal.tsx +15 -25
- data/src/components/macro_settings.tsx +6 -12
- data/src/hooks/useModal.ts +37 -0
- data/src/pages/buttons_setting_page.tsx +8 -18
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d69459407ff4abf005338cd5447a8a2a6df4bdb240c2273d85176e72cfce349b
|
4
|
+
data.tar.gz: a544b0c479257a03fee1d25634a4acdd9c3455e62664e5e0ce1ff7aceb333a45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 100a91a2309523d7cce59f02cd41a18c02120200fdc02489fa093157a103b37a5f2556c710215f1e4784200e0c08bf628ed4713799bbbf74b25e83e3b9024cd2
|
7
|
+
data.tar.gz: ef4ec836a6b1ccbb8a07c214b00ff41888da89656016cae8c6ed2806d5c613c3c892bc4ffc56830965ed3546f4d417dcf79839da495b010abd724ebac7f651f7
|
data/.node-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
16.13.0
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -28,8 +28,11 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
28
28
|
### 開発用のサーバを起動する
|
29
29
|
`bundle exec foreman s`
|
30
30
|
|
31
|
-
|
31
|
+
## How to Release
|
32
32
|
* `yarn run release-build` を実行してgit commit
|
33
|
+
* `lib/procon_bypass_man/web/version.rb` をインクリメント
|
34
|
+
* `CHANGELOG.md` に追記
|
35
|
+
* `bundle exec rake release`
|
33
36
|
|
34
37
|
## TODO
|
35
38
|
* server
|
data/bin/pbm_web
CHANGED
@@ -4,4 +4,9 @@
|
|
4
4
|
require "bundler/setup"
|
5
5
|
require "procon_bypass_man/web"
|
6
6
|
|
7
|
+
ProconBypassMan::Web.configure do |config|
|
8
|
+
config.root = File.expand_path('..', __dir__).freeze
|
9
|
+
# config.logger = Logger.new("#{ProconBypassMan::Web.root}/web.log", 1, 1024 * 1024 * 10)
|
10
|
+
end
|
11
|
+
|
7
12
|
ProconBypassMan::Web::Server.start
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
module Web
|
3
|
+
class Configuration
|
4
|
+
module ClassAttributes
|
5
|
+
# @return [Logger]
|
6
|
+
def logger
|
7
|
+
config.logger
|
8
|
+
end
|
9
|
+
|
10
|
+
# @return [String]
|
11
|
+
def root
|
12
|
+
config.root
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Logger]
|
17
|
+
def logger
|
18
|
+
@logger || Logger.new(nil)
|
19
|
+
end
|
20
|
+
|
21
|
+
def logger=(logger)
|
22
|
+
@logger = logger
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [String]
|
26
|
+
def root
|
27
|
+
@root || File.expand_path('../..', __dir__).freeze
|
28
|
+
end
|
29
|
+
|
30
|
+
def root=(path)
|
31
|
+
@root = path
|
32
|
+
end
|
33
|
+
|
34
|
+
# @return [String]
|
35
|
+
def db_path
|
36
|
+
@db_path ||= ENV["DB_PATH"] || File.join(root, "pbm_web.db")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -3,15 +3,15 @@ module ProconBypassMan
|
|
3
3
|
class Db
|
4
4
|
def self.db
|
5
5
|
# TODO connection cache
|
6
|
-
SQLite3::Database.new(ProconBypassMan::Web.config
|
6
|
+
SQLite3::Database.new(ProconBypassMan::Web.config.db_path)
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.recreate!
|
10
|
-
FileUtils.rm_rf(ProconBypassMan::Web.config
|
11
|
-
SQLite3::Database.new(ProconBypassMan::Web.config
|
10
|
+
FileUtils.rm_rf(ProconBypassMan::Web.config.db_path)
|
11
|
+
SQLite3::Database.new(ProconBypassMan::Web.config.db_path)
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.migrate_if_pending_migration(migrations_path: File.join(ProconBypassMan::Web.
|
14
|
+
def self.migrate_if_pending_migration(migrations_path: File.join(ProconBypassMan::Web.gem_root, 'lib', 'procon_bypass_man/web', 'migration', "/*.sql"))
|
15
15
|
db.execute <<~SQL
|
16
16
|
create table if not exists "schema_migrations" ("version" varchar not null primary key)
|
17
17
|
SQL
|
@@ -8,7 +8,7 @@ module ProconBypassMan
|
|
8
8
|
|
9
9
|
attr_accessor(*column_names)
|
10
10
|
|
11
|
-
def self.
|
11
|
+
def self.find_or_create(*)
|
12
12
|
rows = db.execute("select * from #{table_name}")
|
13
13
|
if rows.size.zero?
|
14
14
|
db.execute("insert into #{table_name} (#{column_names.join(", ")}) values (?, ?)", ['', ''])
|