osmosis 0.1.7 → 0.1.9

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: 71ac09cfd040c7360d2933ad76965fe5aa13fdeac749109975b8dbad0d8b313d
4
- data.tar.gz: 0b957d2a60d2598bd3ebf2905f1b083031acea53c3c2db8fb95c5686f65d9d84
3
+ metadata.gz: e57f00785e0aba7cd790404973ed6406ee765183ac531aca29222d880f39f567
4
+ data.tar.gz: 2577ac906cea414ce5aa5ff1a01326344154b155a8ec8bfe65c452fb67597937
5
5
  SHA512:
6
- metadata.gz: 2bcc855f967c3f7e355bdcc44e7422066014a5d4e2572000d64663a6a04a75e9241a97579af9be78617cd38593f1d45544c2c834b8fc32406e516bd11e2d4370
7
- data.tar.gz: a49afe1e290c5b8c9499ba2d0fa33d0f8c9c0933e7a5bea9dcb90484c4be4d3faf6f6a82beccfbe5b2f423a11aa987694f3dd17e6e2b415e294d8aeaaabbf0b4
6
+ metadata.gz: e5a014c5163b1013b83fa6860afc9f400e1232be6436b0992914208e4030584ae956048d98ac07a25d1dc0bf41c4a91b12656853a4c71708be1fa3ad42e7588c
7
+ data.tar.gz: 11d0aecc24b52d1989737311e6b965da2f4645e8270688efcd99f506cad3304e27f2015c34999d18d2eaf33ae2a1e193b9d058fd795cf357a693957a52d0d8e3
@@ -50,6 +50,22 @@ module Osmosis
50
50
  ]
51
51
  end
52
52
 
53
+ def self.analyze()
54
+ database = ActiveRecord::Base.connection_db_config.database
55
+ return [
56
+ OpenStruct.new(type: :sql, command: "ANALYZE")
57
+ OpenStruct.new(type: :print, command: "Analyzed database '#{database}'")
58
+ ]
59
+ end
60
+
61
+ def self.vacuum_analyze()
62
+ database = ActiveRecord::Base.connection_db_config.database
63
+ return [
64
+ OpenStruct.new(type: :sql, command: "VACUUM ANALYZE")
65
+ OpenStruct.new(type: :print, command: "Vacuum analyzed database '#{database}'")
66
+ ]
67
+ end
68
+
53
69
  def self.run(commands)
54
70
  commands.each do |cmd|
55
71
  if cmd.type == :rake
@@ -58,6 +74,8 @@ module Osmosis
58
74
  system cmd.command
59
75
  elsif cmd.type == :print
60
76
  puts cmd.command
77
+ elsif cmd.type == :sql
78
+ ActiveRecord::Base.connection.execute(cmd.command)
61
79
  elsif cmd.type == :pty
62
80
  PTY.spawn(cmd.command) do |stdout, stdin, pid|
63
81
  trap("INT") { Process.kill("INT", pid) }
@@ -0,0 +1,13 @@
1
+ namespace :db do
2
+ desc "Analyze database tables for query optimization"
3
+ task analyze: :environment do
4
+ commands = Osmosis::Command.analyze()
5
+ Osmosis::Command.run(commands)
6
+ end
7
+
8
+ desc "Vacuum and analyze database"
9
+ task vacuum_analyze: :environment do
10
+ commands = Osmosis::Command.vacuum_analyze()
11
+ Osmosis::Command.run(commands)
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Osmosis
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.9"
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osmosis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas_Skywalker
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-08 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2025-08-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ostruct
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.6'
13
27
  description: This powerful database utility library simplifies and automates common
14
28
  database tasks, including exports, imports, and data migrations. With its intuitive
15
29
  interface and robust feature set, it enables developers to manage databases more
@@ -28,6 +42,7 @@ files:
28
42
  - lib/osmosis.rb
29
43
  - lib/osmosis/command.rb
30
44
  - lib/osmosis/railtie.rb
45
+ - lib/osmosis/tasks/db/analyze.rake
31
46
  - lib/osmosis/tasks/db/connect.rake
32
47
  - lib/osmosis/tasks/db/export.rake
33
48
  - lib/osmosis/tasks/db/import.rake
@@ -56,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
71
  - !ruby/object:Gem::Version
57
72
  version: '0'
58
73
  requirements: []
59
- rubygems_version: 3.5.11
74
+ rubygems_version: 3.5.22
60
75
  signing_key:
61
76
  specification_version: 4
62
77
  summary: A versatile database utility library that streamlines common tasks like exporting