Skip to content

Instantly share code, notes, and snippets.

@agirlnamedsophia
Last active December 7, 2018 19:27
Show Gist options
  • Save agirlnamedsophia/a96f3a79239988298207b7ec72e2ed04 to your computer and use it in GitHub Desktop.
Save agirlnamedsophia/a96f3a79239988298207b7ec72e2ed04 to your computer and use it in GitHub Desktop.
class CoachCli::CI::ConfigGenerators::RubyApp < CoachCli::CI::ConfigGenerator
def generate_jobs
[lint_job, ...]
end
# more jobs...
def lint_job
CoachCli::CI::CircleCiJob.new(
name: "#{project.name}--lint",
config: lint_job_config,
project: project,
allow_failures: allow_failures
).tap do |job|
job.add_steps(checkout_step)
job.add_steps(bundle_steps)
job.add_steps(yarn_steps) if project.file_exists?('package.json')
job.add_steps(rubocop_step)
job.add_steps(scss_lint_step) if project.file_exists?('.scss-lint.yml')
job.add_steps(erb_lint_step) if project.file_exists?('.erb-lint.yml')
job.add_steps(brakeman_step) if project.file_exists?('config/brakeman.yml')
job.add_steps(store_artifacts_step)
end
end
def lint_job_config
from_yaml(<<~YAML)
resource_class: #{project.resource_class}
docker:
- image: #{container_image}
environment:
GEM_SOURCE: https://rubygems.org
RAILS_ENV: test
RACK_ENV: test
YAML
end
def checkout_step
CoachCli::CI::Steps::Checkout.new
end
# more steps...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment