blackstack-deployer 1.2.9 → 1.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blackstack-deployer.rb +30 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2679af8f481fed33450095920f1df612031cc47f790311e184abe7eed4a9c635
|
4
|
+
data.tar.gz: 53fbd6168caa6fa4b119a54a3533c6472695eb695d11a26f9e2c140656990ebe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73e025d6a248f20851a4d40fb635c5a0cc2cecbc4d7d2b4f82e654034923746760daaae6049ead50d0db5db2b1e467bf82af0721b1b4df66a36a5136c4d0c31d
|
7
|
+
data.tar.gz: 56b9cf40e81503d9de69eee618bb1d7cdf024b6604a0fdf00da9da830f75ba5fe7ad4c14c4547cfec26e5b0bb8667e11fe153cb2eae6eb9944089642f80e5b53
|
data/lib/blackstack-deployer.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
require'blackstack-nodes'
|
3
|
-
|
1
|
+
require 'blackstack-nodes'
|
4
2
|
require 'sequel'
|
5
3
|
|
6
4
|
module BlackStack
|
@@ -524,6 +522,7 @@ module BlackStack
|
|
524
522
|
end # def
|
525
523
|
|
526
524
|
module DB
|
525
|
+
LOCKFILE = './blackstack-deployer.lock'
|
527
526
|
@@checkpoint = nil
|
528
527
|
@@superhuser = nil
|
529
528
|
@@ndb = nil
|
@@ -532,7 +531,24 @@ module BlackStack
|
|
532
531
|
def self.set_checkpoint(s)
|
533
532
|
@@checkpoint = s
|
534
533
|
end
|
535
|
-
|
534
|
+
|
535
|
+
def self.checkpoint
|
536
|
+
@@checkpoint
|
537
|
+
end
|
538
|
+
|
539
|
+
def self.save_checkpoint
|
540
|
+
File.new('./blackstack-deployer.lock', "w").write(@@checkpoint)
|
541
|
+
end
|
542
|
+
|
543
|
+
def self.load_checkpoint
|
544
|
+
if File.exists?(BlackStack::Deployer::DB::LOCKFILE)
|
545
|
+
@@checkpoint = File.new(BlackStack::Deployer::DB::LOCKFILE, "r").read
|
546
|
+
else
|
547
|
+
@@checkpoint = nil
|
548
|
+
end
|
549
|
+
@@checkpoint
|
550
|
+
end
|
551
|
+
|
536
552
|
def self.connect(s)
|
537
553
|
@@db = Sequel::connect(s)
|
538
554
|
end # def
|
@@ -611,7 +627,7 @@ module BlackStack
|
|
611
627
|
|
612
628
|
# Run a series of `.sql` files with updates to the database.
|
613
629
|
#
|
614
|
-
def self.deploy()
|
630
|
+
def self.deploy(save_checkpoints=false)
|
615
631
|
tlogger = BlackStack::Deployer::logger
|
616
632
|
# get list of `.sql` files in the directory `sql_path`, with a name higher than `last_filename`, sorted by name.
|
617
633
|
Dir.entries(@@folder).select {
|
@@ -624,8 +640,16 @@ module BlackStack
|
|
624
640
|
tlogger.done
|
625
641
|
|
626
642
|
tlogger.logs "Updating checkpoint... "
|
627
|
-
|
643
|
+
BlackStack::Deployer::DB::set_checkpoint filename
|
628
644
|
tlogger.done
|
645
|
+
|
646
|
+
tlogger.logs 'Saving checkpoint... '
|
647
|
+
if save_checkpoints
|
648
|
+
BlackStack::Deployer::DB::save_checkpoint
|
649
|
+
tlogger.done
|
650
|
+
else
|
651
|
+
tlogger.logf 'disabled'
|
652
|
+
end
|
629
653
|
}
|
630
654
|
end # def
|
631
655
|
end # module DB
|