Sha256: c37cc35d96ba5cd13a2061c7dc0c42ca208f65d6b156d65791a1137aac67381b

Contents?: true

Size: 1.99 KB

Versions: 3

Compression:

Stored size: 1.99 KB

Contents

require_relative 'context/deploy'

module Context
  class Deploy
    include DeployHelper

    attr_reader :context_name
    attr_reader :context_folder

    def initialize(context_name, deploycontext_folder)
      @context_name = context_name
      @context_folder = move_folder(deploycontext_folder)
    end

    def present_localy?
      Dir.exist?(context_folder)
    end

    def actual_working_directory?
      Dir.pwd == context_folder
    end

    def move_folder(folder)
      @context_folder = folder.include?(context_name) ? folder : File.join(folder, context_name)
    end

    def check_folder(folder)
      FileUtils.mkdir_p(context_folder) unless present_localy?
    end

    def version
      puts "Getting version info for #{context_folder}"
      Dir.chdir(context_folder)
      Gem::Version.new(GVB.version)
    end

    def cycle
      ruby_cycle(self)
    end

    def test_context_successful?
      puts "Check if #{context_name} is install #{version}"
      if gem_installed?(self)
        puts "Test context was successfully install on version #{version}"
        true
      else
        abort "Test context has failed to install #{version}"
      end
    end

    def build
      ruby_build(self)
      check_folder get_context_folder(self, 'contexts')
    end

    def commit
      git_commit(self)
    end

    def release
      ruby_release(self)
      git_release(self)
    end

    def install
      ruby_install(self)
    end

    def clean
      clean_folder(self, 'contexts')
      ruby_clean(self)
    end

    def patch_bump
      git_bump(self, 'patch')
    end

    def minor_bump
      git_bump(self, 'minor')
    end

    def major_bump
      git_bump(self, 'major')
    end

    def wait_until_release_available
      wait_until_release_available unless is_present_publicly?
    end

    def is_present_publicly?
      ruby_check_if_available_public(self)
    end

    def new_update_available?
      git_update_available?(self)
    end

    def ready_for_major_update?
      false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deploy-context-2.1.29 lib/deploy-context/deploy.rb
deploy-context-2.1.28 lib/deploy-context/deploy.rb
deploy-context-2.1.27.1.gd07a6e7 lib/deploy-context/deploy.rb