diff --git a/Gemfile b/Gemfile index 350b2907..0b760f98 100644 --- a/Gemfile +++ b/Gemfile @@ -27,6 +27,11 @@ platforms :ruby do gem "redcarpet" end +# Cross-templating language block fix for Ruby 1.8 +platforms :ruby_18 do + gem "ruby18_source_location" +end + platforms :jruby do gem "therubyrhino" end diff --git a/middleman-core/lib/middleman-core/templates/empty/Gemfile.tt b/middleman-core/lib/middleman-core/templates/empty/Gemfile.tt index 463687c3..d0356896 100644 --- a/middleman-core/lib/middleman-core/templates/empty/Gemfile.tt +++ b/middleman-core/lib/middleman-core/templates/empty/Gemfile.tt @@ -1,3 +1,8 @@ source 'https://rubygems.org' gem "middleman", "~><%= Middleman::VERSION %>" + +# Cross-templating language block fix for Ruby 1.8 +platforms :ruby_18 do + gem "ruby18_source_location" +end \ No newline at end of file diff --git a/middleman-core/lib/middleman-core/templates/shared/Gemfile.tt b/middleman-core/lib/middleman-core/templates/shared/Gemfile.tt index 845770ed..e4284101 100644 --- a/middleman-core/lib/middleman-core/templates/shared/Gemfile.tt +++ b/middleman-core/lib/middleman-core/templates/shared/Gemfile.tt @@ -8,4 +8,9 @@ gem "middleman", "~><%= Middleman::VERSION %>" gem "middleman-livereload", "~> 3.1.0" # For faster file watcher updates: -# gem "wdm", "~> 0.1.0") # Windows \ No newline at end of file +# gem "wdm", "~> 0.1.0") # Windows + +# Cross-templating language block fix for Ruby 1.8 +platforms :ruby_18 do + gem "ruby18_source_location" +end \ No newline at end of file diff --git a/middleman-core/lib/middleman-more/core_extensions/default_helpers.rb b/middleman-core/lib/middleman-more/core_extensions/default_helpers.rb index f38c1dc7..737a7ddb 100644 --- a/middleman-core/lib/middleman-more/core_extensions/default_helpers.rb +++ b/middleman-core/lib/middleman-more/core_extensions/default_helpers.rb @@ -1,3 +1,13 @@ +# Required to hack around Padrino blocks within different template types. +if RUBY_VERSION < "1.9.0" + begin + require 'ruby18_source_location' + rescue LoadError + $stderr.puts "Ruby 1.8 requires the 'ruby18_source_location' gem be added to your Gemfile" + exit(1) + end +end + if !defined?(::Padrino::Helpers) require 'vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/support_lite' require 'vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers'