databasion 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/databasion.gemspec +2 -2
- data/lib/databasion/loadlize.rb +9 -4
- metadata +4 -4
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ Jeweler::Tasks.new do |gem|
|
|
8
8
|
gem.email = "mojobojo@gmail.com"
|
9
9
|
gem.homepage = "http://github.com/boj/databasion"
|
10
10
|
gem.authors = ["Brian Jones", "Istpika"]
|
11
|
-
gem.version = "0.0.
|
11
|
+
gem.version = "0.0.5"
|
12
12
|
|
13
13
|
gem.add_dependency('activerecord', '>= 2.3.5')
|
14
14
|
gem.add_dependency('activesupport', '>= 2.3.5')
|
data/databasion.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{databasion}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian Jones", "Istpika"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-21}
|
13
13
|
s.default_executable = %q{databasion}
|
14
14
|
s.email = %q{mojobojo@gmail.com}
|
15
15
|
s.executables = ["databasion"]
|
data/lib/databasion/loadlize.rb
CHANGED
@@ -20,12 +20,17 @@ module Databasion
|
|
20
20
|
|
21
21
|
models.each do |model|
|
22
22
|
f = model.split('/')
|
23
|
-
|
24
|
-
|
23
|
+
normal_name = f[f.size-1].split(".")[0]
|
24
|
+
plural_name = normal_name.pluralize
|
25
|
+
camel_name = normal_name.camelize
|
25
26
|
|
26
27
|
Databasion::LOGGER.info "Loading %s into database..." % camel_name
|
27
28
|
|
28
|
-
|
29
|
+
begin
|
30
|
+
yaml_file = YAML.load_file('%s/%s.yml' % [@@config['output']['yaml_path'], plural_name])
|
31
|
+
rescue
|
32
|
+
yaml_file = YAML.load_file('%s/%s.yml' % [@@config['output']['yaml_path'], normal_name])
|
33
|
+
end
|
29
34
|
|
30
35
|
for row in yaml_file['data']
|
31
36
|
klass = eval("%s.new" % camel_name)
|
@@ -36,7 +41,7 @@ module Databasion
|
|
36
41
|
klass.id = row['id']
|
37
42
|
klass.update_attributes(row)
|
38
43
|
end
|
39
|
-
end
|
44
|
+
end if yaml_file['data']
|
40
45
|
end
|
41
46
|
end
|
42
47
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: databasion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Jones
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-05-
|
19
|
+
date: 2010-05-21 00:00:00 +09:00
|
20
20
|
default_executable: databasion
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|