diff options
-rw-r--r-- | lib/chef/mixin/template.rb | 16 | ||||
-rw-r--r-- | spec/functional/file_content_management/deploy_strategies_spec.rb | 11 |
2 files changed, 3 insertions, 24 deletions
diff --git a/lib/chef/mixin/template.rb b/lib/chef/mixin/template.rb index ae23336581..d705a9e7be 100644 --- a/lib/chef/mixin/template.rb +++ b/lib/chef/mixin/template.rb @@ -23,18 +23,6 @@ class Chef module Mixin module Template - # A compatibility wrapper around IO.binread so it works on Ruby 1.8.7. - # -- - # Used in the TemplateContext class, but that method namespace is shared - # with user code, so we want to avoid adding methods there when possible. - def self.binread(file) - if IO.respond_to?(:binread) - IO.binread(file) - else - File.open(file, "rb") {|f| f.read } - end - end - # == ChefContext # ChefContext was previously used to mix behavior into Erubis::Context so # that it would be available to templates. This behavior has now moved to @@ -105,11 +93,11 @@ class Chef partial_context._extend_modules(@_extension_modules) template_location = @template_finder.find(partial_name, options) - _render_template(Mixin::Template.binread(template_location), partial_context) + _render_template(IO.binread(template_location), partial_context) end def render_template(template_location) - _render_template(Mixin::Template.binread(template_location), self) + _render_template(IO.binread(template_location), self) end def render_template_from_string(template) diff --git a/spec/functional/file_content_management/deploy_strategies_spec.rb b/spec/functional/file_content_management/deploy_strategies_spec.rb index bcd171eb73..03a6c504c1 100644 --- a/spec/functional/file_content_management/deploy_strategies_spec.rb +++ b/spec/functional/file_content_management/deploy_strategies_spec.rb @@ -20,15 +20,6 @@ require 'spec_helper' shared_examples_for "a content deploy strategy" do - # Ruby 1.8 has no binread - def binread(file) - if IO.respond_to?(:binread) - IO.binread(file) - else - IO.read(file) - end - end - def normalize_mode(mode_int) ( mode_int & 07777).to_s(8) end @@ -160,7 +151,7 @@ shared_examples_for "a content deploy strategy" do it "updates the target with content from staged" do content_deployer.deploy(staging_file_path, target_file_path) - expect(binread(target_file_path)).to eq(staging_file_content) + expect(IO.binread(target_file_path)).to eq(staging_file_content) end context "when the owner of the target file is not the owner of the staging file", :requires_root do |