diff --git a/Capfile b/Capfile new file mode 100644 index 00000000..98743d10 --- /dev/null +++ b/Capfile @@ -0,0 +1,5 @@ +load 'deploy' +# Uncomment if you are using Rails' asset pipeline + # load 'deploy/assets' +Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } +load 'config/deploy' # remove this line to skip loading any of the default tasks \ No newline at end of file diff --git a/Gemfile b/Gemfile index bf7cd228..0268a8be 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,7 @@ source 'http://rubygems.org' gem 'rails', '3.0.12' gem 'gravatar_image_tag', '1.0.0.pre2' gem 'will_paginate', '3.0.pre2' +gem 'capistrano' gem 'sqlite3', '1.3.4' group :development do @@ -14,10 +15,5 @@ end group :test do gem 'rspec-rails', '2.6.1' gem 'webrat', '0.7.1' - gem 'spork', '0.9.0.rc8' gem 'factory_girl_rails', '1.0' - # gem 'autotest', '4.4.6' - # gem 'autotest-rails-pure', '4.1.2' - # gem 'autotest-fsevent', '0.2.4' - # gem 'autotest-growl', '0.2.9' end diff --git a/Gemfile.lock b/Gemfile.lock index f9d65656..c56bea5b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,6 +31,12 @@ GEM annotate (2.4.0) arel (2.0.10) builder (2.1.2) + capistrano (2.12.0) + highline + net-scp (>= 1.0.0) + net-sftp (>= 2.0.0) + net-ssh (>= 2.0.14) + net-ssh-gateway (>= 1.1.0) diff-lcs (1.1.2) erubis (2.6.6) abstract (>= 1.0.0) @@ -40,6 +46,7 @@ GEM rails (>= 3.0.0.beta4) faker (0.3.1) gravatar_image_tag (1.0.0.pre2) + highline (1.6.11) i18n (0.5.0) json (1.6.6) mail (2.2.19) @@ -48,6 +55,13 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.18) + net-scp (1.0.4) + net-ssh (>= 1.99.1) + net-sftp (2.0.5) + net-ssh (>= 2.0.9) + net-ssh (2.3.0) + net-ssh-gateway (1.1.0) + net-ssh (>= 1.99.1) nokogiri (1.4.4) polyglot (0.3.3) rack (1.2.5) @@ -85,8 +99,6 @@ GEM activesupport (~> 3.0) railties (~> 3.0) rspec (~> 2.6.0) - spork (0.9.0.rc8) - sqlite3 (1.3.4) thor (0.14.6) treetop (1.4.10) polyglot @@ -103,12 +115,11 @@ PLATFORMS DEPENDENCIES annotate (= 2.4.0) + capistrano factory_girl_rails (= 1.0) faker (= 0.3.1) gravatar_image_tag (= 1.0.0.pre2) rails (= 3.0.12) rspec-rails (= 2.6.1) - spork (= 0.9.0.rc8) - sqlite3 (= 1.3.4) webrat (= 0.7.1) will_paginate (= 3.0.pre2) diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index 4ae2fba7..9ded7323 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -3,7 +3,7 @@ @@ -18,9 +18,9 @@

Sample App

- This is the home page for the Ruby on Rails Tutorial sample application. + This is the home page for the Ruby on Rails Tutorial sample application. Paul Duvall

<%= link_to "Sign up now!", signup_path, :class => "signup_button round" %> -<% end %> \ No newline at end of file +<% end %> diff --git a/config/database.yml b/config/database.yml index 025d62a8..85dac9c5 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,5 +1,5 @@ # SQLite version 3.x -# gem install sqlite3-ruby (not necessary on OS X Leopard) +# gem install sqlite3-ruby (not necessary on OS X Leopard) development: adapter: sqlite3 database: db/development.sqlite3 @@ -19,4 +19,4 @@ production: adapter: sqlite3 database: db/production.sqlite3 pool: 5 - timeout: 5000 + timeout: 5000 \ No newline at end of file diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 00000000..0a3226fe --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,42 @@ +set :application, "rails" +set :domain, "target.devopscloud.com" +set :user, "ec2-user" +set :use_sudo, false +set :deploy_to, "/www/var/#{application}" + +role :app, domain +role :web, domain +role :db, domain, :primary => true + +set :scm, :git +set :repository, 'git@github.com:stelligent/sample_app.git' +set :branch, 'master' +set :deploy_via, :remote_cache + + +after "deploy", "deploy:bundle_install" +after "deploy:bundle_install", "deploy:db_migrate" +after "deploy:db_migrate", "deploy:restart" + +namespace :deploy do + task :bundle_install do + run "cd #{deploy_to} && RAILS_ENV=production bundle install" + end + + task :db_migrate do + run "cd #{deploy_to} && rake db:migrate" + end + + task :start, :roles => :app do + run "touch #{current_release}/tmp/restart.txt" + end + + task :stop, :roles => :app do + # Do nothing. + end + + desc "Restart Application" + task :restart, :roles => :app do + run "touch #{current_release}/tmp/restart.txt" + end +end \ No newline at end of file diff --git a/db/migrate/20100821203213_create_users.rb b/db/migrate/20100821203213_create_users.rb index 805ba7b3..af5f964b 100644 --- a/db/migrate/20100821203213_create_users.rb +++ b/db/migrate/20100821203213_create_users.rb @@ -3,6 +3,7 @@ def self.up create_table :users do |t| t.string :name t.string :email + t.string :mobile t.timestamps end diff --git a/lib/tasks/sample_data.rake b/lib/tasks/sample_data.rake index 5d4aed0f..8f5f0147 100644 --- a/lib/tasks/sample_data.rake +++ b/lib/tasks/sample_data.rake @@ -1,5 +1,5 @@ namespace :db do - desc "Fill database with sample data" + desc "Fill the database with sample data" task :populate => :environment do Rake::Task['db:reset'].invoke make_users @@ -40,4 +40,4 @@ def make_relationships followers = users[3..40] following.each { |followed| user.follow!(followed) } followers.each { |follower| follower.follow!(user) } -end \ No newline at end of file +end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 907420ee..9f377ea5 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -12,7 +12,7 @@ end end - describe "for signed-in-users" do + describe "for all signed-in-users" do before(:each) do @user = test_sign_in(Factory(:user)) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ba697548..08429186 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,39 +1,32 @@ -require 'spork' +# Loading more in this block will cause your tests to run faster. However, +# if you change any configuration or code from libraries loaded here, you'll +# need to restart spork for it take effect. +ENV["RAILS_ENV"] ||= 'test' +require File.expand_path("../../config/environment", __FILE__) +require 'rspec/rails' -Spork.prefork do - # Loading more in this block will cause your tests to run faster. However, - # if you change any configuration or code from libraries loaded here, you'll - # need to restart spork for it take effect. - ENV["RAILS_ENV"] ||= 'test' - require File.expand_path("../../config/environment", __FILE__) - require 'rspec/rails' +# Requires supporting files with custom matchers and macros, etc, +# in ./support/ and its subdirectories. +Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} - # Requires supporting files with custom matchers and macros, etc, - # in ./support/ and its subdirectories. - Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} - - RSpec.configure do |config| - # == Mock Framework - # - # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: - # - # config.mock_with :mocha - # config.mock_with :flexmock - # config.mock_with :rr - config.mock_with :rspec +RSpec.configure do |config| + # == Mock Framework + # + # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: + # + # config.mock_with :mocha + # config.mock_with :flexmock + # config.mock_with :rr + config.mock_with :rspec - config.fixture_path = "#{::Rails.root}/spec/fixtures" + config.fixture_path = "#{::Rails.root}/spec/fixtures" - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, comment the following line or assign false - # instead of true. - config.use_transactional_fixtures = true + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, comment the following line or assign false + # instead of true. + config.use_transactional_fixtures = true - def test_sign_in(user) - controller.sign_in(user) - end + def test_sign_in(user) + controller.sign_in(user) end end - -Spork.each_run do -end
-

What's up?

+

What's up, doc?

<%= render 'shared/micropost_form' %> <%= render 'shared/feed' %>