Sha256: ac91e73700b55a5be8a5d0fb4b061e8757c04b718d09b19be89c6b67792f0a76

Contents?: true

Size: 1.83 KB

Versions: 2

Compression:

Stored size: 1.83 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 context.context_name, "Unknown setting #{action}"
            false
          end
        end
        context.commit
        if state_action
          context.log "Action #{action} executed correctly in context #{context}"
        else
          context.error_log(context.context_name, "Failed to execute action #{action} in context #{context}")
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
deploy-context-2.1.35.3.g2abab85.16.g399fb24.9.g1523b69.3.g0fb07cc libraries/deploy-context/deploy/deployer.rb
deploy-context-2.1.35.3.g2abab85.16.g399fb24.9.g1523b69 libraries/deploy-context/deploy/deployer.rb