ae_users_migrator 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ae_users_migrator}
8
- s.version = "1.0.2"
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nat Budin"]
12
- s.date = %q{2010-06-29}
12
+ s.date = %q{2010-07-18}
13
13
  s.default_executable = %q{export_ae_users}
14
14
  s.description = %q{Importer and exporter for ae_users databases using JSON-based dumpfiles}
15
15
  s.email = %q{natbudin@gmail.com}
@@ -33,10 +33,12 @@ module AeUsersMigrator
33
33
  end
34
34
 
35
35
  class Role
36
- attr_accessor :name
36
+ attr_accessor :name, :id, :people
37
37
 
38
38
  def initialize(json)
39
39
  self.name = json["name"]
40
+ self.id = json["id"]
41
+ self.people = []
40
42
  end
41
43
  end
42
44
 
@@ -74,9 +76,11 @@ module AeUsersMigrator
74
76
 
75
77
  class Dumpfile
76
78
  attr_reader :people
79
+ attr_reader :roles
77
80
 
78
81
  def initialize
79
82
  @people = {}
83
+ @roles = {}
80
84
  end
81
85
 
82
86
  def self.load(file)
@@ -93,6 +97,13 @@ module AeUsersMigrator
93
97
  df.people[p.id] = p
94
98
  end
95
99
 
100
+ df.people.each do |id, person|
101
+ person.roles.each do |role|
102
+ df.roles[role.id] ||= role
103
+ df.roles[role.id].people << person
104
+ end
105
+ end
106
+
96
107
  return df
97
108
  end
98
109
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ae_users_migrator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nat Budin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-29 00:00:00 -04:00
18
+ date: 2010-07-18 00:00:00 -04:00
19
19
  default_executable: export_ae_users
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency