Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Add CI config with circle ci (#68)
Browse files Browse the repository at this point in the history
* Change the init_file method to cook related #76

* Adapt feature to the last refactor
  • Loading branch information
artero authored and pablorc committed Oct 19, 2018
1 parent 15669f0 commit fcf106e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions configurators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
require_relative 'configurators/monitoring'
require_relative 'configurators/sentry'
require_relative 'configurators/postgres_database_uuids'
require_relative 'configurators/ci'
14 changes: 14 additions & 0 deletions configurators/ci.rb
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions pathfinder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
18 changes: 18 additions & 0 deletions recipes/circle_ci.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fcf106e

Please sign in to comment.