fancybox2 0.0.7 → 0.0.8
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/lib/fancybox2/migrations/runner.rb +7 -7
- data/lib/fancybox2/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d6fec49dcd588ebb60bc82f555240121134b3fcfc40747b63513795f50adf96
|
4
|
+
data.tar.gz: 5d683438d83ad32f12db66ab811da55864e3c0f801f6fb0eb7620d5bb35432a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22dcbb5bc7e731cc338ade1afe6023b706230526abeafef56655fe863f0e3314a622c8bab91eb3a2b788219026acb8151651be6deed4f4a616dfde5780338def
|
7
|
+
data.tar.gz: 49e4e79a91a552d4cb130c7c8cce4e037d6cf7c3314d38abaffc75167d3c1fac83fb0384ae850860df11c87de46e5caf278a0442df1e9f2e939b4cbfc1e71f19
|
@@ -3,14 +3,14 @@ module Fancybox2
|
|
3
3
|
class Runner
|
4
4
|
include Exceptions
|
5
5
|
|
6
|
-
VERSION_REGEXP = /^(\d
|
6
|
+
VERSION_REGEXP = /^(\d+)/.freeze
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
10
|
def extract_and_validate_version_from(migration_name)
|
11
11
|
version = migration_name.to_s.scan(VERSION_REGEXP).flatten.first
|
12
12
|
unless version
|
13
|
-
raise ArgumentError, 'migration
|
13
|
+
raise ArgumentError, 'migration name must start with an integer number e.g: 02_do_something.rb'
|
14
14
|
end
|
15
15
|
|
16
16
|
version.to_i
|
@@ -24,7 +24,7 @@ module Fancybox2
|
|
24
24
|
|
25
25
|
load_migrations
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
# @param from a valid migration name or version
|
29
29
|
# @param to a valid migration name or version
|
30
30
|
def run(from: nil, to: nil)
|
@@ -40,13 +40,13 @@ module Fancybox2
|
|
40
40
|
|
41
41
|
def load_migrations
|
42
42
|
# Load files from files_path and create classes
|
43
|
-
@migrations = Dir[File.join(File.expand_path(files_path), '**', '*.rb')].
|
44
|
-
migration_name = File.basename(
|
43
|
+
@migrations = Dir[File.join(File.expand_path(files_path), '**', '*.rb')].map do |file_path|
|
44
|
+
migration_name = File.basename(file_path)
|
45
45
|
klass = Class.new(Base)
|
46
|
-
klass.class_eval(File.read(
|
46
|
+
klass.class_eval(File.read(file_path), file_path)
|
47
47
|
klass.freeze
|
48
48
|
klass.new migration_name
|
49
|
-
end
|
49
|
+
end.sort_by { |migration| migration.version }
|
50
50
|
end
|
51
51
|
|
52
52
|
# Select migrations to run depending given a starting and an ending one
|
data/lib/fancybox2/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fancybox2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Verlato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|