simple_worker 0.6.6 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/railtie.rb +7 -4
- metadata +2 -2
data/lib/railtie.rb
CHANGED
@@ -5,15 +5,15 @@ require 'rails'
|
|
5
5
|
|
6
6
|
module SimpleWorker
|
7
7
|
class Railtie < Rails::Railtie
|
8
|
-
# railtie_name :simple_worker deprecated
|
9
8
|
|
10
9
|
initializer "simple_worker.configure_rails_initialization" do |app|
|
11
|
-
|
10
|
+
SimpleWorker.logger.info "Initializing SimpleWorker for Rails 3..."
|
11
|
+
start_time = Time.now
|
12
12
|
SimpleWorker.configure do |c2|
|
13
13
|
models_path = File.join(Rails.root, 'app/models/*.rb')
|
14
14
|
c2.models = Dir.glob(models_path)
|
15
15
|
mailers_path = File.join(Rails.root, 'app/mailers/*.rb')
|
16
|
-
c2.mailers =Dir.glob(mailers_path).collect { |m| {:filename=>m, :name => File.basename(m), :path_to_templates=>File.join(Rails.root, "app/views/#{File.basename(m, File.extname(m))}")} }
|
16
|
+
c2.mailers = Dir.glob(mailers_path).collect { |m| {:filename=>m, :name => File.basename(m), :path_to_templates=>File.join(Rails.root, "app/views/#{File.basename(m, File.extname(m))}")} }
|
17
17
|
c2.extra_requires += ['active_support/core_ext', 'active_record', 'action_mailer']
|
18
18
|
c2.database = Rails.configuration.database_configuration[Rails.env]
|
19
19
|
c2.gems = get_required_gems if defined?(Bundler)
|
@@ -22,13 +22,16 @@ module SimpleWorker
|
|
22
22
|
SimpleWorker.logger.debug "DATABASE " + c2.database.inspect
|
23
23
|
SimpleWorker.logger.debug "GEMS " + c2.gems.inspect
|
24
24
|
end
|
25
|
+
end_time = Time.now
|
26
|
+
SimpleWorker.logger.info "SimpleWorker initialized. Duration: #{((end_time.to_f-start_time.to_f) * 1000.0).to_i} ms"
|
27
|
+
|
25
28
|
end
|
26
29
|
|
27
30
|
def get_required_gems
|
28
31
|
gems_in_gemfile = Bundler.environment.dependencies.select { |d| d.groups.include?(:default) }
|
29
32
|
gems =[]
|
30
33
|
specs = Bundler.load.specs
|
31
|
-
|
34
|
+
SimpleWorker.logger.debug 'Bundler specs=' + specs.inspect
|
32
35
|
gems_in_gemfile.each do |dep|
|
33
36
|
next if dep.name=='rails' #monkey patch
|
34
37
|
gem_info = {:name=>dep.name, :version=>dep.requirement}
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: simple_worker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Travis Reeder
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-20 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: zip
|