twb 0.0.27 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/twb/dashboard.rb +21 -5
- data/lib/twb/datasource.rb +12 -3
- data/lib/twb/storyboard.rb +7 -3
- data/lib/twb/workbook.rb +8 -0
- data/lib/twb.rb +3 -3
- data/testTwbGem.rb +4 -3
- data/twb-0.0.1.gem +0 -0
- data/twb-0.0.27.gem +0 -0
- data/twb-0.0.29.gem +0 -0
- data/twb-0.0.30.gem +0 -0
- data/twb.gemspec +4 -1
- metadata +4 -1
data/lib/twb/dashboard.rb
CHANGED
@@ -22,25 +22,41 @@ module Twb
|
|
22
22
|
|
23
23
|
@@hasher = Digest::SHA256.new
|
24
24
|
|
25
|
-
attr_reader :node, :name, :
|
25
|
+
attr_reader :node, :name, :worksheets, :autosize, :size, :maxheight, :maxwidth, :minheight, :minwidth, :rangesize, :dimensions
|
26
26
|
|
27
27
|
def initialize dashboardNode
|
28
28
|
"initialize Dashboard"
|
29
|
-
@node
|
30
|
-
@name
|
29
|
+
@node = dashboardNode
|
30
|
+
@name = @node.attr('name')
|
31
|
+
@size = @node.xpath('./size')
|
32
|
+
@autosize = @size.empty?
|
33
|
+
loadSize @size unless @autosize
|
31
34
|
loadSheets
|
32
35
|
return self
|
33
36
|
end
|
34
37
|
|
35
38
|
def loadSheets
|
36
|
-
@sheets =
|
39
|
+
@sheets = {}
|
37
40
|
dsheets = @node.xpath('.//zone[@name]').to_a
|
38
41
|
dsheets.each do |sheetNode|
|
39
42
|
sheet = Twb::Worksheet.new sheetNode
|
40
|
-
@sheets
|
43
|
+
@sheets[sheet.name] = sheet
|
41
44
|
end
|
42
45
|
end
|
43
46
|
|
47
|
+
def worksheets
|
48
|
+
@sheets.values
|
49
|
+
end
|
50
|
+
|
51
|
+
def loadSize size
|
52
|
+
@maxheight = size.attr('maxheight')
|
53
|
+
@maxwidth = size.attr('maxwidth')
|
54
|
+
@minheight = size.attr('minheight')
|
55
|
+
@minwidth = size.attr('minwidth')
|
56
|
+
@rangesize = size.attr('rangesize')
|
57
|
+
@dimensions = @minwidth.to_s + ':' + @minheight.to_s + ':' +@maxwidth.to_s + ':' +@maxheight.to_s
|
58
|
+
end
|
59
|
+
|
44
60
|
end
|
45
61
|
|
46
62
|
end
|
data/lib/twb/datasource.rb
CHANGED
@@ -22,7 +22,7 @@ module Twb
|
|
22
22
|
|
23
23
|
@@hasher = Digest::SHA256.new
|
24
24
|
|
25
|
-
attr_reader :node, :name, :caption, :uiname, :connHash, :class, :connection
|
25
|
+
attr_reader :node, :name, :caption, :uiname, :connHash, :class, :connection, :tables
|
26
26
|
|
27
27
|
def initialize dataSourceNode
|
28
28
|
@node = dataSourceNode
|
@@ -36,15 +36,24 @@ module Twb
|
|
36
36
|
def processConnection
|
37
37
|
@connHash = ''
|
38
38
|
@connection = @node.at_xpath('./connection')
|
39
|
-
|
39
|
+
unless @connection.nil?
|
40
40
|
@class = @connection.attribute('class').text
|
41
41
|
dsAttributes = @node.xpath('./connection/@*')
|
42
|
-
dsConnStr
|
42
|
+
dsConnStr = ''
|
43
43
|
dsAttributes.each do |attr|
|
44
44
|
dsConnStr += attr.text
|
45
45
|
# Note: '' attributes with value '' don't contribute to the hash
|
46
46
|
end
|
47
47
|
@connHash = Digest::MD5.hexdigest(dsConnStr)
|
48
|
+
loadTables @connection
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def loadTables connection
|
53
|
+
@tables = {}
|
54
|
+
nodes = connection.xpath(".//relation[@type='table']")
|
55
|
+
nodes.each do |node|
|
56
|
+
@tables[node.attr('name')] = node.attr('table')
|
48
57
|
end
|
49
58
|
end
|
50
59
|
|
data/lib/twb/storyboard.rb
CHANGED
@@ -22,7 +22,7 @@ module Twb
|
|
22
22
|
|
23
23
|
@@hasher = Digest::SHA256.new
|
24
24
|
|
25
|
-
attr_reader :node, :name, :
|
25
|
+
attr_reader :node, :name, :worksheets
|
26
26
|
|
27
27
|
def initialize node
|
28
28
|
# puts "initialize Storyboard"
|
@@ -32,13 +32,17 @@ module Twb
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def loadSheets
|
35
|
-
@sheets =
|
35
|
+
@sheets = {}
|
36
36
|
sheets = @node.xpath('.//story-point').to_a
|
37
37
|
sheets.each do |node|
|
38
|
-
@sheets.
|
38
|
+
@sheets[node.attr('captured-sheet')] = node.attr('captured-sheet')
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
def worksheets
|
43
|
+
@sheets.values
|
44
|
+
end
|
45
|
+
|
42
46
|
end
|
43
47
|
|
44
48
|
end
|
data/lib/twb/workbook.rb
CHANGED
@@ -18,10 +18,18 @@ require 'nokogiri'
|
|
18
18
|
module Twb
|
19
19
|
|
20
20
|
|
21
|
+
# Represents Tableau Workbooks and their parts.
|
22
|
+
#
|
21
23
|
class Workbook
|
22
24
|
|
23
25
|
attr_reader :name, :dir, :modtime, :version, :build, :ndoc, :datasources, :dashboards, :storyboards, :worksheets
|
24
26
|
|
27
|
+
# Creates a Workbook, from it's file name.
|
28
|
+
#
|
29
|
+
# == Parameters:
|
30
|
+
# twbWithDir
|
31
|
+
# The Workbook's file name
|
32
|
+
#
|
25
33
|
def initialize twbWithDir
|
26
34
|
file = File.new(twbWithDir)
|
27
35
|
@name = File.basename(twbWithDir)
|
data/lib/twb.rb
CHANGED
@@ -4,9 +4,9 @@ require_relative 'twb/worksheet'
|
|
4
4
|
require_relative 'twb/datasource'
|
5
5
|
require_relative 'twb/storyboard'
|
6
6
|
|
7
|
-
|
7
|
+
# Represents Tableau Workbooks and theis contents.
|
8
|
+
#
|
8
9
|
module Twb
|
9
|
-
VERSION = '0.0.
|
10
|
+
VERSION = '0.0.31'
|
10
11
|
end
|
11
12
|
|
12
|
-
puts "Twb version: #{Twb::VERSION}"
|
data/testTwbGem.rb
CHANGED
@@ -14,13 +14,14 @@ def processTWB twbWithDir
|
|
14
14
|
puts " Data Sources"
|
15
15
|
twb.datasources.each do |ds|
|
16
16
|
puts "\n\t n\t-#{ds.name}\n\t :: c\t-#{ds.caption}\n\t :: uin\t-#{ds.uiname} \n\t :: ch\t-#{ds.connHash}\n\t :: prms?\t-#{ds.Parameters?} "
|
17
|
+
puts "\t tbls\t-#{ds.tables}"
|
17
18
|
end
|
18
19
|
|
19
20
|
puts "\n Dashboards ...."
|
20
21
|
puts "\t \t-#{twb.dashboardNames}"
|
21
22
|
twb.dashboards.each do |dsh|
|
22
|
-
puts "\t n\t-#{dsh.name} "
|
23
|
-
dsh.
|
23
|
+
puts "\t n\t-#{dsh.name} \t auto? #{dsh.autosize} \t dim: #{dsh.dimensions} "
|
24
|
+
dsh.worksheets.each do |sheet|
|
24
25
|
puts "\t n\t -#{sheet.name} "
|
25
26
|
end
|
26
27
|
end
|
@@ -30,7 +31,7 @@ def processTWB twbWithDir
|
|
30
31
|
if twb.storyboards
|
31
32
|
twb.storyboards.each do |sb|
|
32
33
|
puts "\t n\t-#{sb.name} "
|
33
|
-
sb.
|
34
|
+
sb.worksheets.each do |sheet|
|
34
35
|
puts "\t n\t -#{sheet} "
|
35
36
|
end
|
36
37
|
end
|
data/twb-0.0.1.gem
CHANGED
Binary file
|
data/twb-0.0.27.gem
ADDED
Binary file
|
data/twb-0.0.29.gem
ADDED
Binary file
|
data/twb-0.0.30.gem
ADDED
Binary file
|
data/twb.gemspec
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require 'twb'
|
3
|
+
|
1
4
|
Gem::Specification.new do |s|
|
2
5
|
s.name = 'twb'
|
3
6
|
s.summary = "Classes for accessing Tableau Workbooks and their contents - summary."
|
4
7
|
s.description = "Classes for accessing Tableau Workbooks and their contents - description"
|
5
|
-
s.version =
|
8
|
+
s.version = Twb::VERSION
|
6
9
|
s.date = "2015-03-14"
|
7
10
|
s.author = "Chris Gerrard"
|
8
11
|
s.email = "Chris@Gerrard.net"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.31
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -38,6 +38,9 @@ files:
|
|
38
38
|
- twb-0.0.24.gem
|
39
39
|
- twb-0.0.25.gem
|
40
40
|
- twb-0.0.26.gem
|
41
|
+
- twb-0.0.27.gem
|
42
|
+
- twb-0.0.29.gem
|
43
|
+
- twb-0.0.30.gem
|
41
44
|
- twb.gemspec
|
42
45
|
homepage: http://rubygems.org/gems/twb
|
43
46
|
licenses:
|