Sha256: 440b0288a7de46c0edb9119c6f7237a2b070ff3dbdcf4ec0f26d88962ef646db

Contents?: true

Size: 1.98 KB

Versions: 13

Compression:

Stored size: 1.98 KB

Contents

# frozen_string_literal: true

require_relative 'project'
require_relative 'cookbook'

# DeployRubygem - deploy a gem using rake
# Containing a class
module DeployRubygem
  # Using Rubygem to deploy and manage Rubygem
  class Rubygem < Project
    def deploy_dependencies
      dependencies.each do |git_depends|
        Dir.chdir(::File.join(Dir.home, git_depends))
        system('git pull')

        system('git add .')

        system("git commit -m \"Deploying #{project_name}_$(git version-bump show)\"")

        system('git push')
      end
    end

    def git_prepare
      binaries.each do |executable|
        system("git add bin/#{executable}")
      end

      system('git add deploy_rubygem.gemspec')
      system('git add .circleci/config.yml')

      system('git add lib')
    end

    def git_sync
      Dir.chdir(path)
      system('git pull')
    end

    def push_minor_bump
      system("git commit -m \"Deploying #{project_name}_$(git version-bump show)\"")
      system('git version-bump patch') # <major|minor|patch|show>
      system('gem build')
      system('gem push deploy_rubygem-$(git version-bump show).gem')
      system('git version-bump minor') # <major|minor|patch|show>
    end

    def deploy_with_git
      deploy_dependencies
      git_sync
      git_prepare

      push_minor_bump
    end

    def rake_test
      FileUtils.rm_f('Gemfile.lock')
      system('bundle') || return
      system('bundle install') || return
      system('rake') || return
      # system('rake build') &&
      # system('rake install:local') &&
    end

    def rake_release
      change_to_project_folder
      git_commit
      system('rake install') || abort("Cannot rake install #{project_name} #{GVB.version}")
      # system('rake release') || exit(105)
    end

    def release
      change_to_project_folder
      rake_test
      rake_release
    end

    def deploy
      change_to_chefrepo
      deploy_cookbooks
      change_to_project_folder

      # release
      test_compliance
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
deploy_rubygem-0.60.47 lib/deploy_rubygem/rubygem.rb
deploy_rubygem-0.60.46 lib/deploy_rubygem/rubygem.rb
deploy_rubygem-0.60.45 lib/deploy_rubygem/rubygem.rb
deploy_rubygem-0.60.44 lib/deploy_rubygem/rubygem.rb
deploy_rubygem-0.60.43 lib/deploy_rubygem/rubygem.rb
deploy_rubygem-0.60.41 lib/deploy_rubygem/rubygem.rb
deploy_rubygem-0.60.40 lib/deploy_rubygem/rubygem.rb
deploy_rubygem-0.60.39 lib/deploy_rubygem/rubygem.rb
deploy_rubygem-0.60.38 lib/deploy_rubygem/rubygem.rb
deploy_rubygem-0.60.37 lib/deploy_rubygem/rubygem.rb
deploy_rubygem-0.60.36 lib/deploy_rubygem/rubygem.rb
deploy_rubygem-0.60.35 lib/deploy_rubygem/rubygem.rb
deploy_rubygem-0.60.34 lib/deploy_rubygem/rubygem.rb