thoughtbot-clearance 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,6 +2,10 @@ require 'rake'
2
2
  require 'rake/testtask'
3
3
  require 'date'
4
4
  require 'lib/clearance/version'
5
+ begin
6
+ require 'jeweler'
7
+ rescue LoadError
8
+ end
5
9
 
6
10
  test_files_pattern = 'test/rails_root/test/{unit,functional,other}/**/*_test.rb'
7
11
  Rake::TestTask.new do |t|
@@ -13,11 +17,8 @@ end
13
17
  desc "Run the test suite"
14
18
  task :default => :test
15
19
 
16
- spec = Gem::Specification.new do |s|
20
+ Jeweler.gemspec = Gem::Specification.new do |s|
17
21
  s.name = "clearance"
18
- s.version = "#{Clearance::Version::MAJOR}.#{Clearance::Version::MINOR}.#{Clearance::Version::PATCH}"
19
- date = DateTime.now
20
- s.date = "#{date.year}-#{date.month}-#{date.day}"
21
22
  s.summary = "Simple, complete Rails authentication."
22
23
  s.email = "dcroak@thoughtbot.com"
23
24
  s.homepage = "http://github.com/thoughtbot/clearance"
@@ -25,82 +26,30 @@ spec = Gem::Specification.new do |s|
25
26
  s.authors = ["thoughtbot, inc.", "Dan Croak", "Josh Nichols", "Mike Breen", "Mike Burns", "Jason Morrison"]
26
27
  s.files = FileList["[A-Z]*", "{generators,lib,test}/**/*"]
27
28
  end
28
-
29
- namespace :gemspec do
30
- desc "Generate a gemspec file for GitHub"
31
- task :write do
32
- File.open("#{spec.name}.gemspec", 'w') do |f|
33
- f.write spec.to_ruby
29
+
30
+ namespace :generator do
31
+ task :templates do
32
+ app_files = FileList["test/rails_root/app/{controllers,models,views}/**/*"]
33
+ app_files.reject! { |file| file.include?("test/rails_root/app/views/layouts") }
34
+ test_files = FileList["test/rails_root/test/{functional,unit}/**/*"]
35
+ test_files += ["test/rails_root/test/factories.rb"]
36
+ files = test_files + app_files
37
+ templates_path = "generators/clearance/templates"
38
+ system `rm -rf #{templates_path}`
39
+ system `mkdir #{templates_path}`
40
+ ["app", "app/controllers", "app/models", "app/views",
41
+ "test", "test/functional", "test/unit"].each do |directory|
42
+ system `mkdir #{templates_path}/#{directory}`
34
43
  end
35
- end
36
- end
37
-
38
- namespace :version do
39
- namespace :bump do
40
- desc "Bump the gemspec a major version."
41
- task :major do
42
- major = Clearance::Version::MAJOR + 1
43
- File.open("lib/clearance/version.rb", 'w') do |file|
44
- file.write <<-END
45
- module Clearance
46
- module Version
47
- MAJOR = #{major}
48
- MINOR = 0
49
- PATCH = 0
50
- end
51
- end
52
- END
53
- end
54
-
55
- spec.version = "#{major}.0.0"
56
- puts "Version bumped to #{spec.version}"
57
-
58
- Rake::Task["gemspec:write"].invoke
59
- puts "Gemspec updated"
60
- end
61
-
62
- desc "Bump the gemspec a minor version."
63
- task :minor do
64
- minor = Clearance::Version::MINOR + 1
65
- File.open("lib/clearance/version.rb", 'w') do |file|
66
- file.write <<-END
67
- module Clearance
68
- module Version
69
- MAJOR = #{Clearance::Version::MAJOR}
70
- MINOR = #{minor}
71
- PATCH = 0
72
- end
73
- end
74
- END
75
- end
76
-
77
- spec.version = "#{Clearance::Version::MAJOR}.#{minor}.0"
78
- puts "Version bumped to #{spec.version}"
79
-
80
- Rake::Task["gemspec:write"].invoke
81
- puts "Gemspec updated"
82
- end
83
-
84
- desc "Bump the gemspec a patch version."
85
- task :patch do
86
- patch = Clearance::Version::PATCH + 1
87
- File.open("lib/clearance/version.rb", 'w') do |file|
88
- file.write <<-END
89
- module Clearance
90
- module Version
91
- MAJOR = #{Clearance::Version::MAJOR}
92
- MINOR = #{Clearance::Version::MINOR}
93
- PATCH = #{patch}
94
- end
95
- end
96
- END
44
+ files.each do |file|
45
+ template = "generators/clearance/templates/#{file.gsub("test/rails_root/", "")}"
46
+ if File.directory?(file)
47
+ system `rm -rf #{template}`
48
+ system `mkdir #{template}`
49
+ else
50
+ system `rm #{template}` if File.exists?(template)
51
+ system `cp #{file} #{template}`
97
52
  end
98
-
99
- spec.version = "#{Clearance::Version::MAJOR}.#{Clearance::Version::MINOR}.#{patch}"
100
- puts "Version bumped to #{spec.version}"
101
-
102
- Rake::Task["gemspec:write"].invoke
103
- puts "Gemspec updated"
104
53
  end
105
54
  end
106
55
  end
@@ -17,7 +17,7 @@ class ClearanceGenerator < Rails::Generator::Base
17
17
  end
18
18
 
19
19
  m.directory File.join("app", "views")
20
- system `mkdir app/views/confirmations`
20
+ m.directory File.join("app", "views", "confirmations")
21
21
  ["app/views/confirmations/new.html.erb"].each do |file|
22
22
  m.file file, file
23
23
  end
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ helper :all
3
+ protect_from_forgery
4
+ include Clearance::ApplicationController
5
+ end
@@ -14,4 +14,7 @@
14
14
  <div class="group buttons">
15
15
  <%= form.submit 'Login', :disable_with => 'Please wait...' %>
16
16
  </div>
17
- <% end %>
17
+ <% end %>
18
+
19
+ <p><%= link_to "Sign up", new_user_path %></p>
20
+ <p><%= link_to "Forgot My Password", new_password_path %></p>
@@ -6,4 +6,4 @@ Factory.define :user do |user|
6
6
  user.email { Factory.next :email }
7
7
  user.password "password"
8
8
  user.password_confirmation "password"
9
- end
9
+ end
@@ -0,0 +1,5 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class UserTest < Test::Unit::TestCase
4
+ include Clearance::UserTest
5
+ end
@@ -1,7 +1,7 @@
1
- module Clearance
1
+ class Clearance
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- PATCH = 4
5
+ PATCH = 5
6
6
  end
7
7
  end
@@ -14,4 +14,7 @@
14
14
  <div class="group buttons">
15
15
  <%= form.submit 'Login', :disable_with => 'Please wait...' %>
16
16
  </div>
17
- <% end %>
17
+ <% end %>
18
+
19
+ <p><%= link_to "Sign up", new_user_path %></p>
20
+ <p><%= link_to "Forgot My Password", new_password_path %></p>
@@ -10,5 +10,4 @@ ActionController::Routing::Routes.draw do |map|
10
10
 
11
11
  map.root :controller => 'sessions', :action => 'new'
12
12
 
13
- end
14
-
13
+ 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.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoughtbot, inc.
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2008-10-11 00:00:00 -07:00
17
+ date: 2008-10-12 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -35,6 +35,7 @@ files:
35
35
  - generators/clearance/templates
36
36
  - generators/clearance/templates/app
37
37
  - generators/clearance/templates/app/controllers
38
+ - generators/clearance/templates/app/controllers/application.rb
38
39
  - generators/clearance/templates/app/controllers/confirmations_controller.rb
39
40
  - generators/clearance/templates/app/controllers/passwords_controller.rb
40
41
  - generators/clearance/templates/app/controllers/sessions_controller.rb