Sha256: 4755f122f6450ffcdc2e95a269cdb32bf6ac7b4a0f06991c240f90081d57adaf

Contents?: true

Size: 1.47 KB

Versions: 2

Compression:

Stored size: 1.47 KB

Contents

module HeadChef
  class Env < Thor
    class_option :environment,
      aliases: '-e',
      banner: '<environment>',
      desc: 'Applies to the specified environment',
      type: :string

    desc 'diff', 'Shows cookbook diff between Berksfile and Chef <environment>'
    long_desc <<-EOD
      Shows cookbook version diff between Berksfile and Chef <environment>

      By default, matches current git branch name against Chef environment.
    EOD
    def diff
      environment = options[:environment] || HeadChef.current_branch

      Diff.diff(environment).pretty_print
    end

    desc 'list', 'Lists cookbooks with versions from Chef <environment>.'
    long_desc <<-EOD
      Shows cookbook version diff between Berksfile and Chef <environment>

      By default, matches current git branch name against Chef enviroment.
    EOD
    def list
      environment = options[:environment] || HeadChef.current_branch

      List.list(environment)
    end

    desc 'sync', 'Syncs Berksfile with Chef <environment>'
    long_desc <<-EOD
      Syncs Berksfile cookbook with Chef <environment>

      By default, matches current git branch and against Chef enviroment. Chef
      environment will be created if it does not exist.
    EOD
    option :force, banner: '', desc: 'Force upload of cookbooks to chef server'
    def sync
      environment = options[:environment] || HeadChef.current_branch
      force = options[:force] ? true : false

      Sync.sync(environment, force)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
head_chef-0.1.1 lib/head_chef/tasks/env.rb
head_chef-0.1.0 lib/head_chef/tasks/env.rb