testdata_text 0.1.0

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 (3) hide show
  1. data/lib/testdata.xsl +58 -0
  2. data/lib/testdata_text.rb +28 -0
  3. metadata +78 -0
data/lib/testdata.xsl ADDED
@@ -0,0 +1,58 @@
1
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
2
+ <xsl:output method="xml" indent="yes" />
3
+
4
+ <xsl:template match="root">
5
+ <tests>
6
+ <summary>
7
+ <title><xsl:value-of select="summary/title"/></title>
8
+ <recordx_type>polyrex</recordx_type>
9
+ <schema>tests/test[path,type,description]/io[type,*]</schema>
10
+ <ruby_version>ruby-1.9.2-p180</ruby_version>
11
+ <script><xsl:value-of select="summary/script"/></script>
12
+ <test_dir><xsl:value-of select="summary/test_dir"/></test_dir>
13
+ </summary>
14
+ <records>
15
+ <xsl:apply-templates select="item"/>
16
+ </records>
17
+ </tests>
18
+ </xsl:template>
19
+
20
+ <xsl:template match="root/item">
21
+ <test>
22
+ <summary>
23
+ <path><xsl:value-of select="path"/></path>
24
+ <type><xsl:value-of select="type"/></type>
25
+ <description><xsl:value-of select="type"/></description>
26
+ </summary>
27
+ <records>
28
+ <xsl:apply-templates select="input"/>
29
+ <xsl:apply-templates select="output"/>
30
+ </records>
31
+ </test>
32
+ </xsl:template>
33
+
34
+ <xsl:template match="input">
35
+ <io>
36
+ <summary>
37
+ <type>input</type>
38
+ <xsl:for-each select="item/*">
39
+ <xsl:copy-of select="."/>
40
+ </xsl:for-each>
41
+ </summary>
42
+ <records/>
43
+ </io>
44
+ </xsl:template>
45
+
46
+ <xsl:template match="output">
47
+ <io>
48
+ <summary>
49
+ <type>output</type>
50
+ <xsl:for-each select="item/*">
51
+ <xsl:copy-of select="."/>
52
+ </xsl:for-each>
53
+ </summary>
54
+ <records/>
55
+ </io>
56
+ </xsl:template>
57
+
58
+ </xsl:stylesheet>
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+ # file: testdata_text.rb
3
+
4
+ require 'rowx'
5
+ require 'nokogiri'
6
+
7
+ class String
8
+ def /(str_to_join)
9
+ File.join(self, str_to_join)
10
+ end
11
+ end
12
+
13
+ class TestdataText
14
+
15
+ def self.parse(txt)
16
+
17
+ rowx = RowX.new(txt)
18
+ xml = rowx.to_xml
19
+
20
+ lib = File.dirname(__FILE__)
21
+ xsl = File.open(lib/'testdata.xsl','r').read
22
+
23
+ doc = Nokogiri::XML(xml)
24
+ xslt = Nokogiri::XSLT(xsl)
25
+ xslt.transform(doc).to_s
26
+
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: testdata_text
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors: []
8
+
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-04-22 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rowx
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ description:
39
+ email:
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - lib/testdata_text.rb
48
+ - lib/testdata.xsl
49
+ has_rdoc: true
50
+ homepage:
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options: []
55
+
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ requirements: []
71
+
72
+ rubyforge_project:
73
+ rubygems_version: 1.5.2
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: testdata_text
77
+ test_files: []
78
+