generic_app 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -32
- data/bin/generic_app +19 -93
- data/bin/generic_app_add +18 -15
- data/gem_install.sh +7 -4
- data/gem_test.sh +25 -32
- data/generic_app.gemspec +0 -1
- data/lib/generic_app/version.rb +1 -1
- data/lib/generic_app.rb +28 -170
- data/spec/lib/1_new_app_spec.rb +60 -0
- data/spec/lib/2_legacy_app_spec.rb +44 -0
- metadata +7 -46
- data/spec/lib/1_sq_spec.rb +0 -62
- data/spec/lib/2_pg_spec.rb +0 -23
- data/spec/lib/3_pg_spec.rb +0 -33
- data/spec/lib/4_addon_spec.rb +0 -43
- data/to_add/README.md +0 -32
- data/to_add/heroku_upload.sh +0 -5
- data/to_add/kill_spring.sh +0 -4
- data/to_add/list_files.sh +0 -42
- data/to_add/notes/0-README.md +0 -9
- data/to_add/notes/2-db.txt +0 -77
- data/to_add/notes/3-db-summary.txt +0 -19
- data/to_add/notes/mvc-account_activations.txt +0 -10
- data/to_add/notes/mvc-application.txt +0 -7
- data/to_add/notes/mvc-layouts.txt +0 -9
- data/to_add/notes/mvc-password_resets.txt +0 -25
- data/to_add/notes/mvc-sessions.txt +0 -27
- data/to_add/notes/mvc-shared_views.txt +0 -4
- data/to_add/notes/mvc-static.txt +0 -22
- data/to_add/notes/mvc-users.txt +0 -96
- data/to_add/notes/tests.txt +0 -52
- data/to_add/sandbox.sh +0 -4
- data/to_add/seed.sh +0 -5
- data/to_add/server.sh +0 -4
- data/to_add/test.sh +0 -7
- data/to_add_pg/config/database.yml +0 -26
data/to_add/notes/mvc-static.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
STATIC PAGES
|
2
|
-
app/controllers/static_pages_controller.rb
|
3
|
-
def home
|
4
|
-
def help
|
5
|
-
def about
|
6
|
-
def contact
|
7
|
-
test/controllers/static_pages_controller_test.rb
|
8
|
-
test "should get home" do
|
9
|
-
test "should get help" do
|
10
|
-
test "should get about" do
|
11
|
-
test "should get contact" do
|
12
|
-
app/helpers/static_pages_helper.rb
|
13
|
-
app/views/static_pages
|
14
|
-
about.html.erb
|
15
|
-
contact.html.erb
|
16
|
-
help.html.erb
|
17
|
-
home.html.erb
|
18
|
-
config/routes.rb
|
19
|
-
root 'static_pages#home'
|
20
|
-
get 'help' => 'static_pages#help'
|
21
|
-
get 'about' => 'static_pages#about'
|
22
|
-
get 'contact' => 'static_pages#contact'
|
data/to_add/notes/mvc-users.txt
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
USERS
|
2
|
-
|
3
|
-
app/controllers/users_controller.rb
|
4
|
-
before_action :logged_in_user, only: [:index, :edit, :update, :destroy]
|
5
|
-
before_action :correct_user, only: [:edit, :update]
|
6
|
-
before_action :admin_user, only: :destroy
|
7
|
-
def index
|
8
|
-
def show
|
9
|
-
def new
|
10
|
-
def create
|
11
|
-
def edit
|
12
|
-
def update
|
13
|
-
def destroy
|
14
|
-
private
|
15
|
-
def user_params
|
16
|
-
def logged_in_user
|
17
|
-
def correct_user
|
18
|
-
def admin_user
|
19
|
-
test/controllers/users_controller_test.rb
|
20
|
-
users_controller_test.rb
|
21
|
-
def setup
|
22
|
-
test "should redirect index when not logged in" do
|
23
|
-
test "should get new" do
|
24
|
-
test "should redirect edit when not logged in" do
|
25
|
-
test "should redirect update when not logged in" do
|
26
|
-
test "should redirect edit when logged in as wrong user" do
|
27
|
-
test "should redirect update when logged in as wrong user" do
|
28
|
-
test "should redirect destroy when not logged in" do
|
29
|
-
test "should redirect destroy when logged in as a non-admin" do
|
30
|
-
app/helpers/users_helper.rb
|
31
|
-
def gravatar_for(user, options = { size: 80 })
|
32
|
-
app/mailers/user_mailer.rb
|
33
|
-
def account_activation(user)
|
34
|
-
def password_reset(user)
|
35
|
-
test/mailers/user_mailer_test.rb
|
36
|
-
test "account_activation" do
|
37
|
-
test "password_reset" do
|
38
|
-
test/mailers/previews/user_mailer_preview.rb
|
39
|
-
# Preview this email at http://localhost:3000/rails/mailers/user_mailer/account_activation
|
40
|
-
def account_activation
|
41
|
-
# Preview this email at http://localhost:3000/rails/mailers/user_mailer/password_reset
|
42
|
-
def password_reset
|
43
|
-
app/models/user.rb
|
44
|
-
attr_accessor :remember_token, :activation_token, :reset_token
|
45
|
-
before_save :downcase_email
|
46
|
-
before_create :create_activation_digest
|
47
|
-
validates :name, presence: true, length: { maximum: 50 }
|
48
|
-
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\-.]+\.[a-z]+\z/i
|
49
|
-
validates :email, presence: true, length: { maximum: 255 },
|
50
|
-
format: { with: VALID_EMAIL_REGEX },
|
51
|
-
uniqueness: { case_sensitive: false }
|
52
|
-
has_secure_password
|
53
|
-
validates :password, length: { minimum: 6 }, allow_blank: true
|
54
|
-
def User.digest(string)
|
55
|
-
def User.new_token
|
56
|
-
def remember
|
57
|
-
def forget
|
58
|
-
def authenticated?(attribute, token)
|
59
|
-
def activate
|
60
|
-
def send_activation_email
|
61
|
-
def create_reset_digest
|
62
|
-
def send_password_reset_email
|
63
|
-
def password_reset_expired?
|
64
|
-
private
|
65
|
-
def downcase_email
|
66
|
-
def create_activation_digest
|
67
|
-
test/models/user_test.rb
|
68
|
-
def setup
|
69
|
-
test "should be valid" do
|
70
|
-
test "name should be present" do
|
71
|
-
test "email should be present" do
|
72
|
-
test "name should not be too long" do
|
73
|
-
test "email should not be too long" do
|
74
|
-
test "email validation should accept valid addresses" do
|
75
|
-
test "email validation should reject invalid addresses" do
|
76
|
-
test "email address should be unique" do
|
77
|
-
test "password should have a minimum length" do
|
78
|
-
test "authenticated? should return false for a user with nil digest" do
|
79
|
-
app/views/user_mailer
|
80
|
-
account_activation.html.erb
|
81
|
-
account_activation.text.erb
|
82
|
-
password_reset.html.erb
|
83
|
-
password_reset.text.erb
|
84
|
-
app/views/users
|
85
|
-
edit.html.erb
|
86
|
-
index.html.erb
|
87
|
-
new.html.erb
|
88
|
-
show.html.erb
|
89
|
-
_user.html.erb
|
90
|
-
config/routes.rb
|
91
|
-
get 'signup' => 'users#new'
|
92
|
-
resources :users
|
93
|
-
|
94
|
-
DATABASE
|
95
|
-
users (name, email, created_at, updated_at, timestamps, password_digest, remember_digest, admin, activation_digest, activated, activated_at, reset_digest, reset_sent_at)
|
96
|
-
index: named "index_users_on_email", based on email (must be unique)
|
data/to_add/notes/tests.txt
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
NOTE: controller, model, mailer, and helper tests are in the notes/mvc-*.txt file.
|
2
|
-
|
3
|
-
test_helper.rb
|
4
|
-
fixtures :all
|
5
|
-
def is_logged_in?
|
6
|
-
def log_in_as(user, options = {})
|
7
|
-
private
|
8
|
-
def integration_test?
|
9
|
-
|
10
|
-
test/fixtures:
|
11
|
-
users.yml
|
12
|
-
michael
|
13
|
-
archer
|
14
|
-
lana
|
15
|
-
mallory
|
16
|
-
<% 30.times do |n| %>
|
17
|
-
user_<%= n %>:
|
18
|
-
|
19
|
-
test/integration:
|
20
|
-
password_resets_test.rb
|
21
|
-
def setup
|
22
|
-
test "password resets" do
|
23
|
-
# Invalid email
|
24
|
-
# Valid email
|
25
|
-
# Password reset form
|
26
|
-
# Wrong email
|
27
|
-
# Inactive user
|
28
|
-
# Right email, wrong token
|
29
|
-
# Right email, right token
|
30
|
-
# Invalid password & confirmation
|
31
|
-
# Blank password & confirmation
|
32
|
-
# Valid password & confirmation
|
33
|
-
site_layout_test.rb
|
34
|
-
test "layout links" do
|
35
|
-
users_edit_test.rb
|
36
|
-
def setup
|
37
|
-
test "unsuccessful edit" do
|
38
|
-
test "successful edit with friendly forwarding" do
|
39
|
-
users_index_test.rb
|
40
|
-
def setup
|
41
|
-
test "index as admin including pagination and delete links" do
|
42
|
-
test "index as non-admin" do
|
43
|
-
users_login_test.rb
|
44
|
-
def setup
|
45
|
-
test "login with invalid information" do
|
46
|
-
test "login with valid information followed by logout" do
|
47
|
-
test "login with remembering" do
|
48
|
-
test "login without remembering" do
|
49
|
-
users_signup_test.rb
|
50
|
-
def setup
|
51
|
-
test "invalid signup information" do
|
52
|
-
test "valid signup information" do
|
data/to_add/sandbox.sh
DELETED
data/to_add/seed.sh
DELETED
data/to_add/server.sh
DELETED
data/to_add/test.sh
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# POSTGRESQL DATABASE PARAMETERS:
|
2
|
-
# Database name (development)
|
3
|
-
# Database name (testing)
|
4
|
-
# Database name (production)
|
5
|
-
# Username
|
6
|
-
# Password
|
7
|
-
# NOTE: All three databases use the same username and password.
|
8
|
-
|
9
|
-
default: &default
|
10
|
-
adapter: postgresql
|
11
|
-
pool: 5
|
12
|
-
timeout: 5000
|
13
|
-
username: <%= ENV['VAR_STORE_USERNAME'] %>
|
14
|
-
password: <%= ENV['VAR_STORE_PASSWORD'] %>
|
15
|
-
|
16
|
-
development:
|
17
|
-
<<: *default
|
18
|
-
database: DB_NAME_DEV
|
19
|
-
|
20
|
-
test:
|
21
|
-
<<: *default
|
22
|
-
database: DB_NAME_TEST
|
23
|
-
|
24
|
-
production:
|
25
|
-
<<: *default
|
26
|
-
database: DB_NAME_PRO
|