knife-essentials 0.8.3 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. data/lib/chef/knife/diff_essentials.rb +2 -2
  2. data/lib/chef/knife/download_essentials.rb +5 -1
  3. data/lib/chef/knife/list_essentials.rb +2 -1
  4. data/lib/chef/knife/upload_essentials.rb +5 -1
  5. data/lib/chef_fs/command_line.rb +94 -63
  6. data/lib/chef_fs/file_system.rb +113 -93
  7. data/lib/chef_fs/file_system/base_fs_object.rb +91 -37
  8. data/lib/chef_fs/file_system/chef_repository_file_system_cookbooks_dir.rb +14 -1
  9. data/lib/chef_fs/file_system/chef_server_root_dir.rb +2 -1
  10. data/lib/chef_fs/file_system/cookbook_file.rb +7 -1
  11. data/lib/chef_fs/file_system/cookbooks_dir.rb +13 -6
  12. data/lib/chef_fs/file_system/environments_dir.rb +59 -0
  13. data/lib/chef_fs/file_system/multiplexed_dir.rb +1 -1
  14. data/lib/chef_fs/file_system/nodes_dir.rb +1 -0
  15. data/lib/chef_fs/file_system/operation_not_allowed_error.rb +29 -0
  16. data/lib/chef_fs/file_system/operation_skipped_error.rb +29 -0
  17. data/lib/chef_fs/knife.rb +29 -21
  18. data/lib/chef_fs/version.rb +1 -1
  19. data/spec/chef_fs/diff_spec.rb +30 -30
  20. data/spec/chef_fs/file_system/cookbooks_dir_spec.rb +5 -1
  21. data/spec/integration/chef_repo_path_spec.rb +705 -0
  22. data/spec/integration/chef_repository_file_system_spec.rb +82 -713
  23. data/spec/integration/chefignore_spec.rb +258 -0
  24. data/spec/integration/diff_spec.rb +151 -0
  25. data/spec/integration/download_spec.rb +403 -0
  26. data/spec/integration/list_spec.rb +21 -21
  27. data/spec/integration/upload_spec.rb +407 -0
  28. data/spec/support/integration_helper.rb +9 -4
  29. data/spec/support/knife_support.rb +14 -2
  30. metadata +12 -3
@@ -33,20 +33,25 @@ module IntegrationSupport
33
33
  raise "Can only create one directory per test" if @repository_dir
34
34
  @repository_dir = Dir.mktmpdir('chef_repo')
35
35
  @old_chef_repo_path = Chef::Config.chef_repo_path
36
- @old_cookbook_path = Chef::Config.cookbook_path
36
+ @old_paths = {}
37
37
  Chef::Config.chef_repo_path = @repository_dir
38
- Chef::Config.cookbook_path = File.join(@repository_dir, 'cookbooks')
38
+ %w(client cookbook data_bag environment node role user).each do |object_name|
39
+ @old_paths[object_name] = Chef::Config["#{object_name}_path".to_sym]
40
+ Chef::Config["#{object_name}_path".to_sym] = nil
41
+ end
39
42
  end
40
43
 
41
44
  after :each do
42
45
  if @repository_dir
43
46
  begin
47
+ %w(client cookbook data_bag environment node role user).each do |object_name|
48
+ Chef::Config["#{object_name}_path".to_sym] = @old_paths[object_name]
49
+ end
44
50
  Chef::Config.chef_repo_path = @old_chef_repo_path
45
- Chef::Config.cookbook_path = @old_cookbook_path
46
51
  FileUtils.remove_entry_secure(@repository_dir)
47
52
  ensure
48
53
  @old_chef_repo_path = nil
49
- @old_cookbook_path = nil
54
+ @old_paths = nil
50
55
  @repository_dir = nil
51
56
  end
52
57
  end
@@ -60,6 +60,10 @@ module KnifeSupport
60
60
  @exit_code = exit_code
61
61
  end
62
62
 
63
+ attr_reader :stdout
64
+ attr_reader :stderr
65
+ attr_reader :exit_code
66
+
63
67
  def should_fail(*args)
64
68
  expected = {}
65
69
  args.each do |arg|
@@ -96,9 +100,17 @@ module KnifeSupport
96
100
  # TODO make this go away
97
101
  stderr_actual = @stderr.sub(/^WARNING: No knife configuration file found\n/, '')
98
102
 
99
- @stdout.should == expected[:stdout]
100
- stderr_actual.should == expected[:stderr]
103
+ if expected[:stderr].is_a?(Regexp)
104
+ stderr_actual.should =~ expected[:stderr]
105
+ else
106
+ stderr_actual.should == expected[:stderr]
107
+ end
101
108
  @exit_code.should == expected[:exit_code]
109
+ if expected[:stdout].is_a?(Regexp)
110
+ @stdout.should =~ expected[:stdout]
111
+ else
112
+ @stdout.should == expected[:stdout]
113
+ end
102
114
  end
103
115
  end
104
116
  end
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.8.3
4
+ version: 0.8.4
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: 2013-01-05 00:00:00.000000000 Z
12
+ date: 2013-01-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef-zero
@@ -61,6 +61,7 @@ files:
61
61
  - lib/chef_fs/file_system/data_bag_dir.rb
62
62
  - lib/chef_fs/file_system/data_bag_item.rb
63
63
  - lib/chef_fs/file_system/data_bags_dir.rb
64
+ - lib/chef_fs/file_system/environments_dir.rb
64
65
  - lib/chef_fs/file_system/file_system_entry.rb
65
66
  - lib/chef_fs/file_system/file_system_error.rb
66
67
  - lib/chef_fs/file_system/file_system_root_dir.rb
@@ -69,6 +70,8 @@ files:
69
70
  - lib/chef_fs/file_system/nodes_dir.rb
70
71
  - lib/chef_fs/file_system/nonexistent_fs_object.rb
71
72
  - lib/chef_fs/file_system/not_found_error.rb
73
+ - lib/chef_fs/file_system/operation_not_allowed_error.rb
74
+ - lib/chef_fs/file_system/operation_skipped_error.rb
72
75
  - lib/chef_fs/file_system/rest_list_dir.rb
73
76
  - lib/chef_fs/file_system/rest_list_entry.rb
74
77
  - lib/chef_fs/file_system.rb
@@ -82,16 +85,22 @@ files:
82
85
  - spec/chef_fs/file_system/cookbooks_dir_spec.rb
83
86
  - spec/chef_fs/file_system/data_bags_dir_spec.rb
84
87
  - spec/chef_fs/file_system_spec.rb
88
+ - spec/integration/chef_repo_path_spec.rb
85
89
  - spec/integration/chef_repository_file_system_spec.rb
90
+ - spec/integration/chefignore_spec.rb
86
91
  - spec/integration/deps_spec.rb
92
+ - spec/integration/diff_spec.rb
93
+ - spec/integration/download_spec.rb
87
94
  - spec/integration/list_spec.rb
95
+ - spec/integration/upload_spec.rb
88
96
  - spec/support/file_system_support.rb
89
97
  - spec/support/integration_helper.rb
90
98
  - spec/support/knife_support.rb
91
99
  - spec/support/spec_helper.rb
92
100
  - spec/support/stickywicket.pem
93
101
  homepage: http://www.opscode.com
94
- licenses: []
102
+ licenses:
103
+ - Apache 2.0
95
104
  post_install_message:
96
105
  rdoc_options: []
97
106
  require_paths: