arxutils_sqlite3 0.1.48 → 0.1.50

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -2
  3. data/.rubocop_todo.yml +209 -109
  4. data/Gemfile +13 -16
  5. data/Gemfile.lock +112 -0
  6. data/Rakefile +12 -58
  7. data/arxutils_sqlite3.gemspec +4 -4
  8. data/config/.gitignore +1 -0
  9. data/config/setting.yml +2 -0
  10. data/exe/arxutils_sqlite3 +38 -29
  11. data/lib/arxutils_sqlite3/arx.rb +3 -3
  12. data/lib/arxutils_sqlite3/cli.rb +48 -27
  13. data/lib/arxutils_sqlite3/config.rb +96 -72
  14. data/lib/arxutils_sqlite3/dbutil/dbconnect.rb +4 -26
  15. data/lib/arxutils_sqlite3/dbutil.rb +0 -1
  16. data/lib/arxutils_sqlite3/hier.rb +3 -3
  17. data/lib/arxutils_sqlite3/migrate.rb +59 -53
  18. data/lib/arxutils_sqlite3/util.rb +2 -1
  19. data/lib/arxutils_sqlite3/version.rb +1 -1
  20. data/lib/arxutils_sqlite3.rb +2 -1
  21. data/lib/arxutils_sqlite3_rake_task.rb +68 -0
  22. data/lib/{arxutils_sqlite3/dbutil/dbrelation.rb → dbacrecord.rb} +0 -0
  23. data/lib/template/{relation/relation.tmpl → acrecord/acrecord.tmpl} +1 -1
  24. data/lib/template/{relation/relation_count.tmpl → acrecord/acrecord_count.tmpl} +0 -0
  25. data/lib/template/{relation/relation_current.tmpl → acrecord/acrecord_current.tmpl} +0 -0
  26. data/lib/template/{relation/relation_invalid.tmpl → acrecord/acrecord_invalid.tmpl} +0 -0
  27. data/lib/template/{relation → acrecord}/base.tmpl +0 -0
  28. data/lib/template/{relation → acrecord}/current.tmpl +0 -0
  29. data/lib/template/{relation → acrecord}/db_scheme/db_scheme.yml +0 -0
  30. data/lib/template/acrecord/db_scheme/db_scheme.yml.sample +48 -0
  31. data/lib/template/{relation/db_scheme/dbsetup.rb → acrecord/db_scheme/dbsetup.tmpl} +2 -2
  32. data/lib/template/acrecord/db_scheme/opts.rb.sample +7 -0
  33. data/lib/template/acrecord/db_scheme/opts.tmpl +7 -0
  34. data/lib/template/{relation → acrecord}/invalid.tmpl +0 -0
  35. data/lib/template/{relation → acrecord}/noitem.tmpl +0 -0
  36. metadata +30 -26
  37. data/LICENSE.txt +0 -21
  38. data/lib/template/relation/db_scheme/opts.rb +0 -8
@@ -0,0 +1,68 @@
1
+ # Defining a task called default that depends on the tasks setup, makeconfig, migrate, and acr.
2
+ require "arxutils_sqlite3"
3
+ config = Arxutils_Sqlite3::Config.new
4
+
5
+ klass = nil
6
+ setting = config.load_setting_yaml_file
7
+ klass = setting[:klass]
8
+
9
+ desc "setup copy_db_scheme copy_opts makeconfig make_migrate_script migrate acr"
10
+ task default: %w[setup copy_db_scheme copy_opts makeconfig make_migrate_script migrate acr]
11
+
12
+ desc "delete setup copy_db_scheme copy_opts makeconfig make_migrate_script migrate acr"
13
+ task bootstrap: %w[delete setup copy_db_scheme copy_opts makeconfig make_migrate_script migrate acr]
14
+
15
+ desc "migrate acr"
16
+ task ma: %w[migrate acr]
17
+
18
+ desc "delete_db"
19
+ task b: %w[delete_db]
20
+
21
+ # コマンドラインで指定したクラス名を含むオプション指定用ハッシュの定義を含むRubyスクリ
22
+ # プトファイルの生成
23
+ desc "produce setting.yml, db_scheme.yml.sample and opts.rb.sample with class name #{klass}"
24
+ task :setup do
25
+ sh "bundle exec arxutils_sqlite3 --cmd=s --klass=#{klass}"
26
+ end
27
+
28
+ desc "copy from db_scheme.yml.sample to db_scheme.yml"
29
+ task :copy_db_scheme do
30
+ sh "bundle exec arxutils_sqlite3 --cmd=cds"
31
+ end
32
+
33
+ desc "copy from opts.rb.sample to opts.rb"
34
+ task :copy_opts do
35
+ sh "bundle exec arxutils_sqlite3 --cmd=co"
36
+ end
37
+
38
+ # DB構成情報の生成
39
+ desc "produce sqlite3.yml"
40
+ task :makeconfig do
41
+ sh "bundle exec arxutils_sqlite3 --cmd=c"
42
+ end
43
+
44
+ # マイグレート用スクリプトファイルの生成
45
+ desc "produce migration scripts"
46
+ task :make_migrate_script do
47
+ sh "bundle exec arxutils_sqlite3 --cmd=f --yaml=config/db_scheme.yml"
48
+ end
49
+ # マイグレートの実行
50
+ desc "execute migration"
51
+ task :migrate do
52
+ sh "bundle exec arxutils_sqlite3 --cmd=m"
53
+ end
54
+
55
+ desc "call ActiveRecord instance method"
56
+ task :acr do
57
+ sh "bundle exec arxutils_sqlite3 --cmd=a"
58
+ end
59
+
60
+ desc "delete configuration files adn migration scripts and db files"
61
+ task :delete do
62
+ sh "bundle exec arxutils_sqlite3 --cmd=d"
63
+ end
64
+
65
+ desc "delete db files"
66
+ task :delete_db do
67
+ sh "bundle exec arxutils_sqlite3 --cmd=b"
68
+ end
@@ -1,3 +1,3 @@
1
1
  class <%= @data[:classname] %> < ActiveRecord::Base
2
- <% @data[:relation].each do |x| %> <%= x %>
2
+ <% @data[:acrecord].each do |x| %> <%= x %>
3
3
  <% end %> end
File without changes
File without changes
@@ -0,0 +1,48 @@
1
+ ---
2
+ - :flist:
3
+ - noitem
4
+ :classname: Countdatetime
5
+ :classname_downcase: countdatetime
6
+ :items:
7
+ - - countdatetime
8
+ - datetime
9
+ - 'false'
10
+ :plural: countdatetimes
11
+ :ar_version: 6.0
12
+ - :flist:
13
+ - noitem
14
+ :classname: Evnb
15
+ :classname_downcase: evnb
16
+ :items:
17
+ - - time_id
18
+ - integer
19
+ - 'false'
20
+ - - ennb_id
21
+ - integer
22
+ - 'false'
23
+ :plural: evnbs
24
+ :ar_version: 6.0
25
+ - :flist:
26
+ - noitem
27
+ - invalid
28
+ - current
29
+ :classname: Ennblist
30
+ :classname_downcase: ennblist
31
+ :items:
32
+ - - stack
33
+ - string
34
+ - 'false'
35
+ - - notebook
36
+ - string
37
+ - 'false'
38
+ - - count
39
+ - integer
40
+ - 'false'
41
+ - - tag_count
42
+ - integer
43
+ - 'false'
44
+ - - start_datetime
45
+ - datetime
46
+ - 'false'
47
+ :plural: ennblists
48
+ :ar_version: 6.0
@@ -2,8 +2,8 @@ class Dbsetup
2
2
  def initialize(connect_time)
3
3
  @connect_time = connect_time
4
4
  @ct = <%= klass %>::Dbutil::Countdatetime.create( countdatetime: @connect_time )
5
- @hs_by_notebook = {}
6
- @hs_by_id = {}
5
+ @hs_by_notebook = Hash.new
6
+ @hs_by_id = Hash.new
7
7
  end
8
8
  =begin
9
9
  # 指定stack(文字列)にノートブック(文字列)、ノートブック数、タグ数を追加
@@ -0,0 +1,7 @@
1
+ @opts = {
2
+ acrecord: {
3
+ module: %w[Enop Dbutil],
4
+ filename: "dbacrecord.rb",
5
+ dir: "lib"
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ @opts = {
2
+ acrecord: {
3
+ module: %w[<%= klass %> Dbutil],
4
+ filename: "dbacrecord.rb",
5
+ dir: "lib"
6
+ }
7
+ }
File without changes
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arxutils_sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.48
4
+ version: 0.1.50
5
5
  platform: ruby
6
6
  authors:
7
7
  - yasuo kominami
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-13 00:00:00.000000000 Z
11
+ date: 2022-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '6.1'
41
41
  - !ruby/object:Gem::Dependency
42
- name: sqlite3
42
+ name: simpleoptparse
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: ykutils
56
+ name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: ykxutils
70
+ name: ykutils
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: simpleoptparse
84
+ name: ykxutils
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -109,33 +109,33 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rspec
112
+ name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '3.0'
117
+ version: '13.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '3.0'
124
+ version: '13.0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rake
126
+ name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '13.0'
131
+ version: '3.0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '13.0'
138
+ version: '3.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rubocop
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -206,14 +206,15 @@ files:
206
206
  - CHANGELOG.md
207
207
  - CODE_OF_CONDUCT.md
208
208
  - Gemfile
209
+ - Gemfile.lock
209
210
  - LICENSE
210
- - LICENSE.txt
211
211
  - README.md
212
212
  - Rakefile
213
213
  - arxutils_sqlite3.gemspec
214
214
  - bin/console
215
215
  - bin/setup
216
216
  - config/.gitignore
217
+ - config/setting.yml
217
218
  - exe/arxutils_sqlite3
218
219
  - lib/arxutils_sqlite3.rb
219
220
  - lib/arxutils_sqlite3/arx.rb
@@ -221,25 +222,28 @@ files:
221
222
  - lib/arxutils_sqlite3/config.rb
222
223
  - lib/arxutils_sqlite3/dbutil.rb
223
224
  - lib/arxutils_sqlite3/dbutil/dbconnect.rb
224
- - lib/arxutils_sqlite3/dbutil/dbrelation.rb
225
225
  - lib/arxutils_sqlite3/hier.rb
226
226
  - lib/arxutils_sqlite3/migrate.rb
227
227
  - lib/arxutils_sqlite3/transactstate.rb
228
228
  - lib/arxutils_sqlite3/util.rb
229
229
  - lib/arxutils_sqlite3/version.rb
230
+ - lib/arxutils_sqlite3_rake_task.rb
231
+ - lib/dbacrecord.rb
232
+ - lib/template/acrecord/acrecord.tmpl
233
+ - lib/template/acrecord/acrecord_count.tmpl
234
+ - lib/template/acrecord/acrecord_current.tmpl
235
+ - lib/template/acrecord/acrecord_invalid.tmpl
236
+ - lib/template/acrecord/base.tmpl
237
+ - lib/template/acrecord/current.tmpl
238
+ - lib/template/acrecord/db_scheme/db_scheme.yml
239
+ - lib/template/acrecord/db_scheme/db_scheme.yml.sample
240
+ - lib/template/acrecord/db_scheme/dbsetup.tmpl
241
+ - lib/template/acrecord/db_scheme/opts.rb.sample
242
+ - lib/template/acrecord/db_scheme/opts.tmpl
243
+ - lib/template/acrecord/invalid.tmpl
244
+ - lib/template/acrecord/noitem.tmpl
230
245
  - lib/template/config/mysql.tmpl
231
246
  - lib/template/config/sqlite3.tmpl
232
- - lib/template/relation/base.tmpl
233
- - lib/template/relation/current.tmpl
234
- - lib/template/relation/db_scheme/db_scheme.yml
235
- - lib/template/relation/db_scheme/dbsetup.rb
236
- - lib/template/relation/db_scheme/opts.rb
237
- - lib/template/relation/invalid.tmpl
238
- - lib/template/relation/noitem.tmpl
239
- - lib/template/relation/relation.tmpl
240
- - lib/template/relation/relation_count.tmpl
241
- - lib/template/relation/relation_current.tmpl
242
- - lib/template/relation/relation_invalid.tmpl
243
247
  homepage: https://ykominami.github.io/arxutils_sqlite3/
244
248
  licenses:
245
249
  - MIT
@@ -254,7 +258,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
254
258
  requirements:
255
259
  - - ">="
256
260
  - !ruby/object:Gem::Version
257
- version: 2.5.0
261
+ version: 2.6.0
258
262
  required_rubygems_version: !ruby/object:Gem::Requirement
259
263
  requirements:
260
264
  - - ">="
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2022 yasuo kominami
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,8 +0,0 @@
1
- @opts = {
2
- db_dir: Arxutils_Sqlite3::Config::DB_DIR,
3
- relation: {
4
- module: %w[<%= klass %> Dbutil],
5
- filename: "dbrelation.rb",
6
- dir: "lib"
7
- }
8
- }