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.
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "0.0.32"
2
+ VERSION = "0.0.33"
3
3
  end
@@ -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
- model_name = ask("What would you like the user model to be called? [user]")
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/"+@single.underscore+".rb", model_name.camelcase, "has_and_belongs_to_many :roles\n"
32
- @plural=model_name.pluralize
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
- @migname=@plural+"_roles" if (@plural.casecmp "roles")<0
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
- create_table :roles_<%= @migname %>, :force => true do |t|
8
- t.integer :<%= @single %>_id
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 :<%= @migname %>
24
+ drop_table :user_tokens
25
+ drop_table :roles_users
17
26
  drop_table :roles
18
27
  end
19
28
  end
@@ -1,3 +1,3 @@
1
1
  class Role < ActiveRecord::Base
2
- has_and_belongs_to_many :<%= @plural.underscore %>
2
+ has_and_belongs_to_many :users
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 32
9
- version: 0.0.32
8
+ - 33
9
+ version: 0.0.33
10
10
  platform: ruby
11
11
  authors:
12
12
  - Avocado