usecase_tracer 0.1.0 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5bb8736df1d14096db5ed85f3929c6cf7dff31c0
4
- data.tar.gz: 0e06083cd346c9c864f74284f96874342e7c93a0
2
+ SHA256:
3
+ metadata.gz: 81bbbf5f94afc511fbf3808f6238c35ce05a0a65727261f5affe7cfabaa3108e
4
+ data.tar.gz: d6f0d6d266043b72cd35e07471e94fc9615d477dde21aa587540034ada4de3f1
5
5
  SHA512:
6
- metadata.gz: 8e7f33ef63cb6d0b07513d84dc25a55bdb68ec59803b986a499d1ee7e519c7b2fbda4fcd815adb48bb63329c21e43ec1c200fe00132cb685754b2e6ffa930f3d
7
- data.tar.gz: f3be850a3a6e21e9d17d8f766a0b588bf6703ead4e3cb4ddfe1de09ccb389e0adfecb43a705a91bf01eb04c2fb7036701fbe376356cdbe1f52329b13339ffa57
6
+ metadata.gz: 71d70ec1b3fe899b7c30441f96ff73ded82a9db74ab8d67fd6c1a520f60a4ca6f90ec9290792cda924d5ee0c70fe7d60b8dec7765259a87691933a837088a592
7
+ data.tar.gz: 4e46dd4e79188dfca377a55154312767be660bd424140f3ff2fc071d2b71a103fcb14442ee4c6f759ecf97e5da43c92f2d9f840b6464e8dfc305fbde8104f096
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/data/weblet.txt ADDED
@@ -0,0 +1,32 @@
1
+ %trace
2
+
3
+ require 'usecase_tracer'
4
+ #{requirex}
5
+
6
+ class #{mainclass}Tracer < UsecaseTracer
7
+
8
+ class_tracer :#{mainclass}
9
+
10
+ def cases()
11
+
12
+ usecase 'untitled usecase 1' do
13
+
14
+ trace do
15
+
16
+ #{code}
17
+
18
+ end
19
+
20
+ true
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+
27
+ lt = #{mainclass}Tracer.new
28
+ lt.run
29
+
30
+ lt.testresult
31
+ lt.passed?
32
+ puts lt.tracelog.first
@@ -2,50 +2,15 @@
2
2
 
3
3
  # file: usecase_tracer.rb
4
4
 
5
+ require 'weblet'
5
6
  require 'indented-tracer'
6
7
 
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
8
  class UsecaseTracer
45
9
 
46
10
  attr_reader :tracelog, :testresult
47
11
 
48
12
  @@classes = []
13
+ @@ignore_methods = []
49
14
 
50
15
  def initialize()
51
16
 
@@ -53,8 +18,7 @@ class UsecaseTracer
53
18
  cases()
54
19
  @tracelog = []
55
20
  @testresult = []
56
-
57
-
21
+
58
22
  end
59
23
 
60
24
  def self.class_tracer(*args)
@@ -62,9 +26,10 @@ class UsecaseTracer
62
26
  @@classes = a.map(&:to_s)
63
27
  end
64
28
 
65
- def classes()
66
- @@classes
67
- end
29
+ def self.ignore_methods(*args)
30
+ a = *args
31
+ @@ignore_methods = a.flatten
32
+ end
68
33
 
69
34
  def run()
70
35
 
@@ -83,16 +48,17 @@ class UsecaseTracer
83
48
  @testresult.map(&:last).all?
84
49
  end
85
50
 
86
- def trace()
51
+ def trace(ignore: [])
87
52
 
88
53
  it = IndentedTracer.new
89
54
  it.classes = @@classes
55
+ it.ignore_methods = (@@ignore_methods + [*ignore].map(&:to_sym))
90
56
  it.on
91
57
 
92
58
  yield
93
59
 
94
60
  it.off
95
- @tracelog << it.log(@desc, tags: classes())
61
+ @tracelog << it.log(@desc, tags: @@classes)
96
62
 
97
63
  end
98
64
 
@@ -109,3 +75,24 @@ class UsecaseTracer
109
75
  end
110
76
  end
111
77
 
78
+ class QuickTrace
79
+
80
+ def self.copy(file=nil, weblet_file: nil)
81
+
82
+ weblet_file ||= File.join(File.dirname(__FILE__), '..',
83
+ 'data', 'weblet.txt')
84
+
85
+ s = file ? File.read(file) : Clipboard.paste
86
+ lines = s.lines
87
+
88
+ a = lines.grep(/^require ["']/)
89
+ idx = lines.index a[-1]
90
+ requirex = lines[0..idx].join
91
+ code = lines[idx+1..-1].join
92
+
93
+ mainclass = code[/(\w+)(?=\.new)/]
94
+ Weblet.new(weblet_file, debug: false).render(:trace, binding)
95
+
96
+ end
97
+ end
98
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usecase_tracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -10,31 +10,75 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE3MDEyMDIwNTk0M1oXDTE4MDEyMDIwNTk0M1owSDESMBAG
16
- A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
- EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
- ggEBAMzkrxF1kZo6Rv5LFgL4sNpMgyPO+PBXSbJxvKarU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Gz4LdVrbsPC6QZMKiT6INndBGvlU+U3xSp1
31
+ DNrF4jpwAJMXBDtbzByBKixhPCJ3lGFjhrh+nce2+TCXKYw4utmlW+Vw+I0btWK5
32
+ mWbGgwR72vmDzZ/Tx9vb5ADwE5xpTd5ogIpIUt78Luc+YKt6X1tzW5MVub70SzVD
33
+ ck9bPerVSgkkpnNzegpW4sUOz/h81AHM9yWhOqrfMNL1jjYwnXLA1w6DqTAOU7ZS
34
+ NAjx9mEIwRn8/Gn0FaPR3nrbmKFSFnUEeVwKpdouFbdGAM63jHr7jz8rDSH15sPk
35
+ Dzy4HHo15g2JVrInud59c/Vozc185I9X90D+9kxM0yHC3BVgLr/YRggkzloRkgy1
36
+ bZUVHBuHbmJ4JO2JZaxTxcRc
33
37
  -----END CERTIFICATE-----
34
- date: 2017-01-20 00:00:00.000000000 Z
38
+ date: 2021-04-12 00:00:00.000000000 Z
35
39
  dependencies:
36
40
  - !ruby/object:Gem::Dependency
37
- name: indented_tracer
41
+ name: clipboard
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.3'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 1.3.5
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '1.3'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 1.3.5
60
+ - !ruby/object:Gem::Dependency
61
+ name: weblet
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '0.3'
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 0.3.5
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '0.3'
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 0.3.5
80
+ - !ruby/object:Gem::Dependency
81
+ name: indented-tracer
38
82
  requirement: !ruby/object:Gem::Requirement
39
83
  requirements:
40
84
  - - "~>"
@@ -42,7 +86,7 @@ dependencies:
42
86
  version: '0.1'
43
87
  - - ">="
44
88
  - !ruby/object:Gem::Version
45
- version: 0.1.3
89
+ version: 0.1.5
46
90
  type: :runtime
47
91
  prerelease: false
48
92
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,13 +96,14 @@ dependencies:
52
96
  version: '0.1'
53
97
  - - ">="
54
98
  - !ruby/object:Gem::Version
55
- version: 0.1.3
99
+ version: 0.1.5
56
100
  description:
57
- email: james@jamesrobertson.eu
101
+ email: digital.robertson@gmail.com
58
102
  executables: []
59
103
  extensions: []
60
104
  extra_rdoc_files: []
61
105
  files:
106
+ - data/weblet.txt
62
107
  - lib/usecase_tracer.rb
63
108
  homepage: https://github.com/jrobertson/usecase_tracer
64
109
  licenses:
@@ -80,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
125
  version: '0'
81
126
  requirements: []
82
127
  rubyforge_project:
83
- rubygems_version: 2.6.8
128
+ rubygems_version: 2.7.10
84
129
  signing_key:
85
130
  specification_version: 4
86
131
  summary: Traces the methods used for each use case and returns them as raw Polyrex
metadata.gz.sig CHANGED
Binary file