trace_eval 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
+ SHA256:
3
+ metadata.gz: 473c7480e65b5d55f580fd6dd6f6f36c4f46e2be272bac867e8c5090cc748fe2
4
+ data.tar.gz: 16832ec5156521c65e3e44fee570be2e4a297c7da6c9087ae6bbd6a89d762e3b
5
+ SHA512:
6
+ metadata.gz: c60792d50615aed0dda218fd68952f0f2de8269902c4522076c1ed7703f4261889bff361aeef9e693d7d7124b82ede5fb5d8f64999262f4d33f33695d6a2cd9d
7
+ data.tar.gz: 4784ad5b5ccb2dce7ef58016b3263c4ad49400485e8eed084511f91e590bb4a02af69b2031a8666971de34448ad0bc4c7d4dbc4c47d0b6337ce390ea583cfb74
data/.rubocop.yml ADDED
@@ -0,0 +1,39 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ TargetRubyVersion: 2.7
4
+
5
+ Layout/EmptyLineAfterGuardClause:
6
+ Enabled: false
7
+
8
+ Layout/SpaceAroundOperators:
9
+ Enabled: false
10
+
11
+ Lint/SendWithMixinArgument:
12
+ Enabled: false
13
+
14
+ Lint/ShadowingOuterLocalVariable:
15
+ Enabled: false
16
+
17
+ Lint/SuppressedException:
18
+ Enabled: false
19
+
20
+ Lint/UnderscorePrefixedVariableName:
21
+ Enabled: false
22
+
23
+ Style/BlockDelimiters:
24
+ EnforcedStyle: semantic
25
+
26
+ Style/ParallelAssignment:
27
+ Enabled: false
28
+
29
+ Style/StringLiterals:
30
+ EnforcedStyle: single_quotes
31
+
32
+ Style/StringLiteralsInInterpolation:
33
+ EnforcedStyle: double_quotes
34
+
35
+ Metrics/MethodLength:
36
+ Enabled: false
37
+
38
+ Security/Eval:
39
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2021-11-01
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in trace_eval.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 13.0'
9
+
10
+ gem 'minitest', '~> 5.0'
11
+
12
+ gem 'rubocop', '~> 1.7'
13
+ gem 'rubocop-minitest'
14
+ gem 'rubocop-rake'
data/Gemfile.lock ADDED
@@ -0,0 +1,50 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ trace_eval (0.1.0)
5
+ chunky_png
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ chunky_png (1.4.0)
12
+ minitest (5.14.4)
13
+ parallel (1.21.0)
14
+ parser (3.0.2.0)
15
+ ast (~> 2.4.1)
16
+ rainbow (3.0.0)
17
+ rake (13.0.6)
18
+ regexp_parser (2.1.1)
19
+ rexml (3.2.5)
20
+ rubocop (1.22.3)
21
+ parallel (~> 1.10)
22
+ parser (>= 3.0.0.0)
23
+ rainbow (>= 2.2.2, < 4.0)
24
+ regexp_parser (>= 1.8, < 3.0)
25
+ rexml
26
+ rubocop-ast (>= 1.12.0, < 2.0)
27
+ ruby-progressbar (~> 1.7)
28
+ unicode-display_width (>= 1.4.0, < 3.0)
29
+ rubocop-ast (1.12.0)
30
+ parser (>= 3.0.1.1)
31
+ rubocop-minitest (0.15.2)
32
+ rubocop (>= 0.90, < 2.0)
33
+ rubocop-rake (0.6.0)
34
+ rubocop (~> 1.0)
35
+ ruby-progressbar (1.11.0)
36
+ unicode-display_width (2.1.0)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ minitest (~> 5.0)
43
+ rake (~> 13.0)
44
+ rubocop (~> 1.7)
45
+ rubocop-minitest
46
+ rubocop-rake
47
+ trace_eval!
48
+
49
+ BUNDLED WITH
50
+ 2.2.27
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Frank J. Cameron
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # TraceEval
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you
4
+ need to be able to package up your Ruby library into a gem. Put your
5
+ Ruby code in the file `lib/trace_eval`. To experiment with that code,
6
+ run `bin/console` for an interactive prompt.
7
+
8
+ TODO: Delete this and the text above, and describe your gem
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'trace_eval'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle install
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install trace_eval
25
+
26
+ ## Usage
27
+
28
+ TODO: Write usage instructions here
29
+
30
+ ## Development
31
+
32
+ After checking out the repo, run `bin/setup` to install
33
+ dependencies. Then, run `rake test` to run the tests. You can also run
34
+ `bin/console` for an interactive prompt that will allow you to experiment.
35
+
36
+ To install this gem onto your local machine, run `bundle exec rake
37
+ install`. To release a new version, update the version number in
38
+ `version.rb`, and then run `bundle exec rake release`, which will create
39
+ a git tag for the version, push git commits and the created tag, and
40
+ push the `.gem` file to [rubygems.org](https://rubygems.org).
41
+
42
+ ## Contributing
43
+
44
+ Bug reports and pull requests are welcome on GitHub at https://gitlab.com/fjc/trace_eval.
45
+
46
+ ## License
47
+
48
+ The gem is available as open source under the terms of the [MIT
49
+ License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/*_test.rb']
10
+ end
11
+
12
+ require 'rubocop/rake_task'
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'trace_eval'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require 'pry'
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TraceEval
4
+ VERSION = '0.1.0'
5
+ end
data/lib/trace_eval.rb ADDED
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'trace_eval/version'
4
+
5
+ # Use trace point to print lines of code during eval. A randomized
6
+ # sigil value is used to only print lines from this invocation of eval,
7
+ # but nonsense could still ensure if this eval also evals.
8
+ #
9
+ module TraceEval
10
+ def trace_eval(code)
11
+ __wzpxmnrjafemvlrwflblbbyenywk__ = rand
12
+ lines = [
13
+ "__wzpxmnrjafemvlrwflblbbyenywk__ = #{__wzpxmnrjafemvlrwflblbbyenywk__}\n"
14
+ ] + code.lines
15
+
16
+ tp = TracePoint.new(:line) do |tp|
17
+ tp.disable
18
+ next unless tp.path == '(eval)'
19
+ next unless tp.binding.local_variable_get(
20
+ :__wzpxmnrjafemvlrwflblbbyenywk__
21
+ )==__wzpxmnrjafemvlrwflblbbyenywk__
22
+ print lines[tp.lineno]
23
+ rescue NameError
24
+ ensure
25
+ tp.enable
26
+ end
27
+
28
+ begin
29
+ tp.enable
30
+ eval code
31
+ ensure
32
+ tp.disable
33
+ end
34
+ end
35
+ end
36
+
37
+ Kernel.send :extend, TraceEval
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/trace_eval/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'trace_eval'
7
+ spec.version = TraceEval::VERSION
8
+ spec.authors = ['Frank J. Cameron']
9
+ spec.email = ['fjc@fastmail.net']
10
+
11
+ spec.summary = ''
12
+ spec.homepage = 'https://gitlab.com/fjc/trace_eval'
13
+ spec.license = 'MIT'
14
+ spec.required_ruby_version = '>= 2.7.0'
15
+
16
+ spec.metadata['homepage_uri'] = spec.homepage
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path(__dir__)) {
21
+ `git ls-files -z`.split("\x0").reject do |f|
22
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
23
+ end
24
+ }
25
+
26
+ spec.bindir = 'exe'
27
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ['lib']
29
+
30
+ spec.add_dependency 'chunky_png'
31
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: trace_eval
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Frank J. Cameron
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-11-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: chunky_png
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description:
28
+ email:
29
+ - fjc@fastmail.net
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rubocop.yml"
35
+ - CHANGELOG.md
36
+ - Gemfile
37
+ - Gemfile.lock
38
+ - LICENSE.txt
39
+ - README.md
40
+ - Rakefile
41
+ - bin/console
42
+ - bin/setup
43
+ - lib/trace_eval.rb
44
+ - lib/trace_eval/version.rb
45
+ - trace_eval.gemspec
46
+ homepage: https://gitlab.com/fjc/trace_eval
47
+ licenses:
48
+ - MIT
49
+ metadata:
50
+ homepage_uri: https://gitlab.com/fjc/trace_eval
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 2.7.0
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubygems_version: 3.1.6
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: ''
70
+ test_files: []