Sha256: 2ad0c788ee63aae9c3327c702a6d9fcdd5f75e8cffa49d137ad2dc916bc9bb03

Contents?: true

Size: 802 Bytes

Versions: 53

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

module RailsAppGenerator
  # XXXX
  class Dependencies
    def initialize(addon, context)
      @addon = addon
      @context = context
      @options = context.options
    end

    def satisfied?
      @addon.dependencies.each do |dependency|
        return false unless dependencies_satisfied?(dependency)
      end

      true
    end

    private

    def dependencies_satisfied?(addon, visited = [])
      return false if @options["skip_#{addon}".to_sym]

      return true if @context.default_addons.include?(addon)

      visited << RailsAppGenerator::Addon
      dependencies = AddonUtil.get(addon).dependencies - visited
      dependencies.each do |dependency|
        return false unless dependencies_satisfied?(dependency, visited)
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
rails_app_generator-0.3.6 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.3.5 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.3.4 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.3.3 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.3.2 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.3.1 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.3.0 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.43 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.42 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.41 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.40 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.39 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.38 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.37 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.36 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.35 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.34 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.33 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.32 lib/rails_app_generator/dependencies.rb
rails_app_generator-0.2.31 lib/rails_app_generator/dependencies.rb