diff --git a/.rubocop.yml b/.rubocop.yml index a1d794f..031f834 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,6 @@ Metrics/BlockLength: Exclude: + - '*.gemspec' - 'spec/**/*' Metrics/ClassLength: diff --git a/bin/tf b/bin/tf index b82873a..abd2fcf 100755 --- a/bin/tf +++ b/bin/tf @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require 'bundler/setup' if File.exist? File.expand_path('../../Gemfile', __FILE__) +require 'bundler/setup' if File.exist?(File.expand_path('../../Gemfile', __FILE__)) require 'yle_tf/cli' cli = YleTf::CLI.new(ARGV) diff --git a/lib/yle_tf/plugin/loader.rb b/lib/yle_tf/plugin/loader.rb index c7823aa..cdbede8 100644 --- a/lib/yle_tf/plugin/loader.rb +++ b/lib/yle_tf/plugin/loader.rb @@ -19,10 +19,10 @@ def self.load_core_plugins end def self.load_bundler_plugins - if defined?(Bundler) - print_bundler_plugin_list if Logger.debug? - Bundler.require(BUNDLER_PLUGIN_GROUP) - end + return if !bundler_set_up? + + Logger.debug { print_bundler_plugin_list } + Bundler.require(BUNDLER_PLUGIN_GROUP) end def self.load_user_plugins @@ -47,6 +47,10 @@ def self.user_plugins ENV.fetch('TF_PLUGINS', '').split(/[ ,]+/) end + def self.bundler_set_up? + defined?(Bundler) && Bundler.respond_to?(:require) + end + def self.print_bundler_plugin_list plugins = bundler_plugins if !plugins.empty? diff --git a/yle_tf.gemspec b/yle_tf.gemspec index 8e5c1a7..1f7fdb9 100644 --- a/yle_tf.gemspec +++ b/yle_tf.gemspec @@ -23,9 +23,9 @@ Gem::Specification.new do |spec| 'antti.forsell@iki.fi', ] - spec.files = `git ls-files -z`.split("\x0").reject do |f| - f.match(%r{^(test|spec|features)/}) - end + spec.files = Dir['bin/**/*'] + + Dir['lib/**/*.rb'] + + Dir['vendor/**/*'] spec.bindir = 'bin' spec.executables = ['tf']