puppet-debugger 0.19.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +10 -27
  3. data/.rubocop.yml +64 -232
  4. data/.rubocop_todo.yml +89 -147
  5. data/CHANGELOG.md +12 -1
  6. data/Gemfile +7 -5
  7. data/README.md +4 -5
  8. data/Rakefile +11 -12
  9. data/bin/pdb +1 -1
  10. data/lib/awesome_print/ext/awesome_puppet.rb +10 -8
  11. data/lib/plugins/puppet-debugger/input_responders/benchmark.rb +5 -4
  12. data/lib/plugins/puppet-debugger/input_responders/classes.rb +4 -1
  13. data/lib/plugins/puppet-debugger/input_responders/classification.rb +4 -2
  14. data/lib/plugins/puppet-debugger/input_responders/commands.rb +18 -18
  15. data/lib/plugins/puppet-debugger/input_responders/datatypes.rb +11 -5
  16. data/lib/plugins/puppet-debugger/input_responders/environment.rb +4 -2
  17. data/lib/plugins/puppet-debugger/input_responders/exit.rb +4 -2
  18. data/lib/plugins/puppet-debugger/input_responders/facterdb_filter.rb +4 -2
  19. data/lib/plugins/puppet-debugger/input_responders/facts.rb +4 -2
  20. data/lib/plugins/puppet-debugger/input_responders/functions.rb +34 -32
  21. data/lib/plugins/puppet-debugger/input_responders/help.rb +4 -2
  22. data/lib/plugins/puppet-debugger/input_responders/krt.rb +4 -2
  23. data/lib/plugins/puppet-debugger/input_responders/play.rb +22 -24
  24. data/lib/plugins/puppet-debugger/input_responders/reset.rb +5 -3
  25. data/lib/plugins/puppet-debugger/input_responders/resources.rb +5 -2
  26. data/lib/plugins/puppet-debugger/input_responders/set.rb +34 -32
  27. data/lib/plugins/puppet-debugger/input_responders/stacktrace.rb +23 -0
  28. data/lib/plugins/puppet-debugger/input_responders/types.rb +6 -2
  29. data/lib/plugins/puppet-debugger/input_responders/vars.rb +6 -5
  30. data/lib/plugins/puppet-debugger/input_responders/whereami.rb +5 -3
  31. data/lib/puppet-debugger/cli.rb +118 -91
  32. data/lib/puppet-debugger/code/code_file.rb +13 -14
  33. data/lib/puppet-debugger/code/code_range.rb +5 -3
  34. data/lib/puppet-debugger/code/loc.rb +1 -1
  35. data/lib/puppet-debugger/debugger_code.rb +2 -0
  36. data/lib/puppet-debugger/hooks.rb +15 -16
  37. data/lib/puppet-debugger/input_responder_plugin.rb +54 -52
  38. data/lib/puppet-debugger/monkey_patches.rb +4 -1
  39. data/lib/puppet-debugger/plugin_test_helper.rb +9 -8
  40. data/lib/puppet-debugger/support.rb +27 -17
  41. data/lib/puppet-debugger/support/environment.rb +4 -4
  42. data/lib/puppet-debugger/support/errors.rb +25 -27
  43. data/lib/puppet-debugger/support/facts.rb +5 -5
  44. data/lib/puppet-debugger/support/node.rb +4 -5
  45. data/lib/puppet-debugger/support/scope.rb +19 -17
  46. data/lib/puppet-debugger/trollop.rb +38 -31
  47. data/lib/puppet-debugger/version.rb +1 -1
  48. data/lib/puppet/application/debugger.rb +141 -135
  49. data/output.json +1 -0
  50. data/puppet-debugger.gemspec +17 -16
  51. data/spec/awesome_print/ext/awesome_puppet_spec.rb +30 -30
  52. data/spec/fixtures/sample_start_debugger.pp +3 -2
  53. data/spec/hooks_spec.rb +33 -35
  54. data/spec/input_responder_plugin_spec.rb +7 -6
  55. data/spec/input_responders/benchmark_spec.rb +3 -1
  56. data/spec/input_responders/classes_spec.rb +12 -10
  57. data/spec/input_responders/classification_spec.rb +4 -2
  58. data/spec/input_responders/commands_spec.rb +2 -0
  59. data/spec/input_responders/datatypes_spec.rb +4 -3
  60. data/spec/input_responders/environment_spec.rb +2 -0
  61. data/spec/input_responders/exit_spec.rb +9 -11
  62. data/spec/input_responders/facterdb_filter_spec.rb +2 -0
  63. data/spec/input_responders/facts_spec.rb +2 -0
  64. data/spec/input_responders/functions_spec.rb +30 -28
  65. data/spec/input_responders/help_spec.rb +4 -2
  66. data/spec/input_responders/krt_spec.rb +3 -1
  67. data/spec/input_responders/play_spec.rb +10 -20
  68. data/spec/input_responders/reset_spec.rb +2 -0
  69. data/spec/input_responders/resources_spec.rb +3 -1
  70. data/spec/input_responders/set_spec.rb +3 -1
  71. data/spec/input_responders/stacktrace_spec.rb +15 -0
  72. data/spec/input_responders/types_spec.rb +2 -0
  73. data/spec/input_responders/vars_spec.rb +4 -4
  74. data/spec/input_responders/whereami_spec.rb +2 -0
  75. data/spec/pdb_spec.rb +0 -9
  76. data/spec/puppet/application/debugger_spec.rb +18 -19
  77. data/spec/puppet_debugger_spec.rb +81 -84
  78. data/spec/remote_node_spec.rb +1 -5
  79. data/spec/spec_helper.rb +22 -18
  80. data/spec/support_spec.rb +3 -5
  81. data/test_matrix.rb +1 -1
  82. metadata +48 -31
@@ -41,7 +41,7 @@ describe 'PuppetDebugger' do
41
41
 
42
42
  describe 'set' do
43
43
  it 'sends message about resetting' do
44
- expect(output.string).to eq("\nResetting to use node puppetdev.localdomain\n")
44
+ expect(output.string).to eq(" => Resetting to use node puppetdev.localdomain\n")
45
45
  end
46
46
 
47
47
  it 'return node name' do
@@ -74,10 +74,6 @@ describe 'PuppetDebugger' do
74
74
  let(:node_name) do
75
75
  'invalid.localdomain'
76
76
  end
77
- # this test stopped working in the puppet 5.x series
78
- xit 'name' do
79
- expect { debugger.node.name }.to raise_error(PuppetDebugger::Exception::UndefinedNode)
80
- end
81
77
  end
82
78
 
83
79
  it 'set node name' do
@@ -1,25 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'simplecov'
4
3
  require_relative '../lib/puppet-debugger'
5
4
  require 'yaml'
6
- ENV['COVERAGE'] = 'true'
5
+ ENV['CI'] = 'true'
7
6
 
8
- module SimpleCov::Configuration
9
- def clean_filters
10
- @filters = []
7
+ if ENV['COVERAGE']
8
+ require 'simplecov'
9
+
10
+ module SimpleCov::Configuration
11
+ def clean_filters
12
+ @filters = []
13
+ end
11
14
  end
12
- end
13
15
 
14
- SimpleCov.configure do
15
- clean_filters
16
- load_profile 'test_frameworks'
17
- end
16
+ SimpleCov.configure do
17
+ clean_filters
18
+ load_profile 'test_frameworks'
19
+ end
18
20
 
19
- SimpleCov.start do
20
- add_filter '/.rvm/'
21
- add_filter 'vendor'
22
- add_filter 'bundler'
21
+ if ENV['COVERAGE']
22
+ SimpleCov.start do
23
+ add_filter '/.rvm/'
24
+ add_filter 'vendor'
25
+ add_filter 'bundler'
26
+ end
27
+ end
23
28
  end
24
29
 
25
30
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -30,17 +35,17 @@ require 'puppet-debugger'
30
35
  ENV['REPL_FACTERDB_FILTER'] = 'operatingsystem=Fedora and operatingsystemrelease=23 and architecture=x86_64 and facterversion=/^2\\.4/'
31
36
  # Requires supporting files with custom matchers and macros, etc,
32
37
  # in ./support/ and its subdirectories.
33
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
38
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
34
39
 
35
40
  def stdlib_path
36
41
  File.join(Puppet[:basemodulepath].split(':').first, 'stdlib')
37
42
  end
38
43
 
39
44
  def install_stdlib
40
- `bundle exec puppet module install puppetlabs/stdlib` unless File.exists?(stdlib_path)
45
+ `bundle exec puppet module install puppetlabs/stdlib` unless File.exist?(stdlib_path)
41
46
  end
42
47
 
43
- #install_stdlib
48
+ # install_stdlib
44
49
 
45
50
  def fixtures_dir
46
51
  File.join(File.dirname(__FILE__), 'fixtures')
@@ -62,7 +67,6 @@ def supports_datatypes?
62
67
  Gem::Version.new(Puppet.version) >= Gem::Version.new('4.5')
63
68
  end
64
69
 
65
-
66
70
  RSpec.configure do |config|
67
71
  config.filter_run_excluding native_functions: !supports_native_functions?
68
72
  RSpec::Expectations.configuration.on_potential_false_positives = :nothing
@@ -21,19 +21,19 @@ describe 'support' do
21
21
  end
22
22
 
23
23
  let(:manifest_file) do
24
- file = File.open('/tmp/debugger_puppet_manifest.pp', 'w') do |f|
24
+ File.open('/tmp/debugger_puppet_manifest.pp', 'w') do |f|
25
25
  f.write(manifest_code)
26
26
  end
27
27
  '/tmp/debugger_puppet_manifest.pp'
28
28
  end
29
29
 
30
30
  let(:manifest_code) do
31
- <<-EOF
31
+ <<-OUT
32
32
  file{'/tmp/test.txt': ensure => absent } \n
33
33
  notify{'hello_there':} \n
34
34
  service{'httpd': ensure => running}\n
35
35
 
36
- EOF
36
+ OUT
37
37
  end
38
38
 
39
39
  after(:each) do
@@ -61,6 +61,4 @@ describe 'support' do
61
61
  expect(debugger.node.facts.values).to be_instance_of(Hash)
62
62
  expect(debugger.node.facts.values['fqdn']).to eq('foo.example.com')
63
63
  end
64
-
65
-
66
64
  end
@@ -30,7 +30,7 @@ def matrix
30
30
  unless @matrix
31
31
  @matrix = {}
32
32
  ci_data.each do |id, data|
33
- @matrix[id] = data if id =~ /^puppet/
33
+ @matrix[id] = data if id.match?(/^puppet/)
34
34
  end
35
35
  end
36
36
  @matrix
metadata CHANGED
@@ -1,113 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-debugger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Osman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-15 00:00:00.000000000 Z
11
+ date: 2020-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: table_print
14
+ name: awesome_print
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0
19
+ version: '1.7'
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
- version: 1.0.0
26
+ version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
- name: pluginator
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.5.0
33
+ version: '0'
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: 1.5.0
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rb-readline
42
+ name: facterdb
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.5.5
47
+ version: 0.4.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.5.5
54
+ version: 0.4.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: pluginator
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.5.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.5.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: puppet
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: '3.8'
75
+ version: '5.5'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: '3.8'
82
+ version: '5.5'
69
83
  - !ruby/object:Gem::Dependency
70
- name: facterdb
84
+ name: rb-readline
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
74
88
  - !ruby/object:Gem::Version
75
- version: 0.4.0
89
+ version: 0.5.5
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
- version: 0.4.0
96
+ version: 0.5.5
83
97
  - !ruby/object:Gem::Dependency
84
- name: awesome_print
98
+ name: table_print
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: '1.7'
103
+ version: 1.0.0
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: '1.7'
110
+ version: 1.0.0
97
111
  - !ruby/object:Gem::Dependency
98
- name: bundler
112
+ name: tty-pager
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - ">="
115
+ - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '0'
117
+ version: 0.13.0
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - ">="
122
+ - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '0'
124
+ version: 0.13.0
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rdoc
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -184,6 +198,7 @@ files:
184
198
  - lib/plugins/puppet-debugger/input_responders/reset.rb
185
199
  - lib/plugins/puppet-debugger/input_responders/resources.rb
186
200
  - lib/plugins/puppet-debugger/input_responders/set.rb
201
+ - lib/plugins/puppet-debugger/input_responders/stacktrace.rb
187
202
  - lib/plugins/puppet-debugger/input_responders/types.rb
188
203
  - lib/plugins/puppet-debugger/input_responders/vars.rb
189
204
  - lib/plugins/puppet-debugger/input_responders/whereami.rb
@@ -208,6 +223,7 @@ files:
208
223
  - lib/puppet-debugger/trollop.rb
209
224
  - lib/puppet-debugger/version.rb
210
225
  - lib/puppet/application/debugger.rb
226
+ - output.json
211
227
  - puppet-debugger.gemspec
212
228
  - run_container_test.sh
213
229
  - spec/awesome_print/ext/awesome_puppet_spec.rb
@@ -275,6 +291,7 @@ files:
275
291
  - spec/input_responders/reset_spec.rb
276
292
  - spec/input_responders/resources_spec.rb
277
293
  - spec/input_responders/set_spec.rb
294
+ - spec/input_responders/stacktrace_spec.rb
278
295
  - spec/input_responders/types_spec.rb
279
296
  - spec/input_responders/vars_spec.rb
280
297
  - spec/input_responders/whereami_spec.rb
@@ -298,7 +315,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
298
315
  requirements:
299
316
  - - ">="
300
317
  - !ruby/object:Gem::Version
301
- version: '2.1'
318
+ version: '2.4'
302
319
  required_rubygems_version: !ruby/object:Gem::Requirement
303
320
  requirements:
304
321
  - - ">="