dfl-factories-and-workers 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGELOG +4 -0
  2. data/init.rb +1 -3
  3. data/rails/init.rb +20 -18
  4. metadata +1 -1
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ * [10/22/2008] - 0.1.4
2
+
3
+ Prevent rails/init from loading factories.rb, etc. if inside rake db:*
4
+
1
5
  * [10/22/2008] - 0.1.3
2
6
 
3
7
  FactoryBuilder was using #classify which also calls #singularize... now uses camelize instead.
data/init.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  if defined?(RAILS_ENV) && __FILE__ =~ %r{vendor/plugins} # are we running as a rails plugin?
2
2
 
3
- # Modify the variable below to specify in which environments this plugin should be loaded.
3
+ # Modify the variable below to specify in which environments this plugin should be loaded.
4
4
  load_plugin_in = {
5
5
  'test' => true,
6
6
  'development' => true, # NOTE: often comes in handy in the console
@@ -24,5 +24,3 @@ else # bootstrap the gem
24
24
  # end
25
25
 
26
26
  end
27
-
28
-
data/rails/init.rb CHANGED
@@ -2,26 +2,28 @@ require 'fileutils'
2
2
 
3
3
  config.after_initialize do
4
4
 
5
- # if script_console_running = defined?(::IRB) && ::IRB.conf[:LOAD_MODULES] && ::IRB.conf[:LOAD_MODULES].include?('console_with_helpers')
6
- # # mixin to Object if we are running in ./script/console
5
+ unless $*.grep(/db:*/) # prevent the plugin from loading if we are simply running rake db:migrate, etc.
6
+
7
+ # if script_console_running = defined?(::IRB) && ::IRB.conf[:LOAD_MODULES] && ::IRB.conf[:LOAD_MODULES].include?('console_with_helpers')
8
+ # # mixin to Object if we are running in ./script/console
7
9
  obj = Object
8
- # else # otherwise just mix into Test::Unit to play it safe
9
- # obj = Test::Unit::TestCase
10
- # end
10
+ # else # otherwise just mix into Test::Unit to play it safe
11
+ # obj = Test::Unit::TestCase
12
+ # end
11
13
 
12
- # mixin plugin
13
- obj.send :include, FactoriesAndWorkers::Factory
14
- obj.send :include, FactoriesAndWorkers::Worker
15
-
16
- # load factory and worker definition files if they exist
17
- %w(spec/factories.rb spec/factory_workers.rb test/factories.rb test/factory_workers.rb).each do |file|
18
- path = File.join(Dir.pwd, file)
19
- require path if File.exists?(path)
20
- end
14
+ # mixin plugin
15
+ obj.send :include, FactoriesAndWorkers::Factory
16
+ obj.send :include, FactoriesAndWorkers::Worker
21
17
 
22
- # mixin factory and worker definitions
23
- obj.send :include, ::TestFactories if defined?(TestFactories)
24
- obj.send :include, ::FactoryWorkers if defined?(FactoryWorkers)
25
- end
18
+ # load factory and worker definition files if they exist
19
+ %w(spec/factories.rb spec/factory_workers.rb test/factories.rb test/factory_workers.rb).each do |file|
20
+ path = File.join(Dir.pwd, file)
21
+ require path if File.exists?(path)
22
+ end
26
23
 
24
+ # mixin factory and worker definitions
25
+ obj.send :include, ::TestFactories if defined?(TestFactories)
26
+ obj.send :include, ::FactoryWorkers if defined?(FactoryWorkers)
27
+ end
27
28
 
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dfl-factories-and-workers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Herald