Class: ParsePackwerk::Configuration
- Inherits:
-
T::Struct
- Object
- T::Struct
- ParsePackwerk::Configuration
- Extended by:
- T::Sig
- Defined in:
- lib/parse_packwerk/configuration.rb
Class Method Summary collapse
Class Method Details
.excludes(config_hash) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/parse_packwerk/configuration.rb', line 32 def self.excludes(config_hash) specified_exclude = config_hash['exclude'] excludes = if specified_exclude.nil? DEFAULT_EXCLUDE_GLOBS.dup else Array(specified_exclude) end begin excludes.push Bundler.bundle_path.join('**').to_s rescue Bundler::GemfileNotFound # Optionally, add bundle to the path. Skip when there isn't a Gemfile. end excludes end |
.fetch ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/parse_packwerk/configuration.rb', line 13 def self.fetch packwerk_yml_filename = Pathname.new(PACKWERK_YML_NAME) if File.exist?(packwerk_yml_filename) # when the YML file is empty or only contains comment, it gets parsed # as the boolean `false` for some reason. this handles that case raw_packwerk_config = YAML.load_file(packwerk_yml_filename) || {} else raw_packwerk_config = {} end Configuration.new( exclude: excludes(raw_packwerk_config), package_paths: package_paths(raw_packwerk_config), requires: raw_packwerk_config['require'] || [], raw: raw_packwerk_config ) end |
.package_paths(config_hash) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/parse_packwerk/configuration.rb', line 50 def self.package_paths(config_hash) specified_package_paths = config_hash['package_paths'] package_paths = if specified_package_paths.nil? DEFAULT_PACKAGE_PATHS.dup else Array(specified_package_paths) end # We add the root package path always package_paths.push '.' end |