Skip to content

Instantly share code, notes, and snippets.

@pooza pooza/Rakefile
Created Feb 7, 2019

Embed
What would you like to do?
.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
You can’t perform that action at this time.