Skip to content

Commit

Permalink
Merge pull request #321 from metricfu/fixes/invalid-yield
Browse files Browse the repository at this point in the history
Fixes/invalid yield
  • Loading branch information
etagwerker authored Nov 4, 2021
2 parents d9f4f3c + 074c715 commit 1ffbcdf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ rvm:
- 2.5
- 2.6
- 2.7
- 3.0
- jruby
matrix:
allow_failures:
Expand Down
16 changes: 4 additions & 12 deletions lib/metric_fu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,9 @@ def loader

def_delegators :loader, :lib_require, :load_tasks

def library_dirs
%w(metrics formatter reporting logging errors data_structures tasks)
end
LIBRARY_DIRS = %w(metrics formatter reporting logging errors data_structures tasks)

loader.create_dirs(self) do
library_dirs
end
loader.create_dirs(self)

# @note artifact_dir is relative to where the task is being run,
# not to the metric_fu library
Expand All @@ -109,13 +105,9 @@ def artifact_dir
MetricFu::Io::FileSystem.artifact_dir
end

def artifact_subdirs
%w(scratch output _data)
end
ARTIFACT_SUBDIRS = %w(scratch output _data)

loader.create_artifact_subdirs(self) do
artifact_subdirs
end
loader.create_artifact_subdirs(self)

loader.setup

Expand Down
4 changes: 2 additions & 2 deletions lib/metric_fu/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def lib_require(base = "", &_block)
# ::metrics_require which takes a block of files to require relative to the metrics_dir
def create_dirs(klass)
class << klass
Array(yield).each do |dir|
Array(LIBRARY_DIRS).each do |dir|
define_method("#{dir}_dir") do
File.join(lib_dir, dir)
end
Expand All @@ -51,7 +51,7 @@ class << klass
# ::scratch_dir (which notably has the leading underscore removed)
def create_artifact_subdirs(klass)
class << klass
Array(yield).each do |dir|
Array(ARTIFACT_SUBDIRS).each do |dir|
define_method("#{dir.gsub(/[^A-Za-z0-9]/, '')}_dir") do
File.join(artifact_dir, dir)
end
Expand Down

0 comments on commit 1ffbcdf

Please sign in to comment.