Skip to content

Instantly share code, notes, and snippets.

@ChrisGerrard
Created September 10, 2018 19:25
Show Gist options
  • Save ChrisGerrard/fd9d9c88643e3cfe89e178f2d4c5b10b to your computer and use it in GitHub Desktop.
Save ChrisGerrard/fd9d9c88643e3cfe89e178f2d4c5b10b to your computer and use it in GitHub Desktop.
Tableau Tool documenting Workbooks' Dashboards and their Worksheets
# analyzeDashboardSheets.rb Copyright (C) 2018 Chris Gerrard
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
system 'cls'
require 'set'
require 'twb'
def argto_a arg
argarray = SortedSet.new
arg.split(',').each { |a| argarray << a}
return argarray.to_a
end
$twbCount = 0
$analyzer = Twb::Analysis::DashSheetsAnalyzer.new
def processTwb twbName
twb = Twb::Workbook.new twbName
puts "\t - #{twbName}"
# --
$analyzer.processTWB twb
# --
$twbCount += 1
end
puts "\n "
puts " #{$analyzer.funcdoc[:blurb]}"
puts "\n "
path = if ARGV.empty? then ['*.twb','*.twbx'] else argto_a(ARGV[0]) end
puts " Processing Workbooks matching: '#{path}'\n "
Dir.glob(path) { |twb| processTwb twb }
puts "\n "
puts " Analysis complete, found: #{$twbCount} Workbooks"
puts "\n"
$analyzer.docfilesdoc(' ').each do |l|
puts l
end
puts "\n\n That's all, folks.\n "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment