Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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