twb 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/twb.cmd ADDED
@@ -0,0 +1,3 @@
1
+ .echo TWB.cmd here
2
+
3
+ ruby twb.rb
data/bin/twb.rb ADDED
@@ -0,0 +1 @@
1
+ puts "\n TWB gem here. \n"
data/lib/twb.rb ADDED
@@ -0,0 +1,8 @@
1
+ require_relative 'twb/workbook'
2
+ require_relative 'twb/datasource'
3
+
4
+ module Twb
5
+ VERSION = '0.0.1'
6
+ end
7
+
8
+ puts "Version: #{Twb::VERSION}"
@@ -17,22 +17,10 @@ module Twb
17
17
 
18
18
  require 'nokogiri'
19
19
 
20
- class Workbook
20
+ class TwbTest
21
21
 
22
- attr_reader :name, :dir, :modtime, :version, :build, :ndoc
23
-
24
- def initialize twbWithDir
25
- file = File.new(twbWithDir)
26
- @name = File.basename(twbWithDir)
27
- @dir = File.dirname(File.expand_path(twbWithDir))
28
- @modtime = File.new(twbWithDir).mtime
29
- @ndoc = Nokogiri::XML(open(twbWithDir))
30
- @version = @ndoc.xpath('/workbook/@version')
31
- @build = @ndoc.xpath('/workbook/comment()').text.gsub(/^[^0-9]+/,'').strip
32
- end
33
-
34
- def dataSources
35
- @ndoc.xpath('//workbook/datasources/datasource').to_a
22
+ def speak
23
+ puts "\nTwbTest speaking.\t arf!\n:
36
24
  end
37
25
 
38
- end #class Workbook
26
+ end
@@ -0,0 +1,58 @@
1
+ # Copyright (C) 2014, 2015 Chris Gerrard
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'nokogiri'
17
+ require 'digest/md5'
18
+
19
+ module Twb
20
+
21
+ class DataSource
22
+
23
+ @@hasher = Digest::SHA256.new
24
+
25
+ attr_reader :node, :name, :caption, :uiname, :connHash, :class, :connection
26
+
27
+ def initialize dataSourceNode
28
+ @node = dataSourceNode
29
+ @name = @node.xpath('./@name').text
30
+ @caption = @node.xpath('./@caption').text
31
+ @uiname = if @caption.nil? || @caption == '' then @name else @caption end
32
+ # puts "DS: n:#{@name}"
33
+ # puts " caption:#{@caption}"
34
+ # puts " c.len :#{@caption.length}"
35
+ # puts " c.nil?:#{@caption.nil?}"
36
+ # puts " uiname:#{@uiname}"
37
+ # puts " "
38
+ processConnection
39
+ end
40
+
41
+ def processConnection
42
+ @connHash = ''
43
+ @connection = @node.at_xpath('./connection')
44
+ if !@connection.nil? then
45
+ @class = @connection.attribute('class').text
46
+ dsAttributes = @node.xpath('./connection/@*')
47
+ dsConnStr = ''
48
+ dsAttributes.each do |attr|
49
+ dsConnStr += attr.text
50
+ # Note: only collects non-'' attribute values
51
+ end
52
+ @connHash = Digest::MD5.hexdigest(dsConnStr)
53
+ end
54
+ end
55
+
56
+ end
57
+
58
+ end
data/lib/twb/there.rb ADDED
@@ -0,0 +1,7 @@
1
+ class There
2
+
3
+ def speak
4
+ puts "Arf! Arf!"
5
+ end
6
+
7
+ end
@@ -0,0 +1,40 @@
1
+ # Copyright (C) 2014, 2015 Chris Gerrard
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module Twb
17
+
18
+ require 'nokogiri'
19
+
20
+ class Workbook
21
+
22
+ attr_reader :name, :dir, :modtime, :version, :build, :ndoc
23
+
24
+ def initialize twbWithDir
25
+ file = File.new(twbWithDir)
26
+ @name = File.basename(twbWithDir)
27
+ @dir = File.dirname(File.expand_path(twbWithDir))
28
+ @modtime = File.new(twbWithDir).mtime
29
+ @ndoc = Nokogiri::XML(open(twbWithDir))
30
+ @version = @ndoc.xpath('/workbook/@version')
31
+ @build = @ndoc.xpath('/workbook/comment()').text.gsub(/^[^0-9]+/,'').strip
32
+ end
33
+
34
+ def dataSources
35
+ @ndoc.xpath('//workbook/datasources/datasource').to_a
36
+ end
37
+
38
+ end
39
+
40
+ end
data/twb-0.0.1.gem ADDED
Binary file
data/twb.gemspec CHANGED
@@ -2,8 +2,8 @@ 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.1"
6
- s.date = "2015-03-12"
5
+ s.version = '0.0.2'
6
+ s.date = "2015-03-14"
7
7
  s.author = "Chris Gerrard"
8
8
  s.email = "Chris@Gerrard.net"
9
9
  s.files = Dir['**/**']
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.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-12 00:00:00.000000000 Z
12
+ date: 2015-03-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Classes for accessing Tableau Workbooks and their contents - description
15
15
  email: Chris@Gerrard.net
@@ -17,9 +17,15 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - lib/datasource.rb
21
- - lib/workbook.rb
20
+ - bin/twb.cmd
21
+ - bin/twb.rb
22
+ - lib/twb/datasource.rb
23
+ - lib/twb/there.rb
24
+ - lib/twb/TwbTest.rb
25
+ - lib/twb/workbook.rb
26
+ - lib/twb.rb
22
27
  - LICENSE.txt
28
+ - twb-0.0.1.gem
23
29
  - twb.gemspec
24
30
  homepage: http://rubygems.org/gems/twb
25
31
  licenses:
data/lib/datasource.rb DELETED
@@ -1,54 +0,0 @@
1
- # Copyright (C) 2014, 2015 Chris Gerrard
2
- #
3
- # This program is free software: you can redistribute it and/or modify
4
- # it under the terms of the GNU General Public License as published by
5
- # the Free Software Foundation, either version 3 of the License, or
6
- # (at your option) any later version.
7
- #
8
- # This program is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- # GNU General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU General Public License
14
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
-
16
- require 'nokogiri'
17
- require 'digest/md5'
18
-
19
- class DataSource
20
-
21
- @@hasher = Digest::SHA256.new
22
-
23
- attr_reader :node, :name, :caption, :uiname, :connHash, :class, :connection
24
-
25
- def initialize dataSourceNode
26
- @node = dataSourceNode
27
- @name = @node.xpath('./@name').text
28
- @caption = @node.xpath('./@caption').text
29
- @uiname = if @caption.nil? || @caption == '' then @name else @caption end
30
- # puts "DS: n:#{@name}"
31
- # puts " caption:#{@caption}"
32
- # puts " c.len :#{@caption.length}"
33
- # puts " c.nil?:#{@caption.nil?}"
34
- # puts " uiname:#{@uiname}"
35
- # puts " "
36
- processConnection
37
- end
38
-
39
- def processConnection
40
- @connHash = ''
41
- @connection = @node.at_xpath('./connection')
42
- if !@connection.nil? then
43
- @class = @connection.attribute('class').text
44
- dsAttributes = @node.xpath('./connection/@*')
45
- dsConnStr = ''
46
- dsAttributes.each do |attr|
47
- dsConnStr += attr.text
48
- # Note: only collects non-'' attribute values
49
- end
50
- @connHash = Digest::MD5.hexdigest(dsConnStr)
51
- end
52
- end
53
-
54
- end