arxutils_sqlite3 0.1.37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +20 -0
- data/.rubocop_todo.yml +387 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +41 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +12 -0
- data/arxutils_sqlite3.gemspec +52 -0
- data/bin/arxutils-cli +134 -0
- data/bin/console +15 -0
- data/bin/makemigrate +55 -0
- data/bin/setup +8 -0
- data/bin/setupx.bat +7 -0
- data/bin/setupx.rb +4 -0
- data/config/.gitignore +3 -0
- data/lib/arxutils_sqlite3/arx.rb +41 -0
- data/lib/arxutils_sqlite3/dbutil/dbconnect.rb +95 -0
- data/lib/arxutils_sqlite3/dbutil/dbmgr.rb +28 -0
- data/lib/arxutils_sqlite3/dbutil.rb +22 -0
- data/lib/arxutils_sqlite3/hier.rb +218 -0
- data/lib/arxutils_sqlite3/migrate.rb +225 -0
- data/lib/arxutils_sqlite3/transactstate.rb +76 -0
- data/lib/arxutils_sqlite3/version.rb +4 -0
- data/lib/arxutils_sqlite3.rb +40 -0
- data/lib/template/config/mysql.tmpl +29 -0
- data/lib/template/config/sqlite3.tmpl +26 -0
- data/lib/template/relation/base.tmpl +14 -0
- data/lib/template/relation/current.tmpl +15 -0
- data/lib/template/relation/db_scheme/db_scheme.yml +48 -0
- data/lib/template/relation/db_scheme/dbsetup.rb +51 -0
- data/lib/template/relation/db_scheme/opts.rb +8 -0
- data/lib/template/relation/invalid.tmpl +12 -0
- data/lib/template/relation/noitem.tmpl +13 -0
- data/lib/template/relation/relation.tmpl +3 -0
- data/lib/template/relation/relation_count.tmpl +3 -0
- data/lib/template/relation/relation_current.tmpl +3 -0
- data/lib/template/relation/relation_invalid.tmpl +4 -0
- metadata +85 -0
@@ -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
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class Dbsetup
|
2
|
+
def initialize(connect_time)
|
3
|
+
@connect_time = connect_time
|
4
|
+
@ct = <%= module_name %>::<%= classname %>.create( <%= classname_downcase %>: @connect_time )
|
5
|
+
@hs_by_notebook = {}
|
6
|
+
@hs_by_id = {}
|
7
|
+
end
|
8
|
+
=begin
|
9
|
+
# 指定stack(文字列)にノートブック(文字列)、ノートブック数、タグ数を追加
|
10
|
+
def add( stack , notebook, count, tag_count )
|
11
|
+
ennblist = @hs_by_notebook[notebook]
|
12
|
+
unless ennblist
|
13
|
+
cur_ennblist = Currentennblist.where( notebook: notebook ).limit(1)
|
14
|
+
if cur_ennblist.size == 0
|
15
|
+
begin
|
16
|
+
ennblist = Ennblist.create( stack: stack, notebook: notebook , count: count, tag_count: tag_count , start_datetime: @register_time )
|
17
|
+
evnb = Evnb.create( time_id: @ct.id , ennb_id: ennblist.id )
|
18
|
+
rescue => ex
|
19
|
+
p ex.class
|
20
|
+
p ex.message
|
21
|
+
pp ex.backtrace
|
22
|
+
|
23
|
+
ennblist = nil
|
24
|
+
evnb = nil
|
25
|
+
end
|
26
|
+
else
|
27
|
+
current_ennblist = cur_ennblist.first.ennblist
|
28
|
+
hs = {:stack => stack, :count => count , :tag_count => tag_count }
|
29
|
+
value_hs = hs.reduce({}){ |hsx,item|
|
30
|
+
if current_ennblist[ item[0] ] != item[1]
|
31
|
+
hsx[ item[0] ] = item[1]
|
32
|
+
end
|
33
|
+
hsx
|
34
|
+
}
|
35
|
+
if value_hs.size > 0
|
36
|
+
if value_hs.all? { |item| item[1] != nil }
|
37
|
+
current_ennblist.update(value_hs)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
else
|
42
|
+
# ignore this case.
|
43
|
+
end
|
44
|
+
if ennblist
|
45
|
+
@hs_by_notebook[notebook] = ennblist
|
46
|
+
@hs_by_id[ennblist.id] = ennblist
|
47
|
+
end
|
48
|
+
ennblist
|
49
|
+
end
|
50
|
+
=end
|
51
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateInvalid<%= @data[:classname_downcase] %> < ActiveRecord::Migration[<%= @data[:ar_version] %>]
|
2
|
+
def self.up
|
3
|
+
create_table :invalid<%= @data[:plural] %> do |t|
|
4
|
+
t.column :org_id, :int, :null => false
|
5
|
+
t.column :count_id, :int, :null => true
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.down
|
10
|
+
drop_table :invalid<%= @data[:plural] %>
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Create<%= @data[:classname] %> < ActiveRecord::Migration[<%= @data[:ar_version] %>]
|
2
|
+
def self.up
|
3
|
+
create_table :<%= @data[:plural] %> do |t|
|
4
|
+
<% @data[:ary].each do |x| %>
|
5
|
+
t.column :<%= x.name %>, :<%= x.type %>, :null => <%= x.null %>
|
6
|
+
<% end %>
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
drop_table :<%= @data[:plural] %>
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: arxutils_sqlite3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.37
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- yasuo kominami
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-09-08 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: utility functions for ActiveRecord.
|
14
|
+
email:
|
15
|
+
- ykominami@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".rspec"
|
21
|
+
- ".rubocop.yml"
|
22
|
+
- ".rubocop_todo.yml"
|
23
|
+
- CHANGELOG.md
|
24
|
+
- CODE_OF_CONDUCT.md
|
25
|
+
- Gemfile
|
26
|
+
- LICENSE
|
27
|
+
- LICENSE.txt
|
28
|
+
- README.md
|
29
|
+
- Rakefile
|
30
|
+
- arxutils_sqlite3.gemspec
|
31
|
+
- bin/arxutils-cli
|
32
|
+
- bin/console
|
33
|
+
- bin/makemigrate
|
34
|
+
- bin/setup
|
35
|
+
- bin/setupx.bat
|
36
|
+
- bin/setupx.rb
|
37
|
+
- config/.gitignore
|
38
|
+
- lib/arxutils_sqlite3.rb
|
39
|
+
- lib/arxutils_sqlite3/arx.rb
|
40
|
+
- lib/arxutils_sqlite3/dbutil.rb
|
41
|
+
- lib/arxutils_sqlite3/dbutil/dbconnect.rb
|
42
|
+
- lib/arxutils_sqlite3/dbutil/dbmgr.rb
|
43
|
+
- lib/arxutils_sqlite3/hier.rb
|
44
|
+
- lib/arxutils_sqlite3/migrate.rb
|
45
|
+
- lib/arxutils_sqlite3/transactstate.rb
|
46
|
+
- lib/arxutils_sqlite3/version.rb
|
47
|
+
- lib/template/config/mysql.tmpl
|
48
|
+
- lib/template/config/sqlite3.tmpl
|
49
|
+
- lib/template/relation/base.tmpl
|
50
|
+
- lib/template/relation/current.tmpl
|
51
|
+
- lib/template/relation/db_scheme/db_scheme.yml
|
52
|
+
- lib/template/relation/db_scheme/dbsetup.rb
|
53
|
+
- lib/template/relation/db_scheme/opts.rb
|
54
|
+
- lib/template/relation/invalid.tmpl
|
55
|
+
- lib/template/relation/noitem.tmpl
|
56
|
+
- lib/template/relation/relation.tmpl
|
57
|
+
- lib/template/relation/relation_count.tmpl
|
58
|
+
- lib/template/relation/relation_current.tmpl
|
59
|
+
- lib/template/relation/relation_invalid.tmpl
|
60
|
+
homepage: https://ykominami.github.io/arxutils_sqlite3/
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata:
|
64
|
+
homepage_uri: https://ykominami.github.io/arxutils_sqlite3/
|
65
|
+
rubygems_mfa_required: 'true'
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 2.5.0
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubygems_version: 3.3.7
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: utility functions for ActiveRecord.
|
85
|
+
test_files: []
|