knife-essentials 0.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/chef_fs/diff.rb CHANGED
@@ -59,8 +59,8 @@ module ChefFS
59
59
  def self.context_aware_diff(old_file, new_file, old_value, new_value)
60
60
  # TODO handle errors in reading JSON
61
61
  if old_file.content_type == :json || new_file.content_type == :json
62
- new_value = Chef::JSONCompat.from_json(new_value)
63
- old_value = Chef::JSONCompat.from_json(old_value)
62
+ new_value = Chef::JSONCompat.from_json(new_value).to_hash
63
+ old_value = Chef::JSONCompat.from_json(old_value).to_hash
64
64
 
65
65
  old_value != new_value
66
66
  else
@@ -16,7 +16,7 @@ module ChefFS
16
16
 
17
17
  def child(name)
18
18
  result = @children.select { |child| child.name == name }.first if @children
19
- result || RestListEntry.new(name, self)
19
+ result ||= can_have_child?(name, false) ? RestListEntry.new(name, self) : NonexistentFSObject.new(name, self)
20
20
  end
21
21
 
22
22
  def can_have_child?(name, is_dir)
@@ -14,8 +14,8 @@ module ChefFS
14
14
  end
15
15
 
16
16
  def api_path
17
- if name.length < 5 && name[-5,5] != ".json"
18
- raise "Invalid name #{name}: must include .json"
17
+ if name.length < 5 || name[-5,5] != ".json"
18
+ raise "Invalid name #{path}: must end in .json"
19
19
  end
20
20
  api_child_name = name[0,name.length-5]
21
21
  environment ? "#{parent.api_path}/#{api_child_name}/environments/#{environment}" : "#{parent.api_path}/#{api_child_name}"
@@ -1,4 +1,4 @@
1
1
  module ChefFS
2
- VERSION = "0.2"
2
+ VERSION = "0.2.1"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-essentials
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-28 00:00:00.000000000Z
12
+ date: 2012-04-29 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Universal knife verbs that work with your Chef repository
15
15
  email: jkeiser@opscode.com