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: 4283b78918a93a63233070c2e5d0d1ef100d4b214e672b50640f5b70c6aa08b3
4
- data.tar.gz: f0bc7f7a08b1311a4b12d754d1bce760fbe59ac39e6bdbf48e215d63c3b9cf2e
3
+ metadata.gz: ae4ea6261885660b6956bce4d82aaa078edd6d727ab6a4e144568473cfdaed69
4
+ data.tar.gz: 3dbfdd5ac21c79fc6adf1bb9009d81de2584327b53f0c92bcaf4a1150dcc623c
5
5
  SHA512:
6
- metadata.gz: 26af49ba18494c6722cd7421ab53598c70ad86a8ced5269ea1328989713678517f696f4886b6cac1fdad5c378e230d72a34e3c0cc399a0db04f7973a1227fb80
7
- data.tar.gz: ad98807c4bfdfbf715b2b528ae5b193b3e205489d505ddca16956c74132113ef50329a8526aef636dff16498b25308a6c02a0f6710a6740488ee0d88b95e576f
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] = model_packages.detect_by(t.file.basename).lookup(t.name)
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 ? basename.gsub(/[\-\_]/, '').downcase : nil
34
+ @name ||= basename ? self.class.regularize_name(basename) : nil
29
35
  end
30
36
 
31
37
  def merge!(other)
@@ -1,3 +1,3 @@
1
1
  module GoonModelGen
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
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 00:00:00.000000000 Z
11
+ date: 2019-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor