goon_model_gen 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae4ea6261885660b6956bce4d82aaa078edd6d727ab6a4e144568473cfdaed69
|
4
|
+
data.tar.gz: 3dbfdd5ac21c79fc6adf1bb9009d81de2584327b53f0c92bcaf4a1150dcc623c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 515e715aaffaf9b359ede38fda8b35c12f9cb75eb7ef8fec5be2318175d9ec75233f32ef77e0200b2351302d9fbba9ebc2b6261eddc705a26605a049d07bdc3b
|
7
|
+
data.tar.gz: 4f8e860ed5ca58cbd6d7f8f1a7b96dc8cd98548426a1b6ae47679d27894425b5222b1c645caaa830d524f6cae11f56c4ecb3d76b559c25058973f87433b34ef5
|
@@ -30,7 +30,13 @@ module GoonModelGen
|
|
30
30
|
types.select{|t| t.is_a?(Source::Struct) && t.id_name && t.id_type }.each do |t|
|
31
31
|
store_type = pkg.new_struct(t.name + "Store")
|
32
32
|
procs << Proc.new{ build_sentences('store', 'goon', t, store_type) }
|
33
|
-
store_type.memo[:model] =
|
33
|
+
store_type.memo[:model] =
|
34
|
+
begin
|
35
|
+
pkg_name = Golang::Package.regularize_name(t.file.basename)
|
36
|
+
pkg = model_packages.detect_by(pkg_name)
|
37
|
+
raise "Package not found for #{t.file.basename}" unless pkg
|
38
|
+
pkg.lookup(t.name)
|
39
|
+
end
|
34
40
|
end
|
35
41
|
end
|
36
42
|
return pkg, procs
|
@@ -9,6 +9,12 @@ require "goon_model_gen/golang/file"
|
|
9
9
|
module GoonModelGen
|
10
10
|
module Golang
|
11
11
|
class Package
|
12
|
+
class << self
|
13
|
+
def regularize_name(name)
|
14
|
+
name.gsub(/[\-\_]/, '').downcase
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
12
18
|
attr_reader :path
|
13
19
|
attr_reader :types
|
14
20
|
attr_reader :files
|
@@ -25,7 +31,7 @@ module GoonModelGen
|
|
25
31
|
end
|
26
32
|
|
27
33
|
def name
|
28
|
-
@name ||= basename ?
|
34
|
+
@name ||= basename ? self.class.regularize_name(basename) : nil
|
29
35
|
end
|
30
36
|
|
31
37
|
def merge!(other)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goon_model_gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|