rare_map 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/rare_map/version.rb +1 -1
  2. data/lib/rare_map.rb +16 -0
  3. metadata +2 -2
@@ -2,7 +2,7 @@ class RareMap
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 2
5
- PATCH = 3
5
+ PATCH = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
data/lib/rare_map.rb CHANGED
@@ -32,6 +32,7 @@ module RareMap
32
32
  puts ' Add following line to your config/application.rb'
33
33
  puts " config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**}')]"
34
34
  puts '*****************************************************************************'
35
+ create_initializer
35
36
  else
36
37
  puts '*****************************************************************************'
37
38
  puts ' A demo.rb is generated'
@@ -50,6 +51,21 @@ module RareMap
50
51
  f.write "Dir[File.dirname(__FILE__) + '/app/models/**/*.rb'].each { |file| require file }\n"
51
52
  f.close
52
53
  end
54
+
55
+ def create_initializer
56
+ f = File.new(@rails_root + 'config/initializers/rare_map.rb')
57
+ f.write "bases = []; models = []\n"
58
+ f.write "Dir[Rails.root + 'app/models/**/*.rb'].each do |file|\n"
59
+ f.write " if file =~ /models\/[^\/]+\/[^\/]+_base.rb$/\n"
60
+ f.write " bases << file\n"
61
+ f.write " elsif file =~ /models\/[^\/]+\/[^\/]+.rb$/\n"
62
+ f.write " models << file\n"
63
+ f.write " end\n"
64
+ f.write "end\n"
65
+ f.write "bases.map { |b| require b }\n"
66
+ f.write "models.map { |m| require m }\n"
67
+ f.close
68
+ end
53
69
  end
54
70
  end
55
71
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rare_map
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -142,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  segments:
144
144
  - 0
145
- hash: 2300737203530498091
145
+ hash: 2043049972341122083
146
146
  required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  none: false
148
148
  requirements: