arxutils_sqlite3 0.1.58 → 0.1.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9869bb5f70a1b84e0b029c73369c71624dd56138009b6926dff1132e36c7e6f6
4
- data.tar.gz: 2037193703cd10ca47ddee96acad81200a50ff4194d94bf88d69fd92fe11779d
3
+ metadata.gz: a3fe12a6d2e70fa7bd8b2756e9f855bdba38dbe8afceee110a35b8d5922423e4
4
+ data.tar.gz: 4492d9e180393bbba47ef444903462ac7f329380620383cd52f4df48ed6796af
5
5
  SHA512:
6
- metadata.gz: 508ac749345626f3c1b1bc98ff0a97e011f40a026e88ac12f13e97e107fecd55068c6f25ce737bfbc5ce9ca6600dbcf6dadccc09c68d0e4eaa62d37fe7b712a4
7
- data.tar.gz: 68c2597c5e5b09fa9415ee74d0cb7c7146425fdcceade63cfe49e93e5f9c188dcafe113f5491a5df8b44f41c07ec9224eb3f0dec0941711c559231975f0c0ff2
6
+ metadata.gz: e2ae6d7ce1900a90b3f748a5458580942b3c248906c7faa48ebbeaf0d4d8bd7b2c9db67ff582d9eeb8f26c6094a635e9322b01034774a93f7a3dccc0b9763348
7
+ data.tar.gz: 9b36ec2adb56b5e6f2e03a1e99c20be60058574855b6a77221b9cae9886015e04a2b7c10aac089640e7a1fe39e0dbf9f4487dce4f81860ba8bd24ad9940abadd
data/.rubocop.yml CHANGED
@@ -8,9 +8,9 @@ AllCops:
8
8
  TargetRubyVersion: 2.6
9
9
  NewCops: enable
10
10
 
11
- Style/StringLiterals:
12
- Enabled: true
13
- EnforcedStyle: double_quotes
11
+ #Style/StringLiterals:
12
+ # Enabled: true
13
+ # EnforcedStyle: double_quotes
14
14
 
15
15
  Style/StringLiteralsInInterpolation:
16
16
  Enabled: true
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-09-23 07:28:29 UTC using RuboCop version 1.36.0.
3
+ # on 2022-10-01 01:21:06 UTC using RuboCop version 1.36.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -27,27 +27,6 @@ Layout/IndentationWidth:
27
27
  Exclude:
28
28
  - 'lib/dbacrecord.rb'
29
29
 
30
- # Offense count: 3
31
- # This cop supports safe autocorrection (--autocorrect).
32
- Layout/SpaceBeforeComma:
33
- Exclude:
34
- # - 'lib/dbacrecord.rb'
35
-
36
- # Offense count: 2
37
- # This cop supports safe autocorrection (--autocorrect).
38
- # Configuration parameters: EnforcedStyle.
39
- # SupportedStyles: space, compact, no_space
40
- Layout/SpaceInsideParens:
41
- Exclude:
42
- # - 'config/dbsetup.rb'
43
-
44
- # Offense count: 1
45
- # This cop supports safe autocorrection (--autocorrect).
46
- # Configuration parameters: AllowInHeredoc.
47
- Layout/TrailingWhitespace:
48
- Exclude:
49
- - 'db/migrate/050_create_currentxenoplist.rb'
50
-
51
30
  # Offense count: 4
52
31
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
53
32
  Metrics/AbcSize:
@@ -56,14 +35,14 @@ Metrics/AbcSize:
56
35
  # Offense count: 3
57
36
  # Configuration parameters: CountComments, CountAsOne.
58
37
  Metrics/ClassLength:
59
- Max: 192
38
+ Max: 190
60
39
 
61
- # Offense count: 11
40
+ # Offense count: 12
62
41
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
63
42
  Metrics/MethodLength:
64
43
  Max: 49
65
44
 
66
- # Offense count: 2
45
+ # Offense count: 3
67
46
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
68
47
  Metrics/ParameterLists:
69
48
  Max: 7
@@ -95,31 +74,17 @@ Naming/ClassAndModuleCamelCase:
95
74
  RSpec/MultipleMemoizedHelpers:
96
75
  Max: 11
97
76
 
98
- # Offense count: 1
99
- # This cop supports safe autocorrection (--autocorrect).
100
- Style/BlockComments:
101
- Exclude:
102
- # - 'config/dbsetup.rb'
103
-
104
- # Offense count: 7
77
+ # Offense count: 5
105
78
  # Configuration parameters: AllowedConstants.
106
79
  Style/Documentation:
107
80
  Exclude:
108
81
  - 'spec/**/*'
109
82
  - 'test/**/*'
110
- - 'config/dbsetup.rb'
111
83
  - 'db/migrate/010_create_countdatetime.rb'
112
84
  - 'db/migrate/020_create_xenop.rb'
113
85
  - 'db/migrate/030_create_xenoplist.rb'
114
86
  - 'db/migrate/040_create_invalidxenoplist.rb'
115
87
  - 'db/migrate/050_create_currentxenoplist.rb'
116
- - 'lib/arxutils_sqlite3/util.rb'
117
-
118
- # Offense count: 2
119
- # This cop supports safe autocorrection (--autocorrect).
120
- Style/EmptyLiteral:
121
- Exclude:
122
- # - 'config/dbsetup.rb'
123
88
 
124
89
  # Offense count: 5
125
90
  # This cop supports safe autocorrection (--autocorrect).
@@ -128,24 +93,31 @@ Style/EmptyLiteral:
128
93
  Style/FormatStringToken:
129
94
  EnforcedStyle: unannotated
130
95
 
131
- # Offense count: 22
96
+ # Offense count: 7
132
97
  # This cop supports unsafe autocorrection (--autocorrect-all).
133
98
  # Configuration parameters: EnforcedStyle.
134
99
  # SupportedStyles: always, always_true, never
135
100
  Style/FrozenStringLiteralComment:
136
- Enabled: false
101
+ Exclude:
102
+ - 'config/dbsetup.rb'
103
+ - 'db/migrate/010_create_countdatetime.rb'
104
+ - 'db/migrate/020_create_xenop.rb'
105
+ - 'db/migrate/030_create_xenoplist.rb'
106
+ - 'db/migrate/040_create_invalidxenoplist.rb'
107
+ - 'db/migrate/050_create_currentxenoplist.rb'
108
+ - 'lib/dbacrecord.rb'
137
109
 
138
- # Offense count: 10
110
+ # Offense count: 11
139
111
  # This cop supports safe autocorrection (--autocorrect).
140
112
  # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
141
113
  # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
142
114
  # SupportedShorthandSyntax: always, never, either, consistent
143
115
  Style/HashSyntax:
144
116
  Exclude:
145
- # - 'db/migrate/010_create_countdatetime.rb'
146
- # - 'db/migrate/020_create_xenop.rb'
147
- # - 'db/migrate/030_create_xenoplist.rb'
148
- # - 'db/migrate/040_create_invalidxenoplist.rb'
117
+ - 'db/migrate/010_create_countdatetime.rb'
118
+ - 'db/migrate/020_create_xenop.rb'
119
+ - 'db/migrate/030_create_xenoplist.rb'
120
+ - 'db/migrate/040_create_invalidxenoplist.rb'
149
121
 
150
122
  # Offense count: 4
151
123
  # This cop supports safe autocorrection (--autocorrect).
@@ -153,5 +125,5 @@ Style/HashSyntax:
153
125
  # SupportedStyles: single_quotes, double_quotes
154
126
  Style/StringLiterals:
155
127
  Exclude:
156
- # - 'config/dbsetup.rb'
157
- # - 'lib/dbacrecord.rb'
128
+ - 'config/dbsetup.rb'
129
+ - 'lib/dbacrecord.rb'
data/Gemfile CHANGED
@@ -1,37 +1,37 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in arxutils_sqlite3.gemspec
6
6
  gemspec
7
7
 
8
- gem "simpleoptparse"
8
+ gem 'simpleoptparse'
9
9
  # gem "ykutils"
10
10
  # gem "ykutils" , :path => "C:\Users\ykomi\cur\ruby\ykutils"
11
11
  # gem "ykutils" , :path => "../ykutils"
12
12
  # gem "ykutils" , :github => "ykominami/ykutils"
13
- gem "ykutils", "> 0.1.3"
14
- gem "ykxutils", "> 0.1.0"
13
+ gem 'ykutils', '> 0.1.3'
14
+ gem 'ykxutils', '> 0.1.0'
15
15
  # gem "ykxutils", path: "../ykxutils"
16
16
 
17
- gem "activesupport"
17
+ gem 'activesupport'
18
18
  # spec.add_runtime_dependency "erb"
19
19
  # spec.add_runtime_dependency "activerecord", "~> 4.2"
20
- gem "activerecord", "~> 6.1"
21
- gem "sqlite3"
20
+ gem 'activerecord', '~> 6.1'
21
+ gem 'sqlite3'
22
22
  # spec.add_runtime_dependency "mysql2" , "~> 0.4.1"
23
23
  # gem "encx"
24
24
 
25
25
  # spec.add_development_dependency "bundler", "~> 2.2.10"
26
- gem "rake", "~> 13.0"
27
- gem "rspec", "~> 3.0"
26
+ gem 'rake', '~> 13.0'
27
+ gem 'rspec', '~> 3.0'
28
28
 
29
- gem "rubocop", "~> 1.7"
30
- gem "rubocop-rake"
31
- gem "rubocop-rspec"
29
+ gem 'rubocop', '~> 1.7'
30
+ gem 'rubocop-rake'
31
+ gem 'rubocop-rspec'
32
32
 
33
33
  group :development do
34
- gem "yard"
34
+ gem 'yard'
35
35
  end
36
36
 
37
37
  # group :test do
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arxutils_sqlite3 (0.1.58)
4
+ arxutils_sqlite3 (0.1.59)
5
5
  activerecord (~> 6.1)
6
6
  activesupport
7
7
  simpleoptparse
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
- require "bundler/gem_tasks"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
2
4
  # require "rake/testtask"
3
5
 
4
6
  # Rake::TestTask.new do |t|
@@ -8,14 +10,14 @@ require "bundler/gem_tasks"
8
10
  # desc "Run test"
9
11
  # task default: :test
10
12
 
11
- require "rspec/core/rake_task"
13
+ require 'rspec/core/rake_task'
12
14
 
13
15
  RSpec::Core::RakeTask.new(:spec)
14
16
 
15
- require "rubocop/rake_task"
17
+ require 'rubocop/rake_task'
16
18
 
17
19
  RuboCop::RakeTask.new
18
20
 
19
21
  # task default: %i[spec rubocop]
20
22
 
21
- require "arxutils_sqlite3/rake_task"
23
+ require 'arxutils_sqlite3/rake_task'
@@ -1,25 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "lib/arxutils_sqlite3/version"
3
+ require_relative 'lib/arxutils_sqlite3/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "arxutils_sqlite3"
6
+ spec.name = 'arxutils_sqlite3'
7
7
  spec.version = Arxutils_Sqlite3::VERSION
8
- spec.authors = ["yasuo kominami"]
9
- spec.email = ["ykominami@gmail.com"]
8
+ spec.authors = ['yasuo kominami']
9
+ spec.email = ['ykominami@gmail.com']
10
10
 
11
- spec.summary = "utility functions for ActiveRecord."
12
- spec.description = "utility functions for ActiveRecord."
13
- spec.homepage = "https://ykominami.github.io/arxutils_sqlite3/"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.6.0"
11
+ spec.summary = 'utility functions for ActiveRecord.'
12
+ spec.description = 'utility functions for ActiveRecord.'
13
+ spec.homepage = 'https://ykominami.github.io/arxutils_sqlite3/'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 2.6.0'
16
16
 
17
17
  # spec.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'"
18
18
 
19
- spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata['homepage_uri'] = spec.homepage
20
20
  # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
21
21
  # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
22
- spec.metadata["rubygems_mfa_required"] = "true"
22
+ spec.metadata['rubygems_mfa_required'] = 'true'
23
23
 
24
24
  # Specify which files should be added to the gem when it is released.
25
25
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -29,27 +29,27 @@ Gem::Specification.new do |spec|
29
29
  end
30
30
  end
31
31
 
32
- spec.bindir = "exe"
32
+ spec.bindir = 'exe'
33
33
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
34
  # p spec.executables
35
- spec.require_paths = ["lib"]
36
- spec.add_runtime_dependency "activesupport"
35
+ spec.require_paths = ['lib']
36
+ spec.add_runtime_dependency 'activesupport'
37
37
  # spec.add_runtime_dependency "erb"
38
38
  # spec.add_runtime_dependency "activerecord", "~> 4.2"
39
39
 
40
- spec.add_runtime_dependency "activerecord", "~> 6.1"
41
- spec.add_runtime_dependency "simpleoptparse"
42
- spec.add_runtime_dependency "sqlite3"
43
- spec.add_runtime_dependency "ykutils"
44
- spec.add_runtime_dependency "ykxutils"
40
+ spec.add_runtime_dependency 'activerecord', '~> 6.1'
41
+ spec.add_runtime_dependency 'simpleoptparse'
42
+ spec.add_runtime_dependency 'sqlite3'
43
+ spec.add_runtime_dependency 'ykutils'
44
+ spec.add_runtime_dependency 'ykxutils'
45
45
  # spec.add_development_dependency "bundler", "~> 2.2.10"
46
- spec.add_development_dependency "bundler"
47
- spec.add_development_dependency "rake", "~> 13.0"
48
- spec.add_development_dependency "rspec", "~> 3.0"
49
- spec.add_development_dependency "rubocop", "~> 1.7"
50
- spec.add_development_dependency "rubocop-rake"
51
- spec.add_development_dependency "rubocop-rspec"
52
- spec.add_development_dependency "yard"
46
+ spec.add_development_dependency 'bundler'
47
+ spec.add_development_dependency 'rake', '~> 13.0'
48
+ spec.add_development_dependency 'rspec', '~> 3.0'
49
+ spec.add_development_dependency 'rubocop', '~> 1.7'
50
+ spec.add_development_dependency 'rubocop-rake'
51
+ spec.add_development_dependency 'rubocop-rspec'
52
+ spec.add_development_dependency 'yard'
53
53
  # Uncomment to register a new dependency of your gem
54
54
  # spec.add_dependency "example-gem", "~> 1.0"
55
55
 
data/bin/console CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require "bundler/setup"
5
- require "arxutils_sqlite3"
4
+ require 'bundler/setup'
5
+ require 'arxutils_sqlite3'
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
@@ -11,5 +11,5 @@ require "arxutils_sqlite3"
11
11
  # require "pry"
12
12
  # Pry.start
13
13
 
14
- require "irb"
14
+ require 'irb'
15
15
  IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -3,6 +3,8 @@ set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
+ bundle config path --local vendor/bundle
6
7
  bundle install
8
+ bundle exec rake arx:arxutils_sqlite3
7
9
 
8
10
  # Do any other automated setup that you need to do here
data/exe/arxutils_sqlite3 CHANGED
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "arxutils_sqlite3"
4
- require "simpleoptparse"
5
- require "pp"
6
- require "ykutils"
7
- require "ykxutils"
4
+ require 'arxutils_sqlite3'
5
+ require 'simpleoptparse'
6
+ require 'pp'
7
+ require 'ykutils'
8
+ require 'ykxutils'
8
9
 
9
10
  config = Arxutils_Sqlite3::Config.new
10
11
 
@@ -13,69 +14,69 @@ opts, mod = config.setupx(self)
13
14
  # p mod
14
15
  # exit
15
16
 
16
- banner = "Usage: bundle exec arxutils_sqlite3 --cmd=(s|cds|co|c|f|m|a|d|del|b|y|dm) -y yaml_file --mod=mod"
17
+ banner = 'Usage: bundle exec arxutils_sqlite3 --cmd=(s|cds|co|c|f|m|a|d|del|b|y|dm) -y yaml_file --mod=mod'
17
18
 
18
19
  Simpleoptparse::Simpleoptparse.parse(ARGV, opts, banner, Arxutils_Sqlite3::VERSION, nil) do |parser|
19
- parser.on("--cmd X", %w[s cds co c f m a d del b y dm]) { |x| opts["cmd"] = x }
20
- parser.on("-y yaml_file", "--yaml yaml_file") { |x| opts["yaml"] = x }
21
- parser.on("--mod mod") { |x| opts["mod"] = x }
20
+ parser.on('--cmd X', %w[s cds co c f m a d del b y dm]) { |x| opts['cmd'] = x }
21
+ parser.on('-y yaml_file', '--yaml yaml_file') { |x| opts['yaml'] = x }
22
+ parser.on('--mod mod') { |x| opts['mod'] = x }
22
23
  end
23
24
 
24
25
  dbconfig = Arxutils_Sqlite3::Config::DBCONFIG_SQLITE3
25
- env = ENV.fetch("ENV", nil)
26
- env ||= "production"
26
+ env = ENV.fetch('ENV', nil)
27
+ env ||= 'production'
27
28
 
28
29
  acrecord = opts[:acrecord]
29
- yaml_fname = opts["yaml"]
30
- mod ||= opts["mod"]
30
+ yaml_fname = opts['yaml']
31
+ mod ||= opts['mod']
31
32
  cli = Arxutils_Sqlite3::Cli.new(config, dbconfig, env, acrecord, yaml_fname, mod)
32
33
 
33
- case opts["cmd"]
34
- when "s"
34
+ case opts['cmd']
35
+ when 's'
35
36
  # config.check_file_exist(Arxutils_Sqlite3::Config::SAMPLE_DEST_OPTS_FILE, banner, 10)
36
37
 
37
- if opts["mod"].nil? || opts["mod"].strip == ""
38
+ if opts['mod'].nil? || opts['mod'].strip == ''
38
39
  puts banner
39
40
  exit 20
40
41
  end
41
42
  cli.setup(mod)
42
43
 
43
- when "cds"
44
+ when 'cds'
44
45
  cli.copy_db_scheme
45
46
 
46
- when "co"
47
+ when 'co'
47
48
  cli.copy_opts_file
48
49
 
49
- when "c"
50
+ when 'c'
50
51
  cli.makeconfig(opts)
51
52
 
52
- when "f"
53
- if yaml_fname.nil? || yaml_fname.strip == ""
53
+ when 'f'
54
+ if yaml_fname.nil? || yaml_fname.strip == ''
54
55
  puts banner
55
56
  exit 40
56
57
  end
57
58
  yaml_pn = Pathname.new(yaml_fname)
58
59
  config.check_file_not_exist(yaml_pn, banner, 55)
59
60
  cli.make_migrate_script
60
- when "m"
61
+ when 'm'
61
62
  cli.migrate
62
63
 
63
- when "a"
64
+ when 'a'
64
65
  cli.acr
65
66
 
66
- when "d"
67
+ when 'd'
67
68
  cli.clean
68
69
 
69
- when "del"
70
+ when 'del'
70
71
  cli.delete
71
72
 
72
- when "b"
73
+ when 'b'
73
74
  cli.delete_db
74
75
 
75
- when "y"
76
+ when 'y'
76
77
  cli.delete_setting_yaml
77
78
 
78
- when "dm"
79
+ when 'dm'
79
80
  cli.delete_migrate
80
81
 
81
82
  else
@@ -1,5 +1,7 @@
1
- require "erb"
2
- require "ykutils"
1
+ # frozen_string_literal: true
2
+
3
+ require 'erb'
4
+ require 'ykutils'
3
5
 
4
6
  module Arxutils_Sqlite3
5
7
  # スキーマ設定に基づき、テンプレートから変換する
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arxutils_Sqlite3
2
4
  # CLI用クラス
3
5
  class Cli
@@ -9,7 +11,7 @@ module Arxutils_Sqlite3
9
11
  @dbconfig_path = @config.make_dbconfig_path(@dbconfig)
10
12
 
11
13
  @db_scheme_ary = nil
12
- if yaml_fname && yaml_fname.strip != ""
14
+ if yaml_fname && yaml_fname.strip != ''
13
15
  yaml_pn = Pathname.new(yaml_fname)
14
16
  @db_scheme_ary = YAML.load_file(yaml_pn)
15
17
  end
@@ -1,43 +1,45 @@
1
- require "ykutils"
1
+ # frozen_string_literal: true
2
+
3
+ require 'ykutils'
2
4
 
3
5
  module Arxutils_Sqlite3
4
6
  ##
5
7
  # migrateに必要なファイルをテンプレートから作成し、migarteを実行する
6
8
  class Config
7
9
  # DB格納ディレクトリ名
8
- DB_DIR = "db".freeze
10
+ DB_DIR = 'db'
9
11
  # migrate用スクリプト格納ディレクトリ名
10
- MIGRATE_BASE_DIR = "migrate".freeze
12
+ MIGRATE_BASE_DIR = 'migrate'
11
13
  # SQLITE3用DB構成名
12
- DBCONFIG_SQLITE3 = "sqlite3".freeze
14
+ DBCONFIG_SQLITE3 = 'sqlite3'
13
15
  # MYSQL用DB構成名
14
- DBCONFIG_MYSQL = "mysql".freeze
16
+ DBCONFIG_MYSQL = 'mysql'
15
17
  # DB構成格納用ディレクトリ名
16
- CONFIG_DIR_NAME = "config".freeze
18
+ CONFIG_DIR_NAME = 'config'
17
19
 
18
20
  # コンフィグディレクトリへのパス
19
21
  CONFIG_DIR = Pathname.new(CONFIG_DIR_NAME)
20
22
  # データベース用ログファイル名
21
- DATABASELOG = "database.log".freeze
23
+ DATABASELOG = 'database.log'
22
24
  # テンプレートディレクトリへのパス
23
- TEMPLATE_DIR = Arxutils_Sqlite3::TOP_DIR.join("template")
25
+ TEMPLATE_DIR = Arxutils_Sqlite3::TOP_DIR.join('template')
24
26
  # リレーションテンプレートディレクトリへのパス
25
- TEMPLATE_ACRECORD_DIR = TEMPLATE_DIR.join("acrecord")
27
+ TEMPLATE_ACRECORD_DIR = TEMPLATE_DIR.join('acrecord')
26
28
  TEMPLATE_CONFIG_DIR = TEMPLATE_DIR.join(CONFIG_DIR)
27
- DB_SCHEME_DIR = TEMPLATE_ACRECORD_DIR.join("db_scheme")
28
- DB_SCHEME_FILE = DB_SCHEME_DIR.join("db_scheme.yml")
29
- SAMPLE_DB_SCHEME_FILE = CONFIG_DIR.join("db_scheme.yml.sample")
30
- DB_SCHEME_FILE_NAME = "db_scheme.yml".freeze
31
- DB_SCHEME_FILE_NAME_B = "db_scheme".freeze
32
- OPTS_FILE_NAME = "opts.tmpl".freeze
33
- SAMPLE_OPTS_FILE_NAME = "opts.rb.sample".freeze
34
- OPTS_FILE_NAME_B = "opts".freeze
35
- DEST_OPTS_FILE_NAME = "opts.rb".freeze
36
- DEST_OPTS_FILE_NAME_B = "opts".freeze
37
- DBSETUP_FILE_NAME = "dbsetup.tmpl".freeze
38
- DBSETUP_FILE_NAME_B = "dbsetup".freeze
39
- DEST_DBSETUP_FILE_NAME = "dbsetup.rb".freeze
40
- SETTING_YAML_FILE_NAME = "setting.yml".freeze
29
+ DB_SCHEME_DIR = TEMPLATE_ACRECORD_DIR.join('db_scheme')
30
+ DB_SCHEME_FILE = DB_SCHEME_DIR.join('db_scheme.yml')
31
+ SAMPLE_DB_SCHEME_FILE = CONFIG_DIR.join('db_scheme.yml.sample')
32
+ DB_SCHEME_FILE_NAME = 'db_scheme.yml'
33
+ DB_SCHEME_FILE_NAME_B = 'db_scheme'
34
+ OPTS_FILE_NAME = 'opts.tmpl'
35
+ SAMPLE_OPTS_FILE_NAME = 'opts.rb.sample'
36
+ OPTS_FILE_NAME_B = 'opts'
37
+ DEST_OPTS_FILE_NAME = 'opts.rb'
38
+ DEST_OPTS_FILE_NAME_B = 'opts'
39
+ DBSETUP_FILE_NAME = 'dbsetup.tmpl'
40
+ DBSETUP_FILE_NAME_B = 'dbsetup'
41
+ DEST_DBSETUP_FILE_NAME = 'dbsetup.rb'
42
+ SETTING_YAML_FILE_NAME = 'setting.yml'
41
43
  DEST_CONFIG_DIR = Pathname.new(CONFIG_DIR)
42
44
  OPTS_FILE = DB_SCHEME_DIR.join(OPTS_FILE_NAME)
43
45
  SAMPLE_OPTS_FILE = CONFIG_DIR.join(SAMPLE_OPTS_FILE_NAME)
@@ -61,7 +63,7 @@ module Arxutils_Sqlite3
61
63
  # 削除しないファイル群
62
64
  EXCLUDE_FILES = %w[SETTING_YAML_FILE_NAME].freeze
63
65
  # 作成対象のActiveRecordの子クラスのデフォルトクラス名
64
- DEFAULT_MOD = "Xenop".freeze
66
+ DEFAULT_MOD = 'Xenop'
65
67
 
66
68
  def default_mod
67
69
  DEFAULT_MOD
@@ -169,7 +171,7 @@ module Arxutils_Sqlite3
169
171
  def require_opts_file
170
172
  return unless DEST_OPTS_FILE.exist?
171
173
 
172
- opts_file = File.join("./", DEST_OPTS_FILE_B.to_s)
174
+ opts_file = File.join('./', DEST_OPTS_FILE_B.to_s)
173
175
  begin
174
176
  require opts_file
175
177
  rescue LoadError
@@ -188,7 +190,7 @@ module Arxutils_Sqlite3
188
190
 
189
191
  # Dbsetupファイル(Rubyスクリプトファイル)のrequire
190
192
  def require_dbsetup_file
191
- dbsetup_file = File.join(".", dest_dbsetup_file_b.to_s)
193
+ dbsetup_file = File.join('.', dest_dbsetup_file_b.to_s)
192
194
  begin
193
195
  require dbsetup_file
194
196
  rescue LoadError
@@ -287,7 +289,7 @@ module Arxutils_Sqlite3
287
289
 
288
290
  def make_dbsetup_file(db_scheme_ary, acrecord, _mod, dest_dbsetup_file)
289
291
  scope = Object.new
290
- hash0 = { mod_name: acrecord[:module].join("::") }
292
+ hash0 = { mod_name: acrecord[:module].join('::') }
291
293
  hash = db_scheme_ary[0].merge(hash0)
292
294
  result_content = Ykutils::Erubyx.erubi_render_with_template_file(src_dbsetup_file, scope, hash)
293
295
 
@@ -1,17 +1,18 @@
1
1
  #! -*- encoding : UTF-8 -*-
2
+ # frozen_string_literal: true
2
3
 
3
- require "fileutils"
4
- require "yaml"
5
- require "active_record"
6
- require "sqlite3"
7
- require "ykxutils"
4
+ require 'fileutils'
5
+ require 'yaml'
6
+ require 'active_record'
7
+ require 'sqlite3'
8
+ require 'ykxutils'
8
9
 
9
10
  module Arxutils_Sqlite3
10
11
  module Dbutil
11
12
  # DB操作用ユーティリティクラス
12
13
  class Dbconnect
13
14
  def self.make_log_file_name(dbconfig, log_file_base_name)
14
- format("%s-%s", dbconfig.to_s, log_file_base_name)
15
+ format('%s-%s', dbconfig.to_s, log_file_base_name)
15
16
  end
16
17
 
17
18
  def self.db_connect(config, dbconfig, env)
@@ -1,4 +1,6 @@
1
- require_relative "dbutil/dbconnect"
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'dbutil/dbconnect'
2
4
 
3
5
  module Arxutils_Sqlite3
4
6
  # DB操作用ユーティリティクラス
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arxutils_Sqlite3
2
4
  # 階層処理
3
5
  class HierOp
@@ -93,7 +95,7 @@ module Arxutils_Sqlite3
93
95
  def register_parent(hier_ary, child_num, level)
94
96
  hier_ary.pop
95
97
  parent_hier_ary = hier_ary
96
- parent_hier = parent_hier_ary.join("/")
98
+ parent_hier = parent_hier_ary.join('/')
97
99
  parent_num = register(parent_hier)
98
100
  hs = { parent_id: parent_num, child_id: child_num, level: level }
99
101
  @hier_klass.create(hs)
@@ -101,7 +103,7 @@ module Arxutils_Sqlite3
101
103
 
102
104
  # 文字列で指定した階層(/を区切り文字として持つ)をhier_klassに登録
103
105
  def register(hier)
104
- hier_ary = hier.split("/")
106
+ hier_ary = hier.split('/')
105
107
  level = get_level_by_array(hier_ary)
106
108
 
107
109
  # もしhier_aryがnilだけを1個持つ配列、または空文字列だけを1個もつ配列であれば、hier_nameは空文字列になる
@@ -175,7 +177,7 @@ module Arxutils_Sqlite3
175
177
 
176
178
  # 階層を表すデータ構造から階層の名前を得る
177
179
  def get_name(items_row)
178
- items_row ? items_row.name.split("/").pop : ""
180
+ items_row ? items_row.name.split('/').pop : ''
179
181
  end
180
182
 
181
183
  # 階層を表すデータ構造で指定された階層の下部階層の名前を調整する
@@ -212,7 +214,7 @@ module Arxutils_Sqlite3
212
214
 
213
215
  # 文字列で指定された親の階層の下の子の名前から、子の名前を作成
214
216
  def make_hier(parent_hier, name)
215
- [parent_hier, name].join("/")
217
+ [parent_hier, name].join('/')
216
218
  end
217
219
  end
218
220
  end
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # require "arxutils_sqlite3"
2
- require "ykutils"
3
- require "fileutils"
4
+ require 'ykutils'
5
+ require 'fileutils'
4
6
  # require "active_support"
5
- require "active_record"
6
- require "active_record/migration"
7
- require "pp"
7
+ require 'active_record'
8
+ require 'active_record/migration'
9
+ require 'pp'
8
10
 
9
11
  # ActiveRecord用ユーティリティモジュール
10
12
  module Arxutils_Sqlite3
@@ -58,7 +60,7 @@ module Arxutils_Sqlite3
58
60
  def delete_migrate_and_config_and_db
59
61
  # def delete_migrate_and_config
60
62
  delete_migrate
61
- Dir.glob(File.join(@dest_config_dir, "*")).each do |x|
63
+ Dir.glob(File.join(@dest_config_dir, '*')).each do |x|
62
64
  basename = File.basename(x)
63
65
  ret = !@config.exclude_file?(basename)
64
66
  ret_file = File.file?(x)
@@ -77,14 +79,14 @@ module Arxutils_Sqlite3
77
79
  def delete_migrate
78
80
  return unless @migrate_dir
79
81
 
80
- Dir.glob(File.join(@migrate_dir, "*")).each do |x|
82
+ Dir.glob(File.join(@migrate_dir, '*')).each do |x|
81
83
  FileUtils.rm(x) if File.file?(x)
82
84
  end
83
85
  end
84
86
 
85
87
  # DBファイルの削除
86
88
  def delete_db
87
- Dir.glob(File.join(@db_dir, "*")).each do |x|
89
+ Dir.glob(File.join(@db_dir, '*')).each do |x|
88
90
  FileUtils.rm(x) if File.file?(x)
89
91
  end
90
92
  end
@@ -106,12 +108,12 @@ module Arxutils_Sqlite3
106
108
  if content_array.find { |x| !x.nil? }
107
109
  # p "####### 1"
108
110
  data_count = {
109
- count_classname: "Count",
111
+ count_classname: 'Count',
110
112
  need_count_class_plural: need_count_class_plural
111
113
  }
112
114
  # p "data_count=#{data_count}"
113
115
  ary = content_array.collect { |x| x[:content] }.flatten
114
- count_content = convert_count_class_acrecord(data_count, "acrecord_count.tmpl")
116
+ count_content = convert_count_class_acrecord(data_count, 'acrecord_count.tmpl')
115
117
  ary.unshift(count_content)
116
118
  content_array = ary
117
119
  end
@@ -132,7 +134,7 @@ module Arxutils_Sqlite3
132
134
  def make_content_array
133
135
  # スキーマ設定配列から、acrecordのmigrate用のスクリプトの内容(ハッシュ形式)の配列を作成する
134
136
  acrecords = @db_scheme_ary.map do |x|
135
- make_acrecord(x, "count")
137
+ make_acrecord(x, 'count')
136
138
  end
137
139
  acrecords.select { |x| x.size.positive? }
138
140
  end
@@ -153,7 +155,7 @@ module Arxutils_Sqlite3
153
155
  def make_dbconfig(data)
154
156
  content = convert(data, @src_config_path, @dbconfig_src_fname)
155
157
  File.open(
156
- @dbconfig_dest_path, "w:utf-8"
158
+ @dbconfig_dest_path, 'w:utf-8'
157
159
  ) do |f|
158
160
  f.puts(content)
159
161
  end
@@ -169,8 +171,8 @@ module Arxutils_Sqlite3
169
171
  # 指定フィールドのフィールド名に対応したテンプレートファイルを用いて、acrecord設定を作成
170
172
  data[:flist].each_with_object({ content: [], need_count_class: nil }) do |field_name, s|
171
173
  case field_name
172
- when "base", "noitem"
173
- name_base = "acrecord"
174
+ when 'base', 'noitem'
175
+ name_base = 'acrecord'
174
176
  # data[:acrecord]がnilに設定されていたら改めて空の配列を設定
175
177
  data[:acrecord] = [] unless data[:acrecord]
176
178
  else
@@ -198,13 +200,13 @@ module Arxutils_Sqlite3
198
200
  # migrationのスクリプトをファイル出力する
199
201
  def output_script(idy, kind, content, classname_downcase)
200
202
  additional = case kind
201
- when "base", "noitem"
202
- ""
203
+ when 'base', 'noitem'
204
+ ''
203
205
  else
204
206
  kind
205
207
  end
206
- fname = File.join(@migrate_dir, format("%03d_create_%s%s.rb", idy, additional, classname_downcase))
207
- File.open(fname, "w", **{ encoding: Encoding::UTF_8 }) do |f|
208
+ fname = File.join(@migrate_dir, format('%03d_create_%s%s.rb', idy, additional, classname_downcase))
209
+ File.open(fname, 'w', **{ encoding: Encoding::UTF_8 }) do |f|
208
210
  f.puts(content)
209
211
  end
210
212
  end
@@ -216,13 +218,13 @@ module Arxutils_Sqlite3
216
218
  fpath = File.join(dir, fname)
217
219
  ret = :SUCCESS
218
220
  begin
219
- File.open(fpath, "w") do |file|
221
+ File.open(fpath, 'w') do |file|
220
222
  acrecord_config[:module].map { |mod| file.puts("module #{mod}") }
221
223
  content_array.map do |x|
222
224
  file.puts x
223
- file.puts ""
225
+ file.puts ''
224
226
  end
225
- acrecord_config[:module].map { |_mod| file.puts("end") }
227
+ acrecord_config[:module].map { |_mod| file.puts('end') }
226
228
  end
227
229
  rescue StandardError
228
230
  ret = :StandardError
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Defining a task called default that depends on the tasks setup, makeconfig, migrate, and acr.
2
- require "arxutils_sqlite3"
4
+ require 'arxutils_sqlite3'
3
5
  config = Arxutils_Sqlite3::Config.new
4
6
 
5
7
  mod = nil
@@ -7,86 +9,86 @@ setting = config.load_setting_yaml_file
7
9
  mod = setting[:mod]
8
10
  mod = config.default_mod if mod.nil?
9
11
 
10
- desc_arxutils_sqlite3 = "setup copy_db_scheme copy_opts makeconfig make_migrate_script migrate acr"
12
+ desc_arxutils_sqlite3 = 'setup copy_db_scheme copy_opts makeconfig make_migrate_script migrate acr'
11
13
 
12
14
  desc desc_arxutils_sqlite3.to_s
13
15
  task arxutils_sqlite3: %w[arx:setup arx:copy_db_scheme arx:copy_opts arx:makeconfig arx:make_migrate_script arx:migrate arx:acr]
14
16
 
15
17
  desc desc_arxutils_sqlite3.to_s
16
- task "arx:arxutils_sqlite3": %w[arxutils_sqlite3]
18
+ task 'arx:arxutils_sqlite3': %w[arxutils_sqlite3]
17
19
 
18
- desc "delete setup copy_db_scheme copy_opts makeconfig make_migrate_script migrate acr"
19
- task "arx:bootstrap": %w[arx:delete arxutils_sqlite3]
20
+ desc 'delete setup copy_db_scheme copy_opts makeconfig make_migrate_script migrate acr'
21
+ task 'arx:bootstrap': %w[arx:delete arxutils_sqlite3]
20
22
 
21
- desc "migrate acr"
22
- task "arx:ma": %w[arx:migrate arx:acr]
23
+ desc 'migrate acr'
24
+ task 'arx:ma': %w[arx:migrate arx:acr]
23
25
 
24
- desc "delete_db"
25
- task "arx:b": %w[arx:delete_db]
26
+ desc 'delete_db'
27
+ task 'arx:b': %w[arx:delete_db]
26
28
 
27
- desc "delete setting.yaml"
28
- task "arx:ds": %w[arx:delete_setting]
29
+ desc 'delete setting.yaml'
30
+ task 'arx:ds': %w[arx:delete_setting]
29
31
 
30
32
  # コマンドラインで指定したクラス名を含むオプション指定用ハッシュの定義を含むRubyスクリ
31
33
  # プトファイルの生成
32
34
  desc "produce setting.yml, db_scheme.yml.sample and opts.rb.sample with class name #{mod}"
33
- task "arx:setup" do
35
+ task 'arx:setup' do
34
36
  sh "bundle exec arxutils_sqlite3 --cmd=s --mod=#{mod}"
35
37
  end
36
38
 
37
- desc "copy from db_scheme.yml.sample to db_scheme.yml"
38
- task "arx:copy_db_scheme" do
39
- sh "bundle exec arxutils_sqlite3 --cmd=cds"
39
+ desc 'copy from db_scheme.yml.sample to db_scheme.yml'
40
+ task 'arx:copy_db_scheme' do
41
+ sh 'bundle exec arxutils_sqlite3 --cmd=cds'
40
42
  end
41
43
 
42
- desc "copy from opts.rb.sample to opts.rb"
43
- task "arx:copy_opts" do
44
- sh "bundle exec arxutils_sqlite3 --cmd=co"
44
+ desc 'copy from opts.rb.sample to opts.rb'
45
+ task 'arx:copy_opts' do
46
+ sh 'bundle exec arxutils_sqlite3 --cmd=co'
45
47
  end
46
48
 
47
49
  # DB構成情報の生成
48
- desc "produce sqlite3.yml"
49
- task "arx:makeconfig" do
50
- sh "bundle exec arxutils_sqlite3 --cmd=c"
50
+ desc 'produce sqlite3.yml'
51
+ task 'arx:makeconfig' do
52
+ sh 'bundle exec arxutils_sqlite3 --cmd=c'
51
53
  end
52
54
 
53
55
  # マイグレート用スクリプトファイルの生成
54
- desc "produce migration scripts"
55
- task "arx:make_migrate_script" do
56
- sh "bundle exec arxutils_sqlite3 --cmd=f --yaml=config/db_scheme.yml"
56
+ desc 'produce migration scripts'
57
+ task 'arx:make_migrate_script' do
58
+ sh 'bundle exec arxutils_sqlite3 --cmd=f --yaml=config/db_scheme.yml'
57
59
  end
58
60
  # マイグレートの実行
59
- desc "execute migration"
60
- task "arx:migrate" do
61
- sh "bundle exec arxutils_sqlite3 --cmd=m"
61
+ desc 'execute migration'
62
+ task 'arx:migrate' do
63
+ sh 'bundle exec arxutils_sqlite3 --cmd=m'
62
64
  end
63
65
 
64
- desc "call ActiveRecord instance method"
65
- task "arx:acr" do
66
- sh "bundle exec arxutils_sqlite3 --cmd=a"
66
+ desc 'call ActiveRecord instance method'
67
+ task 'arx:acr' do
68
+ sh 'bundle exec arxutils_sqlite3 --cmd=a'
67
69
  end
68
70
 
69
- desc "delete configuration files adn migration scripts and db files"
70
- task "arx:delete" do
71
- sh "bundle exec arxutils_sqlite3 --cmd=del"
71
+ desc 'delete configuration files adn migration scripts and db files'
72
+ task 'arx:delete' do
73
+ sh 'bundle exec arxutils_sqlite3 --cmd=del'
72
74
  end
73
75
 
74
- desc "delete configuration files adn migration scripts and db files"
75
- task "arx:clean" do
76
- sh "bundle exec arxutils_sqlite3 --cmd=d"
76
+ desc 'delete configuration files adn migration scripts and db files'
77
+ task 'arx:clean' do
78
+ sh 'bundle exec arxutils_sqlite3 --cmd=d'
77
79
  end
78
80
 
79
- desc "delete db files"
80
- task "arx:delete_db" do
81
- sh "bundle exec arxutils_sqlite3 --cmd=b"
81
+ desc 'delete db files'
82
+ task 'arx:delete_db' do
83
+ sh 'bundle exec arxutils_sqlite3 --cmd=b'
82
84
  end
83
85
 
84
- desc "delete setting yaml"
85
- task "arx:delete_setting" do
86
- sh "bundle exec arxutils_sqlite3 --cmd=y"
86
+ desc 'delete setting yaml'
87
+ task 'arx:delete_setting' do
88
+ sh 'bundle exec arxutils_sqlite3 --cmd=y'
87
89
  end
88
90
 
89
- desc "delete migrate scripts"
90
- task "arx:delete_migrate" do
91
- sh "bundle exec arxutils_sqlite3 --cmd=dm"
91
+ desc 'delete migrate scripts'
92
+ task 'arx:delete_migrate' do
93
+ sh 'bundle exec arxutils_sqlite3 --cmd=dm'
92
94
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arxutils_Sqlite3
2
4
  # 簡易的なトランザクション処理
3
5
  class TransactState
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arxutils_Sqlite3
4
+ # パス操作ユーティリティクラス
2
5
  class Util
3
6
  # DBログファイルへのパスの作成
4
7
  def self.make_log_path(db_dir, dbconfig)
5
- log_path = ""
8
+ log_path = ''
6
9
  log_fname = Dbutil::Dbconnect.make_log_file_name(
7
10
  dbconfig, Config::DATABASELOG
8
11
  )
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Arxutils_Sqlite3
2
4
  # バージョン番号
3
- VERSION = "0.1.58".freeze
5
+ VERSION = '0.1.59'
4
6
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "ykutils"
4
- require "ykxutils"
3
+ require 'ykutils'
4
+ require 'ykxutils'
5
5
 
6
- require "bigdecimal"
7
- require "active_support"
8
- require "active_support/core_ext"
9
- require "active_record"
10
- require "pathname"
6
+ require 'bigdecimal'
7
+ require 'active_support'
8
+ require 'active_support/core_ext'
9
+ require 'active_record'
10
+ require 'pathname'
11
11
 
12
12
  module Arxutils_Sqlite3
13
13
  TOP_DIR = Pathname(__FILE__).parent
@@ -15,14 +15,14 @@ module Arxutils_Sqlite3
15
15
  # Your code goes here...
16
16
  end
17
17
 
18
- require_relative "arxutils_sqlite3/dbutil"
19
- require_relative "arxutils_sqlite3/config"
20
- require_relative "arxutils_sqlite3/cli"
18
+ require_relative 'arxutils_sqlite3/dbutil'
19
+ require_relative 'arxutils_sqlite3/config'
20
+ require_relative 'arxutils_sqlite3/cli'
21
21
 
22
- require_relative "arxutils_sqlite3/version"
23
- require_relative "arxutils_sqlite3/arx"
24
- require_relative "arxutils_sqlite3/transactstate"
25
- require_relative "arxutils_sqlite3/hier"
26
- require_relative "arxutils_sqlite3/migrate"
27
- require_relative "arxutils_sqlite3/util"
28
- require_relative "dbacrecord"
22
+ require_relative 'arxutils_sqlite3/version'
23
+ require_relative 'arxutils_sqlite3/arx'
24
+ require_relative 'arxutils_sqlite3/transactstate'
25
+ require_relative 'arxutils_sqlite3/hier'
26
+ require_relative 'arxutils_sqlite3/migrate'
27
+ require_relative 'arxutils_sqlite3/util'
28
+ require_relative 'dbacrecord'
data/lib/dbacrecord.rb CHANGED
@@ -14,12 +14,12 @@ module Dbutil
14
14
  end
15
15
 
16
16
  class Invalidxenoplist < ActiveRecord::Base
17
- belongs_to :xenoplist, foreign_key: "org_id"
18
- belongs_to :count, foreign_key: ""
17
+ belongs_to :xenoplist, foreign_key: 'org_id'
18
+ belongs_to :count, foreign_key: ''
19
19
  end
20
20
 
21
21
  class Currentxenoplist < ActiveRecord::Base
22
- belongs_to :xenoplist, foreign_key: "org_id"
22
+ belongs_to :xenoplist, foreign_key: 'org_id'
23
23
  end
24
24
 
25
25
  end
@@ -1,3 +1,3 @@
1
1
  class Current<%= @data[:classname_downcase] %> < ActiveRecord::Base
2
- belongs_to :<%= @data[:classname_downcase] %>, foreign_key: "org_id"
2
+ belongs_to :<%= @data[:classname_downcase] %>, foreign_key: 'org_id'
3
3
  end
@@ -1,4 +1,4 @@
1
1
  class Invalid<%= @data[:classname_downcase] %> < ActiveRecord::Base
2
- belongs_to :<%= @data[:classname_downcase] %>, foreign_key: "org_id"
3
- belongs_to :<%= @data[:count_classname_downcase] %>, foreign_key: "<%= @data[:count_field] %>"
2
+ belongs_to :<%= @data[:classname_downcase] %>, foreign_key: 'org_id'
3
+ belongs_to :<%= @data[:count_classname_downcase] %>, foreign_key: '<%= @data[:count_field] %>'
4
4
  end
@@ -1,4 +1,4 @@
1
- require_relative "../lib/dbacrecord"
1
+ require_relative '../lib/dbacrecord'
2
2
 
3
3
  # テスト用クラス
4
4
  class Dbsetup
@@ -8,49 +8,4 @@ class Dbsetup
8
8
  @hs_by_notebook = {}
9
9
  @hs_by_id = {}
10
10
  end
11
- =begin
12
- # 指定stack(文字列)にノートブック(文字列)、ノートブック数、タグ数を追加
13
- def add( stack , notebook, count, tag_count )
14
- ennblist = @hs_by_notebook[notebook]
15
- unless ennblist
16
- cur_ennblist = Currentennblist.where( notebook: notebook ).limit(1)
17
- if cur_ennblist.size == 0
18
- begin
19
- ennblist = Ennblist.create( stack: stack, notebook: notebook ,
20
- count: count, tag_count: tag_count ,
21
- start_datetime: @register_time )
22
- evnb = Evnb.create( time_id: @ct.id , ennb_id: ennblist.id )
23
- rescue => ex
24
- p ex.class
25
- p ex.message
26
- pp ex.backtrace
27
-
28
- ennblist = nil
29
- evnb = nil
30
- end
31
- else
32
- current_ennblist = cur_ennblist.first.ennblist
33
- hs = {:stack => stack, :count => count , :tag_count => tag_count }
34
- value_hs = hs.reduce({}){ |hsx,item|
35
- if current_ennblist[ item[0] ] != item[1]
36
- hsx[ item[0] ] = item[1]
37
- end
38
- hsx
39
- }
40
- if value_hs.size > 0
41
- if value_hs.all? { |item| item[1] != nil }
42
- current_ennblist.update(value_hs)
43
- end
44
- end
45
- end
46
- else
47
- # ignore this case.
48
- end
49
- if ennblist
50
- @hs_by_notebook[notebook] = ennblist
51
- @hs_by_id[ennblist.id] = ennblist
52
- end
53
- ennblist
54
- end
55
- =end
56
11
  end
@@ -1,7 +1,7 @@
1
1
  @opts = {
2
2
  acrecord: {
3
3
  module: %w[<%= mod %> Dbutil],
4
- filename: "dbacrecord.rb",
5
- dir: "lib"
4
+ filename: 'dbacrecord.rb',
5
+ dir: 'lib'
6
6
  }
7
7
  }
@@ -1,7 +1,7 @@
1
1
  @opts = {
2
2
  acrecord: {
3
3
  module: %w[<%= mod_name %> Dbutil],
4
- filename: "dbacrecord.rb",
5
- dir: "lib"
4
+ filename: 'dbacrecord.rb',
5
+ dir: 'lib'
6
6
  }
7
7
  }
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.58
4
+ version: 0.1.59
5
5
  platform: ruby
6
6
  authors:
7
7
  - yasuo kominami
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-30 00:00:00.000000000 Z
11
+ date: 2022-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -250,7 +250,7 @@ licenses:
250
250
  metadata:
251
251
  homepage_uri: https://ykominami.github.io/arxutils_sqlite3/
252
252
  rubygems_mfa_required: 'true'
253
- post_install_message:
253
+ post_install_message:
254
254
  rdoc_options: []
255
255
  require_paths:
256
256
  - lib
@@ -265,8 +265,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
265
  - !ruby/object:Gem::Version
266
266
  version: '0'
267
267
  requirements: []
268
- rubygems_version: 3.1.6
269
- signing_key:
268
+ rubygems_version: 3.3.7
269
+ signing_key:
270
270
  specification_version: 4
271
271
  summary: utility functions for ActiveRecord.
272
272
  test_files: []