added Capistrano

This commit is contained in:
nilsding 2014-12-21 22:12:59 +01:00
parent e8f4c2662a
commit 6ac9af787e
12 changed files with 185 additions and 0 deletions

1
.capistrano/metrics Normal file
View File

@ -0,0 +1 @@
full

24
Capfile Normal file
View File

@ -0,0 +1,24 @@
# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger
#
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails'
require 'capistrano/console'
# Load custom tasks from `lib/capistrano/tasks' if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

View File

@ -48,6 +48,11 @@ gem 'foreman'
group :development do
gem 'spring'
# Capistrano for deployment
gem 'capistrano', '~> 3.1'
gem 'capistrano-rvm', group: :rvm
gem 'capistrano-rails', '~> 1.1'
end
group :production do

View File

@ -44,6 +44,21 @@ GEM
railties (>= 3.1)
buftok (0.2.0)
builder (3.2.2)
capistrano (3.3.5)
capistrano-stats (~> 1.1.0)
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
capistrano-bundler (1.1.3)
capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-rails (1.1.2)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
sshkit (~> 1.2)
capistrano-stats (1.1.1)
capybara (2.4.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
@ -60,6 +75,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.8.0)
colorize (0.7.5)
connection_pool (2.1.0)
daemons (1.1.9)
database_cleaner (1.3.0)
@ -131,6 +147,9 @@ GEM
mysql2 (0.3.17)
naught (1.0.0)
nested_form (0.3.2)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.9.1)
nokogiri (1.6.5)
mini_portile (~> 0.6.0)
nprogress-rails (0.1.6.3)
@ -254,6 +273,10 @@ GEM
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sshkit (1.6.1)
colorize (>= 0.7.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
thin (1.6.3)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0)
@ -302,6 +325,9 @@ DEPENDENCIES
bootstrap-sass (~> 3.2.0.1)
bootstrap_form
bootswatch-rails
capistrano (~> 3.1)
capistrano-rails (~> 1.1)
capistrano-rvm
capybara
coffee-rails (~> 4.1.0)
database_cleaner

16
bin/cap Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'cap' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require 'rubygems'
require 'bundler/setup'
load Gem.bin_path('capistrano', 'cap')

16
bin/capify Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'capify' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require 'rubygems'
require 'bundler/setup'
load Gem.bin_path('capistrano', 'capify')

31
config/deploy.rb Normal file
View File

@ -0,0 +1,31 @@
# config valid only for current version of Capistrano
lock '3.3.5'
set :application, 'justask'
set :repo_url, 'git@git.rrerr.net:justask/justask.git'
ask :branch, :master
set :deploy_to, '/home/justask/cap/'
set :scm, :git
set :format, :pretty
set :log_level, :debug
# RVM
set :rvm_type, :user
set :rvm_ruby_version, '2.0.0'
# Rails
set :conditionally_migrate, true
namespace :deploy do
after :updated do
end
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
end
end
end

View File

@ -0,0 +1,7 @@
server 'rrerr.net', user: 'justask', roles: %w{web app}
set :ssh_options, {
keys: %w(~/.ssh/id_rsa),
forward_agent: false,
auth_methods: %w(publickey)
}

45
config/deploy/staging.rb Normal file
View File

@ -0,0 +1,45 @@
# Simple Role Syntax
# ==================
# Supports bulk-adding hosts to roles, the primary server in each group
# is considered to be the first unless any hosts have the primary
# property set. Don't declare `role :all`, it's a meta role.
role :app, %w{deploy@example.com}
role :web, %w{deploy@example.com}
role :db, %w{deploy@example.com}
# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server definition into the
# server list. The second argument is a, or duck-types, Hash and is
# used to set extended properties on the server.
server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value
# Custom SSH Options
# ==================
# You may pass any option but keep in mind that net/ssh understands a
# limited set of options, consult[net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start).
#
# Global options
# --------------
# set :ssh_options, {
# keys: %w(/home/rlisowski/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(password)
# }
#
# And/or per server (overrides global)
# ------------------------------------
# server 'example.com',
# user: 'user_name',
# roles: %w{web app},
# ssh_options: {
# user: 'user_name', # overrides user setting above
# keys: %w(/home/user_name/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(publickey password)
# # password: 'please use keys'
# }

View File

@ -0,0 +1,9 @@
FactoryGirl.define do
factory :notification do
target_type "MyString"
target_id 1
recipient_id 1
new false
end
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Notification, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end