thoughtbot-clearance 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.textile CHANGED
@@ -1,3 +1,7 @@
1
+ h2. 0.6.5 (5/17/2009)
2
+
3
+ * [#6] Make Clearance i18n aware. (Timur Vafin, Marcel Goerner, Eugene Bolshakov, Dan Croak)
4
+
1
5
  h2. 0.6.4 (05/12/2009)
2
6
 
3
7
  * Moved issue tracking to Github from Lighthouse. (Dan Croak)
data/README.textile CHANGED
@@ -14,19 +14,23 @@ Clearance is a Rails engine. It works with versions of Rails greater than 2.3.
14
14
 
15
15
  In config/environment.rb:
16
16
 
17
- config.gem "thoughtbot-clearance",
18
- :lib => 'clearance',
19
- :source => 'http://gems.github.com',
20
- :version => '0.6.4'
17
+ <pre>
18
+ config.gem "thoughtbot-clearance",
19
+ :lib => 'clearance',
20
+ :source => 'http://gems.github.com',
21
+ :version => '0.6.4'
22
+ </pre>
21
23
 
22
24
  Vendor the gem:
23
25
 
24
- rake gems:install
25
- rake gems:unpack
26
+ <pre>
27
+ rake gems:install
28
+ rake gems:unpack
29
+ </pre>
26
30
 
27
31
  Make sure the development database exists and run the generator:
28
32
 
29
- script/generate clearance
33
+ @script/generate clearance@
30
34
 
31
35
  A number of files will be created and instructions will be printed.
32
36
 
@@ -34,25 +38,25 @@ You may already have some of these files. Don't worry. You'll be asked if you wa
34
38
 
35
39
  Run the migration:
36
40
 
37
- rake db:migrate
41
+ @rake db:migrate@
38
42
 
39
43
  h2. Environment
40
44
 
41
45
  Define a HOST constant in your environment files.
42
46
  In config/environments/test.rb and config/environments/development.rb it can be:
43
47
 
44
- HOST = "localhost"
48
+ @HOST = "localhost"@
45
49
 
46
50
  In production.rb it must be the actual host your application is deployed to.
47
51
  The constant is used by mailers to generate URLs in emails.
48
52
 
49
53
  In config/environment.rb:
50
54
 
51
- DO_NOT_REPLY = "donotreply@example.com"
55
+ @DO_NOT_REPLY = "donotreply@example.com"@
52
56
 
53
57
  Define root_url to *something* in your config/routes.rb:
54
58
 
55
- map.root :controller => 'home'
59
+ @map.root :controller => 'home'@
56
60
 
57
61
  h2. Cucumber Features
58
62
 
@@ -60,42 +64,50 @@ As your app evolves, you want to know that authentication still works. Clearance
60
64
 
61
65
  In config/environments/test.rb:
62
66
 
63
- config.gem 'webrat',
64
- :version => '= 0.4.4'
65
- config.gem 'cucumber',
66
- :version => '= 0.3.0'
67
- config.gem 'thoughtbot-factory_girl',
68
- :lib => 'factory_girl',
69
- :source => "http://gems.github.com",
70
- :version => '1.2.1'
67
+ <pre>
68
+ config.gem 'webrat',
69
+ :version => '= 0.4.4'
70
+ config.gem 'cucumber',
71
+ :version => '= 0.3.0'
72
+ config.gem 'thoughtbot-factory_girl',
73
+ :lib => 'factory_girl',
74
+ :source => "http://gems.github.com",
75
+ :version => '1.2.1'
76
+ </pre>
71
77
 
72
78
  Vendor the gems:
73
79
 
74
- rake gems:install RAILS_ENV=test
75
- rake gems:unpack RAILS_ENV=test
80
+ <pre>
81
+ rake gems:install RAILS_ENV=test
82
+ rake gems:unpack RAILS_ENV=test
83
+ </pre>
76
84
 
77
85
  Don't vendor nokogiri (due to its native extensions):
78
86
 
79
- rm -rf vendor/gems/nokogiri-1.2.3
87
+ @rm -rf vendor/gems/nokogiri-1.2.3@
80
88
 
81
89
  Run the Cucumber generator (if you haven't already) and Clearance's feature generator:
82
90
 
83
- script/generate cucumber
84
- script/generate clearance_features
91
+ <pre>
92
+ script/generate cucumber
93
+ script/generate clearance_features
94
+ </pre>
85
95
 
86
96
  All of the files generated should be new with the exception of the features/support/paths.rb file. If you have not modified your paths.rb then you will be okay to replace it with this one. If you need to keep your paths.rb file then add these locations in your paths.rb manually:
87
97
 
88
- def path_to(page_name)
89
- case page_name
90
- ...
91
- when /the sign up page/i
92
- new_user_path
93
- when /the sign in page/i
94
- new_session_path
95
- when /the password reset request page/i
96
- new_password_path
97
- ...
98
- end
98
+ <pre>
99
+ def path_to(page_name)
100
+ case page_name
101
+ ...
102
+ when /the sign up page/i
103
+ new_user_path
104
+ when /the sign in page/i
105
+ new_session_path
106
+ when /the password reset request page/i
107
+ new_password_path
108
+ ...
109
+ end
110
+ </pre>
99
111
 
100
112
  h2. Authors
101
113
 
data/Rakefile CHANGED
@@ -51,7 +51,7 @@ task :default => ['test:all', 'test:features']
51
51
 
52
52
  gem_spec = Gem::Specification.new do |gem_spec|
53
53
  gem_spec.name = "clearance"
54
- gem_spec.version = "0.6.4"
54
+ gem_spec.version = "0.6.5"
55
55
  gem_spec.summary = "Rails authentication with email & password."
56
56
  gem_spec.email = "support@thoughtbot.com"
57
57
  gem_spec.homepage = "http://github.com/thoughtbot/clearance"
@@ -15,7 +15,9 @@ class Clearance::ConfirmationsController < ApplicationController
15
15
  @user.confirm_email!
16
16
 
17
17
  sign_user_in(@user)
18
- flash[:success] = "Confirmed email and signed in."
18
+ flash[:success] = translate(:confirmed_email,
19
+ :scope => [:clearance, :controllers, :confirmations],
20
+ :default => "Confirmed email and signed in.")
19
21
  redirect_to url_after_create
20
22
  end
21
23
 
@@ -13,11 +13,15 @@ class Clearance::PasswordsController < ApplicationController
13
13
  if user = ::User.find_by_email(params[:password][:email])
14
14
  user.forgot_password!
15
15
  ::ClearanceMailer.deliver_change_password user
16
- flash[:notice] = "You will receive an email within the next few minutes. " <<
17
- "It contains instructions for changing your password."
16
+ flash[:notice] = translate(:deliver_change_password,
17
+ :scope => [:clearance, :controllers, :passwords],
18
+ :default => "You will receive an email within the next few minutes. " <<
19
+ "It contains instructions for changing your password.")
18
20
  redirect_to url_after_create
19
21
  else
20
- flash.now[:failure] = "Unknown email"
22
+ flash.now[:failure] = translate(:unknown_email,
23
+ :scope => [:clearance, :controllers, :passwords],
24
+ :default => "Unknown email.")
21
25
  render :template => 'passwords/new'
22
26
  end
23
27
  end
@@ -34,7 +38,7 @@ class Clearance::PasswordsController < ApplicationController
34
38
  params[:user][:password_confirmation])
35
39
  @user.confirm_email! unless @user.email_confirmed?
36
40
  sign_user_in(@user)
37
- flash[:success] = "Signed in."
41
+ flash[:success] = translate(:signed_in, :default => "Signed in.")
38
42
  redirect_to url_after_update
39
43
  else
40
44
  render :template => 'passwords/edit'
@@ -12,24 +12,29 @@ class Clearance::SessionsController < ApplicationController
12
12
  @user = ::User.authenticate(params[:session][:email],
13
13
  params[:session][:password])
14
14
  if @user.nil?
15
- flash.now[:failure] = "Bad email or password."
15
+ flash.now[:failure] = translate(:bad_email_or_password,
16
+ :scope => [:clearance, :controllers, :sessions],
17
+ :default => "Bad email or password.")
16
18
  render :template => 'sessions/new', :status => :unauthorized
17
19
  else
18
20
  if @user.email_confirmed?
19
21
  sign_user_in(@user)
20
22
  remember(@user) if remember?
21
- flash[:success] = "Signed in."
23
+ flash[:success] = translate(:signed_in, :default => "Signed in.")
22
24
  redirect_back_or url_after_create
23
25
  else
24
26
  ::ClearanceMailer.deliver_confirmation(@user)
25
- deny_access("User has not confirmed email. Confirmation email will be resent.")
27
+ deny_access(translate(:unconfirmed_email,
28
+ :scope => [:clearance, :controllers, :sessions],
29
+ :default => "User has not confirmed email. " <<
30
+ "Confirmation email will be resent."))
26
31
  end
27
32
  end
28
33
  end
29
34
 
30
35
  def destroy
31
36
  forget(current_user)
32
- flash[:success] = "Signed out."
37
+ flash[:success] = translate(:signed_out, :default => "Signed out.")
33
38
  redirect_to url_after_destroy
34
39
  end
35
40
 
@@ -13,8 +13,10 @@ class Clearance::UsersController < ApplicationController
13
13
  @user = ::User.new params[:user]
14
14
  if @user.save
15
15
  ::ClearanceMailer.deliver_confirmation @user
16
- flash[:notice] = "You will receive an email within the next few minutes. " <<
17
- "It contains instructions for confirming your account."
16
+ flash[:notice] = translate(:deliver_confirmation,
17
+ :scope => [:clearance, :controllers, :users],
18
+ :default => "You will receive an email within the next few minutes. " <<
19
+ "It contains instructions for confirming your account.")
18
20
  redirect_to url_after_create
19
21
  else
20
22
  render :template => 'users/new'
@@ -5,14 +5,18 @@ class ClearanceMailer < ActionMailer::Base
5
5
  def change_password(user)
6
6
  from DO_NOT_REPLY
7
7
  recipients user.email
8
- subject "Change your password"
8
+ subject I18n.t(:change_password,
9
+ :scope => [:clearance, :models, :clearance_mailer],
10
+ :default => "Change your password")
9
11
  body :user => user
10
12
  end
11
13
 
12
14
  def confirmation(user)
13
15
  from DO_NOT_REPLY
14
16
  recipients user.email
15
- subject "Account confirmation"
17
+ subject I18n.t(:confirmation,
18
+ :scope => [:clearance, :models, :clearance_mailer],
19
+ :default => "Account confirmation")
16
20
  body :user => user
17
21
  end
18
22
 
@@ -12,11 +12,12 @@ module Clearance
12
12
  attr_accessor :password, :password_confirmation
13
13
 
14
14
  validates_presence_of :email
15
- validates_presence_of :password, :if => :password_required?
16
- validates_confirmation_of :password, :if => :password_required?
17
15
  validates_uniqueness_of :email, :case_sensitive => false
18
16
  validates_format_of :email, :with => %r{.+@.+\..+}
19
17
 
18
+ validates_presence_of :password, :if => :password_required?
19
+ validates_confirmation_of :password, :if => :password_required?
20
+
20
21
  before_save :initialize_salt, :encrypt_password, :initialize_token
21
22
  end
22
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thoughtbot-clearance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Croak
@@ -24,7 +24,7 @@ autorequire:
24
24
  bindir: bin
25
25
  cert_chain: []
26
26
 
27
- date: 2009-05-11 21:00:00 -07:00
27
+ date: 2009-05-16 21:00:00 -07:00
28
28
  default_executable:
29
29
  dependencies: []
30
30
 
@@ -99,7 +99,7 @@ files:
99
99
  - lib/clearance.rb
100
100
  - shoulda_macros/clearance.rb
101
101
  - rails/init.rb
102
- has_rdoc: false
102
+ has_rdoc: true
103
103
  homepage: http://github.com/thoughtbot/clearance
104
104
  post_install_message:
105
105
  rdoc_options: []
@@ -123,7 +123,7 @@ requirements: []
123
123
  rubyforge_project:
124
124
  rubygems_version: 1.2.0
125
125
  signing_key:
126
- specification_version: 2
126
+ specification_version: 3
127
127
  summary: Rails authentication with email & password.
128
128
  test_files: []
129
129