usecase_tracer 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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/usecase_tracer.rb +111 -0
- metadata +88 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5bb8736df1d14096db5ed85f3929c6cf7dff31c0
|
4
|
+
data.tar.gz: 0e06083cd346c9c864f74284f96874342e7c93a0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8e7f33ef63cb6d0b07513d84dc25a55bdb68ec59803b986a499d1ee7e519c7b2fbda4fcd815adb48bb63329c21e43ec1c200fe00132cb685754b2e6ffa930f3d
|
7
|
+
data.tar.gz: f3be850a3a6e21e9d17d8f766a0b588bf6703ead4e3cb4ddfe1de09ccb389e0adfecb43a705a91bf01eb04c2fb7036701fbe376356cdbe1f52329b13339ffa57
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,111 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: usecase_tracer.rb
|
4
|
+
|
5
|
+
require 'indented-tracer'
|
6
|
+
|
7
|
+
=begin
|
8
|
+
|
9
|
+
# example usecase
|
10
|
+
|
11
|
+
# description
|
12
|
+
|
13
|
+
usecase 'new day: create a new entry' do
|
14
|
+
|
15
|
+
# preparation (files to create in the
|
16
|
+
# /tmp directory, setting of the date etc.)
|
17
|
+
|
18
|
+
# intialisation
|
19
|
+
liveblog = LiveBlog.new
|
20
|
+
|
21
|
+
# setup (i.e. setting the date)
|
22
|
+
|
23
|
+
# conditions
|
24
|
+
if liveblog.date == Date.today and liveblog.today_exists? == false then
|
25
|
+
|
26
|
+
trace() do
|
27
|
+
|
28
|
+
# public method to be traced
|
29
|
+
s = '# Testing the liveblog #liveblog'
|
30
|
+
liveblog.add_entry(s)
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
# optional validator
|
35
|
+
html = File.read(File.join(path, 'index.html'))
|
36
|
+
html =~ /Testing the liveblog/ ? true : false
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end # end of run
|
41
|
+
=end
|
42
|
+
|
43
|
+
|
44
|
+
class UsecaseTracer
|
45
|
+
|
46
|
+
attr_reader :tracelog, :testresult
|
47
|
+
|
48
|
+
@@classes = []
|
49
|
+
|
50
|
+
def initialize()
|
51
|
+
|
52
|
+
@usecases = []
|
53
|
+
cases()
|
54
|
+
@tracelog = []
|
55
|
+
@testresult = []
|
56
|
+
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.class_tracer(*args)
|
61
|
+
a = *args
|
62
|
+
@@classes = a.map(&:to_s)
|
63
|
+
end
|
64
|
+
|
65
|
+
def classes()
|
66
|
+
@@classes
|
67
|
+
end
|
68
|
+
|
69
|
+
def run()
|
70
|
+
|
71
|
+
@usecases.each.with_index do |x, i|
|
72
|
+
|
73
|
+
desc, blk = x
|
74
|
+
@desc = desc
|
75
|
+
r = blk.call
|
76
|
+
@testresult << [i, r] if r.is_a?(TrueClass) or r.is_a?(FalseClass)
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
def passed?()
|
83
|
+
@testresult.map(&:last).all?
|
84
|
+
end
|
85
|
+
|
86
|
+
def trace()
|
87
|
+
|
88
|
+
it = IndentedTracer.new
|
89
|
+
it.classes = @@classes
|
90
|
+
it.on
|
91
|
+
|
92
|
+
yield
|
93
|
+
|
94
|
+
it.off
|
95
|
+
@tracelog << it.log(@desc, tags: classes())
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
private
|
100
|
+
|
101
|
+
# override this method with your own implementation of usecase methods
|
102
|
+
#
|
103
|
+
def cases()
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
def usecase(desc='', &blk)
|
108
|
+
@usecases << [desc, blk]
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: usecase_tracer
|
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
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTE3MDEyMDIwNTk0M1oXDTE4MDEyMDIwNTk0M1owSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
+
ggEBAMzkrxF1kZo6Rv5LFgL4sNpMgyPO+PBXSbJxvKarUfmg6V977kKdeXC71bJb
|
19
|
+
DLSXZK/z1T1FiAwkGd1a7vOTUDurlN158lWMKOTAFiirLZ7WBEOPobKVP2r5MTTp
|
20
|
+
GHmTRvyhuzMSggv3u6fbuJnfYR0AwB/9UOz05FPnmTymHczEV52/zxfqdaAFsiVg
|
21
|
+
9kwURfuYWqpyqM1K1f0qvxMpU+MOnsUZN/0xQq2hSBw0mmjSmlVrAk35xGU02y+O
|
22
|
+
iZ5hnYHsN2JkeVAQyuKUPMUHwcZmJYI2CRpClt0tw5/rgqnL0isEVJRSNmgt00FI
|
23
|
+
NDlTVuKjUmLVUUJmzLDuJPk9UFsCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUJRknOEmC5uHpx1V1DcCsKMnd2WcwJgYDVR0RBB8w
|
25
|
+
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAcwW+2Qof
|
27
|
+
wAtdCA3IaaLeTJI6SvhFzsKbZG7sZPy5f7np9Z94xqor5T33t1Gec9lsi59z1hsT
|
28
|
+
MvILi0m/qp2YVwD1Xtsnb35APfruRVCagsA3wek5UAJ1qrTArpFCrsDbAjQSH3xc
|
29
|
+
vafDUhjDBiKDPAG4evqzD4IGQ4lZUssY95fLRX6vtqYuWsEja20nkPUv7KoQeAux
|
30
|
+
88lnocDsOE0Gz3Tx/OtR6Z6mR1JvYWjtV9v2b7v5fkE9NNpb4xc0pCi5cymPEZW9
|
31
|
+
HGmhPBwL2haWfqW7DnI+6yZ/IunAq0eUCsZpxDveDzQAm3ASzbphaKHR1MGrVme6
|
32
|
+
mvh0ZtZs2h0/HQ==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2017-01-20 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: indented_tracer
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.1'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.3
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.1'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.1.3
|
56
|
+
description:
|
57
|
+
email: james@jamesrobertson.eu
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/usecase_tracer.rb
|
63
|
+
homepage: https://github.com/jrobertson/usecase_tracer
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 2.6.8
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Traces the methods used for each use case and returns them as raw Polyrex
|
87
|
+
documents
|
88
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|