Skip to content

Instantly share code, notes, and snippets.

@pooza
Created February 7, 2019 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pooza/821b799e3d48e9fb5bfb399efbe4eb6a to your computer and use it in GitHub Desktop.
Save pooza/821b799e3d48e9fb5bfb399efbe4eb6a to your computer and use it in GitHub Desktop.
.circleci/config.yml
version: 2
jobs:
build:
docker:
- image: circleci/ruby:2.5.3-node-browsers
working_directory: ~/repos
steps:
- checkout
- run:
name: install bundler
command: gem install bundler -v '<2'
- run:
name: install dependencies
command: bundle install
- run:
name: run RuboCop
command: bundle exec rubocop
- run:
name: update repository
command: bundle exec rake repos:update
- run:
name: check repository
command: bundle exec rake repos:check
dir = File.expand_path(__dir__)
namespace :cert do
desc 'update cert'
task :update do
require 'httparty'
File.write(
File.join(dir, 'cert/cacert.pem'),
HTTParty.get('https://curl.haxx.se/ca/cacert.pem'),
)
end
desc 'check cert'
task :check do
if `git status`.include?('cacert.pem')
STDERR.puts 'cert is not fresh.'
exit 1
end
end
end
namespace :bundle do
desc 'update gems'
task :update do
sh 'bundle update'
end
desc 'check gems'
task :check do
if `git status`.include?('Gemfile.lock')
STDERR.puts 'gems is not fresh.'
exit 1
end
end
end
namespace :repos do
desc 'update cert/gems'
task update: ['cert:update', 'bundle:update']
desc 'check cert/gems'
task check: ['cert:check', 'bundle:check']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment