mighost 0.4.0
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 +7 -0
- data/CHANGELOG.md +51 -0
- data/LICENSE +21 -0
- data/README.md +189 -0
- data/lib/generators/mighost/install_generator.rb +22 -0
- data/lib/generators/mighost/templates/initializer.rb.tt +15 -0
- data/lib/mighost/api.rb +155 -0
- data/lib/mighost/capturer.rb +59 -0
- data/lib/mighost/configuration.rb +36 -0
- data/lib/mighost/formatting.rb +89 -0
- data/lib/mighost/git_metadata.rb +31 -0
- data/lib/mighost/git_recovery.rb +129 -0
- data/lib/mighost/migrator_extension.rb +30 -0
- data/lib/mighost/orphan_detector.rb +173 -0
- data/lib/mighost/plain_ui.rb +225 -0
- data/lib/mighost/railtie.rb +27 -0
- data/lib/mighost/rollbacker.rb +113 -0
- data/lib/mighost/snapshot.rb +274 -0
- data/lib/mighost/tasks.rake +300 -0
- data/lib/mighost/version.rb +5 -0
- data/lib/mighost/worktree_recovery.rb +102 -0
- data/lib/mighost.rb +53 -0
- metadata +121 -0
data/lib/mighost.rb
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "mighost/version"
|
|
4
|
+
require_relative "mighost/configuration"
|
|
5
|
+
require_relative "mighost/formatting"
|
|
6
|
+
require_relative "mighost/plain_ui"
|
|
7
|
+
require_relative "mighost/api"
|
|
8
|
+
|
|
9
|
+
module Mighost
|
|
10
|
+
class Error < StandardError; end
|
|
11
|
+
class SnapshotNotFound < Error; end
|
|
12
|
+
class RollbackFailed < Error; end
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
def configuration
|
|
16
|
+
@configuration ||= Configuration.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def configure
|
|
20
|
+
yield(configuration)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def reset_configuration!
|
|
24
|
+
@configuration = Configuration.new
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def enabled?
|
|
28
|
+
configuration.enabled?
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Pluggable UI adapter. Defaults to PlainUI (no colors, no dependencies).
|
|
32
|
+
# Replace with a custom adapter for rich output (e.g. railbow).
|
|
33
|
+
def ui
|
|
34
|
+
@ui ||= PlainUI.new
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
attr_writer :ui
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Mirrors ActiveRecord::Base.connection with Rails 6.1–8.1 compatibility.
|
|
41
|
+
# Usage: Mighost::Base.connection
|
|
42
|
+
module Base
|
|
43
|
+
def self.connection
|
|
44
|
+
if ActiveRecord::Base.respond_to?(:lease_connection)
|
|
45
|
+
ActiveRecord::Base.lease_connection
|
|
46
|
+
else
|
|
47
|
+
ActiveRecord::Base.connection
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
require_relative "mighost/railtie" if defined?(Rails::Railtie)
|
metadata
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mighost
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.4.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Eugene M
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: activerecord
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '6.1'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '8.2'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: '6.1'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '8.2'
|
|
32
|
+
- !ruby/object:Gem::Dependency
|
|
33
|
+
name: railties
|
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '6.1'
|
|
39
|
+
- - "<"
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '8.2'
|
|
42
|
+
type: :runtime
|
|
43
|
+
prerelease: false
|
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: '6.1'
|
|
49
|
+
- - "<"
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: '8.2'
|
|
52
|
+
- !ruby/object:Gem::Dependency
|
|
53
|
+
name: sqlite3
|
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
- - ">="
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: '1.4'
|
|
59
|
+
type: :runtime
|
|
60
|
+
prerelease: false
|
|
61
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
62
|
+
requirements:
|
|
63
|
+
- - ">="
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '1.4'
|
|
66
|
+
description: Captures migration file contents when they run, enabling rollback even
|
|
67
|
+
when the original file is not present (e.g., after switching git branches)
|
|
68
|
+
email:
|
|
69
|
+
- eugene@amberpixels.io
|
|
70
|
+
executables: []
|
|
71
|
+
extensions: []
|
|
72
|
+
extra_rdoc_files: []
|
|
73
|
+
files:
|
|
74
|
+
- CHANGELOG.md
|
|
75
|
+
- LICENSE
|
|
76
|
+
- README.md
|
|
77
|
+
- lib/generators/mighost/install_generator.rb
|
|
78
|
+
- lib/generators/mighost/templates/initializer.rb.tt
|
|
79
|
+
- lib/mighost.rb
|
|
80
|
+
- lib/mighost/api.rb
|
|
81
|
+
- lib/mighost/capturer.rb
|
|
82
|
+
- lib/mighost/configuration.rb
|
|
83
|
+
- lib/mighost/formatting.rb
|
|
84
|
+
- lib/mighost/git_metadata.rb
|
|
85
|
+
- lib/mighost/git_recovery.rb
|
|
86
|
+
- lib/mighost/migrator_extension.rb
|
|
87
|
+
- lib/mighost/orphan_detector.rb
|
|
88
|
+
- lib/mighost/plain_ui.rb
|
|
89
|
+
- lib/mighost/railtie.rb
|
|
90
|
+
- lib/mighost/rollbacker.rb
|
|
91
|
+
- lib/mighost/snapshot.rb
|
|
92
|
+
- lib/mighost/tasks.rake
|
|
93
|
+
- lib/mighost/version.rb
|
|
94
|
+
- lib/mighost/worktree_recovery.rb
|
|
95
|
+
homepage: https://github.com/amberpixels/mighost
|
|
96
|
+
licenses:
|
|
97
|
+
- MIT
|
|
98
|
+
metadata:
|
|
99
|
+
homepage_uri: https://github.com/amberpixels/mighost
|
|
100
|
+
source_code_uri: https://github.com/amberpixels/mighost
|
|
101
|
+
changelog_uri: https://github.com/amberpixels/mighost/blob/main/CHANGELOG.md
|
|
102
|
+
bug_tracker_uri: https://github.com/amberpixels/mighost/issues
|
|
103
|
+
rubygems_mfa_required: 'true'
|
|
104
|
+
rdoc_options: []
|
|
105
|
+
require_paths:
|
|
106
|
+
- lib
|
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
109
|
+
- - ">="
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: 3.1.0
|
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - ">="
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '0'
|
|
117
|
+
requirements: []
|
|
118
|
+
rubygems_version: 4.0.15
|
|
119
|
+
specification_version: 4
|
|
120
|
+
summary: Rollback Rails migrations even when the migration file is missing
|
|
121
|
+
test_files: []
|