Class: Generamba::DependencyChecker
- Inherits:
-
Object
- Object
- Generamba::DependencyChecker
- Defined in:
- lib/generamba/helpers/dependency_checker.rb
Overview
Provides methods for check dependencies from rambaspec in podfile
Class Method Summary collapse
-
.check_all_required_dependencies_has_in_cartfile(dependencies, cartfile_path) ⇒ void
Check Cartfile for dependencies.
-
.check_all_required_dependencies_has_in_podfile(dependencies, podfile_path) ⇒ void
Check Podfile for dependencies.
Class Method Details
.check_all_required_dependencies_has_in_cartfile(dependencies, cartfile_path) ⇒ void
This method returns an undefined value.
Check Cartfile for dependencies
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/generamba/helpers/dependency_checker.rb', line 37 def self.check_all_required_dependencies_has_in_cartfile(dependencies, cartfile_path) return if !dependencies || dependencies.count == 0 || !cartfile_path cartfile_string = File.read(cartfile_path) not_existing_dependency = [] dependencies.each do |dependency_name| unless cartfile_string.include?(dependency_name) not_existing_dependency.push(dependency_name) end end if not_existing_dependency.count > 0 puts "[Warning] Dependencies #{not_existing_dependency} missed in Cartfile".yellow end end |
.check_all_required_dependencies_has_in_podfile(dependencies, podfile_path) ⇒ void
This method returns an undefined value.
Check Podfile for dependencies
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generamba/helpers/dependency_checker.rb', line 11 def self.check_all_required_dependencies_has_in_podfile(dependencies, podfile_path) return if !dependencies || dependencies.count == 0 || !podfile_path dependencies_names = [] Pod::Podfile.from_file(Pathname.new(podfile_path)).dependencies.each do |dependency| dependencies_names.push(dependency.name.gsub(/ .*/, '')) end not_existing_dependency = [] dependencies.each do |dependency_name| unless dependencies_names.include?(dependency_name) not_existing_dependency.push(dependency_name) end end if not_existing_dependency.count > 0 puts "[Warning] Dependencies #{not_existing_dependency} missed in Podfile".yellow end end |