Permalink
Browse files

clearing out extra whitespace

  • Loading branch information...
ryanb committed Sep 23, 2010
1 parent 9529eff commit dba8f687a6f88aca4e9b87c52a2c86f6e1f170cb
Showing with 506 additions and 498 deletions.
  1. +9 −0 CHANGELOG
  2. +2 −2 README.rdoc
  3. +2 −2 features/nifty_authentication.feature
  4. +0 −1 features/nifty_scaffold.feature
  5. +2 −2 lib/generators/nifty.rb
  6. +15 −15 lib/generators/nifty/authentication/USAGE
  7. +6 −6 lib/generators/nifty/authentication/authentication_generator.rb
  8. +9 −9 lib/generators/nifty/authentication/templates/authentication.rb
  9. +1 −1 lib/generators/nifty/authentication/templates/migration.rb
  10. +4 −4 lib/generators/nifty/authentication/templates/sessions_controller.rb
  11. +5 −5 lib/generators/nifty/authentication/templates/tests/rspec/sessions_controller.rb
  12. +15 −15 lib/generators/nifty/authentication/templates/tests/rspec/user.rb
  13. +4 −4 lib/generators/nifty/authentication/templates/tests/rspec/users_controller.rb
  14. +3 −3 lib/generators/nifty/authentication/templates/tests/shoulda/sessions_controller.rb
  15. +15 −15 lib/generators/nifty/authentication/templates/tests/shoulda/user.rb
  16. +2 −2 lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb
  17. +3 −3 lib/generators/nifty/authentication/templates/tests/testunit/sessions_controller.rb
  18. +15 −15 lib/generators/nifty/authentication/templates/tests/testunit/user.rb
  19. +2 −2 lib/generators/nifty/authentication/templates/tests/testunit/users_controller.rb
  20. +7 −7 lib/generators/nifty/authentication/templates/user.rb
  21. +1 −1 lib/generators/nifty/authentication/templates/users_controller.rb
  22. +2 −2 lib/generators/nifty/config/USAGE
  23. +3 −3 lib/generators/nifty/config/config_generator.rb
  24. +2 −2 lib/generators/nifty/layout/USAGE
  25. +4 −4 lib/generators/nifty/layout/layout_generator.rb
  26. +2 −2 lib/generators/nifty/layout/templates/error_messages_helper.rb
  27. +4 −4 lib/generators/nifty/layout/templates/layout.html.haml
  28. +3 −3 lib/generators/nifty/layout/templates/layout_helper.rb
  29. +9 −9 lib/generators/nifty/scaffold/USAGE
  30. +1 −1 lib/generators/nifty/scaffold/scaffold_generator.rb
  31. +1 −1 lib/generators/nifty/scaffold/templates/migration.rb
  32. +1 −1 lib/generators/nifty/scaffold/templates/tests/rspec/actions/create.rb
  33. +1 −1 lib/generators/nifty/scaffold/templates/tests/rspec/actions/update.rb
  34. +2 −2 lib/generators/nifty/scaffold/templates/tests/rspec/controller.rb
  35. +1 −1 lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb
  36. +1 −1 lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb
  37. +1 −1 lib/generators/nifty/scaffold/templates/tests/testunit/actions/create.rb
  38. +1 −1 lib/generators/nifty/scaffold/templates/tests/testunit/actions/update.rb
  39. +2 −2 nifty-generators.gemspec
  40. +15 −15 rails_generators/nifty_authentication/USAGE
  41. +8 −8 rails_generators/nifty_authentication/lib/insert_commands.rb
  42. +20 −20 rails_generators/nifty_authentication/nifty_authentication_generator.rb
  43. +9 −9 rails_generators/nifty_authentication/templates/authentication.rb
  44. +1 −1 rails_generators/nifty_authentication/templates/migration.rb
  45. +4 −4 rails_generators/nifty_authentication/templates/sessions_controller.rb
  46. +5 −5 rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb
  47. +15 −15 rails_generators/nifty_authentication/templates/tests/rspec/user.rb
  48. +4 −4 rails_generators/nifty_authentication/templates/tests/rspec/users_controller.rb
  49. +3 −3 rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb
  50. +15 −15 rails_generators/nifty_authentication/templates/tests/shoulda/user.rb
  51. +2 −2 rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb
  52. +3 −3 rails_generators/nifty_authentication/templates/tests/testunit/sessions_controller.rb
  53. +15 −15 rails_generators/nifty_authentication/templates/tests/testunit/user.rb
  54. +2 −2 rails_generators/nifty_authentication/templates/tests/testunit/users_controller.rb
  55. +7 −7 rails_generators/nifty_authentication/templates/user.rb
  56. +1 −1 rails_generators/nifty_authentication/templates/users_controller.rb
  57. +2 −2 rails_generators/nifty_config/USAGE
  58. +3 −3 rails_generators/nifty_config/nifty_config_generator.rb
  59. +2 −2 rails_generators/nifty_layout/USAGE
  60. +3 −3 rails_generators/nifty_layout/nifty_layout_generator.rb
  61. +3 −3 rails_generators/nifty_layout/templates/helper.rb
  62. +2 −2 rails_generators/nifty_layout/templates/layout.html.erb
  63. +4 −4 rails_generators/nifty_layout/templates/layout.html.haml
  64. +9 −9 rails_generators/nifty_scaffold/USAGE
  65. +38 −38 rails_generators/nifty_scaffold/nifty_scaffold_generator.rb
  66. +1 −1 rails_generators/nifty_scaffold/templates/migration.rb
  67. +1 −1 rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb
  68. +1 −1 rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb
  69. +2 −2 rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb
  70. +1 −1 rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb
  71. +1 −1 rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb
  72. +1 −1 rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb
  73. +1 −1 rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb
  74. +7 −7 test/test_helper.rb
  75. +30 −30 test/test_nifty_authentication_generator.rb
  76. +4 −4 test/test_nifty_config_generator.rb
  77. +5 −5 test/test_nifty_layout_generator.rb
  78. +93 −93 test/test_nifty_scaffold_generator.rb
View
@@ -1,3 +1,12 @@
+* fixing frozen hash error when not passing additional arguments to nifty:scaffold - issue #35
+
+* fixing rendering of default title in nifty:layout - issue #36
+
+* fixing integrate_views error in nifty:scaffold specs - issue #43
+
+* updating SASS syntax (thanks semaperepelitsa) - issue #46
+
+
0.4.0 (April 19th, 2010)
* adding error_messages_for and f.error_messages helper for Rails 3 nifty:layout
View
@@ -87,10 +87,10 @@ Try restarting your development server. Sometimes it doesn't detect the change i
Make sure you have mocha installed and require it in your spec/test helper.
gem install mocha
-
+
# in spec_helper.rb
config.mock_with :mocha
-
+
# in test_helper.rb
require 'mocha'
@@ -2,7 +2,7 @@ Feature: Nifty Authentication Generator
In order to authenticate users
As a rails developer
I want to generate some user authentication
-
+
Scenario: Generate default authentication
Given a new Rails app
When I run "rails g nifty:authentication"
@@ -31,7 +31,7 @@ Feature: Nifty Authentication Generator
And I run "rake db:migrate"
And I add "gem 'mocha', :group => :test" to file "Gemfile"
Then I should successfully run "rake test"
-
+
Scenario: Generate named authentication
Given a new Rails app
When I run "rails g nifty:authentication Account CurrentSession"
@@ -3,7 +3,6 @@ Feature: Nifty Scaffold Generator
As a rails developer
I want to generate a model, controller, and views for that resource
- @focus
Scenario: Generate scaffold for simple resource
Given a new Rails app
When I run "rails g nifty:scaffold Project name:string"
View
@@ -1,12 +1,12 @@
require 'rails/generators/base'
-
+
module Nifty
module Generators
class Base < Rails::Generators::Base #:nodoc:
def self.source_root
@_nifty_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'nifty', generator_name, 'templates'))
end
-
+
def self.banner
"#{$0} nifty:#{generator_name} #{self.arguments.map{ |a| a.usage }.join(' ')} [options]"
end
@@ -1,9 +1,9 @@
Description:
- Generates a user model, users controller, and sessions controller. The
- users controller handles the registration and the sessions controller
- handles authentication. This is similar to restful_authentication, but
+ Generates a user model, users controller, and sessions controller. The
+ users controller handles the registration and the sessions controller
+ handles authentication. This is similar to restful_authentication, but
simpler.
-
+
IMPORTANT: This generator uses the "title" helper method which is generated
by the nifty_layout generator. You may want to run that generator first.
@@ -12,39 +12,39 @@ Usage:
the authentication controller will default to "session". You can override
each of these respectively by passing one or two arguments. Either name can
be CamelCased or under_scored.
-
+
Make sure to setup the authlogic gem if you are using that option.
-
+
gem "authlogic" # in Gemfile
Examples:
rails generate nifty:authentication
-
+
Creates user model, users_controller, and sessions_controller.
-
+
rails generate nifty:authentication account
-
+
Creates account model, accounts_controller, and sessions_controller.
-
+
rails generate nifty:authentication Account UserSession
-
+
Creates account model, accounts_controller, and user_sessions_controller.
Methods:
There are several methods generated which you can use in your application.
Here's a common example of what you might add to your layout.
-
+
<% if logged_in? %>
Welcome <%= current_user.username %>! Not you?
<%= link_to "Log out", logout_path %>
<% else %>
<%= link_to "Sign up", signup_path %> or
<%= link_to "log in", login_path %>.
<% end %>
-
+
You can also restrict unregistered users from accessing a controller using
a before filter. For example.
-
+
before_filter :login_required, :except => [:index, :show]
-
+
See the generated file lib/authentication.rb for details.
@@ -5,17 +5,17 @@ module Nifty
module Generators
class AuthenticationGenerator < Base
include Rails::Generators::Migration
-
+
argument :user_name, :type => :string, :default => 'user', :banner => 'user_name'
argument :session_name, :type => :string, :default => '[[DEFAULT]]', :banner => 'sessions_controller_name'
-
+
class_option :testunit, :desc => 'Use test/unit for test files.', :group => 'Test framework', :type => :boolean
class_option :rspec, :desc => 'Use RSpec for test files.', :group => 'Test framework', :type => :boolean
class_option :shoulda, :desc => 'Use shoulda for test files.', :group => 'Test framework', :type => :boolean
-
+
class_option :haml, :desc => 'Generate HAML views instead of ERB.', :type => :boolean
class_option :authlogic, :desc => 'Use Authlogic for authentication.', :type => :boolean
-
+
def create_model_files
template 'user.rb', "app/models/#{user_singular_name}.rb"
template 'authlogic_session.rb', "app/models/#{user_singular_name}_session.rb" if options.authlogic?
@@ -47,7 +47,7 @@ def create_routes
route "match 'logout' => '#{session_plural_name}#destroy', :as => :logout"
route "match 'signup' => '#{user_plural_name}#new', :as => :signup"
end
-
+
def create_migration
migration_template 'migration.rb', "db/migrate/create_#{user_plural_name}.rb"
end
@@ -72,7 +72,7 @@ def create_test_files
end
private
-
+
def session_name
@_session_name ||= @session_name == '[[DEFAULT]]' ?
(options.authlogic? ? user_name + '_session' : 'session') :
@@ -1,24 +1,24 @@
# This module is included in your application controller which makes
# several methods available to all controllers and views. Here's a
# common example you might add to your application layout file.
-#
+#
# <%% if logged_in? %>
# Welcome <%%= current_<%= user_singular_name %>.username %>! Not you?
# <%%= link_to "Log out", logout_path %>
# <%% else %>
# <%%= link_to "Sign up", signup_path %> or
# <%%= link_to "log in", login_path %>.
# <%% end %>
-#
+#
# You can also restrict unregistered users from accessing a controller using
# a before filter. For example.
-#
+#
# before_filter :login_required, :except => [:index, :show]
module Authentication
def self.included(controller)
controller.send :helper_method, :current_<%= user_singular_name %>, :logged_in?, :redirect_to_target_or_default
end
-
+
<%- if options[:authlogic] -%>
def current_<%= session_singular_name %>
return @current_<%= session_singular_name %> if defined?(@current_<%= session_singular_name %>)
@@ -34,26 +34,26 @@ def current_<%= user_singular_name %>
@current_<%= user_singular_name %> ||= <%= user_class_name %>.find(session[:<%= user_singular_name %>_id]) if session[:<%= user_singular_name %>_id]
end
<%- end -%>
-
+
def logged_in?
current_<%= user_singular_name %>
end
-
+
def login_required
unless logged_in?
flash[:error] = "You must first log in or sign up before accessing this page."
store_target_location
redirect_to login_url
end
end
-
+
def redirect_to_target_or_default(default)
redirect_to(session[:return_to] || default)
session[:return_to] = nil
end
-
+
private
-
+
def store_target_location
session[:return_to] = request.request_uri
end
@@ -13,7 +13,7 @@ def self.up
t.timestamps
end
end
-
+
def self.down
drop_table :<%= user_plural_name %>
end
@@ -3,7 +3,7 @@ class <%= session_plural_class_name %>Controller < ApplicationController
def new
@<%= session_singular_name %> = <%= session_class_name %>.new
end
-
+
def create
@<%= session_singular_name %> = <%= session_class_name %>.new(params[:<%= session_singular_name %>])
if @<%= session_singular_name %>.save
@@ -13,7 +13,7 @@ def create
render :action => 'new'
end
end
-
+
def destroy
@<%= session_singular_name %> = <%= session_class_name %>.find
@<%= session_singular_name %>.destroy
@@ -23,7 +23,7 @@ def destroy
<%- else -%>
def new
end
-
+
def create
<%= user_singular_name %> = <%= user_class_name %>.authenticate(params[:login], params[:password])
if <%= user_singular_name %>
@@ -35,7 +35,7 @@ def create
render :action => 'new'
end
end
-
+
def destroy
session[:<%= user_singular_name %>_id] = nil
flash[:notice] = "You have been logged out."
@@ -1,21 +1,21 @@
require File.dirname(__FILE__) + '/../spec_helper'
-
+
describe <%= session_plural_class_name %>Controller do
fixtures :all
render_views
-
+
it "new action should render new template" do
get :new
response.should render_template(:new)
end
-
+
<%- if options[:authlogic] -%>
it "create action should render new template when authentication is invalid" do
post :create, :<%= session_singular_name %> => { :username => "foo", :password => "badpassword" }
response.should render_template(:new)
<%= session_class_name %>.find.should be_nil
end
-
+
it "create action should redirect when authentication is valid" do
post :create, :<%= session_singular_name %> => { :username => "foo", :password => "secret" }
response.should redirect_to("/")
@@ -28,7 +28,7 @@
response.should render_template(:new)
session['<%= user_singular_name %>_id'].should be_nil
end
-
+
it "create action should redirect when authentication is valid" do
<%= user_class_name %>.stubs(:authenticate).returns(<%= user_class_name %>.first)
post :create
Oops, something went wrong.

0 comments on commit dba8f68

Please sign in to comment.