tmp8-snailgun 1.2.0.2 → 1.2.1

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.
Files changed (2) hide show
  1. data/bin/snailgun +39 -9
  2. metadata +2 -3
@@ -18,6 +18,27 @@ envs = "test"
18
18
  rake = false
19
19
  verbose = false
20
20
 
21
+ def with_forced_dependency_loading
22
+ require 'active_support/dependencies'
23
+ eval <<-EOT
24
+ module ActiveSupport::Dependencies
25
+ def load?
26
+ true
27
+ end
28
+ end
29
+ EOT
30
+
31
+ yield
32
+ ensure
33
+ eval <<-EOT
34
+ module ActiveSupport::Dependencies
35
+ def load?
36
+ mechanism == :load
37
+ end
38
+ end
39
+ EOT
40
+ end
41
+
21
42
  def fix_rake
22
43
  require 'rbconfig'
23
44
  Config::CONFIG['bindir'] = File.expand_path(File.dirname(__FILE__))
@@ -63,6 +84,7 @@ when :ruby
63
84
 
64
85
  when :rails
65
86
  conf = File.expand_path('config/boot.rb')
87
+
66
88
  unless File.exist?(conf)
67
89
  raise "#{conf} does not exist, cannot continue"
68
90
  end
@@ -85,18 +107,24 @@ when :rails
85
107
  ENV['RAILS_ENV'] = env
86
108
  load conf
87
109
 
88
- if File.exist?('./.snailgun.preload')
89
- require 'snailgun/require_preload'
90
- else
91
- puts "please create a .snailgun.preload by ..."
110
+ with_forced_dependency_loading do
111
+ if File.exist?('./.snailgun.preload')
112
+ puts "loading ./.snailgun.preload"
113
+ require 'snailgun/require_preload'
114
+ elsif File.exist?('./snailgun_preload.rb')
115
+ puts "loading ./snailgun_preload.rb"
116
+ require './snailgun_preload.rb'
117
+ else
118
+ puts "please create a .snailgun.preload or a snailgun_preload.rb"
119
+ end
92
120
  end
93
121
 
94
- if Rails.respond_to?(:configuration) && Rails.configuration.cache_classes
95
- STDERR.puts <<-EOS
96
- WARNING: Snailgun doesn't work well with `cache_classes`. Strongly recommend
97
- `config.cache_classes = false` in config/environments/#{env}.rb
98
- EOS
122
+ ActiveSupport::Dependencies.loaded.each do |file|
123
+ puts "did autoload '#{file}'"
99
124
  end
125
+
126
+ ActiveSupport::Dependencies.clear
127
+
100
128
  STDERR.puts "Server ready for RAILS_ENV=#{env}"
101
129
  server.run
102
130
  end
@@ -150,3 +178,5 @@ when :merb
150
178
  # TODO: wait a few secs for them to die, 'KILL' if required
151
179
  STDERR.puts "Snailgun ended"
152
180
  end
181
+
182
+
metadata CHANGED
@@ -5,9 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 2
8
- - 0
9
- - 2
10
- version: 1.2.0.2
8
+ - 1
9
+ version: 1.2.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Brian Candler