Sha256: 379b7847cd4044214a18f872c33f7f602b93b243a7d84972c87d0a5f330bf538

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

module Context
  module DeployHelpers
    module DeployerHelper
      def get_context_folder(context, folder)
        File.join(context.context_folder, folder)
      end

      def build_folder(context)
        context.get_context_folder(context, 'build')
      end
    
      def contexts_container(context)
        context.get_context_folder(context, 'contexts')
      end

      def execute_action(context, action)
        state_action = if action.nil?
          context.cycle
          false
        else
          case action
          when 'once'
            context.log "\nExecute only once\n"
            context.cycle
            true
          when 'always'
            context.log "\nAlways in execution\n"
            while true do
              context.cycle
            end
            true
          when 'bump'
            context.log "\nBump minor version\n"
            context.patch_bump
            true
          when 'release'
            context.log "\nBump major version\n"
            context.minor_bump
            true
          when 'upgrade'
            context.log "\nBump major version\n"
            context.major_bump
            true
          when 'test'
            context.log "\nExecute tests\n"
            context.test_context_successful?
          when 'reset'
            context.log "\nReset versionning\n"
            system('rake')
            # context.cucumber_test(deployer)
            true
          else
            context.error_log "Unknown setting #{action}"
            false
          end
        end
        context.commit
        if state_action
          context.log "Action #{action} executed correctly in context #{context}"
        else
          context.error_log("Failed to execute action #{action} in context #{context}")
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deploy-context-2.1.35.3.g2abab85.16.g399fb24 lib/deploy-context/deploy/deployer.rb