(v11) fix -g GEMFILE option

 bin/fluentd -g MyGemfile

    /home/seo.naotoshi/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/ui.rb:36:in `initialize': undefined method `[]' for #<Fluentd::BundlerInjection::UIShell:0x002b5264302190> (NoMethodError)
        from /home/seo.naotoshi/gitrepos/fluentd_v11/lib/fluentd/bundler_injection.rb:33:in `new'
        from /home/seo.naotoshi/gitrepos/fluentd_v11/lib/fluentd/bundler_injection.rb:33:in `install'
        from /home/seo.naotoshi/gitrepos/fluentd_v11/lib/fluentd/command/fluentd.rb:162:in `<top (required)>'
        from /home/seo.naotoshi/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /home/seo.naotoshi/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from bin/fluentd:5:in `<main>'

where https://github.com/bundler/bundler/blob/v1.3.5/lib/bundler/ui.rb#L36. The modification of `lib/fluentd/bundler_injection.rb` is to fix the above error.  This error was caused because Bundler changed its internal method interface on v1.3.0. 

* v1.2.5 https://github.com/bundler/bundler/blob/v1.2.5/lib/bundler/ui.rb#L28
* v1.3.0 https://github.com/bundler/bundler/blob/v1.3.0/lib/bundler/ui.rb#L34
* at https://github.com/bundler/bundler/commit/d5e8d58999b450ec289b1231610674c2dac70e21#lib/bundler/ui.rb

Next, I met with another error. 
bin/fluentd -g MyGemfile

    /home/seo.naotoshi/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/vendor/thor/actions/create_file.rb:33:in `<module:Actions>': uninitialized constant Thor::Actions::EmptyDirectory (NameError)
            from /home/seo.naotoshi/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/vendor/thor/actions/create_file.rb:4:in `<class:Thor>'
            from /home/seo.naotoshi/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/vendor/thor/actions/create_file.rb:3:in `<top (required)>'
            from /home/seo.naotoshi/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/vendor/thor/actions.rb:4:in `require'
            from /home/seo.naotoshi/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/vendor/thor/actions.rb:4:in `<top (required)>'
            from /home/seo.naotoshi/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/vendor/thor/actions/empty_directory.rb:2:in `<class:Thor>'
            from /home/seo.naotoshi/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/vendor/thor/actions/empty_directory.rb:1:in `<top (required)>'
            from /home/seo.naotoshi/gitrepos/fluentd_v11/lib/fluentd/worker_launcher.rb:177:in `require'
            from /home/seo.naotoshi/gitrepos/fluentd_v11/lib/fluentd/worker_launcher.rb:177:in `block in restore!'
            from /home/seo.naotoshi/gitrepos/fluentd_v11/lib/fluentd/worker_launcher.rb:176:in `each'
            from /home/seo.naotoshi/gitrepos/fluentd_v11/lib/fluentd/worker_launcher.rb:176:in `restore!'
            from /home/seo.naotoshi/gitrepos/fluentd_v11/lib/fluentd/worker_launcher.rb:188:in `restore'
            from /home/seo.naotoshi/gitrepos/fluentd_v11/lib/fluentd/worker_launcher.rb:73:in `main'
            from /home/seo.naotoshi/gitrepos/fluentd_v11/lib/fluentd/command/fluentd-worker.rb:19:in `<main>'

Seeing values of @loaded_features at `lib/fluentd/worker_launcher.rb`, it seems that this error was caused by order of `require`. By adding `sort`, this problem was fixed. 

FINAL THOUGHT: 

However, I feel that `-g GEMFILE` functionality is very *fragile* because it can easily be broken by the change of Bundler's internal interface like this. I also think as `require`ing in alphabetical order does not always assure that the order is correct. 

It would be better to re-consider to adopt this feature. Dropping the position of this feature as an experimental feature would be required until we find a great solution.