Skip to content

Instantly share code, notes, and snippets.

@mariusz-blaszczak
Last active November 23, 2017 12:53
Show Gist options
  • Save mariusz-blaszczak/c985bcf3dd8572ef2a12e0511966f087 to your computer and use it in GitHub Desktop.
Save mariusz-blaszczak/c985bcf3dd8572ef2a12e0511966f087 to your computer and use it in GitHub Desktop.
require "capistrano/setup"
require "capistrano/deploy"
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
require "capistrano/rvm"
require "capistrano/bundler"
require "capistrano/rails/migrations"
require "capistrano/linuxpl"
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
# components/dashboard/dashboard.gemspec
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "dashboard/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "dashboard"
s.version = Dashboard::VERSION
s.authors = ["Mariusz Błaszczak"]
s.email = ["mariusz.blaszczak@gmail.com"]
s.homepage = ""
s.summary = ""
s.description = ""
s.license = "MIT"
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
s.test_files = Dir["spec/**/*"]
s.add_dependency "rails", "~> 5.1.3"
s.add_dependency "sass-rails", ">= 5.0"
s.add_dependency "bootstrap-sass", "~> 3.3.6"
s.add_dependency "coffee-script"
s.add_dependency "font-awesome-rails"
s.add_dependency "parsley-rails"
s.add_dependency "devise"
s.add_development_dependency "sqlite3"
s.add_development_dependency "rspec-rails"
s.add_development_dependency "pry-rails"
s.add_development_dependency "pry-byebug"
end
# components/dashboard/Gemfile
source "https://rubygems.org"
gemspec
lock "3.8.1"
set :application, "test"
set :repo_url, "git@github.com:test/test.git"
set :keep_releases, 1
set :default_shell, "/bin/bash --login"
set :ssh_options, forward_agent: true
set :tmp_dir, "/home/profiart/tmp"
before :deploy, "deploy:run_tests"
after "deploy:log_revision", "deploy:restart_server"
# Gemfile
source "https://rubygems.org"
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem "jbuilder", "~> 2.5"
gem "mysql2", ">= 0.3.18", "< 0.5"
gem "puma", "~> 3.7"
gem "rails", "~> 5.1.3"
gem "react_on_rails", "8.0.0"
gem "sass-rails", "~> 5.0"
gem "sentry-raven"
gem "turbolinks", "~> 5"
gem "uglifier", ">= 1.3.0"
group :development do
gem "capistrano", "~> 3.6"
gem "capistrano-linuxpl", "0.0.3"
gem "capistrano-rails", "~> 1.2"
gem "capistrano-rvm"
gem "guard"
gem "guard-rubocop"
gem "listen", ">= 3.0.5", "< 3.2"
gem "spring"
gem "spring-watcher-listen", "~> 2.0.0"
gem "web-console", ">= 3.3.0"
end
group :development, :test do
gem "pry-rails"
end
group :test do
gem "capybara", "~> 2.16"
gem "rspec-rails"
gem "selenium-webdriver"
end
gem "mini_racer", platforms: :ruby
gem "webpacker_lite"
path "components" do
gem "dashboard"
end
# lib/capistrano/tasks/run_tests.rake
set :test_log, "log/capistrano.test.log"
namespace :deploy do
desc "Runs test before deploying, can't deploy unless they pass"
task :run_tests do
run_locally do
if fetch(:branch) == "master"
info "--> Running tests SKIPPED on not MASTER branch"
next
end
info "--> Running tests locally, please wait ..."
unless system "bundle exec rspec"
puts "--> Tests failed."
exit
end
unless system("cd components/dashboard ;RAILS_ENV='test' bundle exec rspec")
puts "--> Tests failed."
exit
end
info "--> All tests passed"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment