lineprof 0.0.1 → 0.1.3
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 +5 -5
- data/CHANGELOG.md +12 -0
- data/lib/lineprof/version.rb +1 -1
- data/lib/lineprof.rb +17 -5
- data/lib/rack/lineprof/source_extension.rb +15 -0
- data/lineprof.gemspec +2 -2
- metadata +14 -14
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: 56ee1b53ea2ad5a8157bcfd28da5f2779332d583f654f3557dee6f5af4d0400f
         | 
| 4 | 
            +
              data.tar.gz: e0a741f6ff7a70d8e9fe0b181d95c4a65ace6e393f4dc99589f10fc1f47a4c88
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ee9b2b53d0cf2bffccc769f639cc555086fabd84f3c94f706a9fa7756f8402c08b67aaedc346c75333653a06df2997cad49775ac72f1cd78da11ef5aa100b4bd
         | 
| 7 | 
            +
              data.tar.gz: 603c99982a2a3c4ba9fab17bdb646e94a72dbd30e196beffcb889e7c2ec6147678e8adcd5c65e7a0b1faaa0f7e11b302e2a0575d1609857a687d419c6660e06d
         | 
    
        data/CHANGELOG.md
    ADDED
    
    | @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            # Change Log
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            ## [v0.1.1](https://github.com/k0kubun/lineprof/tree/v0.1.1) (2015-09-12)
         | 
| 4 | 
            +
            [Full Changelog](https://github.com/k0kubun/lineprof/compare/v0.1.0...v0.1.1)
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            ## [v0.1.0](https://github.com/k0kubun/lineprof/tree/v0.1.0) (2015-09-07)
         | 
| 7 | 
            +
            [Full Changelog](https://github.com/k0kubun/lineprof/compare/v0.0.1...v0.1.0)
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ## [v0.0.1](https://github.com/k0kubun/lineprof/tree/v0.0.1) (2015-03-09)
         | 
| 10 | 
            +
             | 
| 11 | 
            +
             | 
| 12 | 
            +
            \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
         | 
    
        data/lib/lineprof/version.rb
    CHANGED
    
    
    
        data/lib/lineprof.rb
    CHANGED
    
    | @@ -1,13 +1,14 @@ | |
| 1 1 | 
             
            require 'rblineprof'
         | 
| 2 | 
            -
            require 'rack/lineprof'
         | 
| 2 | 
            +
            require 'rack/lineprof/source_extension'
         | 
| 3 3 |  | 
| 4 4 | 
             
            class Lineprof
         | 
| 5 | 
            -
              IGNORE_PATTERN | 
| 5 | 
            +
              IGNORE_PATTERN  = /lib\/lineprof\.rb$/
         | 
| 6 | 
            +
              DEFAULT_PATTERN = /./
         | 
| 6 7 |  | 
| 7 8 | 
             
              class << self
         | 
| 8 | 
            -
                def profile(&block)
         | 
| 9 | 
            -
                  value | 
| 10 | 
            -
                  result = lineprof( | 
| 9 | 
            +
                def profile(filename = caller_filename(caller), &block)
         | 
| 10 | 
            +
                  value  = nil
         | 
| 11 | 
            +
                  result = lineprof(filename) { value = block.call }
         | 
| 11 12 |  | 
| 12 13 | 
             
                  puts Term::ANSIColor.blue("\n[Lineprof] #{'=' * 70}")
         | 
| 13 14 | 
             
                  puts "\n#{format(result)}\n"
         | 
| @@ -16,6 +17,17 @@ class Lineprof | |
| 16 17 |  | 
| 17 18 | 
             
                private
         | 
| 18 19 |  | 
| 20 | 
            +
                def caller_filename(caller_lines)
         | 
| 21 | 
            +
                  filename = caller_lines.first.split(':').first
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  if filename
         | 
| 24 | 
            +
                    # Don't add \A because filename may not be an absolute path
         | 
| 25 | 
            +
                    /#{Regexp.escape(filename)}\z/
         | 
| 26 | 
            +
                  else
         | 
| 27 | 
            +
                    DEFAULT_PATTERN
         | 
| 28 | 
            +
                  end
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 19 31 | 
             
                def format(result)
         | 
| 20 32 | 
             
                  sources = result.map do |filename, samples|
         | 
| 21 33 | 
             
                    next if filename =~ IGNORE_PATTERN
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            require 'rack/lineprof'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Rack
         | 
| 4 | 
            +
              class Lineprof
         | 
| 5 | 
            +
                module SourceExtension
         | 
| 6 | 
            +
                  def source_lines
         | 
| 7 | 
            +
                    return [] if file_name == '(eval)'
         | 
| 8 | 
            +
                    return [] if file_name.end_with?('module_eval')
         | 
| 9 | 
            +
                    super
         | 
| 10 | 
            +
                  end
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                Source.send(:prepend, SourceExtension)
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
            end
         | 
    
        data/lineprof.gemspec
    CHANGED
    
    | @@ -18,8 +18,8 @@ Gem::Specification.new do |spec| | |
| 18 18 | 
             
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 19 19 | 
             
              spec.require_paths = ["lib"]
         | 
| 20 20 |  | 
| 21 | 
            -
              spec.add_dependency "rblineprof", " | 
| 22 | 
            -
              spec.add_dependency "rack-lineprof", " | 
| 21 | 
            +
              spec.add_dependency "rblineprof", ">= 0.3.6"
         | 
| 22 | 
            +
              spec.add_dependency "rack-lineprof", ">= 0.0.4"
         | 
| 23 23 |  | 
| 24 24 | 
             
              spec.add_development_dependency "bundler"
         | 
| 25 25 | 
             
              spec.add_development_dependency "rake"
         | 
    
        metadata
    CHANGED
    
    | @@ -1,43 +1,43 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: lineprof
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.1.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Takashi Kokubun
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-11-22 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rblineprof
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - - " | 
| 17 | 
            +
                - - ">="
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 19 | 
             
                    version: 0.3.6
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 | 
            -
                - - " | 
| 24 | 
            +
                - - ">="
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: 0.3.6
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: rack-lineprof
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 | 
            -
                - - " | 
| 31 | 
            +
                - - ">="
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: 0.0. | 
| 33 | 
            +
                    version: 0.0.4
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 | 
            -
                - - " | 
| 38 | 
            +
                - - ">="
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: 0.0. | 
| 40 | 
            +
                    version: 0.0.4
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: bundler
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -88,6 +88,7 @@ extensions: [] | |
| 88 88 | 
             
            extra_rdoc_files: []
         | 
| 89 89 | 
             
            files:
         | 
| 90 90 | 
             
            - ".gitignore"
         | 
| 91 | 
            +
            - CHANGELOG.md
         | 
| 91 92 | 
             
            - Gemfile
         | 
| 92 93 | 
             
            - LICENSE.txt
         | 
| 93 94 | 
             
            - README.md
         | 
| @@ -95,12 +96,13 @@ files: | |
| 95 96 | 
             
            - example.rb
         | 
| 96 97 | 
             
            - lib/lineprof.rb
         | 
| 97 98 | 
             
            - lib/lineprof/version.rb
         | 
| 99 | 
            +
            - lib/rack/lineprof/source_extension.rb
         | 
| 98 100 | 
             
            - lineprof.gemspec
         | 
| 99 101 | 
             
            homepage: https://github.com/k0kubun/lineprof
         | 
| 100 102 | 
             
            licenses:
         | 
| 101 103 | 
             
            - MIT
         | 
| 102 104 | 
             
            metadata: {}
         | 
| 103 | 
            -
            post_install_message: | 
| 105 | 
            +
            post_install_message:
         | 
| 104 106 | 
             
            rdoc_options: []
         | 
| 105 107 | 
             
            require_paths:
         | 
| 106 108 | 
             
            - lib
         | 
| @@ -115,10 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 115 117 | 
             
                - !ruby/object:Gem::Version
         | 
| 116 118 | 
             
                  version: '0'
         | 
| 117 119 | 
             
            requirements: []
         | 
| 118 | 
            -
             | 
| 119 | 
            -
             | 
| 120 | 
            -
            signing_key: 
         | 
| 120 | 
            +
            rubygems_version: 3.1.2
         | 
| 121 | 
            +
            signing_key:
         | 
| 121 122 | 
             
            specification_version: 4
         | 
| 122 123 | 
             
            summary: Easy-to-use line profiler for Ruby.
         | 
| 123 124 | 
             
            test_files: []
         | 
| 124 | 
            -
            has_rdoc: 
         |