Skip to content

Commit

Permalink
generator inserts route text. use jeweler for gemming.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Croak committed Jan 19, 2010
1 parent 712a218 commit 1ad0b39
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 176 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pkg
test/rails_root/log/*.log
*.DS_Store
*.swp
Expand Down
14 changes: 2 additions & 12 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,10 @@ h2. Installation

Clearance is a Rails engine. It works with versions of Rails greater than 2.3.

In config/environment.rb:

<pre>
config.gem "clearance",
:lib => 'clearance',
:source => 'http://gemcutter.org',
:version => '0.8.3'
</pre>

Vendor the gem:
Install it as a gem however you like to install gems. Gem Bundler example:

<pre>
rake gems:install
rake gems:unpack
gem "clearance"
</pre>

Make sure the development database exists and run the generator:
Expand Down
37 changes: 16 additions & 21 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,26 +78,21 @@ desc "Run the test suite"
task :default => ['test:basic', 'test:features',
'test:views', 'test:features_for_views']

gem_spec = Gem::Specification.new do |gem_spec|
gem_spec.name = "clearance"
gem_spec.version = "0.8.4"
gem_spec.summary = "Rails authentication with email & password."
gem_spec.email = "support@thoughtbot.com"
gem_spec.homepage = "http://github.com/thoughtbot/clearance"
gem_spec.description = "Rails authentication with email & password."
gem_spec.authors = ["Dan Croak", "Mike Burns", "Jason Morrison",
"Joe Ferris", "Eugene Bolshakov", "Nick Quaranto",
"Josh Nichols", "Mike Breen", "Marcel Görner",
"Bence Nagy", "Ben Mabey", "Eloy Duran",
"Tim Pope", "Mihai Anca", "Mark Cornick",
"Shay Arnett", "Jon Yurek", "Chad Pytel"]
gem_spec.files = FileList["[A-Z]*", "{app,config,generators,lib,shoulda_macros,rails}/**/*"]
end

desc "Generate a gemspec file"
task :gemspec do
File.open("#{gem_spec.name}.gemspec", 'w') do |f|
f.write gem_spec.to_yaml
end
require 'jeweler'

Jeweler::Tasks.new do |gem|
gem.name = "clearance"
gem.summary = "Rails authentication with email & password."
gem.description = "Rails authentication with email & password."
gem.email = "support@thoughtbot.com"
gem.homepage = "http://github.com/thoughtbot/clearance"
gem.authors = ["Dan Croak", "Mike Burns", "Jason Morrison",
"Joe Ferris", "Eugene Bolshakov", "Nick Quaranto",
"Josh Nichols", "Mike Breen", "Marcel Görner",
"Bence Nagy", "Ben Mabey", "Eloy Duran",
"Tim Pope", "Mihai Anca", "Mark Cornick",
"Shay Arnett", "Jon Yurek", "Chad Pytel"]
gem.files = FileList["[A-Z]*", "{app,config,generators,lib,shoulda_macros,rails}/**/*"]
end

Jeweler::GemcutterTasks.new
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.8.4
266 changes: 124 additions & 142 deletions clearance.gemspec
Original file line number Diff line number Diff line change
@@ -1,147 +1,129 @@
--- !ruby/object:Gem::Specification
name: clearance
version: !ruby/object:Gem::Version
version: 0.8.4
platform: ruby
authors:
- Dan Croak
- Mike Burns
- Jason Morrison
- Joe Ferris
- Eugene Bolshakov
- Nick Quaranto
- Josh Nichols
- Mike Breen
- "Marcel G\xC3\xB6rner"
- Bence Nagy
- Ben Mabey
- Eloy Duran
- Tim Pope
- Mihai Anca
- Mark Cornick
- Shay Arnett
- Jon Yurek
- Chad Pytel
autorequire:
bindir: bin
cert_chain: []
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-

date: 2009-12-08 00:00:00 -05:00
default_executable:
dependencies: []
Gem::Specification.new do |s|
s.name = %q{clearance}
s.version = "0.8.4"

description: Rails authentication with email & password.
email: support@thoughtbot.com
executables: []
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Dan Croak", "Mike Burns", "Jason Morrison", "Joe Ferris", "Eugene Bolshakov", "Nick Quaranto", "Josh Nichols", "Mike Breen", "Marcel G\303\266rner", "Bence Nagy", "Ben Mabey", "Eloy Duran", "Tim Pope", "Mihai Anca", "Mark Cornick", "Shay Arnett", "Jon Yurek", "Chad Pytel"]
s.date = %q{2010-01-19}
s.description = %q{Rails authentication with email & password.}
s.email = %q{support@thoughtbot.com}
s.extra_rdoc_files = [
"LICENSE",
"README.textile"
]
s.files = [
"CHANGELOG.textile",
"LICENSE",
"README.textile",
"Rakefile",
"VERSION",
"app/controllers/clearance/confirmations_controller.rb",
"app/controllers/clearance/passwords_controller.rb",
"app/controllers/clearance/sessions_controller.rb",
"app/controllers/clearance/users_controller.rb",
"app/models/clearance_mailer.rb",
"app/views/clearance_mailer/change_password.html.erb",
"app/views/clearance_mailer/confirmation.html.erb",
"app/views/passwords/edit.html.erb",
"app/views/passwords/new.html.erb",
"app/views/sessions/new.html.erb",
"app/views/users/_form.html.erb",
"app/views/users/new.html.erb",
"generators/clearance/USAGE",
"generators/clearance/clearance_generator.rb",
"generators/clearance/lib/insert_commands.rb",
"generators/clearance/lib/rake_commands.rb",
"generators/clearance/templates/README",
"generators/clearance/templates/factories.rb",
"generators/clearance/templates/migrations/create_users.rb",
"generators/clearance/templates/migrations/update_users.rb",
"generators/clearance/templates/user.rb",
"generators/clearance_features/USAGE",
"generators/clearance_features/clearance_features_generator.rb",
"generators/clearance_features/templates/features/password_reset.feature",
"generators/clearance_features/templates/features/sign_in.feature",
"generators/clearance_features/templates/features/sign_out.feature",
"generators/clearance_features/templates/features/sign_up.feature",
"generators/clearance_features/templates/features/step_definitions/clearance_steps.rb",
"generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb",
"generators/clearance_features/templates/features/support/paths.rb",
"generators/clearance_views/USAGE",
"generators/clearance_views/clearance_views_generator.rb",
"generators/clearance_views/templates/formtastic/passwords/edit.html.erb",
"generators/clearance_views/templates/formtastic/passwords/new.html.erb",
"generators/clearance_views/templates/formtastic/sessions/new.html.erb",
"generators/clearance_views/templates/formtastic/users/_inputs.html.erb",
"generators/clearance_views/templates/formtastic/users/new.html.erb",
"lib/clearance.rb",
"lib/clearance/authentication.rb",
"lib/clearance/extensions/errors.rb",
"lib/clearance/extensions/rescue.rb",
"lib/clearance/routes.rb",
"lib/clearance/user.rb",
"rails/init.rb",
"shoulda_macros/clearance.rb"
]
s.homepage = %q{http://github.com/thoughtbot/clearance}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
s.summary = %q{Rails authentication with email & password.}
s.test_files = [
"test/controllers/confirmations_controller_test.rb",
"test/controllers/passwords_controller_test.rb",
"test/controllers/sessions_controller_test.rb",
"test/controllers/users_controller_test.rb",
"test/models/clearance_mailer_test.rb",
"test/models/user_test.rb",
"test/rails_root/app/controllers/accounts_controller.rb",
"test/rails_root/app/controllers/application_controller.rb",
"test/rails_root/app/helpers/application_helper.rb",
"test/rails_root/app/helpers/confirmations_helper.rb",
"test/rails_root/app/helpers/passwords_helper.rb",
"test/rails_root/app/models/user.rb",
"test/rails_root/config/boot.rb",
"test/rails_root/config/environment.rb",
"test/rails_root/config/environments/development.rb",
"test/rails_root/config/environments/production.rb",
"test/rails_root/config/environments/test.rb",
"test/rails_root/config/initializers/clearance.rb",
"test/rails_root/config/initializers/inflections.rb",
"test/rails_root/config/initializers/mime_types.rb",
"test/rails_root/config/initializers/requires.rb",
"test/rails_root/config/initializers/time_formats.rb",
"test/rails_root/config/routes.rb",
"test/rails_root/db/migrate/20100119205611_clearance_create_users.rb",
"test/rails_root/features/step_definitions/clearance_steps.rb",
"test/rails_root/features/step_definitions/factory_girl_steps.rb",
"test/rails_root/features/step_definitions/web_steps.rb",
"test/rails_root/features/support/env.rb",
"test/rails_root/features/support/paths.rb",
"test/rails_root/public/dispatch.rb",
"test/rails_root/script/create_project.rb",
"test/rails_root/test/factories/clearance.rb",
"test/rails_root/test/functional/accounts_controller_test.rb",
"test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/generators/formtastic_stylesheets/formtastic_stylesheets_generator.rb",
"test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/lib/formtastic.rb",
"test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/lib/justin_french/formtastic.rb",
"test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/rails/init.rb",
"test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/spec/formtastic_spec.rb",
"test/rails_root/vendor/gems/justinfrench-formtastic-0.2.1/spec/test_helper.rb",
"test/test_helper.rb"
]

extensions: []
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

extra_rdoc_files: []

files:
- CHANGELOG.textile
- LICENSE
- Rakefile
- README.textile
- TODO.textile
- app/controllers
- app/controllers/clearance
- app/controllers/clearance/confirmations_controller.rb
- app/controllers/clearance/passwords_controller.rb
- app/controllers/clearance/sessions_controller.rb
- app/controllers/clearance/users_controller.rb
- app/models
- app/models/clearance_mailer.rb
- app/views
- app/views/clearance_mailer
- app/views/clearance_mailer/change_password.html.erb
- app/views/clearance_mailer/confirmation.html.erb
- app/views/passwords
- app/views/passwords/edit.html.erb
- app/views/passwords/new.html.erb
- app/views/sessions
- app/views/sessions/new.html.erb
- app/views/users
- app/views/users/_form.html.erb
- app/views/users/new.html.erb
- config/clearance_routes.rb
- generators/clearance
- generators/clearance/clearance_generator.rb
- generators/clearance/lib
- generators/clearance/lib/insert_commands.rb
- generators/clearance/lib/rake_commands.rb
- generators/clearance/templates
- generators/clearance/templates/factories.rb
- generators/clearance/templates/migrations
- generators/clearance/templates/migrations/create_users.rb
- generators/clearance/templates/migrations/update_users.rb
- generators/clearance/templates/README
- generators/clearance/templates/user.rb
- generators/clearance/USAGE
- generators/clearance_features
- generators/clearance_features/clearance_features_generator.rb
- generators/clearance_features/templates
- generators/clearance_features/templates/features
- generators/clearance_features/templates/features/password_reset.feature
- generators/clearance_features/templates/features/sign_in.feature
- generators/clearance_features/templates/features/sign_out.feature
- generators/clearance_features/templates/features/sign_up.feature
- generators/clearance_features/templates/features/step_definitions
- generators/clearance_features/templates/features/step_definitions/clearance_steps.rb
- generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb
- generators/clearance_features/templates/features/support
- generators/clearance_features/templates/features/support/paths.rb
- generators/clearance_features/USAGE
- generators/clearance_views
- generators/clearance_views/clearance_views_generator.rb
- generators/clearance_views/templates
- generators/clearance_views/templates/formtastic
- generators/clearance_views/templates/formtastic/passwords
- generators/clearance_views/templates/formtastic/passwords/edit.html.erb
- generators/clearance_views/templates/formtastic/passwords/new.html.erb
- generators/clearance_views/templates/formtastic/sessions
- generators/clearance_views/templates/formtastic/sessions/new.html.erb
- generators/clearance_views/templates/formtastic/users
- generators/clearance_views/templates/formtastic/users/_inputs.html.erb
- generators/clearance_views/templates/formtastic/users/new.html.erb
- generators/clearance_views/USAGE
- lib/clearance
- lib/clearance/authentication.rb
- lib/clearance/extensions
- lib/clearance/extensions/errors.rb
- lib/clearance/extensions/rescue.rb
- lib/clearance/extensions/routes.rb
- lib/clearance/user.rb
- lib/clearance.rb
- shoulda_macros/clearance.rb
- rails/init.rb
has_rdoc: true
homepage: http://github.com/thoughtbot/clearance
licenses: []

post_install_message:
rdoc_options: []

require_paths:
- lib
required_ruby_version: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: "0"
version:
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: "0"
version:
requirements: []

rubyforge_project:
rubygems_version: 1.3.5
signing_key:
specification_version: 3
summary: Rails authentication with email & password.
test_files: []
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
else
end
else
end
end

3 changes: 3 additions & 0 deletions generators/clearance/clearance_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def manifest
m.file "user.rb", user_model
end

m.insert_into "config/routes.rb",
"Clearance::Routes.draw(map)"

m.directory File.join("test", "factories")
m.file "factories.rb", "test/factories/clearance.rb"

Expand Down
2 changes: 1 addition & 1 deletion generators/clearance/lib/insert_commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def file_contains?(relative_destination, line)
def insert_into(file, line)
logger.insert "#{line} into #{file}"
unless options[:pretend] || file_contains?(file, line)
gsub_file file, /^(class|module) .+$/ do |match|
gsub_file file, /^(class|module|.*Routes).*$/ do |match|
"#{match}\n #{line}"
end
end
Expand Down

0 comments on commit 1ad0b39

Please sign in to comment.