devisable 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -9,21 +9,23 @@ It is a quick and easy generator that sets up devise,cancan and/or oauth on your
9
9
  * Has a user and roles tool so you can change permissions inside a gui
10
10
  * Supports all devise options
11
11
  * Contains rspec and cucumber test options
12
- * Can be added to existing project that don't already have devise.
12
+ * Can be added to existing project that don't already have devise. More work will be required here because you will have to move around files to match your project.
13
13
 
14
14
  == Installation
15
15
 
16
16
  Devisable supports rails 3 with ruby >= 1.9.2.
17
17
 
18
- gem install devisable
18
+ Add devisable to your gemfile
19
19
 
20
- Then Add devisable to your gemfile
20
+ Run bundle
21
21
 
22
22
  rails generate devisable --help
23
23
 
24
24
  == Usage
25
25
 
26
- It is always good practice to start a new branch in your repo before making major updates like when using devisable.
26
+ It is always good practice to start a new branch in your repo before making major updates like when using devisable.
27
+
28
+ At least make sure you have committed all updates prior, in case you have to rollback.
27
29
 
28
30
  Use --help to see a list of complete options
29
31
 
@@ -59,6 +61,10 @@ To just setup Basic authentication with devisable
59
61
  rails generate devisable
60
62
 
61
63
  This will setup with the devise options 1,4,5,7,8,10
64
+
65
+ Starting a project - Use the -n option
66
+
67
+ rails generate devisable -n
62
68
 
63
69
  Twitter Oauth - Note you will need to setup your app in twitter before running this
64
70
 
@@ -75,11 +81,7 @@ Facebook Oauth
75
81
  All three (normal authentication,twitter_oauth, facebook_oauth)
76
82
 
77
83
  rails generate devisable -c 1,2,3,5,6,7,8 -t asdf489fhkbnajbsdf,2uh3uh383493hkjdf -o asdf489fhkbnajbsdf,2uh3uh383493hkjdf,10100101001 -u http://dev.yoururl.com
78
-
79
- Starting a project - Use the -n option
80
-
81
- rails generate devisable -c 1,2,3,5,6,7,8 -t asdf489fhkbnajbsdf,2uh3uh383493hkjdf -o asdf489fhkbnajbsdf,2uh3uh383493hkjdf,10100101001 -n -u http://dev.yoururl.com
82
-
84
+
83
85
  Add Cucumber tests - use the -C option
84
86
 
85
87
  rails generate devisable -c 1,2,3,5,6,7,8 -t asdf489fhkbnajbsdf,2uh3uh383493hkjdf -o asdf489fhkbnajbsdf,2uh3uh383493hkjdf,10100101001 -n -C -u http://dev.yoururl.com
@@ -87,6 +89,11 @@ Add Cucumber tests - use the -C option
87
89
  Add extra fields to the user model
88
90
 
89
91
  rails generate devisable -e first_name:string,last_name:string
92
+
93
+ After running the generator you will most likely need to do a migration.
94
+
95
+ rake db:migrate
96
+
90
97
 
91
98
  == Contributing to devisable
92
99
 
@@ -104,8 +111,29 @@ Add extra fields to the user model
104
111
  * Support for haml and sass instead of erb
105
112
  * Add Facebook javascript autologin option
106
113
 
114
+ == Gems
115
+
116
+ devisable uses the following gems:
117
+
118
+ * devise (https://github.com/plataformatec/devise)
119
+ * cancan (https://github.com/ryanb/cancan.git)
120
+ * warden_oauth (https://github.com/scottsampson/warden_oauth)
121
+ * json_pure (https://github.com/flori/json)
122
+ * twitter_oauth (https://github.com/moomerman/twitter_oauth.git)
123
+ * cucumber (https://github.com/aslakhellesoy/cucumber)
124
+ * cucumber-rails (https://github.com/aslakhellesoy/cucumber-rails)
125
+ * capybara (https://github.com/jnicklas/capybara)
126
+ * database_cleaner (https://github.com/bmabey/database_cleaner)
127
+ * rspec-rails (https://github.com/rspec/rspec-rails)
128
+
129
+ == Maintainers
130
+
131
+ * cloudspace (http://www.cloudspace.com - https://github.com/cloudspace)
132
+ * Scott Sampson (http://github.com/scottsampson)
133
+ * Jeremiah Hemphill (http://github.com/jeremiahishere)
134
+
107
135
  == Copyright
108
136
 
109
- Copyright (c) 2011 Scott. See LICENSE.txt for
137
+ Copyright (c) 2011 cloudspace. See LICENSE.txt for
110
138
  further details.
111
139
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/devisable.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{devisable}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Scott Sampson", "Jeremiah Hemphill"]
12
- s.date = %q{2011-03-23}
12
+ s.date = %q{2011-06-28}
13
13
  s.description = %q{Generates initial code for a devise install. Gives the options for oauth, using cancan, and creating a user tool to manage the users.}
14
14
  s.email = %q{scott@cloudspace.com}
15
15
  s.extra_rdoc_files = [
@@ -79,6 +79,8 @@ Gem::Specification.new do |s|
79
79
  "lib/generators/devisable/templates/spec/models/role_spec.erb",
80
80
  "lib/generators/devisable/templates/spec/models/user_spec.erb",
81
81
  "pkg/devisable-0.1.0.gem",
82
+ "pkg/devisable-0.1.1.gem",
83
+ "pkg/devisable-0.1.2.gem",
82
84
  "pkg/devise_generator-0.1.0.gem",
83
85
  "test/helper.rb",
84
86
  "test/test_devise_generator.rb"
@@ -169,6 +169,9 @@ class DevisableGenerator < Rails::Generators::Base
169
169
  end
170
170
  rep_str = ' devise ' + rep_str[1..-1] + "\n"
171
171
  gsub_file "app/models/user.rb" , /^[ ]*(devise)([^\n]*)(\n)(.*)(\s)/, rep_str
172
+
173
+ str = "attr_accessible :username\n"
174
+ insert_into_file "app/models/user.rb", str, :after => "# Setup accessible (or protected) attributes for your model\n"
172
175
 
173
176
  rep_str = load_erb_string('partials/_user_model_methods.erb')
174
177
  replace_last_end_in_file_with("app/models/user.rb",rep_str)
@@ -246,15 +249,15 @@ class DevisableGenerator < Rails::Generators::Base
246
249
  insert_into_file user_migration_file, fields, :after => "t.token_authenticatable\n"
247
250
 
248
251
  #add correct fields to user model
249
- str = "attr_accessible :default_provider, :username\n"
250
- insert_into_file "app/models/user.rb", str, :after => "# Setup accessible (or protected) attributes for your model\n"
252
+ str = "attr_accessible :default_provider\n"
253
+ insert_into_file "app/models/user.rb", str, :after => "attr_accessible :username\n"
251
254
 
252
255
  generate("model", "oauth_profile user_id:integer provider:string token:string secret:string username:string email:string name:string img_url:string")
253
256
 
254
257
  insert_into_file "app/models/oauth_profile.rb", "belongs_to :user\n", :after => "class OauthProfile < ActiveRecord::Base\n"
255
258
 
256
259
  insert_into_file "app/models/user.rb", "has_many :oauth_profiles\n", :after => "class User < ActiveRecord::Base\n"
257
-
260
+
258
261
  end
259
262
 
260
263
  # Link to "Login With Twitter/Facebook" somewhere in your view
@@ -28,6 +28,6 @@ end
28
28
 
29
29
  Given /^I am signed out$/ do
30
30
  Given %{I am on the sign out page}
31
- Then %{I should be on the homepage page}
31
+ Then %{I should be on the homepage}
32
32
  #And %{I should see "Sign out successful"}
33
33
  end
@@ -13,7 +13,7 @@ Feature: Manage users
13
13
  Given I am signed in as "user@cloudspace.com"
14
14
  And I only have the role "GeneralUser"
15
15
  When I go to the users page
16
- When I should be on the home page
16
+ When I should be on the homepage
17
17
  And I should see "You are not authorized to access this page."
18
18
 
19
19
  Scenario: Editing a User
@@ -7,35 +7,28 @@ describe Ability do
7
7
  :name => 'SuperAdmin'
8
8
  })
9
9
 
10
- @role2 = Role.new({
11
- :name => 'RoleUser'
12
- })
13
-
14
- @user = User.new({:email => 'fred@testsite.com'})
15
- @user2 = User.new({:email => 'terry@testsite.com'})
10
+ @user = User.new({:email => 'fred@testsite.com', :username=>'fred', :password=>'pwfred'})
16
11
  @user.roles << @role
17
- @user2.roles << @role2
18
-
19
12
  @role.permissions << Permission.new({:model => 'Role',:ability => 'Add'})
20
13
  @role.permissions << Permission.new({:model => 'Role',:ability => 'Edit'})
21
14
  @role.permissions << Permission.new({:model => 'Role',:ability => 'Delete'})
22
15
  @role.permissions << Permission.new({:model => 'Role',:ability => 'View'})
23
- @role.save
24
- @user.save
16
+ @role.save!
17
+ @user.save!
25
18
  @user_ability = Ability.new(@user)
26
19
 
27
20
  @role2 = Role.new({
28
21
  :name => 'RoleUser'
29
22
  })
30
23
 
31
- @user2 = User.new({:email => 'terry@testsite.com'})
24
+ @user2 = User.new({:email => 'terry@testsite.com', :username=>'terry', :password=>'pwterry'})
32
25
  @user2.roles << @role2
33
26
  @role2.permissions << Permission.new({:model => 'Role',:ability => 'add'})
34
27
  @role2.permissions << Permission.new({:model => 'Role',:ability => 'edit'})
35
28
  @role2.permissions << Permission.new({:model => 'Role',:ability => 'delete'})
36
29
  @role2.permissions << Permission.new({:model => 'Role',:ability => 'View'})
37
- @role2.save
38
- @user2.save
30
+ @role2.save!
31
+ @user2.save!
39
32
  @user_ability2 = Ability.new(@user2)
40
33
 
41
34
  end
@@ -8,16 +8,14 @@ describe User do
8
8
  @role2 = Role.new({
9
9
  :name => 'SuperAdmin'
10
10
  })
11
- @role.save
12
- @role2.save
13
- @user = User.new({:email => 'fred@testsite.com'})
14
- @user2 = User.new({:email => 'fred2@testsite.com',:username => 'fred2'})
15
- @user3 = User.new({:username => 'fred3'})
16
- @user4 = User.new()
11
+ @role.save!
12
+ @role2.save!
13
+ @user = User.new({:email => 'fred@testsite.com', :password=>'pwfred'})
14
+ @user2 = User.new({:email => 'fred2@testsite.com',:username => 'fred2', :password=>'fred2pw'})
17
15
  @user.roles << @role
18
- @user.save
16
+ @user.save!
19
17
  @user2.roles << @role2
20
- @user2.save
18
+ @user2.save!
21
19
  end
22
20
 
23
21
  it "should have the role Admin if assigned the Admin Role" do
@@ -32,12 +30,7 @@ describe User do
32
30
  (@user.display_name == 'fred@testsite.com').should be_true
33
31
  end
34
32
 
35
- it "should have username fred if there is a username and an email" do
36
- (@user2.display_name == 'fred2').should be_true
37
- end
38
-
39
- it "should have username fred if there is a username and no email" do
40
- @user2.email = ''
33
+ it "should have username fred2 if there is a username and an email" do
41
34
  (@user2.display_name == 'fred2').should be_true
42
35
  end
43
36
 
@@ -46,14 +39,6 @@ describe User do
46
39
  User.superadmins.include?(@user).should be_false
47
40
  end
48
41
 
49
- it "should require a username or email" do
50
- @user4.should_not be_valid
51
- end
52
-
53
- it "should be valid with a username" do
54
- @user3.should be_valid
55
- end
56
-
57
42
  it "should be valid with an email" do
58
43
  @user.should be_valid
59
44
  end
Binary file
Binary file
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: devisable
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Scott Sampson
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-03-23 00:00:00 -04:00
14
+ date: 2011-06-28 00:00:00 -04:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -130,6 +130,8 @@ files:
130
130
  - lib/generators/devisable/templates/spec/models/role_spec.erb
131
131
  - lib/generators/devisable/templates/spec/models/user_spec.erb
132
132
  - pkg/devisable-0.1.0.gem
133
+ - pkg/devisable-0.1.1.gem
134
+ - pkg/devisable-0.1.2.gem
133
135
  - pkg/devise_generator-0.1.0.gem
134
136
  - test/helper.rb
135
137
  - test/test_devise_generator.rb
@@ -147,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
149
  requirements:
148
150
  - - ">="
149
151
  - !ruby/object:Gem::Version
150
- hash: -4424740514264629431
152
+ hash: -2159356801736187739
151
153
  segments:
152
154
  - 0
153
155
  version: "0"