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
- #apply_better_license(other_license) ⇒ Object
- #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
- #whitelisted? ⇒ Boolean
Class Method Details
.acknowledged ⇒ Object
32 33 34 35 36 37 |
# File 'lib/license_finder/tables/dependency.rb', line 32 def self.acknowledged ignored_dependencies = LicenseFinder.config.ignore_dependencies all.reject do |dependency| ignored_dependencies.include? dependency.name end end |
.named(name) ⇒ Object
39 40 41 |
# File 'lib/license_finder/tables/dependency.rb', line 39 def self.named(name) find_or_create(name: name.to_s) end |
.unapproved ⇒ Object
28 29 30 |
# File 'lib/license_finder/tables/dependency.rb', line 28 def self.unapproved acknowledged.reject(&:approved?) end |
Instance Method Details
#apply_better_license(other_license) ⇒ Object
74 75 76 77 78 79 |
# File 'lib/license_finder/tables/dependency.rb', line 74 def apply_better_license(other_license) return if license_assigned_manually? if license.name != other_license.name self.license = other_license end end |
#approve!(approver = nil, notes = nil) ⇒ Object
51 52 53 54 |
# File 'lib/license_finder/tables/dependency.rb', line 51 def approve!(approver = nil, notes = nil) self.manual_approval = ManualApproval.new(approver: approver, notes: notes) save end |
#approved? ⇒ Boolean
56 57 58 |
# File 'lib/license_finder/tables/dependency.rb', line 56 def approved? whitelisted? || approved_manually? end |
#approved_manually? ⇒ Boolean
64 65 66 |
# File 'lib/license_finder/tables/dependency.rb', line 64 def approved_manually? !!manual_approval end |
#bundler_group_names=(names) ⇒ Object
43 44 45 |
# File 'lib/license_finder/tables/dependency.rb', line 43 def bundler_group_names=(names) update_association_collection(:bundler_groups, names) end |
#children_names=(names) ⇒ Object
47 48 49 |
# File 'lib/license_finder/tables/dependency.rb', line 47 def children_names=(names) update_association_collection(:children, names) end |
#set_license_manually!(license) ⇒ Object
68 69 70 71 72 |
# File 'lib/license_finder/tables/dependency.rb', line 68 def set_license_manually!(license) self.license = license self.license_assigned_manually = true save end |
#whitelisted? ⇒ Boolean
60 61 62 |
# File 'lib/license_finder/tables/dependency.rb', line 60 def whitelisted? license.whitelisted? end |