twb 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,7 +21,8 @@ module Twb
21
21
 
22
22
  class MetadataField
23
23
 
24
- attr_reader :node, :aggregation, :containsnull, :localname, :localtype, :ordinal, :parentname, :precision, :remotealias, :remotename, :remotetype, :width, :name
24
+ attr_reader :node, :aggregation, :containsnull, :localname, :localtype, :ordinal
25
+ attr_reader :parentname, :precision, :remotealias, :remotename, :remotetype, :width, :name
25
26
 
26
27
  def initialize fieldNode
27
28
  @node = fieldNode
@@ -42,7 +43,7 @@ module Twb
42
43
 
43
44
  def load nodeName
44
45
  node = @node.at_xpath(nodeName)
45
- val = if node.nil? then node else node.text end
46
+ val = if node.nil? then node else node.text.strip end
46
47
  # puts "==== MD node:'#{nodeName}' \t nil?'#{node.nil?}' \t == val:#{val} \t = '#{node}' "
47
48
  return val
48
49
  end
@@ -142,8 +142,8 @@ module Util
142
142
 
143
143
  def processOrphans
144
144
  pairs = []
145
- @datasources.each { |dsn| pairs << [@workbook.name,dsn] }
146
- @worksheets.each { |wsn| pairs << [@workbook.name,wsn] }
145
+ #@datasources.each { |dsn| pairs << [@workbook.name,dsn] }
146
+ #@worksheets.each { |wsn| pairs << [@workbook.name,wsn] }
147
147
  return pairs
148
148
  end
149
149
 
@@ -41,22 +41,17 @@ module Util
41
41
  }
42
42
  DOTFOOTER
43
43
 
44
- attr_reader :workbook, :dotFile, :dotFileName, :dashCount, :sheetCount, :dataSourceCount
44
+ attr_reader :workbook, :dashesDotFiles, :dotFileName, :dashCount, :sheetCount, :dataSourceCount
45
45
 
46
46
  def initialize twb
47
47
  @workbook = if twb.instance_of?(Twb::Workbook)
48
48
  then twb
49
49
  else Twb::Workbook.new(twb)
50
50
  end
51
- @dashCount = @workbook.dashboards.length
52
- @worksheets = @workbook.worksheetNames
53
- @sheetCount = @worksheets.length
54
- @datasources = @workbook.datasourceUINames
55
- @dataSourceCount = @datasources.length
56
- pairs = processDashboards
57
- pairs += processWorksheets
58
- pairs += processOrphans
59
- initDot
51
+ @dashboards = @workbook.dashboards
52
+ @dashboards.each do |dash|
53
+ initDot
54
+ end
60
55
  buildBody(pairs)
61
56
  sameRank([@workbook.name] )
62
57
  sameRank( @workbook.dashboardNames )
data/lib/twb/workbook.rb CHANGED
@@ -34,9 +34,9 @@ module Twb
34
34
  #
35
35
  def initialize twbWithDir
36
36
  @valid = false
37
- if File.file?(twbWithDir) then
37
+ if File.file?(twbWithDir) then
38
38
  @name = File.basename(twbWithDir)
39
- @dir = File.dirname(File.expand_path(twbWithDir))
39
+ @dir = File.dirname(File.expand_path(twbWithDir))
40
40
  @modtime = File.new(twbWithDir).mtime.strftime("%Y-%m-%d %H:%M:%S")
41
41
  case File.extname(twbWithDir)
42
42
  when '.twb' then processTWB(twbWithDir)
@@ -44,7 +44,7 @@ module Twb
44
44
  end
45
45
  end
46
46
  end
47
-
47
+
48
48
  def processTWBX(twbxWithDir)
49
49
  Zip::File.open(twbxWithDir) do |zip_file|
50
50
  twb = zip_file.glob('*.twb').first
@@ -57,7 +57,7 @@ module Twb
57
57
  @ndoc = Nokogiri::XML(open(twbFile))
58
58
  processDoc
59
59
  end
60
-
60
+
61
61
  def processDoc
62
62
  @workbooknode = @ndoc.at_xpath('//workbook')
63
63
  @version = @ndoc.xpath('/workbook/@version')
@@ -120,7 +120,6 @@ module Twb
120
120
  end
121
121
  end
122
122
 
123
-
124
123
  def datasources
125
124
  @datasources.values
126
125
  end
@@ -129,6 +128,10 @@ module Twb
129
128
  @dashboards.values
130
129
  end
131
130
 
131
+ def dashboardNames
132
+ @dashboards.keys
133
+ end
134
+
132
135
  def storyboards
133
136
  @storyboards.values
134
137
  end
data/lib/twb.rb CHANGED
@@ -33,5 +33,5 @@ require_relative 'twb/util/xraydashboards'
33
33
  # Represents Tableau Workbooks and their contents.
34
34
  #
35
35
  module Twb
36
- VERSION = '0.5.0'
36
+ VERSION = '0.5.1'
37
37
  end
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.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: