Sha256: 12c1f87c51aa5280ff8b61ea24a14a8bf6ed094df67c29ff5bd45a7b2d6f228c

Contents?: true

Size: 761 Bytes

Versions: 3

Compression:

Stored size: 761 Bytes

Contents

# coding: utf-8
require 'goa_model_gen'
require 'goa_model_gen/type'

require "active_support/core_ext/string"

module GoaModelGen
  class SourceFile
    attr_reader :yaml_path, :types
    def initialize(yaml_path, types)
      @yaml_path, @types = yaml_path, types
    end

    def model_dependencies
      @model_dependencies ||= calc_model_dependencies
    end

    def calc_model_dependencies
      r = []
      r << "github.com/goadesign/goa/uuid" if types.any?(&:use_uuid?)
      if types.any?(&:store?)
        r << "fmt"
        r << "golang.org/x/net/context"
        r << "google.golang.org/appengine/datastore"
        r << "google.golang.org/appengine/log"
      end
      r << "time" if types.any?(&:has_time_field?)
      r.uniq
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
goa_model_gen-0.4.2 lib/goa_model_gen/source_file.rb
goa_model_gen-0.4.1 lib/goa_model_gen/source_file.rb
goa_model_gen-0.4.0 lib/goa_model_gen/source_file.rb