dfl-factories-and-workers 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +4 -2
  2. data/init.rb +28 -2
  3. data/rails/init.rb +4 -6
  4. metadata +2 -2
data/README.rdoc CHANGED
@@ -4,13 +4,15 @@ Originally written by Nathan Herald @ Myobie.com
4
4
 
5
5
  Feature enhancements by David Lowenfels @ InternautDesign.com
6
6
 
7
- Minor improvements by Jonathan Barket
7
+ Gemification by Jonathan Barket
8
8
 
9
9
  == Get It
10
10
 
11
11
  Add it as a gem dependency
12
12
 
13
- config.gem 'dfl-factories-and-workers', :lib => 'factories-and-workers', :source => 'http://gems.github.com'
13
+ config.after_initialize do
14
+ config.gem 'dfl-factories-and-workers', :lib => 'factories-and-workers', :source => 'http://gems.github.com' unless RAILS_ENV=='production'
15
+ end
14
16
 
15
17
  Or install it as a gem manually
16
18
 
data/init.rb CHANGED
@@ -1,2 +1,28 @@
1
- require "factories-and-workers"
2
- require File.dirname(__FILE__)+"/rails/init.rb" if defined?(RAILS_ENV)
1
+ if defined?(RAILS_ENV) && __FILE__ =~ %r{vendor/plugins} # are we running as a rails plugin?
2
+
3
+ # Modify the variable below to specify in which environments this plugin should be loaded.
4
+ load_plugin_in = {
5
+ 'test' => true,
6
+ 'development' => true, # NOTE: often comes in handy in the console
7
+ 'production' => false,
8
+ }
9
+
10
+ if load_plugin_in[ RAILS_ENV ]
11
+ require "factories-and-workers"
12
+ require File.dirname(__FILE__)+"/rails/init.rb"
13
+ end
14
+
15
+
16
+ else # bootstrap the gem
17
+
18
+ require "factories-and-workers"
19
+ require File.dirname(__FILE__)+"/rails/init.rb" if defined?(RAILS_ENV)
20
+
21
+ # NOTE: if using as a gem with Rails and you want similar behaviour as above, do something like this in environment.rb :
22
+ # config.after_initialize do
23
+ # config.gem 'dfl-factories-and-workers', :lib => 'factories-and-workers', :source => 'http://gems.github.com' unless RAILS_ENV=='production'
24
+ # end
25
+
26
+ end
27
+
28
+
data/rails/init.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  require 'fileutils'
2
2
 
3
- # config.after_initialize do
4
- %w(spec/factories.rb spec/factory_workers.rb test/factories.rb test/factory_workers.rb).each do |file|
5
- path = File.join(Dir.pwd, file)
6
- require path if File.exists?(path)
7
- end
8
- # end
3
+ %w(spec/factories.rb spec/factory_workers.rb test/factories.rb test/factory_workers.rb).each do |file|
4
+ path = File.join(Dir.pwd, file)
5
+ require path if File.exists?(path)
6
+ 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.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Herald
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2008-10-14 00:00:00 -07:00
14
+ date: 2008-10-15 00:00:00 -07:00
15
15
  default_executable:
16
16
  dependencies: []
17
17