chef-zero 14.0.13 → 14.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -6
  3. data/Rakefile +9 -1
  4. data/chef-zero.gemspec +1 -4
  5. data/lib/chef_zero.rb +1 -1
  6. data/lib/chef_zero/chef_data/cookbook_data.rb +1 -1
  7. data/lib/chef_zero/chef_data/data_normalizer.rb +9 -7
  8. data/lib/chef_zero/chef_data/default_creator.rb +8 -5
  9. data/lib/chef_zero/data_store/data_already_exists_error.rb +1 -1
  10. data/lib/chef_zero/data_store/data_error.rb +1 -1
  11. data/lib/chef_zero/data_store/data_not_found_error.rb +1 -1
  12. data/lib/chef_zero/data_store/default_facade.rb +4 -4
  13. data/lib/chef_zero/data_store/interface_v2.rb +1 -1
  14. data/lib/chef_zero/data_store/memory_store.rb +3 -3
  15. data/lib/chef_zero/data_store/memory_store_v2.rb +22 -14
  16. data/lib/chef_zero/data_store/raw_file_store.rb +6 -4
  17. data/lib/chef_zero/data_store/v1_to_v2_adapter.rb +11 -1
  18. data/lib/chef_zero/data_store/v2_to_v1_adapter.rb +1 -1
  19. data/lib/chef_zero/endpoints/acl_endpoint.rb +3 -2
  20. data/lib/chef_zero/endpoints/acls_endpoint.rb +5 -4
  21. data/lib/chef_zero/endpoints/actor_default_key_endpoint.rb +2 -1
  22. data/lib/chef_zero/endpoints/actor_endpoint.rb +3 -3
  23. data/lib/chef_zero/endpoints/actor_key_endpoint.rb +1 -1
  24. data/lib/chef_zero/endpoints/actor_keys_endpoint.rb +3 -2
  25. data/lib/chef_zero/endpoints/actors_endpoint.rb +1 -1
  26. data/lib/chef_zero/endpoints/authenticate_user_endpoint.rb +2 -1
  27. data/lib/chef_zero/endpoints/container_endpoint.rb +2 -2
  28. data/lib/chef_zero/endpoints/containers_endpoint.rb +2 -2
  29. data/lib/chef_zero/endpoints/controls_endpoint.rb +1 -1
  30. data/lib/chef_zero/endpoints/cookbook_artifact_endpoint.rb +1 -1
  31. data/lib/chef_zero/endpoints/cookbook_artifact_identifier_endpoint.rb +3 -3
  32. data/lib/chef_zero/endpoints/cookbook_artifacts_endpoint.rb +1 -1
  33. data/lib/chef_zero/endpoints/cookbook_endpoint.rb +1 -1
  34. data/lib/chef_zero/endpoints/cookbook_version_endpoint.rb +7 -5
  35. data/lib/chef_zero/endpoints/cookbooks_base.rb +4 -2
  36. data/lib/chef_zero/endpoints/cookbooks_endpoint.rb +1 -1
  37. data/lib/chef_zero/endpoints/data_bag_endpoint.rb +3 -3
  38. data/lib/chef_zero/endpoints/data_bag_item_endpoint.rb +3 -3
  39. data/lib/chef_zero/endpoints/data_bags_endpoint.rb +2 -2
  40. data/lib/chef_zero/endpoints/environment_cookbook_endpoint.rb +1 -1
  41. data/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb +13 -10
  42. data/lib/chef_zero/endpoints/environment_cookbooks_endpoint.rb +1 -1
  43. data/lib/chef_zero/endpoints/environment_endpoint.rb +2 -2
  44. data/lib/chef_zero/endpoints/environment_nodes_endpoint.rb +1 -1
  45. data/lib/chef_zero/endpoints/environment_recipes_endpoint.rb +1 -1
  46. data/lib/chef_zero/endpoints/environment_role_endpoint.rb +1 -1
  47. data/lib/chef_zero/endpoints/file_store_file_endpoint.rb +1 -1
  48. data/lib/chef_zero/endpoints/group_endpoint.rb +2 -2
  49. data/lib/chef_zero/endpoints/groups_endpoint.rb +1 -1
  50. data/lib/chef_zero/endpoints/license_endpoint.rb +1 -1
  51. data/lib/chef_zero/endpoints/node_endpoint.rb +2 -2
  52. data/lib/chef_zero/endpoints/node_identifiers_endpoint.rb +1 -1
  53. data/lib/chef_zero/endpoints/nodes_endpoint.rb +2 -2
  54. data/lib/chef_zero/endpoints/not_found_endpoint.rb +1 -1
  55. data/lib/chef_zero/endpoints/organization_association_request_endpoint.rb +2 -1
  56. data/lib/chef_zero/endpoints/organization_association_requests_endpoint.rb +1 -1
  57. data/lib/chef_zero/endpoints/organization_authenticate_user_endpoint.rb +1 -1
  58. data/lib/chef_zero/endpoints/organization_endpoint.rb +3 -2
  59. data/lib/chef_zero/endpoints/organization_user_base.rb +1 -1
  60. data/lib/chef_zero/endpoints/organization_user_default_key_endpoint.rb +1 -1
  61. data/lib/chef_zero/endpoints/organization_user_endpoint.rb +1 -1
  62. data/lib/chef_zero/endpoints/organization_user_key_endpoint.rb +2 -2
  63. data/lib/chef_zero/endpoints/organization_user_keys_endpoint.rb +1 -1
  64. data/lib/chef_zero/endpoints/organization_users_endpoint.rb +2 -2
  65. data/lib/chef_zero/endpoints/organization_validator_key_endpoint.rb +1 -1
  66. data/lib/chef_zero/endpoints/organizations_endpoint.rb +1 -1
  67. data/lib/chef_zero/endpoints/policies_endpoint.rb +1 -1
  68. data/lib/chef_zero/endpoints/policy_endpoint.rb +1 -1
  69. data/lib/chef_zero/endpoints/policy_group_endpoint.rb +2 -2
  70. data/lib/chef_zero/endpoints/policy_group_policy_endpoint.rb +3 -3
  71. data/lib/chef_zero/endpoints/policy_groups_endpoint.rb +2 -2
  72. data/lib/chef_zero/endpoints/policy_revision_endpoint.rb +1 -1
  73. data/lib/chef_zero/endpoints/policy_revisions_endpoint.rb +1 -1
  74. data/lib/chef_zero/endpoints/principal_endpoint.rb +2 -2
  75. data/lib/chef_zero/endpoints/rest_list_endpoint.rb +2 -2
  76. data/lib/chef_zero/endpoints/rest_object_endpoint.rb +3 -2
  77. data/lib/chef_zero/endpoints/role_endpoint.rb +2 -2
  78. data/lib/chef_zero/endpoints/role_environments_endpoint.rb +1 -1
  79. data/lib/chef_zero/endpoints/sandbox_endpoint.rb +3 -3
  80. data/lib/chef_zero/endpoints/sandboxes_endpoint.rb +1 -1
  81. data/lib/chef_zero/endpoints/search_endpoint.rb +8 -8
  82. data/lib/chef_zero/endpoints/searches_endpoint.rb +1 -1
  83. data/lib/chef_zero/endpoints/server_api_version_endpoint.rb +1 -1
  84. data/lib/chef_zero/endpoints/system_recovery_endpoint.rb +3 -3
  85. data/lib/chef_zero/endpoints/universe_endpoint.rb +2 -2
  86. data/lib/chef_zero/endpoints/user_association_request_endpoint.rb +2 -1
  87. data/lib/chef_zero/endpoints/user_association_requests_count_endpoint.rb +1 -1
  88. data/lib/chef_zero/endpoints/user_association_requests_endpoint.rb +1 -1
  89. data/lib/chef_zero/endpoints/user_organizations_endpoint.rb +1 -1
  90. data/lib/chef_zero/endpoints/version_endpoint.rb +2 -2
  91. data/lib/chef_zero/rest_base.rb +15 -15
  92. data/lib/chef_zero/rest_request.rb +4 -4
  93. data/lib/chef_zero/rest_router.rb +2 -2
  94. data/lib/chef_zero/rspec.rb +3 -2
  95. data/lib/chef_zero/server.rb +87 -83
  96. data/lib/chef_zero/socketless_server_map.rb +2 -1
  97. data/lib/chef_zero/solr/query/phrase.rb +2 -2
  98. data/lib/chef_zero/solr/query/range_query.rb +3 -3
  99. data/lib/chef_zero/solr/query/term.rb +1 -1
  100. data/lib/chef_zero/solr/solr_parser.rb +12 -10
  101. data/lib/chef_zero/version.rb +1 -1
  102. data/spec/run_oc_pedant.rb +5 -3
  103. data/spec/search_spec.rb +2 -2
  104. data/spec/socketless_server_map_spec.rb +1 -1
  105. data/spec/support/oc_pedant.rb +1 -1
  106. metadata +3 -31
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require "chef_zero/data_store/interface_v1"
19
+ require_relative "interface_v1"
20
20
 
21
21
  module ChefZero
22
22
  module DataStore
@@ -1,6 +1,6 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/rest_base"
3
- require "chef_zero/chef_data/acl_path"
2
+ require_relative "../rest_base"
3
+ require_relative "../chef_data/acl_path"
4
4
 
5
5
  module ChefZero
6
6
  module Endpoints
@@ -23,6 +23,7 @@ module ChefZero
23
23
  if !acl_path || !%w{read create update delete grant}.include?(perm)
24
24
  raise RestErrorResponse.new(404, "Object not found: #{build_uri(request.base_uri, request.rest_path)}")
25
25
  end
26
+
26
27
  [acl_path, perm]
27
28
  end
28
29
 
@@ -1,7 +1,7 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/rest_base"
3
- require "chef_zero/chef_data/data_normalizer"
4
- require "chef_zero/chef_data/acl_path"
2
+ require_relative "../rest_base"
3
+ require_relative "../chef_data/data_normalizer"
4
+ require_relative "../chef_data/acl_path"
5
5
 
6
6
  module ChefZero
7
7
  module Endpoints
@@ -17,9 +17,10 @@ module ChefZero
17
17
  path = request.rest_path[0..-2] # Strip off _acl
18
18
  path = path[0..1] if path.size == 3 && path[0] == "organizations" && %w{organization organizations}.include?(path[2])
19
19
  acl_path = ChefData::AclPath.get_acl_data_path(path)
20
- if !acl_path
20
+ unless acl_path
21
21
  raise RestErrorResponse.new(404, "Object not found: #{build_uri(request.base_uri, request.rest_path)}")
22
22
  end
23
+
23
24
  acls = FFI_Yajl::Parser.parse(get_data(request, acl_path))
24
25
  acls = ChefData::DataNormalizer.normalize_acls(acls)
25
26
  if request.query_params["detail"] == "granular"
@@ -1,4 +1,4 @@
1
- require "chef_zero/rest_base"
1
+ require_relative "../rest_base"
2
2
 
3
3
  module ChefZero
4
4
  module Endpoints
@@ -53,6 +53,7 @@ module ChefZero
53
53
 
54
54
  def actor_path(request)
55
55
  return request.rest_path[0..3] if request.rest_path[2] == "clients"
56
+
56
57
  request.rest_path[0..1]
57
58
  end
58
59
 
@@ -1,6 +1,6 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/rest_object_endpoint"
3
- require "chef_zero/chef_data/data_normalizer"
2
+ require_relative "rest_object_endpoint"
3
+ require_relative "../chef_data/data_normalizer"
4
4
 
5
5
  module ChefZero
6
6
  module Endpoints
@@ -125,7 +125,7 @@ module ChefZero
125
125
  def rename_keys!(request, new_client_or_user_name)
126
126
  orig_keys_path = keys_path_base(request)
127
127
  new_keys_path = orig_keys_path.dup
128
- .tap { |path| path[-2] = new_client_or_user_name }
128
+ .tap { |path| path[-2] = new_client_or_user_name }
129
129
 
130
130
  key_names = list_data_or_else(request, orig_keys_path, nil)
131
131
  return unless key_names # No keys to move
@@ -1,4 +1,4 @@
1
- require "chef_zero/rest_base"
1
+ require_relative "../rest_base"
2
2
 
3
3
  module ChefZero
4
4
  module Endpoints
@@ -1,4 +1,4 @@
1
- require "chef_zero/rest_base"
1
+ require_relative "../rest_base"
2
2
 
3
3
  module ChefZero
4
4
  module Endpoints
@@ -50,7 +50,7 @@ module ChefZero
50
50
  response_body["private_key"] = private_key if generate_keys
51
51
 
52
52
  json_response(201, response_body,
53
- headers: { "Location" => response_body["uri"] })
53
+ headers: { "Location" => response_body["uri"] })
54
54
  end
55
55
 
56
56
  private
@@ -117,6 +117,7 @@ module ChefZero
117
117
 
118
118
  def actor_path(request)
119
119
  return request.rest_path[0..3] if client?(request)
120
+
120
121
  request.rest_path[0..1]
121
122
  end
122
123
 
@@ -1,5 +1,5 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/rest_list_endpoint"
2
+ require_relative "rest_list_endpoint"
3
3
 
4
4
  module ChefZero
5
5
  module Endpoints
@@ -1,5 +1,5 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/rest_base"
2
+ require_relative "../rest_base"
3
3
 
4
4
  module ChefZero
5
5
  module Endpoints
@@ -19,6 +19,7 @@ module ChefZero
19
19
  if user["password"] != password
20
20
  raise RestErrorResponse.new(401, "Bad username or password")
21
21
  end
22
+
22
23
  # Include only particular user data in the response
23
24
  user.keep_if { |key, value| %w{first_name last_name display_name email username}.include?(key) }
24
25
  json_response(200, {
@@ -1,6 +1,6 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/rest_object_endpoint"
3
- require "chef_zero/chef_data/data_normalizer"
2
+ require_relative "rest_object_endpoint"
3
+ require_relative "../chef_data/data_normalizer"
4
4
 
5
5
  module ChefZero
6
6
  module Endpoints
@@ -1,5 +1,5 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/rest_list_endpoint"
2
+ require_relative "rest_list_endpoint"
3
3
 
4
4
  module ChefZero
5
5
  module Endpoints
@@ -15,7 +15,7 @@ module ChefZero
15
15
  data = parse_json(request.body)
16
16
  # if they don't match, id wins.
17
17
  container_name = data["id"] || data["containername"]
18
- container_path_suffix = data["containerpath"].split("/").reject { |o| o.empty? }
18
+ container_path_suffix = data["containerpath"].split("/").reject(&:empty?)
19
19
  create_data(request, request.rest_path, container_name, to_json({}), :create_dir)
20
20
 
21
21
  json_response(201, { uri: build_uri(request.base_uri, request.rest_path + container_path_suffix + [container_name]) })
@@ -1,4 +1,4 @@
1
- require "chef_zero/dist"
1
+ require_relative "../dist"
2
2
  module ChefZero
3
3
  module Endpoints
4
4
  # /organizations/ORG/controls
@@ -1,4 +1,4 @@
1
- require "chef_zero/chef_data/data_normalizer"
1
+ require_relative "../chef_data/data_normalizer"
2
2
 
3
3
  module ChefZero
4
4
  module Endpoints
@@ -1,4 +1,4 @@
1
- require "chef_zero/chef_data/data_normalizer"
1
+ require_relative "../chef_data/data_normalizer"
2
2
 
3
3
  module ChefZero
4
4
  module Endpoints
@@ -60,8 +60,8 @@ module ChefZero
60
60
  def normalize(request, cookbook_artifact_data)
61
61
  cookbook = parse_json(cookbook_artifact_data)
62
62
  ChefData::DataNormalizer.normalize_cookbook(self, request.rest_path[0..1],
63
- cookbook, request.rest_path[3], request.rest_path[4],
64
- request.base_uri, request.method, true, api_version: request.api_version)
63
+ cookbook, request.rest_path[3], request.rest_path[4],
64
+ request.base_uri, request.method, true, api_version: request.api_version)
65
65
  end
66
66
  end
67
67
  end
@@ -1,4 +1,4 @@
1
- require "chef_zero/chef_data/data_normalizer"
1
+ require_relative "../chef_data/data_normalizer"
2
2
 
3
3
  module ChefZero
4
4
  module Endpoints
@@ -1,4 +1,4 @@
1
- require "chef_zero/endpoints/cookbooks_base"
1
+ require_relative "cookbooks_base"
2
2
 
3
3
  module ChefZero
4
4
  module Endpoints
@@ -1,8 +1,8 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/rest_object_endpoint"
3
- require "chef_zero/rest_error_response"
4
- require "chef_zero/chef_data/data_normalizer"
5
- require "chef_zero/data_store/data_not_found_error"
2
+ require_relative "rest_object_endpoint"
3
+ require_relative "../rest_error_response"
4
+ require_relative "../chef_data/data_normalizer"
5
+ require_relative "../data_store/data_not_found_error"
6
6
 
7
7
  module ChefZero
8
8
  module Endpoints
@@ -27,9 +27,10 @@ module ChefZero
27
27
  if request.query_params["force"] != "true"
28
28
  raise RestErrorResponse.new(409, "The cookbook #{name} at version #{version} is frozen. Use the 'force' option to override.")
29
29
  end
30
+
30
31
  # For some reason, you are forever unable to modify "frozen?" on a frozen cookbook.
31
32
  request_body = FFI_Yajl::Parser.parse(request.body)
32
- if !request_body["frozen?"]
33
+ unless request_body["frozen?"]
33
34
  request_body["frozen?"] = true
34
35
  request.body = FFI_Yajl::Encoder.encode(request_body, pretty: true)
35
36
  end
@@ -92,6 +93,7 @@ module ChefZero
92
93
  rescue ChefZero::DataStore::DataNotFoundError
93
94
  # Not all chef versions support cookbook_artifacts
94
95
  raise unless cookbook_type == "cookbook_artifacts"
96
+
95
97
  cookbooks = []
96
98
  end
97
99
  cookbooks.each do |cookbook_name|
@@ -1,6 +1,6 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/rest_base"
3
- require "chef_zero/chef_data/data_normalizer"
2
+ require_relative "../rest_base"
3
+ require_relative "../chef_data/data_normalizer"
4
4
 
5
5
  module ChefZero
6
6
  module Endpoints
@@ -54,6 +54,7 @@ module ChefZero
54
54
  versions = []
55
55
  cookbooks_list[name].sort_by { |version| Gem::Version.new(version.dup) }.reverse_each do |version|
56
56
  break if num_versions && versions.size >= num_versions
57
+
57
58
  if constraint.satisfied_by?(Gem::Version.new(version.dup))
58
59
  versions << version
59
60
  end
@@ -66,6 +67,7 @@ module ChefZero
66
67
  cookbook["all_files"].inject([]) do |acc, file|
67
68
  part, name = file["name"].split("/")
68
69
  next acc unless part == "recipes" || File.extname(name) != ".rb"
70
+
69
71
  if name == "default.rb"
70
72
  acc << cookbook_name
71
73
  else
@@ -1,4 +1,4 @@
1
- require "chef_zero/endpoints/cookbooks_base"
1
+ require_relative "cookbooks_base"
2
2
 
3
3
  module ChefZero
4
4
  module Endpoints
@@ -1,7 +1,7 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/rest_list_endpoint"
3
- require "chef_zero/endpoints/data_bag_item_endpoint"
4
- require "chef_zero/rest_error_response"
2
+ require_relative "rest_list_endpoint"
3
+ require_relative "data_bag_item_endpoint"
4
+ require_relative "../rest_error_response"
5
5
 
6
6
  module ChefZero
7
7
  module Endpoints
@@ -1,7 +1,7 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/rest_object_endpoint"
3
- require "chef_zero/endpoints/data_bag_item_endpoint"
4
- require "chef_zero/chef_data/data_normalizer"
2
+ require_relative "rest_object_endpoint"
3
+ require_relative "data_bag_item_endpoint"
4
+ require_relative "../chef_data/data_normalizer"
5
5
 
6
6
  module ChefZero
7
7
  module Endpoints
@@ -1,5 +1,5 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/rest_list_endpoint"
2
+ require_relative "rest_list_endpoint"
3
3
 
4
4
  module ChefZero
5
5
  module Endpoints
@@ -10,7 +10,7 @@ module ChefZero
10
10
  json = FFI_Yajl::Parser.parse(contents)
11
11
  name = identity_keys.map { |k| json[k] }.select { |v| v }.first
12
12
  if name.nil?
13
- error(400, "Must specify #{identity_keys.map { |k| k.inspect }.join(' or ')} in JSON")
13
+ error(400, "Must specify #{identity_keys.map(&:inspect).join(" or ")} in JSON")
14
14
  elsif exists_data_dir?(request, request.rest_path[0..1] + ["data", name])
15
15
  error(409, "Object already exists")
16
16
  else
@@ -1,5 +1,5 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/cookbooks_base"
2
+ require_relative "cookbooks_base"
3
3
 
4
4
  module ChefZero
5
5
  module Endpoints
@@ -1,6 +1,6 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/rest_base"
3
- require "chef_zero/rest_error_response"
2
+ require_relative "../rest_base"
3
+ require_relative "../rest_error_response"
4
4
 
5
5
  module ChefZero
6
6
  module Endpoints
@@ -15,12 +15,14 @@ module ChefZero
15
15
  run_list = FFI_Yajl::Parser.parse(request.body)["run_list"]
16
16
  run_list.each do |run_list_entry|
17
17
  if run_list_entry =~ /(.+)::.+\@(.+)/ || run_list_entry =~ /(.+)\@(.+)/
18
- raise RestErrorResponse.new(412, "No such cookbook: #{$1}") if !cookbook_names.include?($1)
19
- raise RestErrorResponse.new(412, "No such cookbook version for cookbook #{$1}: #{$2}") if !list_data(request, request.rest_path[0..1] + ["cookbooks", $1]).include?($2)
18
+ raise RestErrorResponse.new(412, "No such cookbook: #{$1}") unless cookbook_names.include?($1)
19
+ raise RestErrorResponse.new(412, "No such cookbook version for cookbook #{$1}: #{$2}") unless list_data(request, request.rest_path[0..1] + ["cookbooks", $1]).include?($2)
20
+
20
21
  desired_versions[$1] = [ $2 ]
21
22
  else
22
23
  desired_cookbook = run_list_entry.split("::")[0]
23
- raise RestErrorResponse.new(412, "No such cookbook: #{desired_cookbook}") if !cookbook_names.include?(desired_cookbook)
24
+ raise RestErrorResponse.new(412, "No such cookbook: #{desired_cookbook}") unless cookbook_names.include?(desired_cookbook)
25
+
24
26
  desired_versions[desired_cookbook] = list_data(request, request.rest_path[0..1] + ["cookbooks", desired_cookbook])
25
27
  end
26
28
  end
@@ -35,7 +37,7 @@ module ChefZero
35
37
 
36
38
  # Depsolve!
37
39
  solved = depsolve(request, desired_versions.keys, desired_versions, environment_constraints)
38
- if !solved
40
+ unless solved
39
41
  if @last_missing_dep && !cookbook_names.include?(@last_missing_dep)
40
42
  return raise RestErrorResponse.new(412, "No such cookbook: #{@last_missing_dep}")
41
43
  elsif @last_constraint_failure
@@ -64,7 +66,7 @@ module ChefZero
64
66
 
65
67
  # If everything is already
66
68
  solve_for = unsolved[0]
67
- return desired_versions if !solve_for
69
+ return desired_versions unless solve_for
68
70
 
69
71
  # Go through each desired version of this cookbook, starting with the latest,
70
72
  # until we find one we can solve successfully with
@@ -81,10 +83,10 @@ module ChefZero
81
83
  cookbook_dependencies.each_pair do |dep_name, dep_constraint|
82
84
  # If the dep is not already in the list, add it to the list to solve
83
85
  # and bring in all environment-allowed cookbook versions to desired_versions
84
- if !new_desired_versions.key?(dep_name)
86
+ unless new_desired_versions.key?(dep_name)
85
87
  new_unsolved += [dep_name]
86
88
  # If the dep is missing, we will try other versions of the cookbook that might not have the bad dep.
87
- if !exists_data_dir?(request, request.rest_path[0..1] + ["cookbooks", dep_name])
89
+ unless exists_data_dir?(request, request.rest_path[0..1] + ["cookbooks", dep_name])
88
90
  @last_missing_dep = dep_name.to_s
89
91
  dep_not_found = true
90
92
  break
@@ -110,7 +112,8 @@ module ChefZero
110
112
  end
111
113
 
112
114
  def filter_by_constraint(versions, cookbook_name, constraint)
113
- return versions if !constraint
115
+ return versions unless constraint
116
+
114
117
  constraint = Gem::Requirement.new(constraint)
115
118
  new_versions = versions[cookbook_name]
116
119
  new_versions = new_versions.select { |version| constraint.satisfied_by?(Gem::Version.new(version.dup)) }
@@ -1,5 +1,5 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/cookbooks_base"
2
+ require_relative "cookbooks_base"
3
3
 
4
4
  module ChefZero
5
5
  module Endpoints
@@ -1,6 +1,6 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/rest_object_endpoint"
3
- require "chef_zero/chef_data/data_normalizer"
2
+ require_relative "rest_object_endpoint"
3
+ require_relative "../chef_data/data_normalizer"
4
4
 
5
5
  module ChefZero
6
6
  module Endpoints
@@ -1,5 +1,5 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/rest_base"
2
+ require_relative "../rest_base"
3
3
 
4
4
  module ChefZero
5
5
  module Endpoints
@@ -1,5 +1,5 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/cookbooks_base"
2
+ require_relative "cookbooks_base"
3
3
 
4
4
  module ChefZero
5
5
  module Endpoints
@@ -1,5 +1,5 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/cookbooks_base"
2
+ require_relative "cookbooks_base"
3
3
 
4
4
  module ChefZero
5
5
  module Endpoints
@@ -1,4 +1,4 @@
1
- require "chef_zero/rest_base"
1
+ require_relative "../rest_base"
2
2
 
3
3
  module ChefZero
4
4
  module Endpoints
@@ -1,6 +1,6 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/rest_object_endpoint"
3
- require "chef_zero/chef_data/data_normalizer"
2
+ require_relative "rest_object_endpoint"
3
+ require_relative "../chef_data/data_normalizer"
4
4
 
5
5
  module ChefZero
6
6
  module Endpoints
@@ -1,5 +1,5 @@
1
1
  require "ffi_yajl"
2
- require "chef_zero/endpoints/rest_list_endpoint"
2
+ require_relative "rest_list_endpoint"
3
3
 
4
4
  module ChefZero
5
5
  module Endpoints