lib/tdiary/environment.rb in tdiary-5.0.1 vs lib/tdiary/environment.rb in tdiary-5.0.2

- old
+ new

@@ -15,5 +15,21 @@ env << :development if ENV['RACK_ENV'].nil? || ENV['RACK_ENV'].empty? env << ENV['RACK_ENV'].intern if ENV['RACK_ENV'] env = env.reject{|e| Bundler.settings.without.include? e } Bundler.require *env end + +# Bundler.require doesn't load gems specified in .gemspec +# see: https://github.com/bundler/bundler/issues/1041 +# +# load gems dependented by tdiary +tdiary_spec = Bundler.definition.specs.find {|spec| spec.name == 'tdiary'} +if tdiary_spec + tdiary_spec.dependent_specs.each {|dep_spec| + begin + require dep_spec.name + rescue LoadError => e + STDERR.puts "failed require '#{dep_spec.name}'" + STDERR.puts e + end + } +end