File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,21 +36,21 @@ def remove_ignores_from(file_list)
3636 end
3737
3838 def ignored? ( file_name )
39- @ignores . any? { |regex | regex =~ file_name }
39+ @ignores . any? { |glob | File . fnmatch? ( glob , file_name ) }
4040 end
4141
4242 private
4343
4444 def parse_ignore_file
45- ignore_regexes = [ ]
45+ ignore_globs = [ ]
4646 if File . exist? ( @ignore_file ) && File . readable? ( @ignore_file )
4747 File . foreach ( @ignore_file ) do |line |
48- ignore_regexes << Regexp . new ( line . strip ) unless line =~ COMMENTS_AND_WHITESPACE
48+ ignore_globs << line . strip unless line =~ COMMENTS_AND_WHITESPACE
4949 end
5050 else
5151 Chef ::Log . debug ( "No chefignore file found at #@ignore_file no files will be ignored" )
5252 end
53- ignore_regexes
53+ ignore_globs
5454 end
5555
5656 def find_ignore_file ( path )
Original file line number Diff line number Diff line change @@ -114,15 +114,14 @@ def render_template(template=nil)
114114
115115 def run
116116 require 'highline'
117+ require 'net/ssh'
117118
118119 validate_name_args!
119120
120121 $stdout. sync = true
121122
122123 Chef ::Log . info ( "Bootstrapping Chef on #{ h . color ( config [ :server_name ] , :bold ) } " )
123124
124- knife_ssh . load_late_dependencies
125-
126125 begin
127126 knife_ssh . run
128127 rescue Net ::SSH ::AuthenticationFailed
Original file line number Diff line number Diff line change 33# later in the search path.
44#
55
6- recipes/ignoreme\ .rb
6+ recipes/ignoreme.rb
Original file line number Diff line number Diff line change 2222 @chefignore = Chef ::Cookbook ::Chefignore . new ( File . join ( CHEF_SPEC_DATA , 'cookbooks' ) )
2323 end
2424
25- it "loads the regular expressions in the chefignore file" do
26- @chefignore . ignores . should =~ [ %r{ recipes/ignoreme\ . rb} ]
25+ it "loads the globs in the chefignore file" do
26+ @chefignore . ignores . should =~ %w[ recipes/ignoreme.rb ]
2727 end
2828
2929 it "removes items from an array that match the ignores" do
30- file_list = %w[ / recipes/ignoreme.rb / recipes/dontignoreme.rb ]
31- @chefignore . remove_ignores_from ( file_list ) . should == %w[ / recipes/dontignoreme.rb]
30+ file_list = %w[ recipes/ignoreme.rb recipes/dontignoreme.rb ]
31+ @chefignore . remove_ignores_from ( file_list ) . should == %w[ recipes/dontignoreme.rb ]
3232 end
3333
3434 it "determines if a file is ignored" do
You can’t perform that action at this time.
0 commit comments