focus_common 0.0.3 → 0.0.5

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: 0f68c50ff019b3943eb41032e45c47428bd5f8edf53f61cdc1d25164400039a4
4
- data.tar.gz: 513d24a149fe4c742679a73ff0307bd062ec5f6929a60a0bb5216a94d5ffb133
3
+ metadata.gz: f09b9d81be06a20bd600ef7590a887e3ef9cf21c1fb92a491e64a67c39b5f31b
4
+ data.tar.gz: 8bb58fca0eadaa64e3bafdfc6b08b941fa55fb59dff715c9fc9d28941ffd1ec5
5
5
  SHA512:
6
- metadata.gz: 23a63d542e1226f80f6e92e4756ee8940df30c810715edef745a32b34afa3654a22dc73fb41363947fe977cf2180322864f890236a0cc5da874b7c558724bf4c
7
- data.tar.gz: de52371e9a48df210c257fe75f6232ea1bbb4edaa94d5c74ed12537dbe586d8766648271acd312d01b1ed81284813c331fc40287322c6196835fafc2f4a857a2
6
+ metadata.gz: cece40964b5c2aa9a0e289a47afb8955ce6e2c863b266cd2435c71d4f73a25104be2961baf935404eeb47a0d1e9fb98ee1c18b8ef568b83b6dd130552d8c8c38
7
+ data.tar.gz: 24b4b5d04aeabaaa05929d18de43a05db532dad28970c4fd3fc670d64425c90934334e8c1a31d82e822549c3a448843e325d206997b838dd5a60fa066a4fd35c
@@ -11,6 +11,30 @@ class FocusCommon::AppInfo
11
11
  end
12
12
  end
13
13
 
14
+ def get_database_info
15
+ conn = ActiveRecord::Base.connection
16
+ adapter = conn.adapter_name
17
+
18
+ sql = \
19
+ case adapter
20
+ when "MSSQL"
21
+ "SELECT @@VERSION"
22
+ when "MySQL", "Mysql2", "PostgreSQL"
23
+ "SELECT VERSION()"
24
+ when "SQLServer"
25
+ "SELECT @@VERSION"
26
+ when "OracleEnhanced"
27
+ "SELECT * FROM V$VERSION"
28
+ when "SQLite"
29
+ "SELECT SQLITE_VERSION()"
30
+ else
31
+ nil
32
+ end
33
+
34
+ v = sql ? conn.select_value(sql) : nil
35
+ {version: v}
36
+ end
37
+
14
38
  def git_version
15
39
  if Rails.env.development?
16
40
  `git rev-parse HEAD`
@@ -36,6 +60,7 @@ class FocusCommon::AppInfo
36
60
  ruby: RUBY_VERSION,
37
61
  rails: Rails::VERSION::STRING,
38
62
  git: git_version,
63
+ database: self.get_database_info[:version],
39
64
  },
40
65
  time: {
41
66
  system: {
@@ -52,13 +77,13 @@ class FocusCommon::AppInfo
52
77
  session_zone: db_time_info[:zone].try(:second),
53
78
  },
54
79
  },
55
- important_gems: get_gems.map{|g| [g.name, g.version]}.to_h.slice('sidekiq'),
80
+ important_gems: get_gems.map{|g| [g.name, g.version]}.to_h.slice(*self.important_gems),
56
81
  }
57
82
 
58
- if defined?(CbaDB)
83
+ if defined?(CbaDb)
59
84
  info[:cba_site] = \
60
- CbaDB.enabled_sites.map do |site|
61
- namespace = CbaDB.sites_info.fetch(site, {})[:db_name]
85
+ CbaDb.enabled_sites.map do |site|
86
+ namespace = CbaDb.sites_info.fetch(site, {})[:db_name]
62
87
  [site, namespace]
63
88
  end.to_h
64
89
  end
@@ -66,6 +91,14 @@ class FocusCommon::AppInfo
66
91
  info
67
92
  end
68
93
 
94
+ def important_gems
95
+ ['sidekiq',
96
+ 'grape',
97
+ 'elasticsearch',
98
+ 'twitter-bootstrap-rails',
99
+ ]
100
+ end
101
+
69
102
  def get_gems
70
103
  Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }
71
104
  end
@@ -1,4 +1,3 @@
1
1
  module FocusCommon
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.5'
3
3
  end
4
-
data/makefile CHANGED
@@ -1,7 +1,7 @@
1
1
  build:
2
2
  gem build focus_common.gemspec
3
3
 
4
- upload:
4
+ upload: clear build
5
5
  gem push *.gem
6
6
 
7
7
  clear:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: focus_common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - linjunhalida
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-20 00:00:00.000000000 Z
11
+ date: 2025-01-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Common library for Focus Solution Inc Rails projects
14
14
  email:
@@ -32,7 +32,7 @@ homepage: https://github.com/halida/focus_common
32
32
  licenses:
33
33
  - LGPL-3.0
34
34
  metadata: {}
35
- post_install_message:
35
+ post_install_message:
36
36
  rdoc_options: []
37
37
  require_paths:
38
38
  - lib
@@ -47,8 +47,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  requirements: []
50
- rubygems_version: 3.0.8
51
- signing_key:
50
+ rubygems_version: 3.5.23
51
+ signing_key:
52
52
  specification_version: 4
53
53
  summary: Common library for Focus Solution Inc Rails projects
54
54
  test_files: []