avo-setup 0.0.32 → 0.0.33
Sign up to get free protection for your applications and to get access to all the features.
data/lib/avo-setup/version.rb
CHANGED
@@ -16,7 +16,9 @@ module Avo
|
|
16
16
|
gem("devise", :git => 'git://github.com/plataformatec/devise', :branch => 'master')
|
17
17
|
run('bundle update')
|
18
18
|
generate("devise:install")
|
19
|
-
|
19
|
+
template "user_token.rb", "app/models/user_token.rb"
|
20
|
+
template "user.rb", "app/models/user.rb"
|
21
|
+
|
20
22
|
model_name = "user" if model_name.blank?
|
21
23
|
generate("devise", model_name)
|
22
24
|
generate("devise:views")
|
@@ -28,11 +30,11 @@ module Avo
|
|
28
30
|
copy_file "ability.rb", "models/ability.rb"
|
29
31
|
@single=model_name
|
30
32
|
#insert_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n"
|
31
|
-
inject_into_class "app/models/
|
32
|
-
|
33
|
+
inject_into_class "app/models/user.rb", model_name.camelcase, "has_and_belongs_to_many :roles\n"
|
34
|
+
|
35
|
+
|
33
36
|
template "role.rb", "app/models/role.rb"
|
34
|
-
|
35
|
-
@migname="roles_"+@plural if (@plural.casecmp "roles")>=0
|
37
|
+
|
36
38
|
|
37
39
|
migration_template 'create_roles_migration.rb', "db/migrate/create_roles.rb"
|
38
40
|
end
|
@@ -4,16 +4,25 @@ class CreateRolesMigration < ActiveRecord::Migration
|
|
4
4
|
t.string :title
|
5
5
|
t.timestamps
|
6
6
|
end
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
create_table :user_tokens, :force => true do |t|
|
9
|
+
t.string :provider
|
10
|
+
t.string :uid
|
11
|
+
t.integer :user_id
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
create_table :roles_users, :force => true do |t|
|
15
|
+
t.integer :user_id
|
9
16
|
t.integer :role_id
|
10
17
|
t.timestamps
|
11
18
|
end
|
12
19
|
|
20
|
+
|
13
21
|
end
|
14
22
|
|
15
23
|
def self.down
|
16
|
-
drop_table
|
24
|
+
drop_table :user_tokens
|
25
|
+
drop_table :roles_users
|
17
26
|
drop_table :roles
|
18
27
|
end
|
19
28
|
end
|