Class: Fluent::Format::BundlerInjection
- Inherits:
-
Object
- Object
- Fluent::Format::BundlerInjection
- Defined in:
- lib/fluent/format/check.rb
Instance Method Summary collapse
- #bundler_injection ⇒ Object
-
#initialize(opts = {}) ⇒ BundlerInjection
constructor
A new instance of BundlerInjection.
- #run ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ BundlerInjection
Returns a new instance of BundlerInjection.
56 57 58 59 60 61 |
# File 'lib/fluent/format/check.rb', line 56 def initialize(opts = {}) @opts = { :gemfile => opts[:gemfile], :gem_install_path => opts[:gem_install_path], } end |
Instance Method Details
#bundler_injection ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/fluent/format/check.rb', line 77 def bundler_injection # basically copy from lib/fluent/command/bundler_injection.rb system("bundle install") unless $?.success? exit $?.exitstatus end cmdline = [ 'bundle', 'exec', RbConfig.ruby, File.(File.join(File.dirname(__FILE__), '../../../bin/fluent-format')), ] + ARGV exec *cmdline exit! 127 end |
#run ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/fluent/format/check.rb', line 63 def run # copy from lib/fluent/command/fluentd.rb if ENV['FLUENTD_DISABLE_BUNDLER_INJECTION'] != '1' && gemfile = @opts[:gemfile] ENV['BUNDLE_GEMFILE'] = gemfile if path = @opts[:gem_install_path] ENV['BUNDLE_PATH'] = path else ENV['BUNDLE_PATH'] = File.(File.join(File.dirname(gemfile), 'vendor/bundle')) end ENV['FLUENTD_DISABLE_BUNDLER_INJECTION'] = '1' bundler_injection end end |