meta-record 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/bin/metarecord-make +1 -0
 - data/lib/metarecord/generator_base.rb +5 -1
 - data/lib/metarecord/generators/comet/archive_generator.rb +5 -2
 - data/lib/metarecord/generators/comet/archive_renderer_generator.rb +61 -0
 - data/lib/metarecord/generators/comet/data_generator.rb +4 -2
 - data/lib/metarecord/generators/comet/edit_generator.rb +1 -1
 - data/lib/metarecord/generators/crails/data_generator.rb +1 -0
 - data/lib/metarecord/generators/crails/destroy_generator.rb +2 -2
 - data/lib/metarecord/generators/crails/edit_generator.rb +11 -5
 - data/lib/metarecord/generators/crails/helpers/validations.rb +3 -3
 - data/lib/metarecord/generators/crails/view_generator.rb +3 -3
 - data/lib/metarecord/generators/rails/migrations/type_helpers.rb +17 -17
 - data/lib/metarecord/manifest_generator.rb +1 -1
 - data/lib/metarecord/runner.rb +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1b69f5ecbbd9f965b58eb3e7e24afc9eb1984b9731dacacb27c6b9ca9b330e0a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 27801886a4b4faec633e3126610aafe74a527e4ca01ed196f0cf686fff2e99bb
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 17cdcda84be56c6cadb92d0820de95da5afaa7dd308bedc3a85c50ef435cf4ab319d108a556f6e93487922818d5f90d1d32e0fa08d0317acfb653d83a8c3e222
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 2f6e23b9cd576e810ff94418343cd673c8b5a3ac1104a43d2bda67b791abc0d76958f722ad0510161eaa0465ea548a6f220d91db5839897c5e625ee38e55560a
         
     | 
    
        data/bin/metarecord-make
    CHANGED
    
    | 
         @@ -15,6 +15,7 @@ end 
     | 
|
| 
       15 
15 
     | 
    
         
             
            @tmpdir     = ".tmp"
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
            OptionParser.new do |opts|
         
     | 
| 
      
 18 
     | 
    
         
            +
              opts.on "-v",            "--verbose"          do @verbose == true end
         
     | 
| 
       18 
19 
     | 
    
         
             
              opts.on "-o PATH",       "--output-path=PATH" do |v| @output     = v end
         
     | 
| 
       19 
20 
     | 
    
         
             
              opts.on "-b PATH",       "--base-path=PATH"   do |v| @base_path  = v end
         
     | 
| 
       20 
21 
     | 
    
         
             
              opts.on "-i PATH",       "--source-path=PATH" do |v| @input      = v.split(",") end
         
     | 
| 
         @@ -176,7 +176,7 @@ class GeneratorBase 
     | 
|
| 
       176 
176 
     | 
    
         
             
                if defined? METARECORD_ID_TYPE
         
     | 
| 
       177 
177 
     | 
    
         
             
                  METARECORD_ID_TYPE
         
     | 
| 
       178 
178 
     | 
    
         
             
                else
         
     | 
| 
       179 
     | 
    
         
            -
                  " 
     | 
| 
      
 179 
     | 
    
         
            +
                  "Crails::Odb::id_type"
         
     | 
| 
       180 
180 
     | 
    
         
             
                end
         
     | 
| 
       181 
181 
     | 
    
         
             
              end
         
     | 
| 
       182 
182 
     | 
    
         | 
| 
         @@ -194,4 +194,8 @@ class GeneratorBase 
     | 
|
| 
       194 
194 
     | 
    
         
             
              def property type, name, options = {} ;; end
         
     | 
| 
       195 
195 
     | 
    
         
             
              def has_one type, name, options = {} ;; end
         
     | 
| 
       196 
196 
     | 
    
         
             
              def has_many type, name, options = {} ;; end
         
     | 
| 
      
 197 
     | 
    
         
            +
             
     | 
| 
      
 198 
     | 
    
         
            +
              def should_skip_on_client? options
         
     | 
| 
      
 199 
     | 
    
         
            +
                (not options[:client].nil?) && options[:client][:ignore] == true
         
     | 
| 
      
 200 
     | 
    
         
            +
              end
         
     | 
| 
       197 
201 
     | 
    
         
             
            end
         
     | 
| 
         @@ -71,21 +71,24 @@ class CometArchiveGenerator < GeneratorBase 
     | 
|
| 
       71 
71 
     | 
    
         
             
              end
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
       73 
73 
     | 
    
         
             
              def property type, name, options = {}
         
     | 
| 
      
 74 
     | 
    
         
            +
                return if should_skip_on_client? options
         
     | 
| 
       74 
75 
     | 
    
         
             
                @src += " & #{name}"
         
     | 
| 
       75 
76 
     | 
    
         
             
              end
         
     | 
| 
       76 
77 
     | 
    
         | 
| 
       77 
78 
     | 
    
         
             
              def has_one type, name, options = {}
         
     | 
| 
      
 79 
     | 
    
         
            +
                return if should_skip_on_client? options
         
     | 
| 
       78 
80 
     | 
    
         
             
                if options[:joined] != false
         
     | 
| 
       79 
     | 
    
         
            -
                   
     | 
| 
      
 81 
     | 
    
         
            +
                  @src += " & #{name}"
         
     | 
| 
       80 
82 
     | 
    
         
             
                else
         
     | 
| 
       81 
83 
     | 
    
         
             
                  @src += " & #{name}_id"
         
     | 
| 
       82 
84 
     | 
    
         
             
                end
         
     | 
| 
       83 
85 
     | 
    
         
             
              end
         
     | 
| 
       84 
86 
     | 
    
         | 
| 
       85 
87 
     | 
    
         
             
              def has_many type, name, options = {}
         
     | 
| 
      
 88 
     | 
    
         
            +
                return if should_skip_on_client? options
         
     | 
| 
       86 
89 
     | 
    
         
             
                singular_name = get_singular_name name
         
     | 
| 
       87 
90 
     | 
    
         
             
                if options[:joined] != false
         
     | 
| 
       88 
     | 
    
         
            -
                   
     | 
| 
      
 91 
     | 
    
         
            +
                  @src += " & #{name}"
         
     | 
| 
       89 
92 
     | 
    
         
             
                else
         
     | 
| 
       90 
93 
     | 
    
         
             
                  @src += " & #{singular_name}_ids"
         
     | 
| 
       91 
94 
     | 
    
         
             
                end
         
     | 
| 
         @@ -0,0 +1,61 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'metarecord/generator_base'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'metarecord/generators/rails/migrations/table_helpers'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class CometArchiveRendererGenerator < GeneratorBase
         
     | 
| 
      
 5 
     | 
    
         
            +
              def should_generate_for object
         
     | 
| 
      
 6 
     | 
    
         
            +
                false
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              def should_generate_from_manifest
         
     | 
| 
      
 10 
     | 
    
         
            +
                true
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              def generate_manifest old_manifest, new_manifest
         
     | 
| 
      
 14 
     | 
    
         
            +
                reset
         
     | 
| 
      
 15 
     | 
    
         
            +
                @indent = 2
         
     | 
| 
      
 16 
     | 
    
         
            +
                @declarations = ""
         
     | 
| 
      
 17 
     | 
    
         
            +
                new_manifest.keys.each do |model_name|
         
     | 
| 
      
 18 
     | 
    
         
            +
                  add_model model_name
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
                @indent = 0
         
     | 
| 
      
 21 
     | 
    
         
            +
                make_renderer
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            private
         
     | 
| 
      
 25 
     | 
    
         
            +
              def add_model model
         
     | 
| 
      
 26 
     | 
    
         
            +
                name = model.gsub(/^::/,'').underscore
         
     | 
| 
      
 27 
     | 
    
         
            +
                funcname_prefix = "render_#{name}"
         
     | 
| 
      
 28 
     | 
    
         
            +
                funcname = "#{funcname_prefix}_show_archive"
         
     | 
| 
      
 29 
     | 
    
         
            +
                @declarations += "std::string #{funcname}(const Crails::Renderer* renderer, Crails::SharedVars& vars);\n"
         
     | 
| 
      
 30 
     | 
    
         
            +
                _append "templates.insert("
         
     | 
| 
      
 31 
     | 
    
         
            +
                _append "  pair<string, Generator>(\"#{name}/show\", #{funcname})"
         
     | 
| 
      
 32 
     | 
    
         
            +
                _append ");"
         
     | 
| 
      
 33 
     | 
    
         
            +
                funcname = "#{funcname_prefix}_index_archive"
         
     | 
| 
      
 34 
     | 
    
         
            +
                @declarations += "std::string #{funcname}(const Crails::Renderer* renderer, Crails::SharedVars& vars);\n"
         
     | 
| 
      
 35 
     | 
    
         
            +
                _append "templates.insert("
         
     | 
| 
      
 36 
     | 
    
         
            +
                _append "  pair<string, Generator>(\"#{name}/index\", #{funcname})"
         
     | 
| 
      
 37 
     | 
    
         
            +
                _append ");"
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              def make_renderer
         
     | 
| 
      
 41 
     | 
    
         
            +
                filepath = "lib/renderers/archive.cpp"
         
     | 
| 
      
 42 
     | 
    
         
            +
                src = <<CPP
         
     | 
| 
      
 43 
     | 
    
         
            +
            #include <crails/renderers/archive_renderer.hpp>
         
     | 
| 
      
 44 
     | 
    
         
            +
            #include <crails/archive.hpp>
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            using namespace Crails;
         
     | 
| 
      
 47 
     | 
    
         
            +
            using namespace std;
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            #{@declarations}
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            ArchiveRenderer::ArchiveRenderer()
         
     | 
| 
      
 52 
     | 
    
         
            +
            {
         
     | 
| 
      
 53 
     | 
    
         
            +
            #{@src}
         
     | 
| 
      
 54 
     | 
    
         
            +
            }
         
     | 
| 
      
 55 
     | 
    
         
            +
            CPP
         
     | 
| 
      
 56 
     | 
    
         
            +
                File.open filepath, 'w' do |f|
         
     | 
| 
      
 57 
     | 
    
         
            +
                  f.write src
         
     | 
| 
      
 58 
     | 
    
         
            +
                end
         
     | 
| 
      
 59 
     | 
    
         
            +
                puts "[metarecord][archive/renderer] Generated renderer file #{filepath}"
         
     | 
| 
      
 60 
     | 
    
         
            +
              end
         
     | 
| 
      
 61 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -27,6 +27,7 @@ class CometDataGenerator < CrailsDataGenerator 
     | 
|
| 
       27 
27 
     | 
    
         
             
                _append "void         from_json(Data data);"
         
     | 
| 
       28 
28 
     | 
    
         
             
                _append "virtual std::vector<std::string> find_missing_parameters(Data) const;"
         
     | 
| 
       29 
29 
     | 
    
         
             
                _append "virtual void                     edit(Data);"
         
     | 
| 
      
 30 
     | 
    
         
            +
                _append "virtual void                     merge_data(Data) const;"
         
     | 
| 
       30 
31 
     | 
    
         
             
                _append "virtual std::string              to_json() const;"
         
     | 
| 
       31 
32 
     | 
    
         
             
                _append "virtual bool                     is_valid();"
         
     | 
| 
       32 
33 
     | 
    
         
             
                _append_macro "#else"
         
     | 
| 
         @@ -65,10 +66,11 @@ class CometDataGenerator < CrailsDataGenerator 
     | 
|
| 
       65 
66 
     | 
    
         
             
            <<CPP
         
     | 
| 
       66 
67 
     | 
    
         
             
            #{super}
         
     | 
| 
       67 
68 
     | 
    
         
             
            #ifdef #{client_define}
         
     | 
| 
       68 
     | 
    
         
            -
            # include < 
     | 
| 
      
 69 
     | 
    
         
            +
            # include <comet/mvc/model.hpp>
         
     | 
| 
      
 70 
     | 
    
         
            +
            # include <comet/mvc/archive_model.hpp>
         
     | 
| 
       69 
71 
     | 
    
         
             
            # include <comet/promise.hpp>
         
     | 
| 
       70 
72 
     | 
    
         
             
            # ifndef #{client_super_class}
         
     | 
| 
       71 
     | 
    
         
            -
            #  define #{client_super_class} Comet::JsonModel
         
     | 
| 
      
 73 
     | 
    
         
            +
            #  define #{client_super_class} Comet::JsonModel<>
         
     | 
| 
       72 
74 
     | 
    
         
             
            # endif
         
     | 
| 
       73 
75 
     | 
    
         
             
            #endif
         
     | 
| 
       74 
76 
     | 
    
         
             
            CPP
         
     | 
| 
         @@ -70,6 +70,7 @@ class CrailsDataGenerator < GeneratorBase 
     | 
|
| 
       70 
70 
     | 
    
         
             
              def edit_resource_declaration
         
     | 
| 
       71 
71 
     | 
    
         
             
                _append "virtual std::vector<std::string> find_missing_parameters(Data) const;"
         
     | 
| 
       72 
72 
     | 
    
         
             
                _append "virtual void                     edit(Data);"
         
     | 
| 
      
 73 
     | 
    
         
            +
                _append "virtual void                     merge_data(Data) const;"
         
     | 
| 
       73 
74 
     | 
    
         
             
                _append "virtual std::string              to_json() const;"
         
     | 
| 
       74 
75 
     | 
    
         
             
                _append "virtual bool                     is_valid();"
         
     | 
| 
       75 
76 
     | 
    
         
             
                _append "virtual void                     on_dependent_destroy(#{id_type});"
         
     | 
| 
         @@ -70,7 +70,7 @@ class CrailsDestroyGenerator < GeneratorBase 
     | 
|
| 
       70 
70 
     | 
    
         
             
                  @indent += 1
         
     | 
| 
       71 
71 
     | 
    
         
             
                  depended_by = CrailsDestroyGenerator.destroy_data[object[:classname]]
         
     | 
| 
       72 
72 
     | 
    
         
             
                  if depended_by.class == Array
         
     | 
| 
       73 
     | 
    
         
            -
                    _append " 
     | 
| 
      
 73 
     | 
    
         
            +
                    _append "#{GeneratorBase.odb_connection[:object]} database;"
         
     | 
| 
       74 
74 
     | 
    
         
             
                    depended_by.each do |relation|
         
     | 
| 
       75 
75 
     | 
    
         
             
                      _append "// #{relation[:class]}"
         
     | 
| 
       76 
76 
     | 
    
         
             
                      _append "{"
         
     | 
| 
         @@ -150,7 +150,7 @@ class CrailsDestroyGenerator < GeneratorBase 
     | 
|
| 
       150 
150 
     | 
    
         
             
                  _append "odb::result<#{relation[:class]}> models;"
         
     | 
| 
       151 
151 
     | 
    
         
             
                  _append "Query query;\n"
         
     | 
| 
       152 
152 
     | 
    
         
             
                  id_field = "#{get_singular_name relation[:field]}_ids"
         
     | 
| 
       153 
     | 
    
         
            -
                  _append "query = Query::#{id_field} + \"@>\" +  
     | 
| 
      
 153 
     | 
    
         
            +
                  _append "query = Query::#{id_field} + \"@>\" + Crails::Odb::array_to_string(ids, \"int\");"
         
     | 
| 
       154 
154 
     | 
    
         
             
                  _append "database.find<#{relation[:class]}>(models, query);"
         
     | 
| 
       155 
155 
     | 
    
         
             
                  _append "for (auto model : odb::to_vector<#{relation[:class]}>(models))"
         
     | 
| 
       156 
156 
     | 
    
         
             
                  _append "{"
         
     | 
| 
         @@ -36,11 +36,17 @@ class CrailsEditGenerator < GeneratorBase 
     | 
|
| 
       36 
36 
     | 
    
         | 
| 
       37 
37 
     | 
    
         
             
              def generate_json_methods object
         
     | 
| 
       38 
38 
     | 
    
         
             
                @rendering_to_json = true
         
     | 
| 
      
 39 
     | 
    
         
            +
                _append "void #{@klassname}::merge_data(Data data) const"
         
     | 
| 
      
 40 
     | 
    
         
            +
                _append "{"
         
     | 
| 
      
 41 
     | 
    
         
            +
                @indent += 1
         
     | 
| 
      
 42 
     | 
    
         
            +
                self.instance_eval &object[:block]
         
     | 
| 
      
 43 
     | 
    
         
            +
                @indent -= 1
         
     | 
| 
      
 44 
     | 
    
         
            +
                _append "}\n"
         
     | 
| 
       39 
45 
     | 
    
         
             
                _append "std::string #{@klassname}::to_json() const"
         
     | 
| 
       40 
46 
     | 
    
         
             
                _append "{"
         
     | 
| 
       41 
47 
     | 
    
         
             
                @indent += 1
         
     | 
| 
       42 
48 
     | 
    
         
             
                _append "DataTree data;\n"
         
     | 
| 
       43 
     | 
    
         
            -
                 
     | 
| 
      
 49 
     | 
    
         
            +
                _append "merge_data(data);\n"
         
     | 
| 
       44 
50 
     | 
    
         
             
                _append "return data.to_json();"
         
     | 
| 
       45 
51 
     | 
    
         
             
                @indent -= 1
         
     | 
| 
       46 
52 
     | 
    
         
             
                _append "}\n"
         
     | 
| 
         @@ -131,7 +137,7 @@ class CrailsEditGenerator < GeneratorBase 
     | 
|
| 
       131 
137 
     | 
    
         
             
                tptr = ptr_type type
         
     | 
| 
       132 
138 
     | 
    
         
             
                _append "#{tptr} #{@klassname}::get_#{name}() const"
         
     | 
| 
       133 
139 
     | 
    
         
             
                _append "{"
         
     | 
| 
       134 
     | 
    
         
            -
                _append "   
     | 
| 
      
 140 
     | 
    
         
            +
                _append "  #{GeneratorBase.odb_connection[:object]} database;"
         
     | 
| 
       135 
141 
     | 
    
         
             
                _append "  #{tptr} result;\n"
         
     | 
| 
       136 
142 
     | 
    
         
             
                _append "  database.find_one(result, #{name}_id);"
         
     | 
| 
       137 
143 
     | 
    
         
             
                _append "  return result;"
         
     | 
| 
         @@ -155,7 +161,7 @@ class CrailsEditGenerator < GeneratorBase 
     | 
|
| 
       155 
161 
     | 
    
         
             
                _append "    set_#{name}(nullptr);"
         
     | 
| 
       156 
162 
     | 
    
         
             
                _append "  else if (!get_#{name}() || #{data_id} != get_#{name}()->get_id())"
         
     | 
| 
       157 
163 
     | 
    
         
             
                _append "  {"
         
     | 
| 
       158 
     | 
    
         
            -
                _append "     
     | 
| 
      
 164 
     | 
    
         
            +
                _append "    #{GeneratorBase.odb_connection[:object]} database;"
         
     | 
| 
       159 
165 
     | 
    
         
             
                _append "    #{tptr} linked_resource;"
         
     | 
| 
       160 
166 
     | 
    
         
             
                _append "    database.find_one(linked_resource, data[\"#{name}_id\"].as<#{id_type}>());"
         
     | 
| 
       161 
167 
     | 
    
         
             
                _append "    set_#{name}(linked_resource);"
         
     | 
| 
         @@ -326,11 +332,11 @@ class CrailsEditGenerator < GeneratorBase 
     | 
|
| 
       326 
332 
     | 
    
         
             
                _append "{"
         
     | 
| 
       327 
333 
     | 
    
         
             
                @indent += 1
         
     | 
| 
       328 
334 
     | 
    
         
             
                _append "typedef odb::pgsql::query<#{type}> query;"
         
     | 
| 
       329 
     | 
    
         
            -
                _append " 
     | 
| 
      
 335 
     | 
    
         
            +
                _append "#{GeneratorBase.odb_connection[:object]} database;"
         
     | 
| 
       330 
336 
     | 
    
         
             
                _append "odb::result<#{type}> results;"
         
     | 
| 
       331 
337 
     | 
    
         
             
                _append "#{name}.clear();"
         
     | 
| 
       332 
338 
     | 
    
         
             
                _append "database.find<#{type}>(results,"
         
     | 
| 
       333 
     | 
    
         
            -
                _append "  query::id + \"=\" +  
     | 
| 
      
 339 
     | 
    
         
            +
                _append "  query::id + \"=\" + Crails::Odb::any(#{singular_name}_ids, \"int\")"
         
     | 
| 
       334 
340 
     | 
    
         
             
                _append ");"
         
     | 
| 
       335 
341 
     | 
    
         
             
                _append "for (auto model : results)"
         
     | 
| 
       336 
342 
     | 
    
         
             
                _append "  #{name}.push_back(std::make_shared<#{type}>(model));"
         
     | 
| 
         @@ -25,7 +25,7 @@ def validate_uniqueness source_type, name 
     | 
|
| 
       25 
25 
     | 
    
         
             
                type = source_type[16..-2]
         
     | 
| 
       26 
26 
     | 
    
         
             
            <<CPP
         
     | 
| 
       27 
27 
     | 
    
         
             
              {
         
     | 
| 
       28 
     | 
    
         
            -
                 
     | 
| 
      
 28 
     | 
    
         
            +
                #{GeneratorBase.odb_connection[:object]} database;
         
     | 
| 
       29 
29 
     | 
    
         
             
                odb::result<#{source_type}> results;
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
                database.find(results, odb::query<#{source_type}::#{name}->id == get_#{name}_id());
         
     | 
| 
         @@ -36,7 +36,7 @@ CPP 
     | 
|
| 
       36 
36 
     | 
    
         
             
              else
         
     | 
| 
       37 
37 
     | 
    
         
             
            <<CPP
         
     | 
| 
       38 
38 
     | 
    
         
             
              {
         
     | 
| 
       39 
     | 
    
         
            -
                 
     | 
| 
      
 39 
     | 
    
         
            +
                #{GeneratorBase.odb_connection[:object]} database;
         
     | 
| 
       40 
40 
     | 
    
         
             
                odb::result<#{source_type}> results;
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
                database.find(results, odb::query<#{source_type}::#{name} == #{name});
         
     | 
| 
         @@ -58,7 +58,7 @@ CPP 
     | 
|
| 
       58 
58 
     | 
    
         
             
            if (#{name} == nullptr)
         
     | 
| 
       59 
59 
     | 
    
         
             
              errors["#{name}_id"]["t"] = "validate.required";
         
     | 
| 
       60 
60 
     | 
    
         
             
            CPP
         
     | 
| 
       61 
     | 
    
         
            -
              elsif type == " 
     | 
| 
      
 61 
     | 
    
         
            +
              elsif type == "Crails::Odb::id_type"
         
     | 
| 
       62 
62 
     | 
    
         
             
            <<CPP
         
     | 
| 
       63 
63 
     | 
    
         
             
            if (#{name} == 0)
         
     | 
| 
       64 
64 
     | 
    
         
             
              errors["#{name}"]["t"] = "validate.required";
         
     | 
| 
         @@ -28,7 +28,7 @@ class CrailsViewGenerator < GeneratorBase 
     | 
|
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
              def property type, name, options = {}
         
     | 
| 
       31 
     | 
    
         
            -
                return if  
     | 
| 
      
 31 
     | 
    
         
            +
                return if should_skip_on_client? options
         
     | 
| 
       32 
32 
     | 
    
         
             
                if type == "DataTree" || type == "LocaleString"
         
     | 
| 
       33 
33 
     | 
    
         
             
                  _append "json(#{name.inspect}, model.get_#{name}().as_data());"
         
     | 
| 
       34 
34 
     | 
    
         
             
                else
         
     | 
| 
         @@ -37,7 +37,7 @@ class CrailsViewGenerator < GeneratorBase 
     | 
|
| 
       37 
37 
     | 
    
         
             
              end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
              def has_one type, name, options = {}
         
     | 
| 
       40 
     | 
    
         
            -
                return if  
     | 
| 
      
 40 
     | 
    
         
            +
                return if should_skip_on_client? options
         
     | 
| 
       41 
41 
     | 
    
         
             
                if options[:joined] == false
         
     | 
| 
       42 
42 
     | 
    
         
             
                  _append "if (model.get_#{name}_id() != 0)"
         
     | 
| 
       43 
43 
     | 
    
         
             
                  _append "  json(\"#{name}_id\", model.get_#{name}_id());"
         
     | 
| 
         @@ -48,7 +48,7 @@ class CrailsViewGenerator < GeneratorBase 
     | 
|
| 
       48 
48 
     | 
    
         
             
              end
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
50 
     | 
    
         
             
              def has_many type, name, options = {}
         
     | 
| 
       51 
     | 
    
         
            -
                return if  
     | 
| 
      
 51 
     | 
    
         
            +
                return if should_skip_on_client? options
         
     | 
| 
       52 
52 
     | 
    
         
             
                _append "{"
         
     | 
| 
       53 
53 
     | 
    
         
             
                @indent += 1
         
     | 
| 
       54 
54 
     | 
    
         
             
                id_attr = (get_singular_name name) + "_ids"
         
     | 
| 
         @@ -1,23 +1,23 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module RailsTypeHelpers
         
     | 
| 
       2 
2 
     | 
    
         
             
              def get_record_type type
         
     | 
| 
       3 
3 
     | 
    
         
             
                case type
         
     | 
| 
       4 
     | 
    
         
            -
                when " 
     | 
| 
       5 
     | 
    
         
            -
                when "char" 
     | 
| 
       6 
     | 
    
         
            -
                when "unsigned char" 
     | 
| 
       7 
     | 
    
         
            -
                when "short" 
     | 
| 
       8 
     | 
    
         
            -
                when "unsigned short" 
     | 
| 
       9 
     | 
    
         
            -
                when "int" 
     | 
| 
       10 
     | 
    
         
            -
                when "unsigned int" 
     | 
| 
       11 
     | 
    
         
            -
                when "long" 
     | 
| 
       12 
     | 
    
         
            -
                when "long long" 
     | 
| 
       13 
     | 
    
         
            -
                when "unsigned long" 
     | 
| 
       14 
     | 
    
         
            -
                when "unsigned long long" 
     | 
| 
       15 
     | 
    
         
            -
                when "double" 
     | 
| 
       16 
     | 
    
         
            -
                when "long double" 
     | 
| 
       17 
     | 
    
         
            -
                when "float" 
     | 
| 
       18 
     | 
    
         
            -
                when "bool" 
     | 
| 
       19 
     | 
    
         
            -
                when "std::string" 
     | 
| 
       20 
     | 
    
         
            -
                when "std::time_t" 
     | 
| 
      
 4 
     | 
    
         
            +
                when "Crails::Odb::id_type" then :bigint
         
     | 
| 
      
 5 
     | 
    
         
            +
                when "char"                 then :tinyint
         
     | 
| 
      
 6 
     | 
    
         
            +
                when "unsigned char"        then :smallint
         
     | 
| 
      
 7 
     | 
    
         
            +
                when "short"                then :smallint
         
     | 
| 
      
 8 
     | 
    
         
            +
                when "unsigned short"       then :mediumint
         
     | 
| 
      
 9 
     | 
    
         
            +
                when "int"                  then :integer
         
     | 
| 
      
 10 
     | 
    
         
            +
                when "unsigned int"         then :integer
         
     | 
| 
      
 11 
     | 
    
         
            +
                when "long"                 then :bigint
         
     | 
| 
      
 12 
     | 
    
         
            +
                when "long long"            then :bigint
         
     | 
| 
      
 13 
     | 
    
         
            +
                when "unsigned long"        then :bigint
         
     | 
| 
      
 14 
     | 
    
         
            +
                when "unsigned long long"   then :bigint
         
     | 
| 
      
 15 
     | 
    
         
            +
                when "double"               then :float
         
     | 
| 
      
 16 
     | 
    
         
            +
                when "long double"          then :float
         
     | 
| 
      
 17 
     | 
    
         
            +
                when "float"                then :float
         
     | 
| 
      
 18 
     | 
    
         
            +
                when "bool"                 then :boolean
         
     | 
| 
      
 19 
     | 
    
         
            +
                when "std::string"          then :string
         
     | 
| 
      
 20 
     | 
    
         
            +
                when "std::time_t"          then :timestamp
         
     | 
| 
       21 
21 
     | 
    
         
             
                else nil
         
     | 
| 
       22 
22 
     | 
    
         
             
                end
         
     | 
| 
       23 
23 
     | 
    
         
             
              end
         
     | 
| 
         @@ -28,7 +28,7 @@ class ManifestGenerator < GeneratorBase 
     | 
|
| 
       28 
28 
     | 
    
         
             
                db_options  = options[:db] || Hash.new
         
     | 
| 
       29 
29 
     | 
    
         
             
                column_name = db_options[:column] || "#{name}_id"
         
     | 
| 
       30 
30 
     | 
    
         
             
                db_options.delete :column
         
     | 
| 
       31 
     | 
    
         
            -
                @current_manifest_item[column_name] = { type: " 
     | 
| 
      
 31 
     | 
    
         
            +
                @current_manifest_item[column_name] = { type: "Crails::Odb::id_type", options: db_options }
         
     | 
| 
       32 
32 
     | 
    
         
             
              end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
              def has_many type, name, options = {}
         
     | 
    
        data/lib/metarecord/runner.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: meta-record
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Michael Martin Moro
         
     | 
| 
         @@ -27,6 +27,7 @@ files: 
     | 
|
| 
       27 
27 
     | 
    
         
             
            - lib/metarecord/generator_base.rb
         
     | 
| 
       28 
28 
     | 
    
         
             
            - lib/metarecord/generators/aurelia_generator.rb
         
     | 
| 
       29 
29 
     | 
    
         
             
            - lib/metarecord/generators/comet/archive_generator.rb
         
     | 
| 
      
 30 
     | 
    
         
            +
            - lib/metarecord/generators/comet/archive_renderer_generator.rb
         
     | 
| 
       30 
31 
     | 
    
         
             
            - lib/metarecord/generators/comet/data_generator.rb
         
     | 
| 
       31 
32 
     | 
    
         
             
            - lib/metarecord/generators/comet/edit_generator.rb
         
     | 
| 
       32 
33 
     | 
    
         
             
            - lib/metarecord/generators/crails/data_generator.rb
         
     | 
| 
         @@ -44,7 +45,7 @@ files: 
     | 
|
| 
       44 
45 
     | 
    
         
             
            - lib/metarecord/runner.rb
         
     | 
| 
       45 
46 
     | 
    
         
             
            homepage: https://github.com/crails-framework/meta-record
         
     | 
| 
       46 
47 
     | 
    
         
             
            licenses:
         
     | 
| 
       47 
     | 
    
         
            -
            -  
     | 
| 
      
 48 
     | 
    
         
            +
            - 0BSD
         
     | 
| 
       48 
49 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       49 
50 
     | 
    
         
             
            post_install_message:
         
     | 
| 
       50 
51 
     | 
    
         
             
            rdoc_options: []
         
     |