blue_light_special_heroku_fork 0.2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +95 -0
  3. data/Rakefile +95 -0
  4. data/VERSION +1 -0
  5. data/app/controllers/blue_light_special/impersonations_controller.rb +44 -0
  6. data/app/controllers/blue_light_special/passwords_controller.rb +88 -0
  7. data/app/controllers/blue_light_special/sessions_controller.rb +70 -0
  8. data/app/controllers/blue_light_special/users_controller.rb +48 -0
  9. data/app/models/blue_light_special_mailer.rb +19 -0
  10. data/app/models/deliver_change_password_job.rb +19 -0
  11. data/app/models/deliver_welcome_job.rb +17 -0
  12. data/app/models/generic_mailer.rb +22 -0
  13. data/app/models/impersonation.rb +26 -0
  14. data/app/models/mimi_mailer.rb +21 -0
  15. data/app/views/blue_light_special_mailer/change_password.html.erb +9 -0
  16. data/app/views/impersonations/index.html.erb +5 -0
  17. data/app/views/passwords/edit.html.erb +23 -0
  18. data/app/views/passwords/new.html.erb +15 -0
  19. data/app/views/sessions/new.html.erb +48 -0
  20. data/app/views/users/_form.html.erb +21 -0
  21. data/app/views/users/edit.html.erb +6 -0
  22. data/app/views/users/new.html.erb +6 -0
  23. data/app/views/users/show.html.erb +8 -0
  24. data/generators/blue_light_special/USAGE +1 -0
  25. data/generators/blue_light_special/blue_light_special_generator.rb +78 -0
  26. data/generators/blue_light_special/lib/insert_commands.rb +33 -0
  27. data/generators/blue_light_special/lib/rake_commands.rb +22 -0
  28. data/generators/blue_light_special/templates/README +20 -0
  29. data/generators/blue_light_special/templates/application.html.erb +50 -0
  30. data/generators/blue_light_special/templates/blue_light_special.rb +25 -0
  31. data/generators/blue_light_special/templates/blue_light_special.yml +45 -0
  32. data/generators/blue_light_special/templates/factories.rb +23 -0
  33. data/generators/blue_light_special/templates/migrations/create_users.rb +24 -0
  34. data/generators/blue_light_special/templates/migrations/update_users.rb +44 -0
  35. data/generators/blue_light_special/templates/style.css +31 -0
  36. data/generators/blue_light_special/templates/user.rb +3 -0
  37. data/generators/blue_light_special/templates/xd_receiver.html +10 -0
  38. data/generators/blue_light_special/templates/xd_receiver_ssl.html +10 -0
  39. data/generators/blue_light_special_admin/USAGE +1 -0
  40. data/generators/blue_light_special_admin/blue_light_special_admin_generator.rb +30 -0
  41. data/generators/blue_light_special_admin/lib/insert_commands.rb +33 -0
  42. data/generators/blue_light_special_admin/templates/README +16 -0
  43. data/generators/blue_light_special_admin/templates/app/controllers/admin/admin_controller.rb +14 -0
  44. data/generators/blue_light_special_admin/templates/app/controllers/admin/users_controller.rb +52 -0
  45. data/generators/blue_light_special_admin/templates/app/views/admin/users/_form.html.erb +25 -0
  46. data/generators/blue_light_special_admin/templates/app/views/admin/users/edit.html.erb +6 -0
  47. data/generators/blue_light_special_admin/templates/app/views/admin/users/index.html.erb +7 -0
  48. data/generators/blue_light_special_admin/templates/app/views/admin/users/new.html.erb +6 -0
  49. data/generators/blue_light_special_admin/templates/app/views/admin/users/show.html.erb +10 -0
  50. data/generators/blue_light_special_admin/templates/test/integration/admin/users_test.rb +201 -0
  51. data/generators/blue_light_special_tests/USAGE +1 -0
  52. data/generators/blue_light_special_tests/blue_light_special_tests_generator.rb +21 -0
  53. data/generators/blue_light_special_tests/templates/README +58 -0
  54. data/generators/blue_light_special_tests/templates/test/integration/edit_profile_test.rb +35 -0
  55. data/generators/blue_light_special_tests/templates/test/integration/facebook_test.rb +61 -0
  56. data/generators/blue_light_special_tests/templates/test/integration/impersonation_test.rb +39 -0
  57. data/generators/blue_light_special_tests/templates/test/integration/password_reset_test.rb +128 -0
  58. data/generators/blue_light_special_tests/templates/test/integration/sign_in_test.rb +66 -0
  59. data/generators/blue_light_special_tests/templates/test/integration/sign_out_test.rb +28 -0
  60. data/generators/blue_light_special_tests/templates/test/integration/sign_up_test.rb +47 -0
  61. data/lib/blue_light_special.rb +7 -0
  62. data/lib/blue_light_special/authentication.rb +138 -0
  63. data/lib/blue_light_special/configuration.rb +34 -0
  64. data/lib/blue_light_special/extensions/errors.rb +6 -0
  65. data/lib/blue_light_special/extensions/rescue.rb +5 -0
  66. data/lib/blue_light_special/routes.rb +55 -0
  67. data/lib/blue_light_special/user.rb +247 -0
  68. data/rails/init.rb +4 -0
  69. data/shoulda_macros/blue_light_special.rb +244 -0
  70. data/test/controllers/passwords_controller_test.rb +184 -0
  71. data/test/controllers/sessions_controller_test.rb +129 -0
  72. data/test/controllers/users_controller_test.rb +57 -0
  73. data/test/models/blue_light_special_mailer_test.rb +52 -0
  74. data/test/models/impersonation_test.rb +25 -0
  75. data/test/models/user_test.rb +213 -0
  76. data/test/rails_root/app/controllers/accounts_controller.rb +10 -0
  77. data/test/rails_root/app/controllers/application_controller.rb +6 -0
  78. data/test/rails_root/app/helpers/application_helper.rb +5 -0
  79. data/test/rails_root/app/helpers/confirmations_helper.rb +2 -0
  80. data/test/rails_root/app/helpers/passwords_helper.rb +2 -0
  81. data/test/rails_root/config/boot.rb +110 -0
  82. data/test/rails_root/config/environment.rb +22 -0
  83. data/test/rails_root/config/environments/development.rb +19 -0
  84. data/test/rails_root/config/environments/production.rb +1 -0
  85. data/test/rails_root/config/environments/test.rb +37 -0
  86. data/test/rails_root/config/initializers/inflections.rb +10 -0
  87. data/test/rails_root/config/initializers/mime_types.rb +5 -0
  88. data/test/rails_root/config/initializers/requires.rb +13 -0
  89. data/test/rails_root/config/initializers/time_formats.rb +4 -0
  90. data/test/rails_root/config/routes.rb +9 -0
  91. data/test/rails_root/public/dispatch.rb +10 -0
  92. data/test/rails_root/script/create_project.rb +52 -0
  93. data/test/rails_root/test/functional/accounts_controller_test.rb +23 -0
  94. data/test/test_helper.rb +21 -0
  95. metadata +187 -0
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,13 @@
1
+ Dir[File.join(RAILS_ROOT, 'lib', 'extensions', '*.rb')].each do |f|
2
+ require f
3
+ end
4
+
5
+ Dir[File.join(RAILS_ROOT, 'lib', '*.rb')].each do |f|
6
+ require f
7
+ end
8
+
9
+ # Rails 2 doesn't like mocks
10
+
11
+ Dir[File.join(RAILS_ROOT, 'test', 'mocks', RAILS_ENV, '*.rb')].each do |f|
12
+ require f
13
+ end
@@ -0,0 +1,4 @@
1
+ # Example time formats
2
+ { :short_date => "%x", :long_date => "%a, %b %d, %Y" }.each do |k, v|
3
+ ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update(k => v)
4
+ end
@@ -0,0 +1,9 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ map.namespace :admin do |admin|
3
+ admin.resources :users
4
+ end
5
+ map.resource :account
6
+ map.root :controller => 'accounts', :action => 'edit'
7
+
8
+ BlueLightSpecial::Routes.draw(map)
9
+ end
@@ -0,0 +1,10 @@
1
+ #!/opt/local/bin/ruby
2
+
3
+ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
4
+
5
+ # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
6
+ # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
7
+ require "dispatcher"
8
+
9
+ ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
10
+ Dispatcher.dispatch
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'activesupport'
4
+ require 'pathname'
5
+
6
+ project_name = ARGV[0]
7
+ fail("Usage: #{File.basename(__FILE__)} new_project_name") unless project_name
8
+ fail("Project name must only contain [a-z0-9_]") unless project_name =~ /^[a-z0-9_]+$/
9
+
10
+ base_directory = Pathname.new(File.join(File.dirname(__FILE__), '..', '..')).realpath
11
+ project_directory = base_directory + project_name
12
+ fail("Project directory (#{project_directory}) already exists") if project_directory.exist?
13
+
14
+ template_url = "git@github.com:thoughtbot/rails-template.git"
15
+ changeme = "CHANGEME"
16
+
17
+ def run(cmd)
18
+ puts "Running '#{cmd}'"
19
+ out = `#{cmd}`
20
+ if $? != 0
21
+ fail "Command #{cmd} failed: #$?\n#{out}"
22
+ end
23
+ out
24
+ end
25
+
26
+ def search_and_replace(file, search, replace)
27
+ if File.file?(file)
28
+ contents = File.read(file)
29
+ if contents[search]
30
+ puts "Replacing #{search} with #{replace} in #{file}"
31
+ contents.gsub!(search, replace)
32
+ File.open(file, "w") { |f| f << contents }
33
+ end
34
+ end
35
+ end
36
+
37
+ run("mkdir #{project_directory}")
38
+ Dir.chdir(project_directory) or fail("Couldn't change to #{project_directory}")
39
+ run("git init")
40
+ run("git remote add template #{template_url}")
41
+ run("git pull template master")
42
+
43
+ Dir.glob("#{project_directory}/**/*").each do |file|
44
+ search_and_replace(file, changeme, project_name)
45
+ end
46
+
47
+ run("git commit -a -m 'Initial commit'")
48
+
49
+ puts
50
+ puts "Now login to github and add a new project named '#{project_name.humanize.titleize}'"
51
+
52
+
@@ -0,0 +1,23 @@
1
+ require 'test_helper'
2
+
3
+ class AccountsControllerTest < ActionController::TestCase
4
+
5
+ context "when signed out" do
6
+ setup { sign_out }
7
+ should_deny_access_on :get, :edit
8
+ should_deny_access_on :put, :update
9
+ end
10
+
11
+ context "on POST to create" do
12
+ setup do
13
+ post :create
14
+ end
15
+
16
+ should_deny_access
17
+
18
+ should "not store location" do
19
+ assert session[:return_to].nil?
20
+ end
21
+ end
22
+
23
+ end
@@ -0,0 +1,21 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path(File.dirname(__FILE__) +
3
+ "/rails_root/config/environment")
4
+ require 'test_help'
5
+
6
+ $: << File.expand_path(File.dirname(__FILE__) + '/..')
7
+ require 'blue_light_special'
8
+
9
+ begin
10
+ require 'redgreen'
11
+ rescue LoadError
12
+ end
13
+
14
+ require File.join(File.dirname(__FILE__), '..', 'shoulda_macros', 'blue_light_special')
15
+
16
+ class ActiveSupport::TestCase
17
+ self.use_transactional_fixtures = true
18
+ self.use_instantiated_fixtures = false
19
+ end
20
+
21
+ FakeWeb.allow_net_connect = false
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blue_light_special_heroku_fork
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nathaniel Bibler
8
+ - Mark Kendall
9
+ - Caike Souza
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2010-03-19 00:00:00 -04:00
15
+ default_executable:
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: mini_fb
19
+ type: :runtime
20
+ version_requirement:
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "="
24
+ - !ruby/object:Gem::Version
25
+ version: 0.2.2
26
+ version:
27
+ - !ruby/object:Gem::Dependency
28
+ name: delayed_job
29
+ type: :runtime
30
+ version_requirement:
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "="
34
+ - !ruby/object:Gem::Version
35
+ version: 1.8.4
36
+ version:
37
+ - !ruby/object:Gem::Dependency
38
+ name: mad_mimi_mailer
39
+ type: :runtime
40
+ version_requirement:
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - "="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.0.7
46
+ version:
47
+ - !ruby/object:Gem::Dependency
48
+ name: shoulda
49
+ type: :development
50
+ version_requirement:
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ description: Rails authentication by email and password with integrated dependencies to MadMimi. Also provides administrative user impersonation.
58
+ email: nate@envylabs.com
59
+ executables: []
60
+
61
+ extensions: []
62
+
63
+ extra_rdoc_files:
64
+ - LICENSE
65
+ - README.rdoc
66
+ files:
67
+ - LICENSE
68
+ - README.rdoc
69
+ - Rakefile
70
+ - VERSION
71
+ - app/controllers/blue_light_special/impersonations_controller.rb
72
+ - app/controllers/blue_light_special/passwords_controller.rb
73
+ - app/controllers/blue_light_special/sessions_controller.rb
74
+ - app/controllers/blue_light_special/users_controller.rb
75
+ - app/models/blue_light_special_mailer.rb
76
+ - app/models/deliver_change_password_job.rb
77
+ - app/models/deliver_welcome_job.rb
78
+ - app/models/mimi_mailer.rb
79
+ - app/models/generic_mailer.rb
80
+ - app/models/impersonation.rb
81
+ - app/views/blue_light_special_mailer/change_password.html.erb
82
+ - app/views/impersonations/index.html.erb
83
+ - app/views/passwords/edit.html.erb
84
+ - app/views/passwords/new.html.erb
85
+ - app/views/sessions/new.html.erb
86
+ - app/views/users/_form.html.erb
87
+ - app/views/users/edit.html.erb
88
+ - app/views/users/new.html.erb
89
+ - app/views/users/show.html.erb
90
+ - generators/blue_light_special/USAGE
91
+ - generators/blue_light_special/blue_light_special_generator.rb
92
+ - generators/blue_light_special/lib/insert_commands.rb
93
+ - generators/blue_light_special/lib/rake_commands.rb
94
+ - generators/blue_light_special/templates/README
95
+ - generators/blue_light_special/templates/application.html.erb
96
+ - generators/blue_light_special/templates/blue_light_special.rb
97
+ - generators/blue_light_special/templates/blue_light_special.yml
98
+ - generators/blue_light_special/templates/factories.rb
99
+ - generators/blue_light_special/templates/migrations/create_users.rb
100
+ - generators/blue_light_special/templates/migrations/update_users.rb
101
+ - generators/blue_light_special/templates/style.css
102
+ - generators/blue_light_special/templates/user.rb
103
+ - generators/blue_light_special/templates/xd_receiver.html
104
+ - generators/blue_light_special/templates/xd_receiver_ssl.html
105
+ - generators/blue_light_special_admin/USAGE
106
+ - generators/blue_light_special_admin/blue_light_special_admin_generator.rb
107
+ - generators/blue_light_special_admin/lib/insert_commands.rb
108
+ - generators/blue_light_special_admin/templates/README
109
+ - generators/blue_light_special_admin/templates/app/controllers/admin/admin_controller.rb
110
+ - generators/blue_light_special_admin/templates/app/controllers/admin/users_controller.rb
111
+ - generators/blue_light_special_admin/templates/app/views/admin/users/_form.html.erb
112
+ - generators/blue_light_special_admin/templates/app/views/admin/users/edit.html.erb
113
+ - generators/blue_light_special_admin/templates/app/views/admin/users/index.html.erb
114
+ - generators/blue_light_special_admin/templates/app/views/admin/users/new.html.erb
115
+ - generators/blue_light_special_admin/templates/app/views/admin/users/show.html.erb
116
+ - generators/blue_light_special_admin/templates/test/integration/admin/users_test.rb
117
+ - generators/blue_light_special_tests/USAGE
118
+ - generators/blue_light_special_tests/blue_light_special_tests_generator.rb
119
+ - generators/blue_light_special_tests/templates/README
120
+ - generators/blue_light_special_tests/templates/test/integration/edit_profile_test.rb
121
+ - generators/blue_light_special_tests/templates/test/integration/facebook_test.rb
122
+ - generators/blue_light_special_tests/templates/test/integration/impersonation_test.rb
123
+ - generators/blue_light_special_tests/templates/test/integration/password_reset_test.rb
124
+ - generators/blue_light_special_tests/templates/test/integration/sign_in_test.rb
125
+ - generators/blue_light_special_tests/templates/test/integration/sign_out_test.rb
126
+ - generators/blue_light_special_tests/templates/test/integration/sign_up_test.rb
127
+ - lib/blue_light_special.rb
128
+ - lib/blue_light_special/authentication.rb
129
+ - lib/blue_light_special/configuration.rb
130
+ - lib/blue_light_special/extensions/errors.rb
131
+ - lib/blue_light_special/extensions/rescue.rb
132
+ - lib/blue_light_special/routes.rb
133
+ - lib/blue_light_special/user.rb
134
+ - rails/init.rb
135
+ - shoulda_macros/blue_light_special.rb
136
+ has_rdoc: false
137
+ homepage: http://github.com/envylabs/blue_light_special
138
+ post_install_message:
139
+ rdoc_options:
140
+ - --charset=UTF-8
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: "0"
148
+ version:
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: "0"
154
+ version:
155
+ requirements: []
156
+
157
+ rubyforge_project:
158
+ rubygems_version: 1.3.1
159
+ signing_key:
160
+ specification_version: 3
161
+ summary: Rails authentication by email and password
162
+ test_files:
163
+ - test/controllers/passwords_controller_test.rb
164
+ - test/controllers/sessions_controller_test.rb
165
+ - test/controllers/users_controller_test.rb
166
+ - test/models/blue_light_special_mailer_test.rb
167
+ - test/models/impersonation_test.rb
168
+ - test/models/user_test.rb
169
+ - test/rails_root/app/controllers/accounts_controller.rb
170
+ - test/rails_root/app/controllers/application_controller.rb
171
+ - test/rails_root/app/helpers/application_helper.rb
172
+ - test/rails_root/app/helpers/confirmations_helper.rb
173
+ - test/rails_root/app/helpers/passwords_helper.rb
174
+ - test/rails_root/config/boot.rb
175
+ - test/rails_root/config/environment.rb
176
+ - test/rails_root/config/environments/development.rb
177
+ - test/rails_root/config/environments/production.rb
178
+ - test/rails_root/config/environments/test.rb
179
+ - test/rails_root/config/initializers/inflections.rb
180
+ - test/rails_root/config/initializers/mime_types.rb
181
+ - test/rails_root/config/initializers/requires.rb
182
+ - test/rails_root/config/initializers/time_formats.rb
183
+ - test/rails_root/config/routes.rb
184
+ - test/rails_root/public/dispatch.rb
185
+ - test/rails_root/script/create_project.rb
186
+ - test/rails_root/test/functional/accounts_controller_test.rb
187
+ - test/test_helper.rb