twb 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
data/lib/twb.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  require_relative 'twb/workbook'
2
+ require_relative 'twb/dashboard'
3
+ require_relative 'twb/worksheet'
2
4
  require_relative 'twb/datasource'
3
5
 
6
+
4
7
  module Twb
5
8
  VERSION = '0.0.1'
6
9
  end
@@ -25,24 +25,21 @@ module Twb
25
25
  attr_reader :node, :name, :sheets
26
26
 
27
27
  def initialize dashboardNode
28
- puts "Dashboard initialize"
29
28
  @node = dashboardNode
30
- @name = @node.attr('name').text
29
+ @name = @node.attr('name')
31
30
  loadSheets
32
31
  return self
33
32
  end
34
33
 
35
34
  def loadSheets
36
- puts "$$$ in loadSheets"
37
35
  @sheets = []
38
- @ndoc.xpath('.//zone[@name]').to_a.each do |sheetNode|
36
+ dsheets = @node.xpath('.//zone[@name]').to_a
37
+ dsheets.each do |sheetNode|
39
38
  sheet = Twb::Worksheet.new sheetNode
40
- puts "### :: #{sheet.nil?} :: '#{sheet}'"
41
- @dashboards.push sheet unless sheet.name == '' || sheet.name.nil?
39
+ @sheets.push sheet unless sheet.name == '' || sheet.name.nil?
42
40
  end
43
-
44
41
  end
45
42
 
46
43
  end
47
44
 
48
- end
45
+ end
@@ -13,9 +13,10 @@
13
13
  # You should have received a copy of the GNU General Public License
14
14
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
 
16
+ require 'nokogiri'
17
+
16
18
  module Twb
17
19
 
18
- require 'nokogiri'
19
20
 
20
21
  class Workbook
21
22
 
@@ -29,6 +30,7 @@ module Twb
29
30
  @ndoc = Nokogiri::XML(open(twbWithDir))
30
31
  @version = @ndoc.xpath('/workbook/@version')
31
32
  @build = @ndoc.xpath('/workbook/comment()').text.gsub(/^[^0-9]+/,'').strip
33
+ loadDashboards
32
34
  loadDataSources
33
35
  return self
34
36
  end
@@ -52,27 +54,6 @@ module Twb
52
54
  @ndoc.xpath('//workbook/datasources/datasource').to_a
53
55
  end
54
56
 
55
- def dataSources
56
- sources = []
57
- dataSourceNodes.each do |dsn|
58
- sources.push Twb::DataSource.new(dsn)
59
- end
60
- return sources
61
- end
62
-
63
- def dashboardNodes
64
- @ndoc.xpath('//workbook/datasources/datasource').to_a
65
- end
66
-
67
- def dashboards
68
- sources = []
69
- dataSourceNodes.each do |dsn|
70
- puts "adding dashboard"
71
- sources.push Twb::Dashboard.new(dsn)
72
- end
73
- return sources
74
- end
75
-
76
57
  end
77
58
 
78
59
  end
@@ -25,9 +25,8 @@ module Twb
25
25
  attr_reader :node, :name
26
26
 
27
27
  def initialize sheetNode
28
- puts "Worksheet initialize"
29
28
  @node = sheetNode
30
- @name = @node.attr('name').text
29
+ @name = @node.attr('name')
31
30
  return self
32
31
  end
33
32
 
@@ -17,6 +17,9 @@ def processTWB twbWithDir
17
17
  puts "\n Dashboards ...."
18
18
  twb.dashboards.each do |dsh|
19
19
  puts "\t n\t-#{dsh.name} "
20
+ dsh.sheets.each do |sheet|
21
+ puts "\t n\t -#{sheet.name} "
22
+ end
20
23
  end
21
24
  end
22
25
 
@@ -26,6 +29,6 @@ end
26
29
 
27
30
  puts "START"
28
31
 
29
- Dir.glob("**/variety.twb") {|twb| processTWB twb }
32
+ Dir.glob("**/TwoDashboards.twb") {|twb| processTWB twb }
30
33
 
31
34
  $f.close unless $f.nil?
Binary file
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
2
2
  s.name = 'twb'
3
3
  s.summary = "Classes for accessing Tableau Workbooks and their contents - summary."
4
4
  s.description = "Classes for accessing Tableau Workbooks and their contents - description"
5
- s.version = '0.0.25'
5
+ s.version = '0.0.26'
6
6
  s.date = "2015-03-14"
7
7
  s.author = "Chris Gerrard"
8
8
  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.25
4
+ version: 0.0.26
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,6 +36,7 @@ files:
36
36
  - twb-0.0.22.gem
37
37
  - twb-0.0.23.gem
38
38
  - twb-0.0.24.gem
39
+ - twb-0.0.25.gem
39
40
  - twb.gemspec
40
41
  homepage: http://rubygems.org/gems/twb
41
42
  licenses: