testkit123 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 920bf0a0901c6b09370b33e601182a763759e256
4
+ data.tar.gz: e4ef2fb72744f7a083ddb7399e2ecca26fa8e0c2
5
+ SHA512:
6
+ metadata.gz: 8acdcc6e58c8e216bba3399f0a65cc878ca1580976e0a82d7fc4cbf66bf22fe9345ca3e4d1da1ff156c708e794eae680667f45476cea0aed643c32c724f8ebef
7
+ data.tar.gz: 30b89c3e422b261f31191e55533bfa3c5966fa19c9ac3c6b1dc67314850a005f19bb4d0a26991c03d1a32f599827d90bfaa061b7626435e68f7037d6446cb332
checksums.yaml.gz.sig ADDED
@@ -0,0 +1 @@
1
+ �ݧ|��.��%�{��ã�^~����P�H�m�љ��?��C���/���#�kn�d7\���Њ+��On#7F�2�0��o�˕U�ſo 8��2�ʻe������gXD�C� ���+2W'����}/�{���%vu5�� W�/"���~��[�Y8����hmT�����^�='�TE?e�V��qD!�O�Z���s�����l#����P��S�Ӧ�vm��p��%�1���1/ AE��˸�� Øl
data.tar.gz.sig ADDED
Binary file
data/lib/testkit123.rb ADDED
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: testkit123.rb
4
+
5
+ require 'rxfhelper'
6
+ require 'fileutils'
7
+ require 'simple-config'
8
+
9
+
10
+ class String
11
+ def camelize
12
+ self.split('_').collect(&:capitalize).join
13
+ end
14
+ end
15
+
16
+ class TestKit123
17
+
18
+ def initialize(templates: {testdata: nil, testx: nil}, project: nil,
19
+ testdata: nil, debug: false, localpath: nil, datapath: nil,
20
+ gemtest_url: nil, rubyver: 'ruby-2.5.1')
21
+
22
+ @h = templates
23
+ @project_config = project
24
+ @testdata, @debug = testdata, debug
25
+ @localpath, @datapath, @gemtest_url = localpath, datapath, gemtest_url
26
+ @rubyver = rubyver
27
+
28
+ end
29
+
30
+ def create_files(project=@project_config)
31
+
32
+ puts 'running create_files ...' if @debug
33
+
34
+ puts '1) Reading the config file' if @debug
35
+ raise "missing the config file " unless @project_config
36
+ raise "config file not found" unless File.exists? @project_config
37
+
38
+ config_file = @project_config
39
+
40
+ puts 'config_file: ' + config_file.inspect if @debug
41
+
42
+ config = SimpleConfig.new(config_file).to_h
43
+ puts 'config : ' + config.inspect if @debug
44
+
45
+ rbfile_buffer = config[:test][:items].join "\n"
46
+
47
+ puts 'before project' if @debug
48
+ proj = config[:project]
49
+ classname = config[:classname]
50
+
51
+ puts 'proj: ' + proj.inspect if @debug
52
+
53
+ filepath = config[:local_path] + '/' + proj
54
+ puts 'filepath: ' + filepath.inspect if @debug
55
+ datafilepath = config[:data_path] + '/' + proj
56
+
57
+ puts 'before ext' if @debug
58
+
59
+ ext = config[:testdata_ext][/\.?td$/] ? 'td' : 'xml'
60
+
61
+ puts 'before stage 2' if @debug
62
+
63
+ puts '2) Making directory for file path ' + filepath.inspect if @debug
64
+ FileUtils.mkdir_p filepath
65
+
66
+ puts '3) Writing the .testdata file' if @debug
67
+ buffer = config[:http_gemtest] + "%s/testdata_%s.%s" % ([proj, proj, ext])
68
+ File.write filepath + '/.testdata', buffer
69
+
70
+ puts '4) Creating the working code tests from templates' if @debug
71
+ # fetch the template testdata
72
+
73
+ testdata = @h[:testdata].gsub(/(?<=\.)\w+$/, ext)
74
+ puts 'testdata: ' + testdata.inspect if @debug
75
+ buffer_testdata, _ = RXFHelper.read(testdata)
76
+
77
+ FileUtils.mkdir_p datafilepath
78
+
79
+ testdata_file = File.join(datafilepath, "testdata_#{proj}.#{ext}")
80
+ File.write testdata_file, eval('%{' + buffer_testdata + '}')
81
+
82
+ test_template_rsf = @h[:testx]
83
+ buffer_test, _ = RXFHelper.read(test_template_rsf)
84
+
85
+ test_rsffile = File.join(config[:data_path], "#{proj}.rsf")
86
+ File.write test_rsffile, eval('%{' + buffer_test + '}')
87
+
88
+ buffer_rb = %{#!/usr/bin/env ruby
89
+
90
+ # file: test_#{proj}.rb
91
+
92
+ class Test#{config[:classname]} < Testdata::Base
93
+
94
+ def tests()
95
+
96
+ #{rbfile_buffer.lines.map {|x| ' '*4 + x}.join}
97
+
98
+ end
99
+ end
100
+ }
101
+
102
+ test_rbfile = File.join(datafilepath, "test_#{proj}.rb")
103
+ puts 'reading the ruby template file ...' if @debug
104
+ File.write test_rbfile, eval('%{' + buffer_rb + '}')
105
+
106
+ "finished processing #{proj}"
107
+ end
108
+
109
+ def create_standalone()
110
+ end
111
+
112
+ def destroy_files()
113
+ end
114
+
115
+ def new_project(project='myproject', classname=nil, save: false)
116
+
117
+ classname ||= project.camelize
118
+
119
+ s =<<EOF
120
+ project: #{project}
121
+ classname: #{classname}
122
+ local_path: #{@localpath || '~/test-ruby'}
123
+ data_path: #{@datapath || '~/gemtest'}
124
+ http_gemtest: #{@gemtest_url || 'http://mywebsite.com/r/gemtest/'}
125
+ ruby_version: #{@rubyver}
126
+
127
+ # testdata_ext defaults to .xml
128
+
129
+ testdata_ext: .xml
130
+ test:
131
+
132
+ test 'to_s only' do |filepath|
133
+
134
+ #{classname}.new(filepath).to_s
135
+
136
+ end
137
+ EOF
138
+
139
+
140
+ if save then
141
+ filepath = File.join(@localpath, project + '.txt')
142
+ File.write filepath, s
143
+ puts 'file saved ' + filepath if @debug
144
+ @project_config = filepath
145
+ self
146
+ else
147
+ s
148
+ end
149
+
150
+ end
151
+
152
+ end
153
+
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: testkit123
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQUFADAsMSowKAYDVQQDDCFnZW1t
14
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwNzE1MTYwNTQ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noiyau3znLWYXucwnOR8dh4RhcwxaP82ZX6Up19+qVqJqravkDQ+OBff6o+
31
+ m3U=
32
+ -----END CERTIFICATE-----
33
+ date: 2018-07-15 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rxfhelper
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '0.7'
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 0.7.0
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - "~>"
50
+ - !ruby/object:Gem::Version
51
+ version: '0.7'
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.7.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: simple-config
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.6'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 0.6.4
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '0.6'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 0.6.4
75
+ description:
76
+ email: james@jamesrobertson.eu
77
+ executables: []
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - lib/testkit123.rb
82
+ homepage: https://github.com/jrobertson/testkit123
83
+ licenses:
84
+ - MIT
85
+ metadata: {}
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 2.6.13
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: Generates a test suite of files (for use with the testdata gem) from a config
106
+ file.
107
+ test_files: []
metadata.gz.sig ADDED
Binary file