molo 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
data/Molo.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{molo}
8
- s.version = "0.7.4"
8
+ s.version = "0.7.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joel Moss", "Todd Huss", "Michael Grosser"]
12
- s.date = %q{2010-12-20}
12
+ s.date = %q{2010-12-21}
13
13
  s.email = %q{joel@developwithstyle.com}
14
14
  s.extra_rdoc_files = [
15
15
  "README.markdown"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.4
1
+ 0.7.5
data/lib/tasks/molo.rb CHANGED
@@ -244,14 +244,14 @@ class MigratorTasks < ::Rake::TaskLib
244
244
  task :load => :ar_init do
245
245
  format_class = ENV['class'] || "YamlDb::Helper"
246
246
  helper = format_class.constantize
247
- SerializationHelper::Base.new(helper).load(db_dump_data_file helper.extension)
247
+ SerializationHelper::Base.new(helper).load db_dump_data_file(helper.extension), table_options
248
248
  end
249
249
 
250
250
  desc "Load contents of db/data/* into database"
251
251
  task :load_dir => :ar_init do
252
252
  dir = ENV['dir'] || "data"
253
253
  format_class = ENV['class'] || "YamlDb::Helper"
254
- SerializationHelper::Base.new(format_class.constantize).load_from_dir dump_dir("/#{dir}")
254
+ SerializationHelper::Base.new(format_class.constantize).load_from_dir dump_dir("/#{dir}"), table_options
255
255
  end
256
256
  end
257
257
 
@@ -49,9 +49,26 @@ module SerializationHelper
49
49
  reenable_logger
50
50
  end
51
51
 
52
- def load_from_dir(dirname, truncate = true)
52
+ def load_from_dir(dirname, *opts)
53
+ options = opts.extract_options!
54
+
55
+ truncate = options[:truncate] || true
56
+ except = options[:except].is_a?(String) ? options[:except].split(',') : options[:except]
57
+ only = options[:only].is_a?(String) ? options[:only].split(',') : options[:only]
58
+
53
59
  Dir.entries(dirname).each do |filename|
54
60
  next if filename =~ /^[.]/
61
+ table = filename.gsub(/\.[a-z]+/, "")
62
+
63
+ if except.present? and except.include? table
64
+ puts " excluding #{filename}"
65
+ next
66
+ end
67
+
68
+ if only.present? and !only.include? table
69
+ puts " excluding #{filename}"
70
+ next
71
+ end
55
72
 
56
73
  puts " -- loading data: #{filename}"
57
74
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: molo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 4
10
- version: 0.7.4
9
+ - 5
10
+ version: 0.7.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joel Moss
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-12-20 00:00:00 +00:00
20
+ date: 2010-12-21 00:00:00 +00:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency