Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
transform engine with hooks for repo and global config files.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed Jan 9, 2017
1 parent d28d4ea commit 0a70470
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions lib/capsulecd/base/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ class Engine

def initialize(options)
@config = CapsuleCD::Configuration.new(options)

# transform the engine with system config file hooks
transformer = CapsuleCD::TransformEngine.new()
transformer.transform(self, options[:config_file], :global)

if @config.source == :github
require_relative 'source/github'
self.class.send(:include, CapsuleCD::Source::Github)
Expand Down Expand Up @@ -51,7 +56,6 @@ def start
# REQUIRES source_client
pre_source_process_pull_request_payload
source_process_pull_request_payload(payload)
@config.populate_repo_config_file(@source_git_local_path)
post_source_process_pull_request_payload
else
# start processing the payload, which should result in a local git repository that we
Expand All @@ -62,10 +66,17 @@ def start
# REQUIRES source_client
pre_source_process_push_payload
source_process_push_payload(payload)
@config.populate_repo_config_file(@source_git_local_path)
post_source_process_push_payload
end

# update the config with repo config file options
@config.populate_repo_config_file(@source_git_local_path)

# transform the engine with the repo config file hooks
transformer = CapsuleCD::TransformEngine.new()
transformer.transform(self, @source_git_local_path + '/capsule.yml', :repo)


# now that the payload has been processed we can begin by building the code.
# this may be creating missing files/default structure, compilation, version bumping, etc.

Expand Down
4 changes: 2 additions & 2 deletions lib/capsulecd/base/transform_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def transform(engine, config_file, type = :repo) #type can only be :repo or :glo
@engine = engine
@type = type

unless File.exists?(config_file)
puts 'no configuration file found, no engine hooks'
if !config_file || !File.exists?(config_file)
puts "no #{type} configuration file found, no engine hooks applied"
return
end

Expand Down

0 comments on commit 0a70470

Please sign in to comment.