Class: LicenseFinder::Dependency
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- LicenseFinder::Dependency
- Defined in:
- lib/license_finder/tables/dependency.rb
Class Method Summary collapse
Instance Method Summary collapse
- #approve!(approver = nil, notes = nil) ⇒ Object
- #approved? ⇒ Boolean
- #approved_manually? ⇒ Boolean
- #bundler_group_names=(names) ⇒ Object
- #children_names=(names) ⇒ Object
- #set_license_manually!(license) ⇒ Object
- #set_licenses(other_licenses) ⇒ Object
- #whitelisted? ⇒ Boolean
Class Method Details
.acknowledged ⇒ Object
41 42 43 44 45 46 |
# File 'lib/license_finder/tables/dependency.rb', line 41 def self.acknowledged ignored_dependencies = LicenseFinder.config.ignore_dependencies all.reject do |dependency| ignored_dependencies.include? dependency.name end end |
.named(name) ⇒ Object
48 49 50 |
# File 'lib/license_finder/tables/dependency.rb', line 48 def self.named(name) find_or_create(name: name.to_s) end |
.unapproved ⇒ Object
37 38 39 |
# File 'lib/license_finder/tables/dependency.rb', line 37 def self.unapproved acknowledged.reject(&:approved?) end |
Instance Method Details
#approve!(approver = nil, notes = nil) ⇒ Object
60 61 62 63 |
# File 'lib/license_finder/tables/dependency.rb', line 60 def approve!(approver = nil, notes = nil) self.manual_approval = ManualApproval.new(approver: approver, notes: notes) save end |
#approved? ⇒ Boolean
65 66 67 |
# File 'lib/license_finder/tables/dependency.rb', line 65 def approved? whitelisted? || approved_manually? end |
#approved_manually? ⇒ Boolean
73 74 75 |
# File 'lib/license_finder/tables/dependency.rb', line 73 def approved_manually? !!manual_approval end |
#bundler_group_names=(names) ⇒ Object
52 53 54 |
# File 'lib/license_finder/tables/dependency.rb', line 52 def bundler_group_names=(names) update_association_collection(:bundler_groups, names) end |
#children_names=(names) ⇒ Object
56 57 58 |
# File 'lib/license_finder/tables/dependency.rb', line 56 def children_names=(names) update_association_collection(:children, names) end |
#set_license_manually!(license) ⇒ Object
85 86 87 88 89 |
# File 'lib/license_finder/tables/dependency.rb', line 85 def set_license_manually!(license) self.licenses = [license].to_set self.license_assigned_manually = true save end |
#set_licenses(other_licenses) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/license_finder/tables/dependency.rb', line 77 def set_licenses(other_licenses) return if license_assigned_manually? other_licenses = other_licenses.to_set if licenses != other_licenses self.licenses = other_licenses end end |
#whitelisted? ⇒ Boolean
69 70 71 |
# File 'lib/license_finder/tables/dependency.rb', line 69 def whitelisted? licenses.any? &:whitelisted? end |