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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ced49c040a2859f7fe714c4df7f08ce0d511f255d54413dd15cefd3f055286ad
4
- data.tar.gz: 3516d63341da7e7f407151f9c44709c634216766b2c5256bb035c43d99587ecb
3
+ metadata.gz: d69459407ff4abf005338cd5447a8a2a6df4bdb240c2273d85176e72cfce349b
4
+ data.tar.gz: a544b0c479257a03fee1d25634a4acdd9c3455e62664e5e0ce1ff7aceb333a45
5
5
  SHA512:
6
- metadata.gz: cfe6ee8972cda2d2b17673f6250402b097b70041242bc6423b35a9720c9dd9b1f80d7fa2ee5749180d02370f0b745d8fc731b226060d48b3964a30c5c37519f5
7
- data.tar.gz: 6bffd759f6645cebd10e0885081990c4e82981fa07aff575f6d9fbcdc5fbe1d6055b89957b26f3ebdb90460fb76d7509bfc19dc9efe6ef8c980b1424602b0431
6
+ metadata.gz: 100a91a2309523d7cce59f02cd41a18c02120200fdc02489fa093157a103b37a5f2556c710215f1e4784200e0c08bf628ed4713799bbbf74b25e83e3b9024cd2
7
+ data.tar.gz: ef4ec836a6b1ccbb8a07c214b00ff41888da89656016cae8c6ed2806d5c613c3c892bc4ffc56830965ed3546f4d417dcf79839da495b010abd724ebac7f651f7
data/.node-version ADDED
@@ -0,0 +1 @@
1
+ 16.13.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [0.1.2] - 2021-
2
+ - 設定ファイルに書いている未定義のDSLがあった時に無視する
3
+
1
4
  ## [0.1.1] - 2021-10-16
2
5
  - bugfix setting edtior
3
6
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- procon_bypass_man-web (0.1.1)
4
+ procon_bypass_man-web (0.1.2)
5
5
  sinatra
6
6
  sqlite3
7
7
  webrick
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
- ### frontend側のビルド方法
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[:db_path])
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[:db_path])
11
- SQLite3::Database.new(ProconBypassMan::Web.config[:db_path])
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.root, 'lib', 'procon_bypass_man/web', 'migration', "/*.sql"))
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
@@ -0,0 +1,3 @@
1
+ insert into settings (root_path, setting_path) values (
2
+ "/usr/share/pbm/current", "/usr/share/pbm/current/setting.yml"
3
+ )
@@ -8,7 +8,7 @@ module ProconBypassMan
8
8
 
9
9
  attr_accessor(*column_names)
10
10
 
11
- def self.find_or_create_by(*)
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 (?, ?)", ['', ''])