drupal83 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -3,6 +3,10 @@ https://rubygems.org/gems/drupal83
3
3
 
4
4
  Help you to migrate Drupal (php) to a Ruby web project ;)
5
5
 
6
+ WARNIG ::
7
+ for now you can use this gem only with a 6.1.* Drupal site.
8
+ we plan to manage Drupal 7 site in future version
9
+
6
10
  ## Dependencies
7
11
  datamapper sources http://datamapper.org/
8
12
 
data/lib/drupal/role.rb CHANGED
@@ -5,5 +5,12 @@ module Drupal
5
5
 
6
6
  property :rid, Serial
7
7
  property :name, String
8
+
9
+ has n, :user_roles,
10
+ :child_key => [:rid],
11
+ :repository => Drupal::Repository
12
+
13
+ has n, :users, :through => :user_roles
14
+
8
15
  end
9
16
  end
data/lib/drupal/user.rb CHANGED
@@ -21,6 +21,12 @@ module Drupal
21
21
  has n, :comments,
22
22
  :child_key => [:uid],
23
23
  :repository => Drupal::Repository
24
+
25
+ has n, :user_roles,
26
+ :child_key => [:uid],
27
+ :repository => Drupal::Repository
28
+
29
+ has n, :roles, :through => :user_roles
24
30
 
25
31
  def profile
26
32
  Drupal::Node.first :type => 'profile', :uid => uid
@@ -29,4 +35,20 @@ module Drupal
29
35
  #property :created, Date
30
36
  #def created_at ; Time.at(self[:created]) ; end
31
37
  end
38
+
39
+ class UserRole
40
+ eval Drupal.common
41
+ storage_names[:drupal] = 'users_roles'
42
+
43
+ property :rid, Integer
44
+ property :uid, Integer
45
+
46
+ belongs_to :role,
47
+ :child_key => [:rid],
48
+ :repository => Drupal::Repository
49
+
50
+ belongs_to :user,
51
+ :child_key => [:uid],
52
+ :repository => Drupal::Repository
53
+ end
32
54
  end
@@ -1,3 +1,3 @@
1
1
  module Drupal
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drupal83
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: