diff --git a/gemfiles/sprockets_4_0.gemfile b/gemfiles/sprockets_4_0.gemfile index 6804884..14ff116 100644 --- a/gemfiles/sprockets_4_0.gemfile +++ b/gemfiles/sprockets_4_0.gemfile @@ -1,14 +1,16 @@ +# frozen_string_literal: true + # This file was generated by Appraisal -source "http://rubygems.org" +source 'http://rubygems.org' -gem "appraisal" -gem "haml", "~> 6.3" -gem "slim", "~> 5.2" -gem "minitest", "~> 5.25" -gem "rake", "~> 13.2" -gem "rubocop", require: false -gem "rubocop-rake", require: false -gem "sprockets", "4.0.3" +gem 'appraisal' +gem 'haml', '~> 6.3' +gem 'minitest', '~> 5.25' +gem 'rake', '~> 13.2' +gem 'rubocop', require: false +gem 'rubocop-rake', require: false +gem 'slim', '~> 5.2' +gem 'sprockets', '4.0.3' -gemspec path: "../" +gemspec path: '../' diff --git a/gemfiles/sprockets_4_1.gemfile b/gemfiles/sprockets_4_1.gemfile index bb895b8..68d899b 100644 --- a/gemfiles/sprockets_4_1.gemfile +++ b/gemfiles/sprockets_4_1.gemfile @@ -1,14 +1,16 @@ +# frozen_string_literal: true + # This file was generated by Appraisal -source "http://rubygems.org" +source 'http://rubygems.org' -gem "appraisal" -gem "haml", "~> 6.3" -gem "slim", "~> 5.2" -gem "minitest", "~> 5.25" -gem "rake", "~> 13.2" -gem "rubocop", require: false -gem "rubocop-rake", require: false -gem "sprockets", "4.1.1" +gem 'appraisal' +gem 'haml', '~> 6.3' +gem 'minitest', '~> 5.25' +gem 'rake', '~> 13.2' +gem 'rubocop', require: false +gem 'rubocop-rake', require: false +gem 'slim', '~> 5.2' +gem 'sprockets', '4.1.1' -gemspec path: "../" +gemspec path: '../' diff --git a/gemfiles/sprockets_4_2.gemfile b/gemfiles/sprockets_4_2.gemfile index 266bbeb..f5c6f75 100644 --- a/gemfiles/sprockets_4_2.gemfile +++ b/gemfiles/sprockets_4_2.gemfile @@ -1,14 +1,16 @@ +# frozen_string_literal: true + # This file was generated by Appraisal -source "http://rubygems.org" +source 'http://rubygems.org' -gem "appraisal" -gem "haml", "~> 6.3" -gem "slim", "~> 5.2" -gem "minitest", "~> 5.25" -gem "rake", "~> 13.2" -gem "rubocop", require: false -gem "rubocop-rake", require: false -gem "sprockets", "4.2.1" +gem 'appraisal' +gem 'haml', '~> 6.3' +gem 'minitest', '~> 5.25' +gem 'rake', '~> 13.2' +gem 'rubocop', require: false +gem 'rubocop-rake', require: false +gem 'slim', '~> 5.2' +gem 'sprockets', '4.2.1' -gemspec path: "../" +gemspec path: '../' diff --git a/lib/handlebars_assets/handlebars_template.rb b/lib/handlebars_assets/handlebars_template.rb index b79953b..40274fb 100644 --- a/lib/handlebars_assets/handlebars_template.rb +++ b/lib/handlebars_assets/handlebars_template.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'English' require 'json' module HandlebarsAssets @@ -88,17 +89,16 @@ def choose_engine(data) def compile(source) # remove trailing \n on file, for some reason the directives pipeline adds this - trim_source = source.chomp($/) + trim_source = source.chomp($INPUT_RECORD_SEPARATOR) # handle the case of multiple frameworks combined with ember # DEFER: use extension setup for ember - data = - if (HandlebarsAssets::Config.multiple_frameworks? && @template_path.ember?) || - (HandlebarsAssets::Config.ember? && !HandlebarsAssets::Config.multiple_frameworks?) - compile_ember(trim_source) - else - compile_default(trim_source) - end + if (HandlebarsAssets::Config.multiple_frameworks? && @template_path.ember?) || + (HandlebarsAssets::Config.ember? && !HandlebarsAssets::Config.multiple_frameworks?) + compile_ember(trim_source) + else + compile_default(trim_source) + end end def compile_ember(source) diff --git a/test/test_helper.rb b/test/test_helper.rb index 9a39668..596b6a9 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -25,7 +25,7 @@ module CompilerSupport def compile_hbs(source) compiler_src = Pathname(HandlebarsAssets::Config.compiler_path).join(HandlebarsAssets::Config.compiler).read - ExecJS.compile("#{compiler_src}").call('Handlebars.precompile', source, HandlebarsAssets::Config.options) + ExecJS.compile(compiler_src.to_s).call('Handlebars.precompile', source, HandlebarsAssets::Config.options) end def hbs_compiled(template_name, source)