knife-essentials 0.8.5 → 0.8.6

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.
@@ -1,5 +1,6 @@
1
1
  require 'chef_fs/knife'
2
2
  require 'chef_fs/file_system'
3
+ require 'highline'
3
4
 
4
5
  class Chef
5
6
  class Knife
@@ -117,8 +118,7 @@ class Chef
117
118
  if config[:one_column] || !stdout.isatty
118
119
  columns = 0
119
120
  else
120
- # TODO: tput cols is not cross platform
121
- columns = Integer(`tput cols`)
121
+ columns = HighLine::SystemExtensions.terminal_size[0]
122
122
  end
123
123
  current_line = ''
124
124
  results.each do |result|
data/lib/chef_fs.rb CHANGED
@@ -1,9 +1,7 @@
1
- require 'chef_fs/file_system/chef_server_root_dir'
2
- require 'chef/config'
3
- require 'chef/rest'
1
+ require 'chef/platform'
4
2
 
5
3
  module ChefFS
6
4
  def self.windows?
7
- false
5
+ Chef::Platform.windows?
8
6
  end
9
7
  end
@@ -27,6 +27,7 @@ module ChefFS
27
27
  begin
28
28
  @chefignore = Chef::Cookbook::Chefignore.new(self.file_path)
29
29
  rescue Errno::EISDIR
30
+ rescue Errno::EACCES
30
31
  # Work around a bug in Chefignore when chefignore is a directory
31
32
  end
32
33
  end
@@ -22,6 +22,7 @@ require 'chef_fs/file_system/cookbooks_dir'
22
22
  require 'chef_fs/file_system/data_bags_dir'
23
23
  require 'chef_fs/file_system/nodes_dir'
24
24
  require 'chef_fs/file_system/environments_dir'
25
+ require 'chef/rest'
25
26
 
26
27
  module ChefFS
27
28
  module FileSystem
@@ -56,7 +56,7 @@ module ChefFS
56
56
  end
57
57
 
58
58
  def self.regexp_path_separator
59
- ChefFS::windows? ? '[/\\]' : '/'
59
+ ChefFS::windows? ? '[\/\\\\]' : '/'
60
60
  end
61
61
 
62
62
  # Given a path which may only be partly real (i.e. /x/y/z when only /x exists,
@@ -1,4 +1,4 @@
1
1
  module ChefFS
2
- VERSION = "0.8.5"
2
+ VERSION = "0.8.6"
3
3
  end
4
4
 
@@ -157,7 +157,7 @@ describe ChefFS::FilePattern do
157
157
  end
158
158
  end
159
159
 
160
- context 'with simple pattern "a\*\b"' do
160
+ context 'with simple pattern "a\*\b"', :pending => (Chef::Platform.windows?) do
161
161
  let(:pattern) { ChefFS::FilePattern.new('a\*\b') }
162
162
  it 'match?' do
163
163
  pattern.match?('a*b').should be_true
@@ -264,7 +264,7 @@ describe ChefFS::FilePattern do
264
264
  end
265
265
  end
266
266
 
267
- context 'with star pattern "/abc/d[a-z][0-9]f/ghi"' do
267
+ context 'with star pattern "/abc/d[a-z][0-9]f/ghi"', :pending => (Chef::Platform.windows?) do
268
268
  let(:pattern) { ChefFS::FilePattern.new('/abc/d[a-z][0-9]f/ghi') }
269
269
  it 'match?' do
270
270
  pattern.match?('/abc/de1f/ghi').should be_true
@@ -565,6 +565,7 @@ describe ChefFS::FileSystem::CookbooksDir do
565
565
  nonexistent_child.dir?.should be_false
566
566
  end
567
567
  it 'read returns NotFoundError' do
568
+ should_list_cookbooks
568
569
  expect { nonexistent_child.read }.to raise_error(ChefFS::FileSystem::NotFoundError)
569
570
  end
570
571
  end
@@ -344,7 +344,7 @@ EOM
344
344
  end
345
345
  end
346
346
 
347
- when_the_repository 'has a cookbooks directory and a symlinked cookbooks directory' do
347
+ when_the_repository 'has a cookbooks directory and a symlinked cookbooks directory', :pending => (Chef::Platform.windows?) do
348
348
  directory 'cookbooks'
349
349
  symlink 'symlinked', 'cookbooks'
350
350
 
@@ -379,7 +379,7 @@ EOM
379
379
  end
380
380
  end
381
381
 
382
- when_the_repository 'has a real_cookbooks directory and a cookbooks symlink to it' do
382
+ when_the_repository 'has a real_cookbooks directory and a cookbooks symlink to it', :pending => (Chef::Platform.windows?) do
383
383
  directory 'real_cookbooks'
384
384
  symlink 'cookbooks', 'real_cookbooks'
385
385
 
@@ -105,11 +105,16 @@ module KnifeSupport
105
105
  else
106
106
  stderr_actual.should == expected[:stderr]
107
107
  end
108
+ stdout_actual = @stdout
109
+ if Chef::Platform.windows?
110
+ stderr_actual = stderr_actual.gsub("\r\n", "\n")
111
+ stdout_actual = stdout_actual.gsub("\r\n", "\n")
112
+ end
108
113
  @exit_code.should == expected[:exit_code]
109
114
  if expected[:stdout].is_a?(Regexp)
110
- @stdout.should =~ expected[:stdout]
115
+ stdout_actual.should =~ expected[:stdout]
111
116
  else
112
- @stdout.should == expected[:stdout]
117
+ stdout_actual.should == expected[:stdout]
113
118
  end
114
119
  end
115
120
  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.5
4
+ version: 0.8.6
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-18 00:00:00.000000000 Z
12
+ date: 2013-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef-zero