Skip to content

Commit c0bf900

Browse files
committed
Merge branch 'kpaulisse-puppet-version-ci' into kpaulisse-mega-merge
2 parents 61369b4 + 6093d3c commit c0bf900

File tree

26 files changed

+96
-60
lines changed

26 files changed

+96
-60
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ script: "script/cibuild"
77
matrix:
88
include:
99
# Build with latest ruby
10-
- rvm: 2.3.1
10+
- rvm: 2.4.1
1111
env: RUBOCOP_TEST="true" RSPEC_TEST="true"
1212
# Build with older ruby versions
13+
- rvm: 2.3.4
14+
env: RUBOCOP_TEST="false" RSPEC_TEST="true"
1315
- rvm: 2.2
1416
env: RUBOCOP_TEST="false" RSPEC_TEST="true"
1517
- rvm: 2.1

doc/dev/integration-tests.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe 'whatever behavior' do
2222
# @result[:logs] is a String containing everything printed to STDERR (Logger)
2323
# @result[:output] is a String containing everything printed to STDOUT
2424
# @result[:diffs] is an Array of differences
25-
# @result[:exitcode] is a Fixnum representing the exit code: 0 = no changes, 1 = failure, 2 = success, with changes
25+
# @result[:exitcode] is an Integer representing the exit code: 0 = no changes, 1 = failure, 2 = success, with changes
2626
# @result[:exception] contains any exception that was thrown
2727
end
2828

@@ -46,7 +46,7 @@ describe 'whatever behavior' do
4646
# @result[:logs] is a String containing everything printed to STDERR (Logger)
4747
# @result[:output] is a String containing everything printed to STDOUT
4848
# @result[:diffs] is an Array of differences
49-
# @result[:exitcode] is a Fixnum representing the exit code: 0 = no changes, 1 = failure, 2 = success, with changes
49+
# @result[:exitcode] is an Integer representing the exit code: 0 = no changes, 1 = failure, 2 = success, with changes
5050
# @result[:exception] contains any exception that was thrown
5151
end
5252

doc/requirements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
To run `octocatalog-diff` you will need these basics:
44

5-
- Ruby 2.0 or higher
5+
- Ruby 2.0 through 2.4 (we test octocatalog-diff with Ruby 2.0, 2.1, 2.2, 2.3, and 2.4)
66
- Mac OS, Linux, or other Unix-line operating system (Windows is not supported)
77
- Ability to install gems, e.g. with [rbenv](https://github.com/rbenv/rbenv) or [rvm](https://rvm.io/), or root privileges to install into the system Ruby
8-
- Puppet agent for [Linux](https://docs.puppet.com/puppet/latest/reference/install_linux.html) or [Mac OS X](https://docs.puppet.com/puppet/latest/reference/install_osx.html), or installed as a gem
8+
- Puppet agent for [Linux](https://docs.puppet.com/puppet/latest/reference/install_linux.html) or [Mac OS X](https://docs.puppet.com/puppet/latest/reference/install_osx.html), or installed as a gem (we support Puppet 3.8.7 and all versions of Puppet 4.x)
99

1010
We recommend that you also have the following to get the most out of `octocatalog-diff`, but these are not absolute requirements:
1111

lib/octocatalog-diff/api/v1/override.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ def convert_to_data_type(datatype, value)
7474
return value if datatype == 'string'
7575
return parse_json(value) if datatype == 'json'
7676
return nil if datatype == 'nil'
77-
if datatype == 'fixnum'
77+
if datatype == 'fixnum' || datatype == 'integer'
7878
return Regexp.last_match(1).to_i if value =~ /^(-?\d+)$/
79-
raise ArgumentError, "Illegal fixnum '#{value}'"
79+
raise ArgumentError, "Illegal integer '#{value}'"
8080
end
8181
if datatype == 'float'
8282
return Regexp.last_match(1).to_f if value =~ /^(-?\d*\.\d+)$/

lib/octocatalog-diff/bootstrap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Bootstrap
1010
# @param options [Hash] Options hash:
1111
# :path [String] => Directory to bootstrap
1212
# :bootstrap_script [String] => Bootstrap script, relative to directory
13-
# @return [Hash] => [Fixnum] :status_code, [String] :output
13+
# @return [Hash] => [Integer] :status_code, [String] :output
1414
def self.bootstrap(options = {})
1515
# Options validation
1616
unless options[:path].is_a?(String)

lib/octocatalog-diff/catalog-diff/differ.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def hashdiff_initial(catalog1_in, catalog2_in)
530530

531531
# Added a new key that points to some kind of data structure that we know how
532532
# to handle.
533-
if obj[1] =~ /^(.+)\f([^\f]+)$/ && [String, Fixnum, Float, TrueClass, FalseClass, Array, Hash].include?(obj[2].class)
533+
if obj[1] =~ /^(.+)\f([^\f]+)$/ && [String, Integer, Float, TrueClass, FalseClass, Array, Hash].include?(obj[2].class)
534534
hashdiff_add_remove.add(obj[1])
535535
next
536536
end

lib/octocatalog-diff/catalog-diff/display/text.rb

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def self.loc_string(loc, compilation_dir, logger)
255255
# Get the diff of two long strings. Call the 'diffy' gem for this.
256256
# @param string1 [String] First string (-)
257257
# @param string2 [String] Second string (+)
258-
# @param depth [Fixnum] Depth, for correct indentation
258+
# @param depth [Integer] Depth, for correct indentation
259259
# @return Array<String> Displayable result
260260
def self.diff_two_strings_with_diffy(string1, string2, depth)
261261
# Single line strings?
@@ -324,8 +324,8 @@ def self.make_trailing_whitespace_visible(string_in)
324324
# Get the diff of two hashes. Call the 'diffy' gem for this.
325325
# @param hash1 [Hash] First hash (-)
326326
# @param hash1 [Hash] Second hash (+)
327-
# @param depth [Fixnum] Depth, for correct indentation
328-
# @param limit [Fixnum] Maximum string length
327+
# @param depth [Integer] Depth, for correct indentation
328+
# @param limit [Integer] Maximum string length
329329
# @param strip_diff [Boolean] Strip leading +/-/" "
330330
# @return [Array<String>] Displayable result
331331
def self.diff_two_hashes_with_diffy(opts = {})
@@ -358,7 +358,7 @@ def self.diff_two_hashes_with_diffy(opts = {})
358358
end
359359

360360
# Special case: addition only, no truncation
361-
# @param depth [Fixnum] Depth, for correct indentation
361+
# @param depth [Integer] Depth, for correct indentation
362362
# @param hash [Hash] Added object
363363
# @return [Array<String>] Displayable result
364364
def self.addition_only_no_truncation(depth, hash)
@@ -383,7 +383,7 @@ def self.addition_only_no_truncation(depth, hash)
383383

384384
# Limit length of a string
385385
# @param str [String] String
386-
# @param limit [Fixnum] Limit (0=unlimited)
386+
# @param limit [Integer] Limit (0=unlimited)
387387
# @return [String] Truncated string
388388
def self.truncate_string(str, limit)
389389
return str if limit.nil? || str.length <= limit
@@ -392,7 +392,7 @@ def self.truncate_string(str, limit)
392392

393393
# Get the diff between two hashes. This is recursive-aware.
394394
# @param obj [diff object] diff object
395-
# @param depth [Fixnum] Depth of nesting, used for indentation
395+
# @param depth [Integer] Depth of nesting, used for indentation
396396
# @return Array<String> Printable diff outputs
397397
def self.hash_diff(obj, depth, key_in, nested = false)
398398
result = []
@@ -417,7 +417,7 @@ def self.hash_diff(obj, depth, key_in, nested = false)
417417
end
418418

419419
# Get the diff between two arbitrary objects
420-
# @param depth [Fixnum] Depth of nesting, used for indentation
420+
# @param depth [Integer] Depth of nesting, used for indentation
421421
# @param old_obj [?] Old object
422422
# @param new_obj [?] New object
423423
# @return Array<String> Diff output
@@ -432,23 +432,42 @@ def self.diff_at_depth(depth, old_obj, new_obj)
432432

433433
# Utility Method!
434434
# Indent a given text string with a certain number of spaces
435-
# @param spaces [Fixnum] Number of spaces
435+
# @param spaces [Integer] Number of spaces
436436
# @param text [String] Text
437437
def self.left_pad(spaces, text = '')
438438
[' ' * spaces, text].join('')
439439
end
440440

441+
# Utility Method!
442+
# Harmonize equivalent class names for comparison purposes.
443+
# @param class_name [String] Class name as input
444+
# @return [String] Class name as output
445+
def self.class_name_for_diffy(class_name)
446+
return 'Integer' if class_name == 'Fixnum'
447+
class_name
448+
end
449+
450+
# Utility Method!
451+
# `is_a?(class)` only allows one method, but this uses an array
452+
# @param object [?] Object to consider
453+
# @param classes [Array] Classes to determine if object is a member of
454+
# @return [Boolean] True if object is_a any of the classes, false otherwise
455+
def self.object_is_any_of?(object, classes)
456+
classes.each { |clazz| return true if object.is_a? clazz }
457+
false
458+
end
459+
441460
# Utility Method!
442461
# Given an arbitrary object, convert it into a string for use by 'diffy'.
443462
# This basically exists so we can do something prettier than just calling .inspect or .to_s
444463
# on object types we anticipate seeing, while not failing entirely on other object types.
445464
# @param obj [?] Object to be stringified
446465
# @return [String] String representation of object for diffy
447466
def self.stringify_for_diffy(obj)
448-
return JSON.pretty_generate(obj) if [Hash, Array].include?(obj.class)
467+
return JSON.pretty_generate(obj) if object_is_any_of?(obj, [Hash, Array])
449468
return '""' if obj.is_a?(String) && obj == ''
450-
return obj if [String, Fixnum, Float].include?(obj.class)
451-
"#{obj.class}: #{obj.inspect}"
469+
return obj if object_is_any_of?(obj, [String, Fixnum, Integer, Float])
470+
"#{class_name_for_diffy(obj.class)}: #{obj.inspect}"
452471
end
453472

454473
# Utility Method!
@@ -512,8 +531,8 @@ def self._adjust_for_display_datatype(obj1, obj2, option, logger)
512531
return ['""', 'undef'] if obj2.nil?
513532

514533
# If one is an integer and the other is a string
515-
return [obj1, "\"#{obj2}\""] if obj1.is_a?(Fixnum) && obj2.is_a?(String)
516-
return ["\"#{obj1}\"", obj2] if obj1.is_a?(String) && obj2.is_a?(Fixnum)
534+
return [obj1, "\"#{obj2}\""] if obj1.is_a?(Integer) && obj2.is_a?(String)
535+
return ["\"#{obj1}\"", obj2] if obj1.is_a?(String) && obj2.is_a?(Integer)
517536

518537
# True and false
519538
return [obj1, "\"#{obj2}\""] if obj1.is_a?(TrueClass) && obj2.is_a?(String)

lib/octocatalog-diff/catalog-util/builddir.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class BuildDir
2121
# Constructor
2222
# Options for constructor:
2323
# :puppetdb_url [String] PuppetDB Server URLs
24-
# :puppetdb_server_url_timeout [Fixnum] Timeout (seconds) for puppetdb.conf
24+
# :puppetdb_server_url_timeout [Integer] Timeout (seconds) for puppetdb.conf
2525
# :facts [OctocatalogDiff::Facts] Facts object
2626
# :fact_file [String] File from which to read facts
2727
# :node [String] Node name
@@ -99,14 +99,14 @@ def create_symlinks(logger = nil)
9999

100100
# Install puppetdb.conf file in temporary directory
101101
# @param server_urls [String] String for server_urls in puppetdb.conf
102-
# @param server_url_timeout [Fixnum] Value for server_url_timeout in puppetdb.conf
102+
# @param server_url_timeout [Integer] Value for server_url_timeout in puppetdb.conf
103103
def install_puppetdb_conf(logger, server_urls, server_url_timeout = 30)
104104
unless server_urls.is_a?(String)
105105
raise ArgumentError, "server_urls must be a string, got a: #{server_urls.class}"
106106
end
107107

108108
server_url_timeout ||= 30 # If called with nil argument, supply default
109-
unless server_url_timeout.is_a?(Fixnum)
109+
unless server_url_timeout.is_a?(Integer)
110110
raise ArgumentError, "server_url_timeout must be a fixnum, got a: #{server_url_timeout.class}"
111111
end
112112

lib/octocatalog-diff/catalog-util/command.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def override_and_append_commandline_with_user_supplied_arguments(cmdline)
168168
# the index.
169169
# @param cmdline [Array] Existing command line
170170
# @param key [String] Key to look up
171-
# @return [Fixnum] Index of where key is defined (nil if undefined)
171+
# @return [Integer] Index of where key is defined (nil if undefined)
172172
def key_position(cmdline, key)
173173
cmdline.index { |x| x == "--#{key}" || x =~ /\A--#{key}=/ }
174174
end

lib/octocatalog-diff/catalog/computed.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Computed
2222
# @param :node [String] REQUIRED: Node name
2323
# @param :basedir [String] Directory in which to compile the catalog
2424
# @param :pass_env_vars [Array<String>] Environment variables to pass when compiling catalog
25-
# @param :retry_failed_catalog [Fixnum] Number of retries if a catalog compilation fails
25+
# @param :retry_failed_catalog [Integer] Number of retries if a catalog compilation fails
2626
# @param :tag [String] For display purposes, the catalog being compiled
2727
# @param :puppet_binary [String] Full path to Puppet
2828
# @param :puppet_version [String] Puppet version (optional; if not supplied, it is calculated)

0 commit comments

Comments
 (0)