bear 0.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.
@@ -0,0 +1,116 @@
1
+
2
+ create_file 'spec/fabricators/user.rb' do
3
+ <<-'FILE'
4
+ Fabricator(:user) do
5
+ name { Fabricate.sequence(:name) { |i| "Bear #{i}" } }
6
+ email { Fabricate.sequence(:email) { |i| "user#{i}@yoursite.com" } }
7
+ password "password"
8
+ confirmed_at Time.new.to_s
9
+ confirmation_sent_at Time.new.to_s
10
+ password_confirmation "password"
11
+ end
12
+
13
+ Fabricator(:admin, :from => :user) do
14
+ email "admin@yoursite.com"
15
+ password "password"
16
+ end
17
+
18
+ Fabricator(:member, :from => :user) do
19
+ email "member@quickleft.com"
20
+ password "password"
21
+ end
22
+ FILE
23
+ end
24
+
25
+ create_file 'features/step_definitions/devise_steps.rb' do
26
+ <<-'FILE'
27
+ When /^I log in as "([^\"]*)" with password "([^\"]*)"$/ do |email, password|
28
+ visit(new_user_session_path)
29
+ fill_in("user[email]", :with => email)
30
+ fill_in("user[password]", :with => password)
31
+ click_button("Sign in")
32
+ end
33
+
34
+ Given /^a logged in admin user$/ do
35
+ Fabricate(:admin)
36
+ visit(new_user_session_path)
37
+ fill_in("user[email]", :with => "quickleft@quickleft.com")
38
+ fill_in("user[password]", :with => "password")
39
+ click_button("Sign in")
40
+ end
41
+
42
+ Given /^a logged in member user$/ do
43
+ Fabricate(:member)
44
+ visit(new_user_session_path)
45
+ fill_in("user[email]", :with => "member@quickleft.com")
46
+ fill_in("user[password]", :with => "password")
47
+ click_button("Sign in")
48
+ end
49
+
50
+ When /^I log out$/ do
51
+ visit(destroy_user_session_path)
52
+ end
53
+
54
+ Given /^a user "([^\"]*)"$/ do |email|
55
+ Fabricate(:user, :email => email)
56
+ end
57
+ FILE
58
+ end
59
+
60
+ inject_into_file 'features/support/paths.rb', :after => "case page_name\n" do
61
+ <<-'FILE'
62
+
63
+ when /logout/
64
+ '/users/sign_out'
65
+
66
+ when /login/
67
+ '/users/sign_in'
68
+ FILE
69
+ end
70
+
71
+ create_file 'features/forgot_password.feature' do
72
+ <<-'FILE'
73
+ Feature: Forgot password
74
+ As an user
75
+ I want to secure way to reset my password
76
+ So that I can still login if I forget it
77
+
78
+ Scenario: Follow forget your password link
79
+ Given the following user records
80
+ | email |
81
+ | forgot@quickleft.com |
82
+ When I am on the login page
83
+ And I follow "Forgot your password?"
84
+ And I fill in "Email" with "forgot@quickleft.com"
85
+ And I press "Send me reset password instructions"
86
+ Then I should see "You will receive an email with instructions about how to reset your password in a few minutes."
87
+ And 1 emails should be delivered to forgot@quickleft.com
88
+ When I click the first link in the email
89
+ And I fill in "Password" with "myNewP@ssword"
90
+ And I fill in "Password confirmation" with "myNewP@ssword"
91
+ And I press "Change my password"
92
+ Then I should see "Your password was changed successfully. You are now signed in."
93
+ FILE
94
+ end
95
+
96
+ create_file 'features/resend_verification_email.feature' do
97
+ <<-'FILE'
98
+ Feature: Resend Verification
99
+ As an user
100
+ I want to resend my verification email
101
+ So that I can activate my account if I lost the original email
102
+
103
+ Scenario: Follow resend verification email
104
+ Given the following user records
105
+ | email | confirmed_at |
106
+ | resend@quickleft.com | nil |
107
+ When I am on the login page
108
+ And I follow "Didn't receive confirmation instructions?"
109
+ And I fill in "Email" with "resend@quickleft.com"
110
+ And I press "Resend confirmation instructions"
111
+ Then I should see "You will receive an email with instructions about how to confirm your account in a few minutes."
112
+ And 2 emails should be delivered to resend@quickleft.com
113
+ When I click the first link in the email
114
+ Then I should see "Your account was successfully confirmed. You are now signed in."
115
+ FILE
116
+ end
@@ -0,0 +1,36 @@
1
+ run "rm Gemfile"
2
+
3
+ create_file "Gemfile", "source \"http://rubygems.org\"\n"
4
+
5
+ gem "rails", "~> 3.0.0"
6
+ gem "autotest", :group => [ :test ]
7
+ gem "autotest-rails", :group => [ :test ]
8
+ gem "bistro_car"
9
+ gem "capybara", "0.4.0", :group => [ :cucumber ]
10
+ gem "cover_me", ">= 1.0.0.pre2", :require => false, :group => [ :development, :test, :cucumber ]
11
+ gem "cucumber", :group => [ :cucumber ]
12
+ gem "cucumber-rails", :group => [ :cucumber ]
13
+ gem "database_cleaner", :group => [ :test, :cucumber ]
14
+ gem "devise", ">= 1.1.3" if ENV["BEAR_AUTH"]
15
+ gem "fabrication", :group => [ :test, :cucumber ]
16
+ gem "faker", :group => [ :test ]
17
+ gem "formtastic", "1.1.0"
18
+ gem "haml", ">= 3.0.21"
19
+ gem "hoptoad_notifier"
20
+ gem "hpricot", :group => [ :development ]
21
+ gem "jammit"
22
+ gem "launchy", :group => [ :cucumber ]
23
+ gem "mocha", :group => [ :test ]
24
+ gem "mysql2"
25
+ gem "pickle", :group => [ :test, :cucumber ]
26
+ gem "rails3-generators", :group => :development
27
+ gem "remarkable_activemodel", ">=4.0.0.alpha4", :group => :test
28
+ gem "rspec-rails", "~> 2.0.0", :group => [ :test, :development ]
29
+ gem "ruby_parser", :group => [ :development ]
30
+ gem "shoulda", :git => "git://github.com/thoughtbot/shoulda.git", :group => [ :test ]
31
+ gem "spork", :group => [ :cucumber ]
32
+ gem "thin", :group => [ :test, :cucumber, :development ]
33
+ gem "timecop", :group => [ :test, :cucumber ]
34
+ gem "will_paginate", "~> 3.0.pre2"
35
+
36
+ run "bundle install"
@@ -0,0 +1,7 @@
1
+ inject_into_file "config/application.rb", :after => "# Configure the default encoding used in templates for Ruby 1.9.\n" do
2
+ <<-RUBY
3
+ config.generators do |g|
4
+ g.template_engine :haml
5
+ end
6
+ RUBY
7
+ end
@@ -0,0 +1,9 @@
1
+ generate(:controller, "home index")
2
+
3
+ create_file "app/views/home/index.html.haml" do
4
+ <<-FILE
5
+ %h1 #{app_name.humanize}
6
+ FILE
7
+ end
8
+
9
+ route("root :to => \"home#index\"")
@@ -0,0 +1,24 @@
1
+ initializer("accessible_attributes.rb") do
2
+ <<-"FILE"
3
+ class ActiveRecord::Base
4
+ attr_accessible
5
+ attr_accessor :accessible
6
+
7
+ private
8
+
9
+ def mass_assignment_authorizer
10
+ if accessible == :all
11
+ self.class.protected_attributes
12
+ else
13
+ super + (accessible || [])
14
+ end
15
+ end
16
+ end
17
+ FILE
18
+ end
19
+
20
+ initializer("haml.rb") do
21
+ <<-"FILE"
22
+ Haml::Template.options[:format] = :html5
23
+ FILE
24
+ end
@@ -0,0 +1,20 @@
1
+ create_file "config/assets.yml" do
2
+ <<-FILE
3
+ embed_assets: on
4
+
5
+ javascripts:
6
+ common:
7
+ - public/javascripts/jquery.js
8
+ - public/javascripts/rails.js
9
+ - public/javascripts/core.js
10
+
11
+ stylesheets:
12
+ main:
13
+ - public/stylesheets/reset.css
14
+ - public/stylesheets/grid.css
15
+ - public/stylesheets/common.css
16
+ - public/stylesheets/application.css
17
+ admin:
18
+ - public/stylesheets/admin.css
19
+ FILE
20
+ end
@@ -0,0 +1,58 @@
1
+ get "http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js", "public/javascripts/jquery.js"
2
+ get_remote_https_file "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
3
+ get "http://html5shiv.googlecode.com/svn/trunk/html5.js", "public/javascripts/shiv.js"
4
+ run "rm public/javascripts/application.js"
5
+
6
+ create_file "public/javascripts/core.js" do
7
+ <<-FILE
8
+ (function($){
9
+ var QL = QL || {};
10
+
11
+ QL = {
12
+ init: function QL_init(){
13
+ // some code that needs to be executed after doc ready
14
+ QL.bindEvents();
15
+ },
16
+ bindEvents: function QL_liveEvents(){
17
+ $('a[rel*=external]').live('click',function(){
18
+ window.open(this.href);
19
+ return false;
20
+ });
21
+
22
+ // more globally bound events
23
+ },
24
+ helpers: function QL_helpers(){
25
+ // helper for searching through arrays
26
+ QL.helpers.arraySearch = function(a){
27
+ var o = {};
28
+ for(var i=0;i<a.length;i++){
29
+ o[a[i]]='';
30
+ }
31
+ return o;
32
+ };
33
+ //j. resigs array remove overload
34
+ Array.prototype.remove = function(from, to) {
35
+ var rest = this.slice((to || from) + 1 || this.length);
36
+ this.length = from < 0 ? this.length + from : from;
37
+ return this.push.apply(this, rest);
38
+ };
39
+ // duck punch Array.indexOf into IE browsers
40
+ if(!Array.indexOf){
41
+ Array.prototype.indexOf = function(obj){
42
+ for(var i=0; i<this.length; i++){
43
+ if(this[i]==obj){
44
+ return i;
45
+ }
46
+ }
47
+ return -1;
48
+ }
49
+ }
50
+ }
51
+ };
52
+
53
+ window.QL = QL;
54
+ $(document).ready(QL.init);
55
+
56
+ })(jQuery);
57
+ FILE
58
+ end
@@ -0,0 +1,5 @@
1
+ run "rm public/index.html"
2
+ run "rm public/images/rails.png"
3
+ run "rm README"
4
+ run "touch README"
5
+ run "rm public/favicon.ico"
@@ -0,0 +1,3 @@
1
+ run "rm -rf spec/views/*"
2
+ run "rm -rf spec/models/*"
3
+ run "rm -rf spec/helpers/*"
@@ -0,0 +1,459 @@
1
+ run "mkdir public/stylesheets/sass"
2
+
3
+ create_file "public/stylesheets/sass/colors.sass" do
4
+ <<-FILE
5
+ $black = rgba(0, 0, 0, 1)
6
+ $white = rgba(255, 255, 255, 1)
7
+ FILE
8
+ end
9
+
10
+ create_file "public/stylesheets/sass/mixins.sass" do
11
+ <<-FILE
12
+ @mixin rounded-top-left($radius)
13
+ border-top-left-radius: $radius
14
+ -moz-border-top-left-radius: $radius
15
+ -webkit-border-top-left-radius: $radius
16
+
17
+ @mixin rounded-top-right($radius)
18
+ border-top-right-radius: $radius
19
+ -moz-border-top-right-radius: $radius
20
+ -webkit-border-top-right-radius: $radius
21
+
22
+ @mixin rounded-bottom-left($radius)
23
+ border-bottom-left-radius: $radius
24
+ -moz-border-bottom-left-radius: $radius
25
+ -webkit-border-bottom-left-radius: $radius
26
+
27
+ @mixin rounded-bottom-right($radius)
28
+ border-bottom-right-radius: $radius
29
+ -moz-border-bottom-right-radius: $radius
30
+ -webkit-border-bottom-right-radius: $radius
31
+
32
+ @mixin rounded($radius)
33
+ @include rounded-top-left($radius)
34
+ @include rounded-top-right($radius)
35
+ @include rounded-bottom-left($radius)
36
+ @include rounded-bottom-right($radius)
37
+
38
+ @mixin box-shadow($x, $y, $spread, $color)
39
+ box-shadow: $x $y $spread $color
40
+ -webkit-box-shadow: $x $y $spread $color
41
+ -moz-box-shadow: $x $y $spread $color
42
+ FILE
43
+ end
44
+
45
+ create_file "public/stylesheets/sass/application.sass" do
46
+ <<-FILE
47
+ @import "colors"
48
+ @import "mixins"
49
+
50
+ body
51
+ background-color: $white
52
+ color: lighten($black, 25%)
53
+ font-family: Helvetica, Arial, Verdana, sans
54
+ font-size: 1em
55
+
56
+ h1, h2, h3, h4, h5, h6
57
+ color: $black
58
+ FILE
59
+ end
60
+
61
+ create_file "public/stylesheets/sass/reset.sass" do
62
+ <<-FILE
63
+ html, body, div, span, applet, object, iframe,
64
+ h1, h2, h3, h4, h5, h6,
65
+ p, blockquote, pre, a, abbr, acronym, address,
66
+ big, cite, code, del, dfn, em, font, img, ins, kbd,
67
+ q, s, samp, small, strike, strong, sub, sup, tt, var,
68
+ b, u, i, center, dl, dt, dd, ol, ul, li,
69
+ fieldset, form, label, legend,
70
+ table, caption, tbody, tfoot, thead, tr, th, td
71
+ background: transparent
72
+ border: 0
73
+ margin: 0
74
+ outline: 0
75
+ padding: 0
76
+ vertical-align: baseline
77
+
78
+ ol, ul
79
+ list-style: none
80
+
81
+ blockquote, q
82
+ quotes: none
83
+
84
+ table
85
+ border-collapse: collapsellapse
86
+ border-spacing: 0
87
+ FILE
88
+ end
89
+
90
+ create_file "public/stylesheets/grid.sass" do
91
+ <<-FILE
92
+ /*
93
+ Variable Grid System.
94
+ Learn more ~ http://www.spry-soft.com/grids/
95
+ Based on 960 Grid System - http://960.gs/
96
+
97
+ Licensed under GPL and MIT.
98
+ */
99
+
100
+
101
+ /* Containers
102
+ ----------------------------------------------------------------------------------------------------*/
103
+ .container_12 {
104
+ margin-left: auto;
105
+ margin-right: auto;
106
+ width: 960px;
107
+ }
108
+
109
+ /* Grid >> Global
110
+ ----------------------------------------------------------------------------------------------------*/
111
+
112
+ .grid_1,
113
+ .grid_2,
114
+ .grid_3,
115
+ .grid_4,
116
+ .grid_5,
117
+ .grid_6,
118
+ .grid_7,
119
+ .grid_8,
120
+ .grid_9,
121
+ .grid_10,
122
+ .grid_11,
123
+ .grid_12 {
124
+ display:inline;
125
+ float: left;
126
+ position: relative;
127
+ margin-left: 10px;
128
+ margin-right: 10px;
129
+ }
130
+
131
+ /* Grid >> Children (Alpha ~ First, Omega ~ Last)
132
+ ----------------------------------------------------------------------------------------------------*/
133
+
134
+ .alpha {
135
+ margin-left: 0;
136
+ }
137
+
138
+ .omega {
139
+ margin-right: 0;
140
+ }
141
+
142
+ /* Grid >> 12 Columns
143
+ ----------------------------------------------------------------------------------------------------*/
144
+
145
+ .container_12 .grid_1 {
146
+ width:60px;
147
+ }
148
+
149
+ .container_12 .grid_2 {
150
+ width:140px;
151
+ }
152
+
153
+ .container_12 .grid_3 {
154
+ width:220px;
155
+ }
156
+
157
+ .container_12 .grid_4 {
158
+ width:300px;
159
+ }
160
+
161
+ .container_12 .grid_5 {
162
+ width:380px;
163
+ }
164
+
165
+ .container_12 .grid_6 {
166
+ width:460px;
167
+ }
168
+
169
+ .container_12 .grid_7 {
170
+ width:540px;
171
+ }
172
+
173
+ .container_12 .grid_8 {
174
+ width:620px;
175
+ }
176
+
177
+ .container_12 .grid_9 {
178
+ width:700px;
179
+ }
180
+
181
+ .container_12 .grid_10 {
182
+ width:780px;
183
+ }
184
+
185
+ .container_12 .grid_11 {
186
+ width:860px;
187
+ }
188
+
189
+ .container_12 .grid_12 {
190
+ width:940px;
191
+ }
192
+
193
+
194
+
195
+ /* Prefix Extra Space >> 12 Columns
196
+ ----------------------------------------------------------------------------------------------------*/
197
+
198
+ .container_12 .prefix_1 {
199
+ padding-left:80px;
200
+ }
201
+
202
+ .container_12 .prefix_2 {
203
+ padding-left:160px;
204
+ }
205
+
206
+ .container_12 .prefix_3 {
207
+ padding-left:240px;
208
+ }
209
+
210
+ .container_12 .prefix_4 {
211
+ padding-left:320px;
212
+ }
213
+
214
+ .container_12 .prefix_5 {
215
+ padding-left:400px;
216
+ }
217
+
218
+ .container_12 .prefix_6 {
219
+ padding-left:480px;
220
+ }
221
+
222
+ .container_12 .prefix_7 {
223
+ padding-left:560px;
224
+ }
225
+
226
+ .container_12 .prefix_8 {
227
+ padding-left:640px;
228
+ }
229
+
230
+ .container_12 .prefix_9 {
231
+ padding-left:720px;
232
+ }
233
+
234
+ .container_12 .prefix_10 {
235
+ padding-left:800px;
236
+ }
237
+
238
+ .container_12 .prefix_11 {
239
+ padding-left:880px;
240
+ }
241
+
242
+
243
+
244
+ /* Suffix Extra Space >> 12 Columns
245
+ ----------------------------------------------------------------------------------------------------*/
246
+
247
+ .container_12 .suffix_1 {
248
+ padding-right:80px;
249
+ }
250
+
251
+ .container_12 .suffix_2 {
252
+ padding-right:160px;
253
+ }
254
+
255
+ .container_12 .suffix_3 {
256
+ padding-right:240px;
257
+ }
258
+
259
+ .container_12 .suffix_4 {
260
+ padding-right:320px;
261
+ }
262
+
263
+ .container_12 .suffix_5 {
264
+ padding-right:400px;
265
+ }
266
+
267
+ .container_12 .suffix_6 {
268
+ padding-right:480px;
269
+ }
270
+
271
+ .container_12 .suffix_7 {
272
+ padding-right:560px;
273
+ }
274
+
275
+ .container_12 .suffix_8 {
276
+ padding-right:640px;
277
+ }
278
+
279
+ .container_12 .suffix_9 {
280
+ padding-right:720px;
281
+ }
282
+
283
+ .container_12 .suffix_10 {
284
+ padding-right:800px;
285
+ }
286
+
287
+ .container_12 .suffix_11 {
288
+ padding-right:880px;
289
+ }
290
+
291
+
292
+
293
+ /* Push Space >> 12 Columns
294
+ ----------------------------------------------------------------------------------------------------*/
295
+
296
+ .container_12 .push_1 {
297
+ left:80px;
298
+ }
299
+
300
+ .container_12 .push_2 {
301
+ left:160px;
302
+ }
303
+
304
+ .container_12 .push_3 {
305
+ left:240px;
306
+ }
307
+
308
+ .container_12 .push_4 {
309
+ left:320px;
310
+ }
311
+
312
+ .container_12 .push_5 {
313
+ left:400px;
314
+ }
315
+
316
+ .container_12 .push_6 {
317
+ left:480px;
318
+ }
319
+
320
+ .container_12 .push_7 {
321
+ left:560px;
322
+ }
323
+
324
+ .container_12 .push_8 {
325
+ left:640px;
326
+ }
327
+
328
+ .container_12 .push_9 {
329
+ left:720px;
330
+ }
331
+
332
+ .container_12 .push_10 {
333
+ left:800px;
334
+ }
335
+
336
+ .container_12 .push_11 {
337
+ left:880px;
338
+ }
339
+
340
+
341
+
342
+ /* Pull Space >> 12 Columns
343
+ ----------------------------------------------------------------------------------------------------*/
344
+
345
+ .container_12 .pull_1 {
346
+ left:-80px;
347
+ }
348
+
349
+ .container_12 .pull_2 {
350
+ left:-160px;
351
+ }
352
+
353
+ .container_12 .pull_3 {
354
+ left:-240px;
355
+ }
356
+
357
+ .container_12 .pull_4 {
358
+ left:-320px;
359
+ }
360
+
361
+ .container_12 .pull_5 {
362
+ left:-400px;
363
+ }
364
+
365
+ .container_12 .pull_6 {
366
+ left:-480px;
367
+ }
368
+
369
+ .container_12 .pull_7 {
370
+ left:-560px;
371
+ }
372
+
373
+ .container_12 .pull_8 {
374
+ left:-640px;
375
+ }
376
+
377
+ .container_12 .pull_9 {
378
+ left:-720px;
379
+ }
380
+
381
+ .container_12 .pull_10 {
382
+ left:-800px;
383
+ }
384
+
385
+ .container_12 .pull_11 {
386
+ left:-880px;
387
+ }
388
+
389
+
390
+
391
+
392
+ /* Clear Floated Elements
393
+ ----------------------------------------------------------------------------------------------------*/
394
+
395
+ /* http://sonspring.com/journal/clearing-floats */
396
+
397
+ .clear {
398
+ clear: both;
399
+ display: block;
400
+ overflow: hidden;
401
+ visibility: hidden;
402
+ width: 0;
403
+ height: 0;
404
+ }
405
+
406
+ /* http://perishablepress.com/press/2008/02/05/lessons-learned-concerning-the-clearfix-css-hack */
407
+
408
+ .clearfix:after {
409
+ clear: both;
410
+ content: ' ';
411
+ display: block;
412
+ font-size: 0;
413
+ line-height: 0;
414
+ visibility: hidden;
415
+ width: 0;
416
+ height: 0;
417
+ }
418
+
419
+ .clearfix {
420
+ display: inline-block;
421
+ }
422
+
423
+ * html .clearfix {
424
+ height: 1%;
425
+ }
426
+
427
+ .clearfix {
428
+ display: block;
429
+ }
430
+ FILE
431
+ end
432
+
433
+ create_file 'public/stylesheets/sass/common.sass' do
434
+ <<-FILE
435
+ .group:after
436
+ content: "."
437
+ display: block
438
+ height: 0
439
+ clear: both
440
+ visibility: hidden
441
+
442
+ .left
443
+ float: left
444
+
445
+ .right
446
+ float: right
447
+
448
+ .text-center
449
+ text-align: center !important
450
+
451
+ .text-left
452
+ text-align: left !important
453
+
454
+ .text-right
455
+ text-align: right !important
456
+ FILE
457
+ end
458
+
459
+ run 'sass public/stylesheets/sass/main.scss public/stylesheets/main.css'