Sha256: 76dc24ffc5f9e8f21312a5e97828d59bf7df852254b6417770a7b082518cfa0a

Contents?: true

Size: 1.79 KB

Versions: 2

Compression:

Stored size: 1.79 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.cucumber_test(context)
            true
          when 'reset'
            context.log "\nReset versionning\n"
            system('rake')
            # context.cucumber_test(deployer)
            true
          else
            context.log "Unknown setting #{action}"
            false
          end
        end
        context.commit
        if state_action
          context.log "Action #{action} executed correctly in context #{context}"
        else
          context.abort("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 lib/deploy-context/deploy/deployer.rb
deploy-context-2.1.35.2.g385b63e lib/deploy-context/deploy/deployer.rb