base_rails_app 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -0
- data/README +1 -0
- data/lib/app/controllers/application_controller.rb +55 -0
- data/lib/app/controllers/password_resets_controller.rb +45 -0
- data/lib/app/controllers/user_sessions_controller.rb +25 -0
- data/lib/app/controllers/users_controller.rb +37 -0
- data/lib/app/helpers/application_helper.rb +4 -0
- data/lib/app/helpers/user_sessions_helper.rb +2 -0
- data/lib/app/helpers/users_helper.rb +2 -0
- data/lib/app/models/postman.rb +20 -0
- data/lib/app/models/user.rb +12 -0
- data/lib/app/models/user_session.rb +2 -0
- data/lib/app/views/application/404_not_found.html.erb +8 -0
- data/lib/app/views/layouts/application.html.erb +57 -0
- data/lib/app/views/password_resets/_sidebar.html.erb +0 -0
- data/lib/app/views/password_resets/edit.html.erb +33 -0
- data/lib/app/views/password_resets/new.html.erb +26 -0
- data/lib/app/views/postman/password_reset_instructions.html.erb +3 -0
- data/lib/app/views/postman/welcome_email.html.erb +3 -0
- data/lib/app/views/user_sessions/_form.html.erb +19 -0
- data/lib/app/views/user_sessions/_sidebar.html.erb +13 -0
- data/lib/app/views/user_sessions/new.html.erb +15 -0
- data/lib/app/views/users/_form.html.erb +28 -0
- data/lib/app/views/users/_sidebar.html.erb +6 -0
- data/lib/app/views/users/edit.html.erb +19 -0
- data/lib/app/views/users/new.html.erb +15 -0
- data/lib/app/views/users/show.html.erb +46 -0
- data/lib/base_rails_app.rb +5 -0
- data/lib/base_rails_app/boot.rb +2 -0
- data/lib/base_rails_app/tasks.rb +12 -0
- data/lib/config/configatron/cucumber.rb +0 -0
- data/lib/config/configatron/defaults.rb +4 -0
- data/lib/config/configatron/development.rb +1 -0
- data/lib/config/configatron/production.rb +0 -0
- data/lib/config/configatron/test.rb +0 -0
- data/lib/config/database.yml +25 -0
- data/lib/config/deploy.rb +15 -0
- data/lib/config/environments/cucumber.rb +22 -0
- data/lib/config/environments/development.rb +17 -0
- data/lib/config/environments/production.rb +28 -0
- data/lib/config/environments/test.rb +28 -0
- data/lib/config/gemtronics.rb +36 -0
- data/lib/config/initializers/backtrace_silencers.rb +7 -0
- data/lib/config/initializers/configatron.rb +1 -0
- data/lib/config/initializers/hoptoad.rb +3 -0
- data/lib/config/initializers/inflections.rb +10 -0
- data/lib/config/initializers/mailers.rb +1 -0
- data/lib/config/initializers/mime_types.rb +5 -0
- data/lib/config/initializers/new_rails_defaults.rb +21 -0
- data/lib/config/initializers/session_store.rb +17 -0
- data/lib/config/locales/en.yml +5 -0
- data/lib/config/routes.rb +51 -0
- data/lib/config/schedule.rb +20 -0
- data/lib/db/migrate/20090809175903_create_users.rb +30 -0
- data/lib/db/migrate/20090809204840_acts_as_taggable_on_migration.rb +29 -0
- data/lib/db/migrate/20090912171353_create_delayed_jobs.rb +20 -0
- data/lib/db/migrate/20090912171829_add_delayed_job_extras.rb +11 -0
- data/lib/db/migrate/20090929201455_add_more_time_columns_to_dj.rb +11 -0
- data/lib/db/schema.rb +72 -0
- data/lib/db/seeds.rb +7 -0
- data/lib/lib/tasks/cucumber.rake +36 -0
- data/lib/lib/tasks/rcov.rake +27 -0
- data/lib/lib/tasks/rspec.rake +183 -0
- data/lib/vendor/plugins/delayed_job/generators/delayed_job/delayed_job_generator.rb +22 -0
- data/lib/vendor/plugins/delayed_job/generators/delayed_job/templates/migration.rb +20 -0
- data/lib/vendor/plugins/delayed_job/init.rb +2 -0
- data/lib/vendor/plugins/delayed_job/lib/delayed/command.rb +65 -0
- data/lib/vendor/plugins/delayed_job/lib/delayed/job.rb +271 -0
- data/lib/vendor/plugins/delayed_job/lib/delayed/message_sending.rb +18 -0
- data/lib/vendor/plugins/delayed_job/lib/delayed/performable_method.rb +55 -0
- data/lib/vendor/plugins/delayed_job/lib/delayed/tasks.rb +15 -0
- data/lib/vendor/plugins/delayed_job/lib/delayed/worker.rb +54 -0
- data/lib/vendor/plugins/delayed_job/lib/delayed_job.rb +13 -0
- data/lib/vendor/plugins/delayed_job/recipes/delayed_job.rb +26 -0
- data/lib/vendor/plugins/delayed_job/tasks/jobs.rake +1 -0
- data/lib/vendor/plugins/hoptoad_notifier/install.rb +1 -0
- data/lib/vendor/plugins/hoptoad_notifier/lib/hoptoad_notifier.rb +418 -0
- data/lib/vendor/plugins/hoptoad_notifier/lib/hoptoad_tasks.rb +26 -0
- data/lib/vendor/plugins/hoptoad_notifier/recipes/hoptoad.rb +22 -0
- data/lib/vendor/plugins/hoptoad_notifier/tasks/hoptoad_notifier_tasks.rake +66 -0
- data/lib/vendor/plugins/inherited_resources/README.rdoc +524 -0
- data/lib/vendor/plugins/inherited_resources/inherited_resources.gemspec +71 -0
- data/lib/vendor/plugins/inherited_resources/init.rb +1 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources.rb +23 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/actions.rb +79 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/base.rb +42 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/base_helpers.rb +363 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/belongs_to_helpers.rb +89 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/class_methods.rb +338 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/dsl.rb +26 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/dumb_responder.rb +20 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/has_scope_helpers.rb +83 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/legacy/respond_to.rb +156 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/legacy/responder.rb +200 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/polymorphic_helpers.rb +155 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/singleton_helpers.rb +95 -0
- data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/url_helpers.rb +179 -0
- data/lib/vendor/plugins/inherited_resources/test/aliases_test.rb +139 -0
- data/lib/vendor/plugins/inherited_resources/test/association_chain_test.rb +125 -0
- data/lib/vendor/plugins/inherited_resources/test/base_test.rb +225 -0
- data/lib/vendor/plugins/inherited_resources/test/belongs_to_test.rb +87 -0
- data/lib/vendor/plugins/inherited_resources/test/class_methods_test.rb +138 -0
- data/lib/vendor/plugins/inherited_resources/test/customized_base_test.rb +162 -0
- data/lib/vendor/plugins/inherited_resources/test/customized_belongs_to_test.rb +76 -0
- data/lib/vendor/plugins/inherited_resources/test/defaults_test.rb +70 -0
- data/lib/vendor/plugins/inherited_resources/test/flash_test.rb +88 -0
- data/lib/vendor/plugins/inherited_resources/test/has_scope_test.rb +139 -0
- data/lib/vendor/plugins/inherited_resources/test/locales/en.yml +17 -0
- data/lib/vendor/plugins/inherited_resources/test/nested_belongs_to_test.rb +108 -0
- data/lib/vendor/plugins/inherited_resources/test/optional_belongs_to_test.rb +164 -0
- data/lib/vendor/plugins/inherited_resources/test/polymorphic_test.rb +186 -0
- data/lib/vendor/plugins/inherited_resources/test/redirect_to_test.rb +51 -0
- data/lib/vendor/plugins/inherited_resources/test/respond_to_test.rb +155 -0
- data/lib/vendor/plugins/inherited_resources/test/singleton_test.rb +83 -0
- data/lib/vendor/plugins/inherited_resources/test/test_helper.rb +38 -0
- data/lib/vendor/plugins/inherited_resources/test/url_helpers_test.rb +537 -0
- data/lib/vendor/plugins/inherited_resources/test/views/cars/edit.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/cars/index.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/cars/new.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/cars/show.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/cities/edit.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/cities/index.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/cities/new.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/cities/show.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/comments/edit.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/comments/index.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/comments/new.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/comments/show.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/employees/edit.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/employees/index.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/employees/new.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/employees/show.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/managers/edit.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/managers/new.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/managers/show.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/painters/edit.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/painters/index.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/painters/new.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/painters/show.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/pets/edit.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/pets/index.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/pets/new.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/pets/show.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/products/edit.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/products/index.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/products/new.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/products/show.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/professors/edit.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/professors/index.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/professors/new.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/professors/show.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/projects/index.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/projects/index.json.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/projects/respond_to_skip_default_template.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/projects/respond_with_resource.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/students/edit.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/students/new.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/trees/edit.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/trees/index.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/trees/new.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/trees/show.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/users/edit.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/users/index.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/users/new.html.erb +1 -0
- data/lib/vendor/plugins/inherited_resources/test/views/users/show.html.erb +1 -0
- data/lib/vendor/plugins/web-app-theme/README.md +22 -0
- data/lib/vendor/plugins/web-app-theme/images/avatar.png +0 -0
- data/lib/vendor/plugins/web-app-theme/index.html +473 -0
- data/lib/vendor/plugins/web-app-theme/javascripts/jquery-1.3.min.js +19 -0
- data/lib/vendor/plugins/web-app-theme/javascripts/jquery.localscroll.js +104 -0
- data/lib/vendor/plugins/web-app-theme/javascripts/jquery.scrollTo.js +150 -0
- data/lib/vendor/plugins/web-app-theme/rails_generators/theme/templates/view_layout_administration.html.erb +48 -0
- data/lib/vendor/plugins/web-app-theme/rails_generators/theme/templates/view_layout_sign.html.erb +15 -0
- data/lib/vendor/plugins/web-app-theme/rails_generators/theme/theme_generator.rb +38 -0
- data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_edit.html.erb +20 -0
- data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_form.html.erb +10 -0
- data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_new.html.erb +19 -0
- data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_show.html.erb +23 -0
- data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_sidebar.html.erb +13 -0
- data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_signin.html.erb +39 -0
- data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_signup.html.erb +56 -0
- data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_tables.html.erb +50 -0
- data/lib/vendor/plugins/web-app-theme/rails_generators/themed/themed_generator.rb +89 -0
- data/lib/vendor/plugins/web-app-theme/stylesheets/base.css +336 -0
- data/lib/vendor/plugins/web-app-theme/stylesheets/themes/bec-green/style.css +290 -0
- data/lib/vendor/plugins/web-app-theme/stylesheets/themes/bec/style.css +301 -0
- data/lib/vendor/plugins/web-app-theme/stylesheets/themes/blue/style.css +280 -0
- data/lib/vendor/plugins/web-app-theme/stylesheets/themes/default/style.css +267 -0
- data/lib/vendor/plugins/web-app-theme/stylesheets/themes/djime-cerulean/style.css +298 -0
- data/lib/vendor/plugins/web-app-theme/stylesheets/themes/drastic-dark/style.css +373 -0
- data/lib/vendor/plugins/web-app-theme/stylesheets/themes/kathleene/style.css +272 -0
- data/lib/vendor/plugins/web-app-theme/stylesheets/themes/orange/style.css +263 -0
- data/lib/vendor/plugins/web-app-theme/stylesheets/themes/reidb-greenish/style.css +301 -0
- metadata +257 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
# Use this file to easily define all of your cron jobs.
|
2
|
+
#
|
3
|
+
# It's helpful, but not entirely necessary to understand cron before proceeding.
|
4
|
+
# http://en.wikipedia.org/wiki/Cron
|
5
|
+
|
6
|
+
# Example:
|
7
|
+
#
|
8
|
+
# set :cron_log, "/path/to/my/cron_log.log"
|
9
|
+
#
|
10
|
+
# every 2.hours do
|
11
|
+
# command "/usr/bin/some_great_command"
|
12
|
+
# runner "MyModel.some_method"
|
13
|
+
# rake "some:great:rake:task"
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# every 4.days do
|
17
|
+
# runner "AnotherModel.prune_old_records"
|
18
|
+
# end
|
19
|
+
|
20
|
+
# Learn more: http://github.com/javan/whenever
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class CreateUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :users do |t|
|
4
|
+
t.string :login, :null => false
|
5
|
+
t.string :email, :null => false
|
6
|
+
t.string :crypted_password, :null => false
|
7
|
+
t.string :password_salt, :null => false
|
8
|
+
t.string :persistence_token, :null => false # required
|
9
|
+
t.string :perishable_token, :null => false
|
10
|
+
t.integer :login_count, :null => false, :default => 0
|
11
|
+
t.integer :failed_login_count, :null => false, :default => 0
|
12
|
+
t.datetime :last_request_at
|
13
|
+
t.datetime :current_login_at
|
14
|
+
t.datetime :last_login_at
|
15
|
+
t.string :current_login_ip
|
16
|
+
t.string :last_login_ip
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
|
20
|
+
add_index :users, :login
|
21
|
+
add_index :users, :email
|
22
|
+
add_index :users, :persistence_token
|
23
|
+
add_index :users, :perishable_token
|
24
|
+
add_index :users, :last_request_at
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.down
|
28
|
+
drop_table :users
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class ActsAsTaggableOnMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :tags do |t|
|
4
|
+
t.column :name, :string
|
5
|
+
end
|
6
|
+
|
7
|
+
create_table :taggings do |t|
|
8
|
+
t.column :tag_id, :integer
|
9
|
+
t.column :taggable_id, :integer
|
10
|
+
t.column :tagger_id, :integer
|
11
|
+
t.column :tagger_type, :string
|
12
|
+
|
13
|
+
# You should make sure that the column created is
|
14
|
+
# long enough to store the required class names.
|
15
|
+
t.column :taggable_type, :string
|
16
|
+
t.column :context, :string
|
17
|
+
|
18
|
+
t.column :created_at, :datetime
|
19
|
+
end
|
20
|
+
|
21
|
+
add_index :taggings, :tag_id
|
22
|
+
add_index :taggings, [:taggable_id, :taggable_type, :context]
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.down
|
26
|
+
drop_table :taggings
|
27
|
+
drop_table :tags
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreateDelayedJobs < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :delayed_jobs, :force => true do |table|
|
4
|
+
table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
|
5
|
+
table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
|
6
|
+
table.text :handler # YAML-encoded string of the object that will do work
|
7
|
+
table.text :last_error # reason for last failure (See Note below)
|
8
|
+
table.datetime :run_at # When to run. Could be Time.now for immediately, or sometime in the future.
|
9
|
+
table.datetime :locked_at # Set when a client is working on this object
|
10
|
+
table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
|
11
|
+
table.string :locked_by # Who is working on this object (if locked)
|
12
|
+
table.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.down
|
18
|
+
drop_table :delayed_jobs
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddDelayedJobExtras < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :delayed_jobs, :deleted_at, :datetime
|
4
|
+
add_column :delayed_jobs, :worker_class_name, :string
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
remove_column :delayed_jobs, :worker_class_name
|
9
|
+
remove_column :delayed_jobs, :deleted_at
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddMoreTimeColumnsToDj < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :delayed_jobs, :started_at, :datetime
|
4
|
+
add_column :delayed_jobs, :finished_at, :datetime
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
remove_column :delayed_jobs, :finished_at
|
9
|
+
remove_column :delayed_jobs, :started_at
|
10
|
+
end
|
11
|
+
end
|
data/lib/db/schema.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead of editing this file,
|
2
|
+
# please use the migrations feature of Active Record to incrementally modify your database, and
|
3
|
+
# then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
|
6
|
+
# to create the application database on another system, you should be using db:schema:load, not running
|
7
|
+
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
8
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
9
|
+
#
|
10
|
+
# It's strongly recommended to check this file into your version control system.
|
11
|
+
|
12
|
+
ActiveRecord::Schema.define(:version => 20090929201455) do
|
13
|
+
|
14
|
+
create_table "delayed_jobs", :force => true do |t|
|
15
|
+
t.integer "priority", :default => 0
|
16
|
+
t.integer "attempts", :default => 0
|
17
|
+
t.text "handler"
|
18
|
+
t.text "last_error"
|
19
|
+
t.datetime "run_at"
|
20
|
+
t.datetime "locked_at"
|
21
|
+
t.datetime "failed_at"
|
22
|
+
t.string "locked_by"
|
23
|
+
t.datetime "created_at"
|
24
|
+
t.datetime "updated_at"
|
25
|
+
t.datetime "deleted_at"
|
26
|
+
t.string "worker_class_name"
|
27
|
+
t.datetime "started_at"
|
28
|
+
t.datetime "finished_at"
|
29
|
+
end
|
30
|
+
|
31
|
+
create_table "taggings", :force => true do |t|
|
32
|
+
t.integer "tag_id"
|
33
|
+
t.integer "taggable_id"
|
34
|
+
t.integer "tagger_id"
|
35
|
+
t.string "tagger_type"
|
36
|
+
t.string "taggable_type"
|
37
|
+
t.string "context"
|
38
|
+
t.datetime "created_at"
|
39
|
+
end
|
40
|
+
|
41
|
+
add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
|
42
|
+
add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
|
43
|
+
|
44
|
+
create_table "tags", :force => true do |t|
|
45
|
+
t.string "name"
|
46
|
+
end
|
47
|
+
|
48
|
+
create_table "users", :force => true do |t|
|
49
|
+
t.string "login", :null => false
|
50
|
+
t.string "email", :null => false
|
51
|
+
t.string "crypted_password", :null => false
|
52
|
+
t.string "password_salt", :null => false
|
53
|
+
t.string "persistence_token", :null => false
|
54
|
+
t.string "perishable_token", :null => false
|
55
|
+
t.integer "login_count", :default => 0, :null => false
|
56
|
+
t.integer "failed_login_count", :default => 0, :null => false
|
57
|
+
t.datetime "last_request_at"
|
58
|
+
t.datetime "current_login_at"
|
59
|
+
t.datetime "last_login_at"
|
60
|
+
t.string "current_login_ip"
|
61
|
+
t.string "last_login_ip"
|
62
|
+
t.datetime "created_at"
|
63
|
+
t.datetime "updated_at"
|
64
|
+
end
|
65
|
+
|
66
|
+
add_index "users", ["email"], :name => "index_users_on_email"
|
67
|
+
add_index "users", ["last_request_at"], :name => "index_users_on_last_request_at"
|
68
|
+
add_index "users", ["login"], :name => "index_users_on_login"
|
69
|
+
add_index "users", ["perishable_token"], :name => "index_users_on_perishable_token"
|
70
|
+
add_index "users", ["persistence_token"], :name => "index_users_on_persistence_token"
|
71
|
+
|
72
|
+
end
|
data/lib/db/seeds.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
+
# Major.create(:name => 'Daley', :city => cities.first)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
|
2
|
+
|
3
|
+
unless ARGV.any? {|a| a =~ /^gems/}
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
namespace :cucumber do
|
8
|
+
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
9
|
+
t.fork = true # You may get faster startup if you set this to false
|
10
|
+
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
11
|
+
end
|
12
|
+
|
13
|
+
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
14
|
+
t.fork = true # You may get faster startup if you set this to false
|
15
|
+
t.cucumber_opts = "--color --tags @wip:2 --wip --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Run all features'
|
19
|
+
task :all => [:ok, :wip]
|
20
|
+
end
|
21
|
+
desc 'Alias for cucumber:ok'
|
22
|
+
task :cucumber => 'cucumber:ok'
|
23
|
+
|
24
|
+
task :default => :cucumber
|
25
|
+
|
26
|
+
task :features => :cucumber do
|
27
|
+
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
28
|
+
end
|
29
|
+
rescue LoadError
|
30
|
+
desc 'cucumber rake task not available (cucumber not installed)'
|
31
|
+
task :cucumber do
|
32
|
+
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'cucumber/rake/task' #I have to add this
|
2
|
+
require 'spec/rake/spectask'
|
3
|
+
|
4
|
+
namespace :rcov do
|
5
|
+
Cucumber::Rake::Task.new(:cucumber) do |t|
|
6
|
+
t.rcov = true
|
7
|
+
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data}
|
8
|
+
t.rcov_opts << %[-o "coverage"]
|
9
|
+
end
|
10
|
+
|
11
|
+
Spec::Rake::SpecTask.new(:rspec) do |t|
|
12
|
+
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
13
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
14
|
+
t.rcov = true
|
15
|
+
t.rcov_opts = lambda do
|
16
|
+
IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Run both specs and features to generate aggregated coverage"
|
21
|
+
task :all do |t|
|
22
|
+
rm "coverage.data" if File.exist?("coverage.data")
|
23
|
+
Rake::Task["rcov:rspec"].invoke
|
24
|
+
Rake::Task["rcov:cucumber"].invoke
|
25
|
+
system "open coverage/index.html"
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,183 @@
|
|
1
|
+
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
|
2
|
+
rspec_gem_dir = nil
|
3
|
+
Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
|
4
|
+
rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
|
5
|
+
end
|
6
|
+
rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
|
7
|
+
|
8
|
+
if rspec_gem_dir && (test ?d, rspec_plugin_dir)
|
9
|
+
raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
if rspec_gem_dir
|
13
|
+
$LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
|
14
|
+
elsif File.exist?(rspec_plugin_dir)
|
15
|
+
$LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
|
16
|
+
end
|
17
|
+
|
18
|
+
# Don't load rspec if running "rake gems:*"
|
19
|
+
unless ARGV.any? {|a| a =~ /^gems/}
|
20
|
+
|
21
|
+
begin
|
22
|
+
require 'spec/rake/spectask'
|
23
|
+
rescue MissingSourceFile
|
24
|
+
module Spec
|
25
|
+
module Rake
|
26
|
+
class SpecTask
|
27
|
+
def initialize(name)
|
28
|
+
task name do
|
29
|
+
# if rspec-rails is a configured gem, this will output helpful material and exit ...
|
30
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
|
31
|
+
|
32
|
+
# ... otherwise, do this:
|
33
|
+
raise <<-MSG
|
34
|
+
|
35
|
+
#{"*" * 80}
|
36
|
+
* You are trying to run an rspec rake task defined in
|
37
|
+
* #{__FILE__},
|
38
|
+
* but rspec can not be found in vendor/gems, vendor/plugins or system gems.
|
39
|
+
#{"*" * 80}
|
40
|
+
MSG
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
Rake.application.instance_variable_get('@tasks').delete('default')
|
49
|
+
|
50
|
+
spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
|
51
|
+
task :noop do
|
52
|
+
end
|
53
|
+
|
54
|
+
# task :default => [:spec, 'cucumber:all']
|
55
|
+
task :default => ['rcov:all']
|
56
|
+
task :stats => "spec:statsetup"
|
57
|
+
|
58
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
59
|
+
Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
|
60
|
+
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
61
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
62
|
+
end
|
63
|
+
|
64
|
+
namespace :spec do
|
65
|
+
desc "Run all specs in spec directory with RCov (excluding plugin specs)"
|
66
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
67
|
+
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
68
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
69
|
+
t.rcov = true
|
70
|
+
t.rcov_opts = lambda do
|
71
|
+
IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
desc "Print Specdoc for all specs (excluding plugin specs)"
|
76
|
+
Spec::Rake::SpecTask.new(:doc) do |t|
|
77
|
+
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
78
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
79
|
+
end
|
80
|
+
|
81
|
+
desc "Print Specdoc for all plugin examples"
|
82
|
+
Spec::Rake::SpecTask.new(:plugin_doc) do |t|
|
83
|
+
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
84
|
+
t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*')
|
85
|
+
end
|
86
|
+
|
87
|
+
[:models, :controllers, :views, :helpers, :lib, :integration].each do |sub|
|
88
|
+
desc "Run the code examples in spec/#{sub}"
|
89
|
+
Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
|
90
|
+
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
91
|
+
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
desc "Run the code examples in vendor/plugins (except RSpec's own)"
|
96
|
+
Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
|
97
|
+
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
98
|
+
t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
|
99
|
+
end
|
100
|
+
|
101
|
+
namespace :plugins do
|
102
|
+
desc "Runs the examples for rspec_on_rails"
|
103
|
+
Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
|
104
|
+
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
105
|
+
t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb']
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Setup specs for stats
|
110
|
+
task :statsetup do
|
111
|
+
require 'code_statistics'
|
112
|
+
::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
|
113
|
+
::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
|
114
|
+
::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
|
115
|
+
::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
|
116
|
+
::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
|
117
|
+
::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
|
118
|
+
::STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?('spec/integration')
|
119
|
+
::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
|
120
|
+
::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
|
121
|
+
::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
|
122
|
+
::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
|
123
|
+
::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
|
124
|
+
::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
|
125
|
+
::CodeStatistics::TEST_TYPES << "Integration specs" if File.exist?('spec/integration')
|
126
|
+
end
|
127
|
+
|
128
|
+
namespace :db do
|
129
|
+
namespace :fixtures do
|
130
|
+
desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
|
131
|
+
task :load => :environment do
|
132
|
+
ActiveRecord::Base.establish_connection(Rails.env)
|
133
|
+
base_dir = File.join(Rails.root, 'spec', 'fixtures')
|
134
|
+
fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
|
135
|
+
|
136
|
+
require 'active_record/fixtures'
|
137
|
+
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
|
138
|
+
Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
namespace :server do
|
145
|
+
daemonized_server_pid = File.expand_path("#{RAILS_ROOT}/tmp/pids/spec_server.pid")
|
146
|
+
|
147
|
+
desc "start spec_server."
|
148
|
+
task :start do
|
149
|
+
if File.exist?(daemonized_server_pid)
|
150
|
+
$stderr.puts "spec_server is already running."
|
151
|
+
else
|
152
|
+
$stderr.puts %Q{Starting up spec_server ...}
|
153
|
+
FileUtils.mkdir_p('tmp/pids') unless test ?d, 'tmp/pids'
|
154
|
+
system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
desc "stop spec_server."
|
159
|
+
task :stop do
|
160
|
+
unless File.exist?(daemonized_server_pid)
|
161
|
+
$stderr.puts "No server running."
|
162
|
+
else
|
163
|
+
$stderr.puts "Shutting down spec_server ..."
|
164
|
+
system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
|
165
|
+
File.delete(daemonized_server_pid)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
desc "restart spec_server."
|
170
|
+
task :restart => [:stop, :start]
|
171
|
+
|
172
|
+
desc "check if spec server is running"
|
173
|
+
task :status do
|
174
|
+
if File.exist?(daemonized_server_pid)
|
175
|
+
$stderr.puts %Q{spec_server is running (PID: #{File.read(daemonized_server_pid).gsub("\n","")})}
|
176
|
+
else
|
177
|
+
$stderr.puts "No server running."
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|