hiiro 0.1.218 → 0.1.219

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/h-pgsync +60 -0
  3. data/lib/hiiro/version.rb +1 -1
  4. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 421ab200f5d487c144a9832d8c5ab7f2468f346f160e791349711e9b94383549
4
- data.tar.gz: 9ef8b39d295b809b0b391989061ab0e522d6086dab4c5f86cea06fb6c475e794
3
+ metadata.gz: 2fd3f8ae4acfb1fa951769555cd0503a9038070f2a5f630c455363e5ab7f4f08
4
+ data.tar.gz: '03231287cddeded344610db00c4b28e144ace9230d3463f5503231b93533d909'
5
5
  SHA512:
6
- metadata.gz: ebd0de90681546a3f90031419a0acdbfdd483531aadd1ef7cb53352abcc2471064673e688b98c4c95ffa6e8b6fb3cb673e947ad5a44ccec8ee60c42ebf135a9f
7
- data.tar.gz: ec509bbb7a3eaa72bfb68de541df920b26798bb18553ed16960e066c1ae8f5b4da2f03c3ad715daaad7078ac89f5175496d60f937fbeaf1ed796d2962471d59a
6
+ metadata.gz: c1a8c762c7d82202bc791eaddfa49bfcdf1cdef7d1ab938a1388f3fd0df6fd495a02d2ce96c7f773ed44b93adfec182aa95752235603374da0fe336453366d83
7
+ data.tar.gz: d8935dd8119922a2f714a173236e28a244dc84281e9b0f7ad0881a5e664fd17d60cbeb71a7a1ac3fb372f8ffb50ae7485edb684c3ce01f9f1992fa915fa76992
data/bin/h-pgsync ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'hiiro'
4
+
5
+ Hiiro.run(tasks: true) do
6
+ env = environment
7
+
8
+ add_subcmd(:fix) do |db,*tables|
9
+ task = env.task
10
+ path = task&.path
11
+
12
+ matches =
13
+ if db.nil?
14
+ Dir.glob(File.join(path, ['.pgsync-', '*.y*ml'].join))
15
+ else
16
+ Dir.glob(File.join(path, ['.pgsync-', db, '*.y*ml'].join))
17
+ end
18
+ match = matches.first
19
+
20
+ puts "match: #{match}"
21
+
22
+ puts "matches: #{matches.join("\n")}"
23
+ puts
24
+
25
+ if matches.count == 0
26
+ puts 'No matching db found'
27
+ exit 1
28
+ end
29
+
30
+ if matches.count > 1
31
+ match = fuzzyfind(matches)
32
+ end
33
+
34
+ puts "match: #{match}"
35
+
36
+ lines = File.readlines(match, chomp: true)
37
+ pieces = lines.slice_when {|l| l.match?(/\bgroups:/) }.to_a
38
+
39
+ unless pieces.count == 2
40
+ puts 'ERROR: no groups defined in yaml file'
41
+ exit 1
42
+ end
43
+
44
+ if tables.count == 0
45
+ puts 'ERROR: must provide a list of tables'
46
+ exit 1
47
+ end
48
+
49
+ pieces[0] << ' tempsync:'
50
+ table_lines = tables.map do |tbl|
51
+ " #{tbl.strip}:"
52
+ end
53
+
54
+ File.write(match, [*pieces[0], *table_lines, *pieces[1]].join("\n"))
55
+
56
+ db_name = match.sub(/.*pgsync-/, '').sub(/[.].*/, '')
57
+ puts 'Run this command in your shell:'
58
+ puts " PGSYNC_FROM_STAGING=1 pgsync tempsync --db #{db_name} --truncate --debug"
59
+ end
60
+ end
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.218"
2
+ VERSION = "0.1.219"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.218
4
+ version: 0.1.219
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota
@@ -109,6 +109,7 @@ files:
109
109
  - bin/h-misc
110
110
  - bin/h-notify
111
111
  - bin/h-pane
112
+ - bin/h-pgsync
112
113
  - bin/h-plugin
113
114
  - bin/h-pr
114
115
  - bin/h-project