ar_loader 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ar_loader.rb CHANGED
@@ -1,53 +1,66 @@
1
- # Copyright:: (c) Autotelik Media Ltd 2011
2
- # Author :: Tom Statter
3
- # Date :: Aug 2010
4
- # License:: TBD. Free, Open Source. MIT ?
5
- #
6
- # Details:: Active Record Loader
7
- #
8
- module ArLoader
9
-
10
- def self.gem_version
11
- @gem_version ||= File.read( File.join( root_path, 'lib', 'VERSION') ).chomp
12
- @gem_version
13
- end
14
-
15
- def self.gem_name
16
- "ar_loader"
17
- end
18
-
19
- def self.root_path
20
- File.expand_path("#{File.dirname(__FILE__)}/..")
21
- end
22
-
23
- def self.require_libraries
24
-
25
- loader_libs = %w{ lib }
26
-
27
- # Base search paths - these will be searched recursively and any xxx.rake files autoimported
28
- loader_paths = []
29
-
30
- loader_libs.each {|lib| loader_paths << File.join(root_path, lib) }
31
-
32
- # Define require search paths, any dir in here will be added to LOAD_PATH
33
-
34
- loader_paths.each do |base|
35
- $:.unshift base if File.directory?(base)
36
- Dir[File.join(base, '**', '**')].each do |p|
37
- if File.directory? p
38
- $:.unshift p
39
- end
40
- end
41
- end
42
- end
43
-
44
- def self.require_tasks
45
- # Long parameter lists so ensure rake -T produces nice wide output
46
- ENV['RAKE_COLUMNS'] = '180'
47
- base = File.join(root_path, 'tasks', '**')
48
- Dir["#{base}/*.rake"].sort.each { |ext| load ext }
49
- end
50
-
51
- end
52
-
53
- ArLoader::require_libraries
1
+ # Copyright:: (c) Autotelik Media Ltd 2011
2
+ # Author :: Tom Statter
3
+ # Date :: Aug 2010
4
+ # License:: TBD. Free, Open Source. MIT ?
5
+ #
6
+ # Details:: Active Record Loader
7
+ #
8
+ require 'active_record'
9
+
10
+ module ArLoader
11
+
12
+ def self.gem_version
13
+ @gem_version ||= File.read( File.join( root_path, 'lib', 'VERSION') ).chomp
14
+ @gem_version
15
+ end
16
+
17
+ def self.gem_name
18
+ "ar_loader"
19
+ end
20
+
21
+ def self.root_path
22
+ File.expand_path("#{File.dirname(__FILE__)}/..")
23
+ end
24
+
25
+ def self.require_libraries
26
+
27
+ loader_libs = %w{ lib }
28
+
29
+ # Base search paths - these will be searched recursively and any xxx.rake files autoimported
30
+ loader_paths = []
31
+
32
+ loader_libs.each {|l| loader_paths << File.join(root_path(), l) }
33
+
34
+ # Define require search paths, any dir in here will be added to LOAD_PATH
35
+
36
+ loader_paths.each do |base|
37
+ $:.unshift base if File.directory?(base)
38
+ Dir[File.join(base, '**', '**')].each do |p|
39
+ if File.directory? p
40
+ $:.unshift p
41
+ end
42
+ end
43
+ end
44
+
45
+ require__libs = %w{ loaders engine }
46
+
47
+ require__libs.each do |base|
48
+ Dir[File.join('lib', base, '*.rb')].each do |rb|
49
+ unless File.directory? rb
50
+ require rb
51
+ end
52
+ end
53
+ end
54
+
55
+ end
56
+
57
+ def self.require_tasks
58
+ # Long parameter lists so ensure rake -T produces nice wide output
59
+ ENV['RAKE_COLUMNS'] = '180'
60
+ base = File.join(root_path, 'tasks', '**')
61
+ Dir["#{base}/*.rake"].sort.each { |ext| load ext }
62
+ end
63
+
64
+ end
65
+
66
+ ArLoader::require_libraries