hekenga 0.1.2 → 0.2.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 +4 -4
- data/examples/simple_example.rb +0 -3
- data/exe/hekenga +4 -2
- data/lib/hekenga/document_task.rb +1 -2
- data/lib/hekenga/dsl/document_task.rb +0 -8
- data/lib/hekenga/migration.rb +0 -8
- data/lib/hekenga/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ada2d751dad24dfabc63bc15116d3f0716ca86af
|
4
|
+
data.tar.gz: 625d792a4d30c70410b9e2211ef5e42b2473781e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5954d9417a8841b68fdf45555f3e2685fe8469e2aac72767f34d58ecc7a11ea4f44fad05bae5dbeb789a094b0cf2cef9804ff315c55fd7a3fb70c984cf7658e
|
7
|
+
data.tar.gz: 4ec78aa0ccee0ccb5df3cb013604989b52e9e0ddafc5ee5ee10adb4635c37a55517dd8b5c49341afc6b5861fa6384a22d4190eebe8292f4b05693a776dffa40c
|
data/examples/simple_example.rb
CHANGED
@@ -24,9 +24,6 @@ Hekenga.migration do
|
|
24
24
|
# - scope
|
25
25
|
# - arbitrary block
|
26
26
|
# Jobs can be run in parallel via ActiveJob.
|
27
|
-
# Callbacks can be disabled for the context of the job either globally via
|
28
|
-
# disable_callbacks or specifically via disable_callback, with multiple models
|
29
|
-
# optionally targetted via the `on` param.
|
30
27
|
# A setup block is also provided (this must be able to be run multiple times!)
|
31
28
|
# per_document migrations should be resumable/retryable..
|
32
29
|
# errors should never result in data loss, and should be logged to a migration
|
data/exe/hekenga
CHANGED
@@ -33,8 +33,10 @@ class HekengaCLI < Thor
|
|
33
33
|
bail_if_errors
|
34
34
|
Hekenga.load_all!
|
35
35
|
Hekenga.registry.sort_by {|x| x.stamp}.each do |migration|
|
36
|
-
migration
|
37
|
-
|
36
|
+
if Hekenga.status(migration) == :naught
|
37
|
+
migration.perform!
|
38
|
+
bail_if_errors
|
39
|
+
end
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
@@ -2,12 +2,11 @@ require 'hekenga/irreversible'
|
|
2
2
|
module Hekenga
|
3
3
|
class DocumentTask
|
4
4
|
attr_reader :ups, :downs, :setups, :filters
|
5
|
-
attr_accessor :parallel, :
|
5
|
+
attr_accessor :parallel, :scope, :timeless
|
6
6
|
attr_accessor :description, :invalid_strategy, :skip_prepare
|
7
7
|
def initialize
|
8
8
|
@ups = []
|
9
9
|
@downs = []
|
10
|
-
@disable_rules = []
|
11
10
|
@setups = []
|
12
11
|
@filters = []
|
13
12
|
@invalid_strategy = :prompt
|
@@ -25,14 +25,6 @@ module Hekenga
|
|
25
25
|
def skip_prepare!
|
26
26
|
@object.skip_prepare = true
|
27
27
|
end
|
28
|
-
def disable_callback(callback, args = {})
|
29
|
-
[args[:on]].flatten.compact.each do |model|
|
30
|
-
@object.disable_rules.push({
|
31
|
-
klass: model,
|
32
|
-
callback: callback
|
33
|
-
})
|
34
|
-
end
|
35
|
-
end
|
36
28
|
def setup(&block)
|
37
29
|
@object.setups.push block
|
38
30
|
end
|
data/lib/hekenga/migration.rb
CHANGED
@@ -271,18 +271,10 @@ module Hekenga
|
|
271
271
|
task&.setups&.each do |block|
|
272
272
|
@context.instance_exec(&block)
|
273
273
|
end
|
274
|
-
# Disable specific callbacks
|
275
274
|
begin
|
276
|
-
task&.disable_rules&.each do |rule|
|
277
|
-
rule[:klass].skip_callback rule[:callback]
|
278
|
-
end
|
279
275
|
yield
|
280
276
|
ensure
|
281
277
|
@context = nil
|
282
|
-
# Make sure the callbacks make it back
|
283
|
-
task&.disable_rules&.each do |rule|
|
284
|
-
rule[:klass].set_callback rule[:callback]
|
285
|
-
end
|
286
278
|
end
|
287
279
|
end
|
288
280
|
def start_document_task(task, task_idx, scope)
|
data/lib/hekenga/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hekenga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tapio Saarinen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
197
|
version: '0'
|
198
198
|
requirements: []
|
199
199
|
rubyforge_project:
|
200
|
-
rubygems_version: 2.
|
200
|
+
rubygems_version: 2.6.12
|
201
201
|
signing_key:
|
202
202
|
specification_version: 4
|
203
203
|
summary: Sophisticated migration framework for mongoid, with the ability to parallelise
|