dm-metamapper 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -37,6 +37,14 @@ module DataMapper
37
37
  @setup_model_blk = blk
38
38
  end
39
39
 
40
+ def snake_case
41
+ self.gsub(/::/, '/').
42
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
43
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
44
+ tr("-", "_").
45
+ downcase
46
+ end
47
+
40
48
  def inherited(klass)
41
49
  @subclasses ||= []
42
50
  @subclasses << klass
@@ -77,6 +85,7 @@ module DataMapper
77
85
  raise NoTemplateError, "Template does not exist at path #{template.full_path}"
78
86
  end
79
87
 
88
+ # puts "generating " + template.inspect
80
89
  compiled = ERB.new(File.read(template.full_path), nil, "%<>-").result(binding)
81
90
  path = respond_to?(:output_path) ? output_path(model, template) : template.output_name
82
91
  if !File.exists?(path) || File.read(path) != compiled
@@ -1,6 +1,6 @@
1
1
  module DataMapper
2
2
  module MetaMapper
3
- VERSION = "0.2.2" unless defined?(::DataMapper::MetaMapper::VERSION)
3
+ VERSION = "0.2.3" unless defined?(::DataMapper::MetaMapper::VERSION)
4
4
  end
5
5
 
6
6
  end
@@ -24,7 +24,7 @@ class O_<%= class_name %>{
24
24
  public:
25
25
 
26
26
  O_<%= class_name %>() {}
27
- <%- many_to_one.each do |r| -%>
27
+ <%- many_to_one.each do |r| -%>
28
28
  <%- parent = decolonize(r[1].parent_model_name) -%>
29
29
  O_<%= class_name %>(const I_<%= parent %>& parent_id)
30
30
  : _f_<%= r[1].child_key.first.name.to_s %>(parent_id)
@@ -38,6 +38,8 @@ public:
38
38
  <%- end -%>
39
39
 
40
40
  <%- one_to_many.each do |relative| -%>
41
+ <%- puts relative[1].child_model.inspect + " " + relative[1].parent_model.inspect-%>
42
+ <%- puts "" -%>
41
43
  std::vector<O_<%= decolonize(relative[1].child_model.to_s) %>> _<%= decolonize(relative[1].child_model.storage_name) %>() const
42
44
  {
43
45
  T_<%= decolonize(relative[1].child_model.to_s) %> table;
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-metamapper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonah Honeyman
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-01-31 00:00:00 Z
19
+ date: 2012-07-01 00:00:00 Z
20
20
  dependencies: []
21
21
 
22
22
  description: C++ API for databases created with DM. Hard typing, compile time checked queries.