diff --git a/Gemfile b/Gemfile index ad6abe09c..3bb965787 100644 --- a/Gemfile +++ b/Gemfile @@ -3,13 +3,6 @@ source 'https://rubygems.org' git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } -gem 'csv', '~> 3.0' -gem 'facets', require: false # Specify your gem's dependencies in kiba-extend.gemspec gemspec - -group :development do - gem 'rubocop', require: false - gem 'rubocop-rspec', require: false -end diff --git a/Gemfile.lock b/Gemfile.lock index 553936527..28bac253e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,12 @@ PATH remote: . specs: - kiba-extend (1.15.3) - activesupport - kiba (>= 4.0.0) - kiba-common (>= 1.5.0) - xxhash + kiba-extend (1.15.4) + activesupport (~> 6.1.4) + csv (~> 3.0) + kiba (~> 4.0.0) + kiba-common (~> 1.5.0) + xxhash (~> 0.4) GEM remote: https://rubygems.org/ @@ -19,9 +20,8 @@ GEM ast (2.4.2) coderay (1.1.2) concurrent-ruby (1.1.9) - csv (3.1.9) + csv (3.2.0) diff-lcs (1.3) - facets (3.1.0) i18n (1.8.10) concurrent-ruby (~> 1.0) kiba (4.0.0) @@ -52,13 +52,13 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-support (3.9.3) - rubocop (1.18.3) + rubocop (1.18.4) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.7.0, < 2.0) + rubocop-ast (>= 1.8.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) rubocop-ast (1.8.0) @@ -78,14 +78,12 @@ PLATFORMS DEPENDENCIES bundler (>= 1.17) - csv (~> 3.0) - facets kiba-extend! pry (~> 0.12.2) rake (~> 13.0) rspec (~> 3.0) - rubocop - rubocop-rspec + rubocop (~> 1.18.4) + rubocop-rspec (~> 2.4.0) BUNDLED WITH 2.1.4 diff --git a/kiba-extend.gemspec b/kiba-extend.gemspec index 5e82a1410..d9e6bbc38 100644 --- a/kiba-extend.gemspec +++ b/kiba-extend.gemspec @@ -1,8 +1,6 @@ # frozen_string_literal: true -lib = File.expand_path('lib', __dir__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'kiba/extend/version' +require_relative 'lib/kiba/extend/version' Gem::Specification.new do |spec| spec.name = 'kiba-extend' @@ -37,13 +35,16 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.add_dependency 'activesupport' - spec.add_dependency 'kiba', '>= 4.0.0' - spec.add_dependency 'kiba-common', '>= 1.5.0' - spec.add_dependency 'xxhash' + spec.add_dependency 'activesupport', '~> 6.1.4' + spec.add_dependency 'csv', '~> 3.0' + spec.add_dependency 'kiba', '~> 4.0.0' + spec.add_dependency 'kiba-common', '~> 1.5.0' + spec.add_dependency 'xxhash', '~> 0.4' spec.add_development_dependency 'bundler', '>= 1.17' spec.add_development_dependency 'pry', '~> 0.12.2' spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec', '~> 3.0' + spec.add_development_dependency 'rubocop', '~> 1.18.4' + spec.add_development_dependency 'rubocop-rspec', '~> 2.4.0' end diff --git a/lib/kiba/extend.rb b/lib/kiba/extend.rb index 007cd62ea..9aff1674c 100644 --- a/lib/kiba/extend.rb +++ b/lib/kiba/extend.rb @@ -1,12 +1,15 @@ # frozen_string_literal: true +require "active_support" +require "active_support/core_ext/object" require 'kiba' require 'kiba-common/sources/csv' require 'kiba-common/destinations/csv' require 'pry' -require 'active_support/all' require 'xxhash' -require 'facets/kernel/blank' + +require 'kiba/extend/version' + # Default CSV options CSVOPT = { headers: true, header_converters: :symbol }.freeze @@ -22,30 +25,12 @@ module Kiba # Provides a suite of abstract, reusable, well-tested data transformations for use in Kiba ETL pipelines module Extend - autoload :VERSION, 'extend/version' - puts "kiba-extend version: #{Kiba::Extend::VERSION}" - require 'kiba/extend/fieldset' - require 'kiba/extend/destinations/csv' - require 'kiba/extend/transforms/helpers' - require 'kiba/extend/transforms/append' - require 'kiba/extend/transforms/clean' - require 'kiba/extend/transforms/combine_values' - require 'kiba/extend/transforms/copy' - require 'kiba/extend/transforms/deduplicate' - require 'kiba/extend/transforms/cspace' - require 'kiba/extend/transforms/delete' - require 'kiba/extend/transforms/explode' - require 'kiba/extend/transforms/filter_rows' - require 'kiba/extend/transforms/merge' - require 'kiba/extend/transforms/ms_access' - require 'kiba/extend/transforms/prepend' - require 'kiba/extend/transforms/rename' - require 'kiba/extend/transforms/replace' - require 'kiba/extend/transforms/reshape' - require 'kiba/extend/transforms/split' - require 'kiba/extend/utils/lookup' + # Require application files + Dir.glob("#{__dir__}/**/*").sort.select{ |path| path.match?(/\.rb$/) }.each do |rbfile| + require rbfile.delete_prefix("#{File.expand_path(__dir__)}/lib/") + end # strips, collapses multiple spaces, removes terminal commas, strips again CSV::Converters[:stripplus] = lambda { |s| diff --git a/lib/kiba/extend/transforms/clean.rb b/lib/kiba/extend/transforms/clean.rb index 481fa6d36..23835959e 100644 --- a/lib/kiba/extend/transforms/clean.rb +++ b/lib/kiba/extend/transforms/clean.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'kiba/extend/transforms/helpers' + module Kiba module Extend module Transforms diff --git a/lib/kiba/extend/version.rb b/lib/kiba/extend/version.rb index e8b58c5f3..09c271094 100644 --- a/lib/kiba/extend/version.rb +++ b/lib/kiba/extend/version.rb @@ -2,6 +2,6 @@ module Kiba module Extend - VERSION = '1.15.3' + VERSION = '1.15.4' end end