Skip to content

Commit

Permalink
Merge pull request #152 from inspec/ss/upgrade-ruby-3.1.0
Browse files Browse the repository at this point in the history
CHEF-8869: Upgrade to Ruby 3.1.0 with Essential Fixes
  • Loading branch information
sa-progress authored Dec 8, 2023
2 parents 2ab8cb6 + bf72a5b commit 1478631
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 49 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ to help you get it set up.

To get started, you'll need:

* Ruby 2.6.0
* Ruby 3.1.0
* You can use `rbenv` to manage your Ruby version(s)
* [`Bundler`](https://github.com/bundler/bundler)
* This can be installed with `gem install bundler`
Expand Down
2 changes: 1 addition & 1 deletion mmv1/.ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.0
3.1.0
111 changes: 67 additions & 44 deletions mmv1/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,66 +1,90 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.1.7.5)
activesupport (7.1.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
ast (2.4.0)
binding_of_caller (0.8.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.4)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
concurrent-ruby (1.2.2)
debug_inspector (0.0.3)
diff-lcs (1.3)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
connection_pool (2.4.1)
debug_inspector (1.1.0)
diff-lcs (1.5.0)
drb (2.2.0)
ruby2_keywords
faraday (2.7.12)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.4)
json (2.7.1)
language_server-protocol (3.17.0.3)
metaclass (0.0.4)
minitest (5.19.0)
minitest (5.20.0)
mocha (1.3.0)
metaclass (~> 0.0.1)
multipart-post (2.0.0)
octokit (4.13.0)
sawyer (~> 0.8.0, >= 0.5.3)
parallel (1.19.1)
parser (2.6.5.0)
ast (~> 2.4.0)
public_suffix (3.0.3)
rainbow (3.0.0)
rake (12.3.3)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.1)
mutex_m (0.2.0)
octokit (8.0.0)
faraday (>= 1, < 3)
sawyer (~> 0.9)
parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
public_suffix (5.0.4)
racc (1.7.3)
rainbow (3.1.1)
rake (13.1.0)
regexp_parser (2.8.3)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.77.0)
jaro_winkler (~> 1.5.1)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.58.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 2.6)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
ruby-progressbar (1.10.1)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (1.6.0)
zeitwerk (2.6.11)
unicode-display_width (2.5.0)

PLATFORMS
ruby
Expand All @@ -75,5 +99,4 @@ DEPENDENCIES
rubocop (>= 0.77.0)

BUNDLED WITH
1.17.2

2.4.13
1 change: 1 addition & 0 deletions mmv1/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# generation.
ENV['TZ'] = 'UTC'

require 'active_support'
require 'active_support/inflector'
require 'active_support/core_ext/array/conversions'
require 'api/compiler'
Expand Down
2 changes: 1 addition & 1 deletion mmv1/google/yaml_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def parse(content)
# TODO(nelsonjr): Allow specifying which symbols to restrict it further.
# But it requires inspecting all configuration files for symbol sources,
# such as Enum values. Leaving it as a nice-to-have for the future.
YAML.safe_load(content, allowed_classes)
YAML.safe_load(content, permitted_classes: allowed_classes)
end

def allowed_classes
Expand Down
4 changes: 4 additions & 0 deletions mmv1/provider/file_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def generate(pwd, template, path, provider)

Google::LOGGER.debug "Generating #{path}"
path = pwd + '/' +path

# create the directory if it doesn't exist
FileUtils.mkdir_p(File.dirname(path)) unless File.exist?(File.dirname(path))

File.open(path, 'w') { |f| f.puts compile_file(ctx, pwd + '/' + template) }

# Files are often generated in parallel.
Expand Down
4 changes: 2 additions & 2 deletions mmv1/templates/inspec/plural_resource.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ name = resource_name(object, product)

filter_table_config.connect(self, :table)

<%
<%
link_query_items = object&.nested_query&.keys&.first || object.collection_url_key
-%>
def initialize(params = {})
Expand Down Expand Up @@ -82,7 +82,7 @@ link_query_items = object&.nested_query&.keys&.first || object.collection_url_ke
def transformers
{
<% object.all_user_properties.reject(&:exclude_plural).each do |prop| -%>
'<%= prop.api_name -%>' => ->(obj) { <%= "return :#{ prop.override_name || prop.out_name }, #{parse_code(prop, 'obj')}" -%> },
'<%= prop.api_name -%>' => ->(obj) { <%= "[:#{ prop.override_name || prop.out_name }, #{parse_code(prop, 'obj')}]" -%> },
<% end # object.all_user_properties.each -%>
}
end
Expand Down

0 comments on commit 1478631

Please sign in to comment.