tophold_engine 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ #encoding: utf-8
2
+ require 'active_support/dependencies'
3
+
4
+ module ActiveSupport::Dependencies
5
+ alias_method :require_or_load_without_multiple, :require_or_load
6
+ def require_or_load(file_name, const_path = nil)
7
+ if file_name.starts_with?(Rails.root.to_s + '/app')
8
+ relative_name = file_name.gsub(Rails.root.to_s, '')
9
+ #@engine_paths ||= Rails::Application.railties.engines.collect{|engine| engine.config.root.to_s }
10
+ #EDIT: above line gives deprecation notice in Rails 3 (although it works in Rails 2), causing error in test env. Change to:
11
+ @engine_paths ||= <%=Rails.application.class.to_s%>.railties.engines.collect{|engine| engine.config.root.to_s }
12
+ @engine_paths.each do |path|
13
+ engine_file = File.join(path, relative_name)
14
+ require_or_load_without_multiple(engine_file, const_path) if File.file?(engine_file)
15
+ end
16
+ end
17
+ require_or_load_without_multiple(file_name, const_path)
18
+ end
19
+ end
20
+
@@ -0,0 +1,10 @@
1
+ require 'rails/generators'
2
+ class TopholdEngineGenerator < Rails::Generators::Base
3
+
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def install_engine_patch
7
+ template "rails_engine_namespace_patch.rb", "config/initializers/rails_engine_namespace_patch.rb"
8
+ end
9
+
10
+ end
@@ -2,6 +2,10 @@ module TopholdEngine
2
2
 
3
3
  class Engine < Rails::Engine
4
4
 
5
+ config.generators do |g|
6
+ g.orm :active_record
7
+ end
8
+
5
9
  initializer "tophold_rack.load_app_instance_data" do |app|
6
10
  TopholdEngine.setup do |config|
7
11
  config.app_root = app.root
@@ -12,10 +16,6 @@ module TopholdEngine
12
16
  # app.middleware.use ServeGridfsImage
13
17
  # end
14
18
 
15
- rake_tasks do
16
- #require 'resque/tasks'
17
- end
18
-
19
19
  end
20
20
 
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module TopholdEngine
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -6,7 +6,7 @@ require 'tophold_engine/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "tophold_engine"
8
8
  gem.version = TopholdEngine::VERSION
9
- gem.authors = ["shreadline"]
9
+ gem.authors = ["tteng"]
10
10
  gem.email = ["tim.rubist@gmail.com"]
11
11
  gem.description = %q{tophold models engine}
12
12
  gem.summary = %q{tophold models center}
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tophold_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - shreadline
8
+ - tteng
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-30 00:00:00.000000000 Z
12
+ date: 2013-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mysql2
@@ -82,6 +82,8 @@ files:
82
82
  - app/models/user_document.rb
83
83
  - config/initializers/basic_configatron_settings.rb
84
84
  - config/initializers/mongoid_extends_patch.rb
85
+ - lib/generators/tophold_engine/templates/rails_engine_namespace_patch.rb
86
+ - lib/generators/tophold_engine/tophold_engine_generator.rb
85
87
  - lib/serve_gridfs_image.rb
86
88
  - lib/tophold_engine.rb
87
89
  - lib/tophold_engine/engine.rb