Sha256: aad83c1642db5c4a71d33d626c1dcb642538eb464510df25a81a1a75cbdcc345

Contents?: true

Size: 1.5 KB

Versions: 15

Compression:

Stored size: 1.5 KB

Contents

class Lono::Jade
  class Registry
    attr_reader :args, :options
    attr_accessor :caller_line, :parent, :depends_on
    def initialize(args, options)
      @args, @options = args, options
    end

    def name
      @args.first
    end

    def gem_options
      options = @options.dup
      # Delete special options that is not supported by bundler Gemfile
      options.delete(:repo)
      options.delete(:resource) # configset
      options.delete(:vars) # configset
      options
    end

    # configset
    def resource
      @options[:resource]
    end

    def resource=(v)
      @options[:resource] = v
    end

    def vars
      options[:vars] || {}
    end

    class_attribute :tracked_configsets, default: []
    class_attribute :downloaded_configsets, default: []
    class_attribute :tracked_extensions, default: []
    class_attribute :downloaded_extensions, default: []

    class << self
      def register_configset(args, options)
        registry = new(args, options)
        jade_type = determine_jade_type(caller)
        jade = Lono::Jade.new(registry.name, jade_type, registry)
        self.tracked_configsets << jade
        registry
      end

      def determine_jade_type(caller)
        if caller.detect { |l| l =~ %r{config/configsets.rb} }
          'blueprint/configset'
        else
          'configset'
        end
      end

      def register_extension(args, options)
        registry = new(args, options)
        self.tracked_extensions << registry
        registry
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
lono-7.5.2 lib/lono/jade/registry.rb
lono-7.5.1 lib/lono/jade/registry.rb
lono-7.5.0 lib/lono/jade/registry.rb
lono-7.4.11 lib/lono/jade/registry.rb
lono-7.4.10 lib/lono/jade/registry.rb
lono-7.4.9 lib/lono/jade/registry.rb
lono-7.4.8 lib/lono/jade/registry.rb
lono-7.4.7 lib/lono/jade/registry.rb
lono-7.4.6 lib/lono/jade/registry.rb
lono-7.4.5 lib/lono/jade/registry.rb
lono-7.4.4 lib/lono/jade/registry.rb
lono-7.4.3 lib/lono/jade/registry.rb
lono-7.4.2 lib/lono/jade/registry.rb
lono-7.4.1 lib/lono/jade/registry.rb
lono-7.4.0 lib/lono/jade/registry.rb