blueprint-generators-rails 0.0.3 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4999d4e07cfdd49b11513b7ce6edd41fa287f725
4
- data.tar.gz: 2c06e8027acbe7efa129e28f3c945d0bf2307e25
3
+ metadata.gz: 6e093116648ccadb8e7e3af697d340d6cc8328ff
4
+ data.tar.gz: 529e32ca8435ebb1b8838eb7517d08db54283efb
5
5
  SHA512:
6
- metadata.gz: 9e033c548e479d8fb6f3d48b196bd4cf032e628d450a1594f93ed41a405b7758fdfb9792a47b565bb0d4f6f41cf21894443376403560d8c9aff7f515d309a9fa
7
- data.tar.gz: 9f85e78fd1db2cb59fdb081e25afb5e32250d30a736b8f4db061b712dfe69e78a7ca279c74e10e1c89e264b4346a73682e865212c9888d941362ec5b048f3dd9
6
+ metadata.gz: 9bb08f536ea6a9d9215f0ef5971d491a0d229d0094877209aac2e61c3629ad7d954550c87e35c674f4fcf814679621fbd3b50fc38d575e10ef39bbd05e1d6248
7
+ data.tar.gz: 2ec7633abc39453b87bc9859dc6980f0c3e6ea4ded2c501c1f99dfe5b40a3583f73f85af38b35274cbbcd524c72c01c47dcfe3ccef6a47184e9a408575b43ab0
@@ -1,7 +1,7 @@
1
1
  module Blueprint
2
2
  module Generators
3
3
  module Rails
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.6"
5
5
  end
6
6
  end
7
7
  end
@@ -8,7 +8,7 @@ namespace :blueprint do
8
8
 
9
9
  models = ActiveRecord::Base.descendants
10
10
  models.each { |m|
11
- pogo << "\n concept \"" + m.name + "\"\n"
11
+ pogo << "\n concept \"" + humanise(m.name) + "\"\n"
12
12
 
13
13
  associations = m.reflect_on_all_associations
14
14
  associations.each { |a|
@@ -18,9 +18,9 @@ namespace :blueprint do
18
18
 
19
19
  case a.macro
20
20
  when :belongs_to, :has_one
21
- pogo << " has one \"" + a.name.to_s.singularize.capitalize + "\"\n"
21
+ pogo << " has one \"" + humanise(a.name.to_s.singularize.capitalize) + "\"\n"
22
22
  when :has_many
23
- pogo << " has many \"" + a.name.to_s.singularize.capitalize + "\"\n"
23
+ pogo << " has many \"" + humanise(a.name.to_s.singularize.capitalize) + "\"\n"
24
24
  else
25
25
  # TODO error condition
26
26
  end
@@ -47,4 +47,19 @@ namespace :blueprint do
47
47
  task :conceptualize => :cm do
48
48
  end
49
49
 
50
+ private
51
+
52
+ def self.humanise(str)
53
+ # this block applies a naming clean-up by camel-casing any words after an underscore (e.g.: Invited_by => InvitedBy)
54
+
55
+ tokens = str.scan(/[_]+[\w]/)
56
+ unless tokens.empty?
57
+ tokens.each { |t|
58
+ str[t]= t[-1, 1].capitalize
59
+ }
60
+ end
61
+
62
+ str
63
+ end
64
+
50
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blueprint-generators-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - benjii