twb 0.0.31 → 0.0.33

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 (45) hide show
  1. data/bg.cmd +5 -0
  2. data/lib/twb.rb +7 -2
  3. data/lib/twb/dashboard.rb +7 -7
  4. data/lib/twb/datasource.rb +38 -9
  5. data/lib/twb/docdashboard.rb +123 -0
  6. data/lib/twb/field.rb +39 -0
  7. data/lib/twb/hashtohtml.rb +39 -0
  8. data/lib/twb/htmllistcollapsible.rb +154 -0
  9. data/lib/twb/localfield.rb +42 -0
  10. data/lib/twb/metadatafield.rb +55 -0
  11. data/lib/twb/util/UpLeftArrowsNav.png +0 -0
  12. data/lib/twb/util/hashtohtml.rb +45 -0
  13. data/lib/twb/util/htmllistcollapsible.rb +195 -0
  14. data/lib/twb/window.rb +31 -0
  15. data/lib/twb/workbook.rb +77 -12
  16. data/lib/twb/worksheet.rb +29 -1
  17. data/test/No Content.injected.twb +82 -0
  18. data/test/No Content.twb +68 -0
  19. data/test/No Dashboards.injected.twb +618 -0
  20. data/test/No Dashboards.twb +604 -0
  21. data/test/Special Documentation.html +198 -0
  22. data/test/TableauDocInlineCSS.html +165 -0
  23. data/test/UpLeftArrowsNav.png +0 -0
  24. data/test/Web Page Dashboards.injected.twb +1361 -0
  25. data/test/Web Page Dashboards.twb +1347 -0
  26. data/test/collapsibleList.html +198 -0
  27. data/test/testDocDashboard.rb +53 -0
  28. data/test/testDocDashboardCreate.rb +33 -0
  29. data/test/testHTMLList.rb +23 -0
  30. data/test/testTwbGem.rb +67 -0
  31. data/testTwbGem.rb +23 -9
  32. data/testTwbWrite.rb +22 -0
  33. data/twb-0.0.32.gem +0 -0
  34. metadata +29 -12
  35. data/twb-0.0.1.gem +0 -0
  36. data/twb-0.0.2.gem +0 -0
  37. data/twb-0.0.21.gem +0 -0
  38. data/twb-0.0.22.gem +0 -0
  39. data/twb-0.0.23.gem +0 -0
  40. data/twb-0.0.24.gem +0 -0
  41. data/twb-0.0.25.gem +0 -0
  42. data/twb-0.0.26.gem +0 -0
  43. data/twb-0.0.27.gem +0 -0
  44. data/twb-0.0.29.gem +0 -0
  45. data/twb-0.0.30.gem +0 -0
@@ -0,0 +1,198 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
5
+ <title>Tableau Documentation</title>
6
+ <style type="text/css">
7
+ body, a {
8
+ color: #3B4C56;
9
+ font-family: sans-serif;
10
+ font-size: 14px;
11
+ text-decoration: none;
12
+ }
13
+ #pgtitle
14
+ {
15
+ margin: 0px 0px 20px;
16
+ font-size: 14pt;
17
+ text-align: center;
18
+ }
19
+ a{
20
+ cursor:pointer;
21
+ }
22
+ .tree ul {
23
+ list-style: none outside none;
24
+ }
25
+ .tree li a {
26
+ line-height: 25px;
27
+ }
28
+ .tree > ul > li > a {
29
+ color: #3B4C56;
30
+ display: block;
31
+ font-weight: normal;
32
+ position: relative;
33
+ text-decoration: none;
34
+ }
35
+ .tree li.parent > a {
36
+ padding: 0 0 0 28px;
37
+ }
38
+ .tree li.parent > a:before {
39
+ background-image: url("Controls.png");
40
+ background-position: 20px center;
41
+ content: "";
42
+ display: block;
43
+ height: 20px;
44
+ left: 0;
45
+ position: absolute;
46
+ top: 2px;
47
+ vertical-align: middle;
48
+ width: 20px;
49
+ }
50
+ .tree ul li.active > a:before {
51
+ background-position: 0 center;
52
+ }
53
+ .tree ul li ul {
54
+ border-left: 1px solid #D9DADB;
55
+ display: none;
56
+ margin: 0 0 0 12px;
57
+ overflow: hidden;
58
+ padding: 0 0 0 25px;
59
+ }
60
+ .tree ul li ul li {
61
+ position: relative;
62
+ }
63
+ .tree ul li ul li:before {
64
+ border-bottom: 1px dashed #E2E2E3;
65
+ content: "";
66
+ left: -20px;
67
+ position: absolute;
68
+ top: 12px;
69
+ width: 15px;
70
+ }
71
+ #wrapper {
72
+ margin: 0 auto;
73
+ width: 300px;
74
+ }
75
+ </style>
76
+ <script src="http://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript"> </script><script type="text/javascript">
77
+ $( document ).ready( function( ) {
78
+ $( '.tree li' ).each( function() {
79
+ if( $( this ).children( 'ul' ).length > 0 ) {
80
+ $( this ).addClass( 'parent' );
81
+ }
82
+ });
83
+
84
+ $( '.tree li.parent > a' ).click( function( ) {
85
+ $( this ).parent().toggleClass( 'active' );
86
+ $( this ).parent().children( 'ul' ).slideToggle( 'fast' );
87
+ });
88
+
89
+ $( '#all' ).click( function() {
90
+
91
+ $( '.tree li' ).each( function() {
92
+ $( this ).toggleClass( 'active' );
93
+ $( this ).children( 'ul' ).slideToggle( 'fast' );
94
+ });
95
+ });
96
+
97
+ $( '.tree li' ).each( function() {
98
+ $( this ).toggleClass( 'active' );
99
+ $( this ).children( 'ul' ).slideToggle( 'fast' );
100
+ });
101
+
102
+ });
103
+
104
+ </script>
105
+ </head>
106
+ <body>
107
+ <div id="pgtitle">Exploratory Content</div>
108
+ <div id="wrapper">
109
+ <div class="tree">
110
+ <button id="all">Toggle all</button>
111
+ <ul>
112
+ <li>
113
+ <a>a</a>
114
+ <ul>
115
+ <li>
116
+ <a>eh?</a>
117
+ </li>
118
+ </ul>
119
+ </li>
120
+ <li>
121
+ <a>b</a>
122
+ <ul>
123
+ <li>
124
+ <a>bee</a>
125
+ </li>
126
+ <li>
127
+ <a>be</a>
128
+ </li>
129
+ </ul>
130
+ </li>
131
+ <li>
132
+ <a>c</a>
133
+ <ul>
134
+ <li>
135
+ <a>sea</a>
136
+ <ul>
137
+ <li>
138
+ <a>ocean</a>
139
+ </li>
140
+ <li>
141
+ <a>mer</a>
142
+ </li>
143
+ </ul>
144
+ </li>
145
+ <li>
146
+ <a>see</a>
147
+ <ul>
148
+ <li>
149
+ <a>vision</a>
150
+ </li>
151
+ <li>
152
+ <a>sight</a>
153
+ </li>
154
+ <li>
155
+ <a>lookers</a>
156
+ </li>
157
+ </ul>
158
+ </li>
159
+ </ul>
160
+ </li>
161
+ <li>
162
+ <a>red</a>
163
+ <ul>
164
+ <li>
165
+ <a>red</a>
166
+ <ul>
167
+ <li>
168
+ <a>crimson</a>
169
+ <ul>
170
+ <li>
171
+ <a>color</a>
172
+ </li>
173
+ <li>
174
+ <a>of</a>
175
+ </li>
176
+ <li>
177
+ <a>blood</a>
178
+ </li>
179
+ </ul>
180
+ </li>
181
+ </ul>
182
+ </li>
183
+ <li>
184
+ <a>read</a>
185
+ <ul>
186
+ <li>
187
+ <a>tense uncertain</a>
188
+ </li>
189
+ </ul>
190
+ </li>
191
+ </ul>
192
+ </li>
193
+ </ul>
194
+ </div>
195
+ </div>
196
+
197
+ </body>
198
+ </html>
@@ -0,0 +1,53 @@
1
+ require 'twb'
2
+ require "test/unit"
3
+
4
+ system "cls"
5
+
6
+ class TestDocDash < Test::Unit::TestCase
7
+
8
+ def test_create
9
+ vDash = Twb::DocDashboardWebVert.new
10
+ assert(!vDash.nil?, "Doc Dashboard creation should not be null")
11
+ assert_equal('columnar Web Page', vDash.type)
12
+ assert(!vDash.dashnode.nil?, "Doc Dashboard dashboard node should not be null")
13
+ assert(!vDash.winnode.nil?, "Doc Dashboard window node should not be null")
14
+ assert(!vDash.dashnode.at_xpath('.//zone[@type="web"]').nil?, " <dashboard Web zone must not be null")
15
+ assert(!vDash.winnode.at_xpath('.//zone[@type="web"]').nil?, " <window Web zone must not be null")
16
+ end
17
+
18
+ def test_assignname
19
+ vDash = Twb::DocDashboardWebVert.new
20
+ vDash.title=('test title name')
21
+ assert_equal('test title name', vDash.title)
22
+ assert(!vDash.dashnode.attribute('name').nil?)
23
+ assert(!vDash.winnode.attribute('name').nil?)
24
+ assert_equal('test title name', vDash.dashnode.attribute('name').value)
25
+ assert_equal('test title name', vDash.winnode.attribute('name').value)
26
+ end
27
+
28
+ def test_assigurl
29
+ vDash = Twb::DocDashboardWebVert.new
30
+ vDash.url=('test URL')
31
+ assert_equal('test URL', vDash.url)
32
+ end
33
+
34
+ def test_inject
35
+ vDash = Twb::DocDashboardWebVert.new
36
+ vDash.title=('Injected Documentation Dashboard')
37
+ vDash.url=('http://localhost:8808/doc_root/nokogiri-1.5.5-x86-mingw32/rdoc/Nokogiri/XML/Node.html#method-i-add_next_sibling')
38
+ do_injection(vDash, 'No Content.twb')
39
+ vDash.title=('Collapsible List of Workook Contents')
40
+ vDash.url=('file:///C:/tech/misc/expandable_tree_view/TableauDocInlineCSS.html')
41
+ do_injection(vDash, 'No Dashboards.twb')
42
+ do_injection(vDash, 'Web Page Dashboards.twb')
43
+ end
44
+
45
+ def do_injection(dash, twbName)
46
+ print "\ninjecting into: #{twbName}"
47
+ twb = Twb::Workbook.new(twbName)
48
+ assert(!twb.nil?)
49
+ twb.addDocDashboard dash
50
+ twb.writeAppend('injected')
51
+ end
52
+
53
+ end
@@ -0,0 +1,33 @@
1
+ # testTwbGem.rb - this Ruby script Copyright 2013, 2014 Christopher Gerrard
2
+
3
+ require 'nokogiri'
4
+
5
+ #require 'twb'
6
+ require 'C:\tech\Tableau\tools\Ruby\gems\twb\lib\twb.rb'
7
+
8
+
9
+ vDash = Twb::DocDashboardWebVert.new
10
+ vDash.title='Test Web Page Doc Dashboard'
11
+
12
+ vDash.url='new dashboard URL'
13
+
14
+ =begin
15
+ hDash = Twb::DocDashboardWebHoriz.new
16
+ hDash.title='across'
17
+
18
+ puts "Vert: #{vDash} -> #{vDash.type} \t - #{vDash.title} \ndashnode:\n #{vDash.dashnode} \n\nwinnode: #{vDash.winnode}\n\n\n"
19
+ puts "horz: #{hDash} -> #{hDash.type} \t - #{hDash.title}"
20
+
21
+ def loadDash type
22
+ print "init new dash '#{type}'\t: "
23
+ dash = Twb::DocDashboard.new(type)
24
+ puts "#{dash} :: #{dash.nil?}"
25
+ puts "#{if dash.nil? then 'nope' else dash.type end}"
26
+ end
27
+
28
+ loadDash 'v'
29
+ loadDash 'vert'
30
+ loadDash 'tical'
31
+ loadDash 'vertical'
32
+ loadDash 'veert'
33
+ =end
@@ -0,0 +1,23 @@
1
+ require 'twb'
2
+ require "test/unit"
3
+
4
+ system "cls"
5
+
6
+ class TestHTMLList < Test::Unit::TestCase
7
+
8
+ def test_create
9
+ struct = {'a' => {'eh?'=>nil},
10
+ 'b' => ['bee', 'be'],
11
+ 'c' => {'sea'=>['ocean','mer'],
12
+ 'see'=>['vision','sight','lookers']
13
+ },
14
+ 'red' => {'red'=>{'crimson'=>['color','of','blood']},
15
+ 'read'=>['tense uncertain']
16
+ }
17
+ }
18
+ doc = Twb::HTMLListCollapsible.new(struct)
19
+ doc.title="Important Stuff to See"
20
+ doc.write('Special Documentation.html')
21
+ end
22
+
23
+ end
@@ -0,0 +1,67 @@
1
+ # testTwbGem.rb - this Ruby script Copyright 2013, 2014 Christopher Gerrard
2
+
3
+ require 'nokogiri'
4
+
5
+ #require 'twb'
6
+ require 'C:\tech\Tableau\tools\Ruby\gems\twb\lib\twb.rb'
7
+
8
+ def processTWB twbWithDir
9
+ print "\n\n\n== #{twbWithDir}"
10
+ twb = Twb::Workbook.new twbWithDir
11
+ puts " :: #{twb.name}"
12
+ doc = twb.ndoc
13
+
14
+ puts " Data Sources"
15
+ twb.datasources.each do |ds|
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 :: p?\t- #{ds.Parameters?} "
17
+ puts "\t tbls\t- #{ds.tables}"
18
+ ds.localfields.each do |name,fld|
19
+ puts "\t\t lfld:\t- #{name}"
20
+ end
21
+ ds.metadatafields.each do |name,fld|
22
+ puts "\t\t mfld:\t- #{name} = #{fld.localname} = #{fld}"
23
+ end
24
+ end
25
+
26
+ puts "\n Dashboards ...."
27
+ puts "\t \t-#{twb.dashboardNames}"
28
+ twb.dashboards.each do |dsh|
29
+ puts "\n\t n\t- #{dsh.name} \t zc:#{dsh.zonecount} \t auto? #{dsh.autosize} \t dim: #{dsh.dimensions} "
30
+ dsh.worksheets.each do |sheet|
31
+ puts "\t s\t - #{sheet.name} \t dsnames:#{sheet.datasourcenames} "
32
+ end
33
+ end
34
+
35
+ puts "\n Worksheets ...."
36
+ puts "\t \t-#{twb.worksheetNames}"
37
+ twb.worksheets.each do |ws|
38
+ puts "\t n\t-#{ws.name}"
39
+ ws.datasourcenames.each do |dsn|
40
+ puts "\t ds:\t- #{dsn}"
41
+ end
42
+ end
43
+
44
+ puts "\n Storyboards ...."
45
+ puts "\t \t-#{twb.storyboardNames}"
46
+ if twb.storyboards
47
+ twb.storyboards.each do |sb|
48
+ puts "\t n\t-#{sb.name} "
49
+ sb.worksheets.each do |sheet|
50
+ puts "\t n\t -#{sheet} "
51
+ end
52
+ end
53
+ end
54
+
55
+ end
56
+
57
+ def getName techName
58
+ techName.gsub(/^\[/,'').gsub(/\]$/,'')
59
+ end
60
+
61
+ puts "START"
62
+
63
+ path = if ARGV.empty? then '**/*.twb' else ARGV[0] end
64
+ puts "Looking for Workbooks matching: #{path}"
65
+ Dir.glob(path) {|twb| processTWB twb }
66
+
67
+ $f.close unless $f.nil?
data/testTwbGem.rb CHANGED
@@ -6,23 +6,38 @@ require 'nokogiri'
6
6
  require 'C:\tech\Tableau\tools\Ruby\gems\twb\lib\twb.rb'
7
7
 
8
8
  def processTWB twbWithDir
9
- puts "\n\n\n== #{twbWithDir}"
9
+ print "\n\n\n== #{twbWithDir}"
10
10
  twb = Twb::Workbook.new twbWithDir
11
- puts "#{twb.name}"
11
+ puts " :: #{twb.name}"
12
12
  doc = twb.ndoc
13
13
 
14
14
  puts " Data Sources"
15
15
  twb.datasources.each do |ds|
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}"
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 :: p?\t- #{ds.Parameters?} "
17
+ puts "\t tbls\t- #{ds.tables}"
18
+ ds.localfields.each do |name,fld|
19
+ puts "\t\t lfld:\t- #{name}"
20
+ end
21
+ ds.metadatafields.each do |name,fld|
22
+ puts "\t\t mfld:\t- #{name} = #{fld.localname} = #{fld}"
23
+ end
18
24
  end
19
25
 
20
26
  puts "\n Dashboards ...."
21
27
  puts "\t \t-#{twb.dashboardNames}"
22
28
  twb.dashboards.each do |dsh|
23
- puts "\t n\t-#{dsh.name} \t auto? #{dsh.autosize} \t dim: #{dsh.dimensions} "
29
+ puts "\n\t n\t- #{dsh.name} \t zc:#{dsh.zonecount} \t auto? #{dsh.autosize} \t dim: #{dsh.dimensions} "
24
30
  dsh.worksheets.each do |sheet|
25
- puts "\t n\t -#{sheet.name} "
31
+ puts "\t s\t - #{sheet.name} \t dsnames:#{sheet.datasourcenames} "
32
+ end
33
+ end
34
+
35
+ puts "\n Worksheets ...."
36
+ puts "\t \t-#{twb.worksheetNames}"
37
+ twb.worksheets.each do |ws|
38
+ puts "\t n\t-#{ws.name}"
39
+ ws.datasourcenames.each do |dsn|
40
+ puts "\t ds:\t- #{dsn}"
26
41
  end
27
42
  end
28
43
 
@@ -45,9 +60,8 @@ end
45
60
 
46
61
  puts "START"
47
62
 
48
- path = if ARGV.empty? then '*.twb' else ARGV[0] end
49
-
50
-
63
+ path = if ARGV.empty? then '**/*.twb' else ARGV[0] end
64
+ puts "Looking for Workbooks matching: #{path}"
51
65
  Dir.glob(path) {|twb| processTWB twb }
52
66
 
53
67
  $f.close unless $f.nil?
data/testTwbWrite.rb ADDED
@@ -0,0 +1,22 @@
1
+ # testTwbGem.rb - this Ruby script Copyright 2013, 2014 Christopher Gerrard
2
+
3
+ require 'nokogiri'
4
+
5
+ #require 'twb'
6
+ require 'C:\tech\Tableau\tools\Ruby\gems\twb\lib\twb.rb'
7
+
8
+ def processTWB twbWithDir
9
+ print "\n\n\n== #{twbWithDir}"
10
+ twb = Twb::Workbook.new twbWithDir
11
+ puts " :: #{twb.name}"
12
+ twb.writeAppend '.Documented'
13
+ twb.writeAppend '....MultiLeadingPeriods'
14
+ end
15
+
16
+ puts "START"
17
+
18
+ path = if ARGV.empty? then '**/*.twb' else ARGV[0] end
19
+ puts "Looking for Workbooks matching: #{path}"
20
+ Dir.glob(path) {|twb| processTWB twb }
21
+
22
+ $f.close unless $f.nil?