Sha256: 974bbeb837dd6a055aba293d0aeb513e67b6aa04a80db2304ac233da92753029
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
require 'forwardable' module LicenseFinder class PackageSaver extend Forwardable def_delegators :package, :license, :children, :groups, :summary, :description, :version, :homepage attr_reader :dependency, :package def self.save_all(packages) packages.map do |package| find_or_create_by_name(package).save end end def initialize(dependency, package) @dependency = dependency @package = package end def save DB.transaction do dependency.version = version.to_s dependency.summary = summary dependency.description = description dependency.homepage = homepage dependency.bundler_group_names = groups.map(&:to_s) dependency.children_names = children dependency.apply_better_license license dependency.save_changes end dependency end private def self.find_or_create_by_name(package) dependency = Dependency.named(package.name) new(dependency, package) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
license_finder-1.0.0.0 | lib/license_finder/package_saver.rb |
license_finder-1.0.0.0-java | lib/license_finder/package_saver.rb |