puppet-debugger 0.4.1 → 0.4.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 +4 -4
- data/.gitlab-ci.yml +25 -2
- data/.release_me.yaml +11 -0
- data/.rubocop.yml +239 -0
- data/.rubocop_todo.yml +196 -0
- data/.ruby-version +1 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +17 -1
- data/bin/pdb +1 -0
- data/lib/awesome_print/ext/awesome_puppet.rb +6 -5
- data/lib/puppet/application/debugger.rb +24 -24
- data/lib/puppet-debugger/cli.rb +76 -81
- data/lib/puppet-debugger/code/code_file.rb +82 -82
- data/lib/puppet-debugger/code/code_range.rb +56 -57
- data/lib/puppet-debugger/code/loc.rb +68 -70
- data/lib/puppet-debugger/debugger_code.rb +279 -280
- data/lib/puppet-debugger/support/compiler.rb +1 -1
- data/lib/puppet-debugger/support/environment.rb +2 -2
- data/lib/puppet-debugger/support/errors.rb +3 -4
- data/lib/puppet-debugger/support/facts.rb +7 -7
- data/lib/puppet-debugger/support/functions.rb +4 -5
- data/lib/puppet-debugger/support/input_responders.rb +26 -28
- data/lib/puppet-debugger/support/node.rb +7 -6
- data/lib/puppet-debugger/support/play.rb +16 -24
- data/lib/puppet-debugger/support/scope.rb +3 -4
- data/lib/puppet-debugger/support.rb +38 -40
- data/lib/puppet-debugger.rb +38 -17
- data/lib/version.rb +2 -1
- data/spec/facts_spec.rb +7 -6
- data/spec/pdb_spec.rb +1 -0
- data/spec/puppet/application/debugger_spec.rb +2 -3
- data/spec/{puppet-debugger_spec.rb → puppet_debugger_spec.rb} +27 -33
- data/spec/remote_node_spec.rb +13 -14
- data/spec/spec_helper.rb +8 -7
- data/spec/support_spec.rb +19 -24
- data/test_matrix.rb +4 -3
- metadata +6 -2
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -1,7 +1,8 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require 'simplecov'
         | 
| 2 3 | 
             
            require_relative '../lib/puppet-debugger'
         | 
| 3 4 | 
             
            require 'yaml'
         | 
| 4 | 
            -
            ENV['COVERAGE'] =  | 
| 5 | 
            +
            ENV['COVERAGE'] = 'true'
         | 
| 5 6 |  | 
| 6 7 | 
             
            module SimpleCov::Configuration
         | 
| 7 8 | 
             
              def clean_filters
         | 
| @@ -15,9 +16,9 @@ SimpleCov.configure do | |
| 15 16 | 
             
            end
         | 
| 16 17 |  | 
| 17 18 | 
             
            SimpleCov.start do
         | 
| 18 | 
            -
              add_filter  | 
| 19 | 
            -
              add_filter  | 
| 20 | 
            -
              add_filter  | 
| 19 | 
            +
              add_filter '/.rvm/'
         | 
| 20 | 
            +
              add_filter 'vendor'
         | 
| 21 | 
            +
              add_filter 'bundler'
         | 
| 21 22 | 
             
            end
         | 
| 22 23 |  | 
| 23 24 | 
             
            $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
         | 
| @@ -25,10 +26,10 @@ $LOAD_PATH.unshift(File.dirname(__FILE__)) | |
| 25 26 |  | 
| 26 27 | 
             
            require 'rspec'
         | 
| 27 28 | 
             
            require 'puppet-debugger'
         | 
| 28 | 
            -
            ENV['REPL_FACTERDB_FILTER'] =  | 
| 29 | 
            +
            ENV['REPL_FACTERDB_FILTER'] = 'operatingsystem=Fedora and operatingsystemrelease=23 and architecture=x86_64 and facterversion=/^2\\.4/'
         | 
| 29 30 | 
             
            # Requires supporting files with custom matchers and macros, etc,
         | 
| 30 31 | 
             
            # in ./support/ and its subdirectories.
         | 
| 31 | 
            -
            Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
         | 
| 32 | 
            +
            Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
         | 
| 32 33 |  | 
| 33 34 | 
             
            def stdlib_path
         | 
| 34 35 | 
             
              File.join(Puppet[:basemodulepath].split(':').first, 'stdlib')
         | 
| @@ -53,5 +54,5 @@ def supports_native_functions? | |
| 53 54 | 
             
            end
         | 
| 54 55 |  | 
| 55 56 | 
             
            RSpec.configure do |config|
         | 
| 56 | 
            -
              config.filter_run_excluding : | 
| 57 | 
            +
              config.filter_run_excluding native_functions: !supports_native_functions?
         | 
| 57 58 | 
             
            end
         | 
    
        data/spec/support_spec.rb
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require 'spec_helper'
         | 
| 2 3 | 
             
            require 'tempfile'
         | 
| 3 4 |  | 
| 4 5 | 
             
            describe 'support' do
         | 
| 5 | 
            -
             | 
| 6 6 | 
             
              let(:output) do
         | 
| 7 7 | 
             
                StringIO.new('', 'w')
         | 
| 8 8 | 
             
              end
         | 
| 9 9 |  | 
| 10 10 | 
             
              let(:debugger) do
         | 
| 11 | 
            -
                PuppetDebugger::Cli.new(: | 
| 11 | 
            +
                PuppetDebugger::Cli.new(out_buffer: output)
         | 
| 12 12 | 
             
              end
         | 
| 13 13 |  | 
| 14 14 | 
             
              let(:scope) do
         | 
| @@ -17,7 +17,7 @@ describe 'support' do | |
| 17 17 |  | 
| 18 18 | 
             
              describe 'play' do
         | 
| 19 19 | 
             
                before(:each) do
         | 
| 20 | 
            -
                  allow(debugger).to receive(:fetch_url_data).with(file_url +  | 
| 20 | 
            +
                  allow(debugger).to receive(:fetch_url_data).with(file_url + '.txt').and_return(File.read(fixtures_file))
         | 
| 21 21 | 
             
                end
         | 
| 22 22 |  | 
| 23 23 | 
             
                let(:fixtures_file) do
         | 
| @@ -59,17 +59,15 @@ describe 'support' do | |
| 59 59 | 
             
              end
         | 
| 60 60 |  | 
| 61 61 | 
             
              after(:each) do
         | 
| 62 | 
            -
                #manifest_file.close
         | 
| 62 | 
            +
                # manifest_file.close
         | 
| 63 63 | 
             
              end
         | 
| 64 64 |  | 
| 65 65 | 
             
              context '#function_map' do
         | 
| 66 | 
            -
             | 
| 67 66 | 
             
                it 'should list functions' do
         | 
| 68 67 | 
             
                  func = debugger.function_map["#{puppet_version}::hiera"]
         | 
| 69 68 | 
             
                  expect(debugger.function_map).to be_instance_of(Hash)
         | 
| 70 | 
            -
                  expect(func).to eq( | 
| 69 | 
            +
                  expect(func).to eq(name: 'hiera', parent: puppet_version)
         | 
| 71 70 | 
             
                end
         | 
| 72 | 
            -
             | 
| 73 71 | 
             
              end
         | 
| 74 72 |  | 
| 75 73 | 
             
              it 'should return a puppet version' do
         | 
| @@ -95,9 +93,8 @@ describe 'support' do | |
| 95 93 | 
             
              end
         | 
| 96 94 |  | 
| 97 95 | 
             
              describe 'convert  url' do
         | 
| 98 | 
            -
             | 
| 99 96 | 
             
                describe 'unsupported' do
         | 
| 100 | 
            -
                  let(:url) { 'https://bitbuck.com/master/lib/log_helper.rb'}
         | 
| 97 | 
            +
                  let(:url) { 'https://bitbuck.com/master/lib/log_helper.rb' }
         | 
| 101 98 | 
             
                  let(:converted) { 'https://bitbuck.com/master/lib/log_helper.rb' }
         | 
| 102 99 | 
             
                  it do
         | 
| 103 100 | 
             
                    expect(debugger.convert_to_text(url)).to eq(converted)
         | 
| @@ -105,7 +102,7 @@ describe 'support' do | |
| 105 102 | 
             
                end
         | 
| 106 103 | 
             
                describe 'gitlab' do
         | 
| 107 104 | 
             
                  describe 'blob' do
         | 
| 108 | 
            -
                    let(:url) { 'https://gitlab.com/nwops/pdebugger-web/blob/master/lib/log_helper.rb'}
         | 
| 105 | 
            +
                    let(:url) { 'https://gitlab.com/nwops/pdebugger-web/blob/master/lib/log_helper.rb' }
         | 
| 109 106 | 
             
                    let(:converted) { 'https://gitlab.com/nwops/pdebugger-web/raw/master/lib/log_helper.rb' }
         | 
| 110 107 | 
             
                    it do
         | 
| 111 108 | 
             
                      expect(debugger.convert_to_text(url)).to eq(converted)
         | 
| @@ -113,7 +110,7 @@ describe 'support' do | |
| 113 110 | 
             
                  end
         | 
| 114 111 |  | 
| 115 112 | 
             
                  describe 'raw' do
         | 
| 116 | 
            -
                    let(:url) { 'https://gitlab.com/nwops/pdebugger-web/raw/master/lib/log_helper.rb'}
         | 
| 113 | 
            +
                    let(:url) { 'https://gitlab.com/nwops/pdebugger-web/raw/master/lib/log_helper.rb' }
         | 
| 117 114 | 
             
                    let(:converted) { 'https://gitlab.com/nwops/pdebugger-web/raw/master/lib/log_helper.rb' }
         | 
| 118 115 | 
             
                    it do
         | 
| 119 116 | 
             
                      expect(debugger.convert_to_text(url)).to eq(converted)
         | 
| @@ -121,18 +118,17 @@ describe 'support' do | |
| 121 118 | 
             
                  end
         | 
| 122 119 |  | 
| 123 120 | 
             
                  describe 'snippet' do
         | 
| 124 | 
            -
             | 
| 125 121 | 
             
                    describe 'not raw' do
         | 
| 126 | 
            -
                      let(:url) { 'https://gitlab.com/snippets/19471'}
         | 
| 127 | 
            -
                      let(:converted) { 'https://gitlab.com/snippets/19471/raw'}
         | 
| 122 | 
            +
                      let(:url) { 'https://gitlab.com/snippets/19471' }
         | 
| 123 | 
            +
                      let(:converted) { 'https://gitlab.com/snippets/19471/raw' }
         | 
| 128 124 | 
             
                      it do
         | 
| 129 125 | 
             
                        expect(debugger.convert_to_text(url)).to eq(converted)
         | 
| 130 126 | 
             
                      end
         | 
| 131 127 | 
             
                    end
         | 
| 132 128 |  | 
| 133 129 | 
             
                    describe 'raw' do
         | 
| 134 | 
            -
                      let(:url) { 'https://gitlab.com/snippets/19471/raw'}
         | 
| 135 | 
            -
                      let(:converted) { 'https://gitlab.com/snippets/19471/raw'}
         | 
| 130 | 
            +
                      let(:url) { 'https://gitlab.com/snippets/19471/raw' }
         | 
| 131 | 
            +
                      let(:converted) { 'https://gitlab.com/snippets/19471/raw' }
         | 
| 136 132 | 
             
                      it do
         | 
| 137 133 | 
             
                        expect(debugger.convert_to_text(url)).to eq(converted)
         | 
| 138 134 | 
             
                      end
         | 
| @@ -141,37 +137,36 @@ describe 'support' do | |
| 141 137 | 
             
                end
         | 
| 142 138 | 
             
                describe 'github' do
         | 
| 143 139 | 
             
                  describe 'raw' do
         | 
| 144 | 
            -
                    let(:url) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw'}
         | 
| 140 | 
            +
                    let(:url) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw' }
         | 
| 145 141 | 
             
                    let(:converted) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw' }
         | 
| 146 142 | 
             
                    it do
         | 
| 147 143 | 
             
                      expect(debugger.convert_to_text(url)).to eq(converted)
         | 
| 148 144 | 
             
                    end
         | 
| 149 145 | 
             
                  end
         | 
| 150 146 | 
             
                  describe 'raw' do
         | 
| 151 | 
            -
                    let(:url) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0'}
         | 
| 147 | 
            +
                    let(:url) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0' }
         | 
| 152 148 | 
             
                    let(:converted) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0.txt' }
         | 
| 153 149 | 
             
                    it do
         | 
| 154 150 | 
             
                      expect(debugger.convert_to_text(url)).to eq(converted)
         | 
| 155 151 | 
             
                    end
         | 
| 156 152 | 
             
                  end
         | 
| 157 153 | 
             
                  describe 'raw gist' do
         | 
| 158 | 
            -
                    let(:url) {'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw/c8f6be52da5b2b0eeaabb9aa75832b75793d35d1/controls.pp'}
         | 
| 159 | 
            -
                    let(:converted) {'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw/c8f6be52da5b2b0eeaabb9aa75832b75793d35d1/controls.pp'}
         | 
| 154 | 
            +
                    let(:url) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw/c8f6be52da5b2b0eeaabb9aa75832b75793d35d1/controls.pp' }
         | 
| 155 | 
            +
                    let(:converted) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw/c8f6be52da5b2b0eeaabb9aa75832b75793d35d1/controls.pp' }
         | 
| 160 156 | 
             
                    it do
         | 
| 161 157 | 
             
                      expect(debugger.convert_to_text(url)).to eq(converted)
         | 
| 162 158 | 
             
                    end
         | 
| 163 159 | 
             
                  end
         | 
| 164 160 | 
             
                  describe 'raw non gist' do
         | 
| 165 | 
            -
                    let(:url) { 'https://raw.githubusercontent.com/nwops/puppet-debugger/master/lib/puppet-debugger.rb'}
         | 
| 161 | 
            +
                    let(:url) { 'https://raw.githubusercontent.com/nwops/puppet-debugger/master/lib/puppet-debugger.rb' }
         | 
| 166 162 | 
             
                    let(:converted) { 'https://raw.githubusercontent.com/nwops/puppet-debugger/master/lib/puppet-debugger.rb' }
         | 
| 167 163 | 
             
                    it do
         | 
| 168 164 | 
             
                      expect(debugger.convert_to_text(url)).to eq(converted)
         | 
| 169 165 | 
             
                    end
         | 
| 170 | 
            -
             | 
| 171 166 | 
             
                  end
         | 
| 172 167 |  | 
| 173 168 | 
             
                  describe 'blob' do
         | 
| 174 | 
            -
                    let(:url) { 'https://github.com/nwops/puppet-debugger/blob/master/lib/puppet-debugger.rb'}
         | 
| 169 | 
            +
                    let(:url) { 'https://github.com/nwops/puppet-debugger/blob/master/lib/puppet-debugger.rb' }
         | 
| 175 170 | 
             
                    let(:converted) { 'https://github.com/nwops/puppet-debugger/raw/master/lib/puppet-debugger.rb' }
         | 
| 176 171 | 
             
                    it do
         | 
| 177 172 | 
             
                      expect(debugger.convert_to_text(url)).to eq(converted)
         | 
| @@ -179,7 +174,7 @@ describe 'support' do | |
| 179 174 | 
             
                  end
         | 
| 180 175 |  | 
| 181 176 | 
             
                  describe 'gist' do
         | 
| 182 | 
            -
                    let(:url) { 'https://gist.github.com/logicminds/f9b1ac65a3a440d562b0'}
         | 
| 177 | 
            +
                    let(:url) { 'https://gist.github.com/logicminds/f9b1ac65a3a440d562b0' }
         | 
| 183 178 | 
             
                    let(:converted) { 'https://gist.github.com/logicminds/f9b1ac65a3a440d562b0.txt' }
         | 
| 184 179 | 
             
                    it do
         | 
| 185 180 | 
             
                      expect(debugger.convert_to_text(url)).to eq(converted)
         | 
    
        data/test_matrix.rb
    CHANGED
    
    | @@ -1,3 +1,4 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 1 2 | 
             
            require 'yaml'
         | 
| 2 3 | 
             
            require 'fileutils'
         | 
| 3 4 | 
             
            @threads = {}
         | 
| @@ -5,14 +6,14 @@ require 'fileutils' | |
| 5 6 | 
             
            def run_container(image, puppet_version)
         | 
| 6 7 | 
             
              pversion = puppet_version.match(/([\d\.]+)/)[0]
         | 
| 7 8 | 
             
              ruby_version = image.split(':').last
         | 
| 8 | 
            -
              dir = File.join('.','local_test_results', pversion, ruby_version)
         | 
| 9 | 
            +
              dir = File.join('.', 'local_test_results', pversion, ruby_version)
         | 
| 9 10 | 
             
              real_dir = File.expand_path(dir)
         | 
| 10 11 | 
             
              FileUtils.rm_rf(real_dir)
         | 
| 11 12 | 
             
              FileUtils.mkdir_p(real_dir)
         | 
| 12 13 | 
             
              cmd = "docker run -e OUT_DIR='#{dir}' -e RUBY_VERSION='#{ruby_version}' -e PUPPET_GEM_VERSION='#{puppet_version}' --rm -ti -v ${PWD}:/module --workdir /module #{image} /bin/bash run_container_test.sh"
         | 
| 13 14 | 
             
              File.write(File.join(real_dir, 'command.txt'), cmd)
         | 
| 14 15 | 
             
              output = `#{cmd}`
         | 
| 15 | 
            -
              if  | 
| 16 | 
            +
              if $CHILD_STATUS.success?
         | 
| 16 17 | 
             
                File.write(File.join(dir, 'success.txt'), output)
         | 
| 17 18 | 
             
              else
         | 
| 18 19 | 
             
                File.write(File.join(dir, 'error.txt'), output)
         | 
| @@ -39,4 +40,4 @@ matrix.each do |id, item| | |
| 39 40 | 
             
              end
         | 
| 40 41 | 
             
            end
         | 
| 41 42 |  | 
| 42 | 
            -
            @threads.each {| | 
| 43 | 
            +
            @threads.each { |_id, thr| thr.join } # wait on thread to finish
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: puppet-debugger
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.4. | 
| 4 | 
            +
              version: 0.4.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Corey Osman
         | 
| @@ -79,7 +79,11 @@ files: | |
| 79 79 | 
             
            - ".document"
         | 
| 80 80 | 
             
            - ".gitignore"
         | 
| 81 81 | 
             
            - ".gitlab-ci.yml"
         | 
| 82 | 
            +
            - ".release_me.yaml"
         | 
| 82 83 | 
             
            - ".rspec"
         | 
| 84 | 
            +
            - ".rubocop.yml"
         | 
| 85 | 
            +
            - ".rubocop_todo.yml"
         | 
| 86 | 
            +
            - ".ruby-version"
         | 
| 83 87 | 
             
            - CHANGELOG.md
         | 
| 84 88 | 
             
            - DEVELOPMENT.md
         | 
| 85 89 | 
             
            - Gemfile
         | 
| @@ -117,8 +121,8 @@ files: | |
| 117 121 | 
             
            - spec/fixtures/sample_manifest.pp
         | 
| 118 122 | 
             
            - spec/fixtures/sample_start_debugger.pp
         | 
| 119 123 | 
             
            - spec/pdb_spec.rb
         | 
| 120 | 
            -
            - spec/puppet-debugger_spec.rb
         | 
| 121 124 | 
             
            - spec/puppet/application/debugger_spec.rb
         | 
| 125 | 
            +
            - spec/puppet_debugger_spec.rb
         | 
| 122 126 | 
             
            - spec/remote_node_spec.rb
         | 
| 123 127 | 
             
            - spec/spec_helper.rb
         | 
| 124 128 | 
             
            - spec/support_spec.rb
         |