diff --git a/configurators.rb b/configurators.rb index 23cf64b..15a3b9c 100644 --- a/configurators.rb +++ b/configurators.rb @@ -5,3 +5,4 @@ require_relative 'configurators/monitoring' require_relative 'configurators/sentry' require_relative 'configurators/postgres_database_uuids' +require_relative 'configurators/ci' diff --git a/configurators/ci.rb b/configurators/ci.rb new file mode 100644 index 0000000..e013681 --- /dev/null +++ b/configurators/ci.rb @@ -0,0 +1,14 @@ +module Configurators + class Ci < Base + + askable 'Will you use a CI system' + optionable %w(CircleCI None) + + def recipe + case ask! + when 'CircleCI' + @pathfinder.add_recipe(Recipes::CircleCi.new(@pathfinder)) + end + end + end +end diff --git a/pathfinder.rb b/pathfinder.rb index f96dace..6a15ea9 100644 --- a/pathfinder.rb +++ b/pathfinder.rb @@ -28,6 +28,7 @@ def ask_for_recipes def ask_for_configurators add_recipe_from_configurator(Configurators::Monitoring.new(self)) add_configurator(Configurators::PostgresDatabaseUuids.new(self)) + add_recipe_from_configurator(Configurators::Ci.new(self)) add_configurator(Configurators::ActiveAdmin.new(self)) add_configurator(Configurators::FormFramework.new(self)) add_configurator(Configurators::ImageMagick.new(self)) diff --git a/recipes/circle_ci.rb b/recipes/circle_ci.rb new file mode 100644 index 0000000..c4e834f --- /dev/null +++ b/recipes/circle_ci.rb @@ -0,0 +1,18 @@ +module Recipes + class CircleCi < Base + + def cook + generate_circle_ci_config + end + + private + + def generate_circle_ci_config + path = 'https://raw.githubusercontent.com/MarsBased/circleci/master/config/rails/' + + @template.run 'mkdir .circleci' + @template.run "curl #{path}.circleci/config.yml > ./.circleci/config.yml" + @template.run "curl #{path}config/database.ci.yml > ./config/database.ci.yml" + end + end +end