datafusion 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05159f4373eeb40d11b0a2dd7869c5f5cf5703e8
4
- data.tar.gz: f6b8fa17cea6134a2f2cc3232afb88e032cc905f
3
+ metadata.gz: 4065931f372c1c4d91ee61f462100b7c3c7ec7e7
4
+ data.tar.gz: e6e4f5c874d0e1972d7a81ec7ebb8d1997343f08
5
5
  SHA512:
6
- metadata.gz: c76a7c10a1ebb986394279b36af981f16efddbc2a333eb926a099a26f736976f48fa2b302480d7488a78104d9bfc639f5c7b6e4f335b5397c8add27d78876b0b
7
- data.tar.gz: b49a0ed3fb636c087e297864b4739d75f1c65932ba74255379659ec84d69e1a594ede803912f98049ea4db76c0e7c1d7e9f07b0f887b955e6996102cb8f8326f
6
+ metadata.gz: 0e9dd475618d1922e2273187b15e970a413df6129c637d0893a74ce260e15215fe998f1914db1021d27cad35416843342f4fcd2ea267a7801a59b8d928f37660
7
+ data.tar.gz: 6124e7695e338b00e6650fbdff8092c52281cc85f543ab457b0c4fb2c71c0890bb4047c4320b6d0a1168eb6979c4c300040edb5494883681e0ffc4e818ca8959
@@ -18,6 +18,7 @@ end
18
18
  o = Slop::Options.new
19
19
  o.string '-f', '--file', 'Integrations file (URL or local)'
20
20
  o.string '-c', '--connection', 'Connection string to fusion engine (postgres)', default: 'postgres://localhost'
21
+ o.bool '-r', '--remove', 'Remove existing integrations', default: false
21
22
  o.bool '-s', '--setup', 'Setup integrations', default: false
22
23
  o.bool '-a', '--agent', 'Connection string (i.e postgres://localhost)', default: false
23
24
  o.bool '-d', '--dryrun', 'dry run for refreshes', default: false
@@ -46,14 +47,21 @@ end
46
47
  end
47
48
 
48
49
  file = opts[:file]
50
+
49
51
 
50
- if opts[:setup]
51
- Datafusion.fuse(file, exec_class, opts)
52
- elsif opts[:agent]
52
+ if opts[:agent]
53
53
  sched = Datafusion.refresh(file, exec_class, opts)
54
54
  Datafusion.log.info("Running refresh agent.")
55
55
  sched.join
56
- else
57
- bail("Please pick a mode: --setup | --agent", opts)
58
56
  end
59
57
 
58
+ if opts[:remove]
59
+ Datafusion.remove!(exec_class)
60
+ Datafusion.log.info("Removed all integrations")
61
+ end
62
+
63
+ if opts[:setup]
64
+ Datafusion.fuse(file, exec_class, opts)
65
+ end
66
+
67
+
@@ -20,6 +20,10 @@ module Datafusion
20
20
  @log = logger
21
21
  end
22
22
 
23
+ def self.remove!(executor)
24
+ executor.remove!
25
+ end
26
+
23
27
  def self.fuse(file, executor, opts)
24
28
  out = Integrations.render(file, opts)
25
29
  executor.execute(out, "integrations")
@@ -8,6 +8,13 @@ module Datafusion
8
8
  @db = Sequel.connect(conn)
9
9
  end
10
10
 
11
+ def remove!
12
+ servers = @db[:pg_foreign_server].map(:srvname)
13
+ servers.each do |srv|
14
+ execute("drop server if exists #{srv} cascade", "drop #{srv}")
15
+ end
16
+ end
17
+
11
18
  def execute(sql, label='')
12
19
  run = rand(36**5).to_s(36)
13
20
 
@@ -1,5 +1,10 @@
1
1
  module Datafusion
2
2
  class DebugExecutor
3
+
4
+ def remove!
5
+ puts "-- REMOVE!"
6
+ end
7
+
3
8
  def execute(stuff, label='')
4
9
  puts "-- EXECUTE: #{label}\n#{stuff}"
5
10
  end
@@ -1,3 +1,3 @@
1
1
  module Datafusion
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datafusion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dotan Nahum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-22 00:00:00.000000000 Z
11
+ date: 2016-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop