Sha256: 162898b892232954d3582b2b8625709680133ffc6f1a705ee9e416f3d85bc33c

Contents?: true

Size: 1.93 KB

Versions: 12

Compression:

Stored size: 1.93 KB

Contents

# encoding: utf-8
$:.push File.expand_path("../lib", __FILE__)

require 'bundler'
require 'bundler/setup'

require 'berkshelf'
require 'thor/rake_compat'

class Default < Thor
  class Gem < Thor
    include Thor::RakeCompat
    Bundler::GemHelper.install_tasks

    namespace :gem

    desc "build", "Build berkshelf-#{Berkshelf::VERSION}.gem into the pkg directory"
    def build
      Rake::Task["build"].execute
    end

    desc "release", "Create tag v#{Berkshelf::VERSION} and build and push berkshelf-#{Berkshelf::VERSION}.gem to Rubygems"
    def release
      Rake::Task["release"].execute
    end

    desc "install", "Build and install berkshelf-#{Berkshelf::VERSION}.gem into system gems"
    def install
      Rake::Task["install"].execute
    end
  end

  class Spec < Thor
    include Thor::Actions

    namespace :spec
    default_task :all

    desc "all", "Run all tests"
    def all
      unless run_unit && run_acceptance && run_quality
        exit 1
      end
    end

    desc "ci", "Run all possible tests on Travis-CI"
    def ci
      ENV['CI'] = 'true' # Travis-CI also sets this, but set it here for local testing
      unless run_unit("--tag ~chef_server") && run_acceptance("--tags ~@chef_server") && run_quality
        exit 1
      end
    end

    desc "unit", "Run unit tests"
    def unit
      unless run_unit
        exit 1
      end
    end

    desc "acceptance", "Run acceptance tests"
    def acceptance
      unless run_acceptance
        exit 1
      end
    end

    desc "quality", "Run quality tests"
    def quality
      unless run_quality
        exit 1
      end
    end

    no_tasks do
      def run_unit(*flags)
        run "rspec --color --format=documentation #{flags.join(' ')} spec"
      end

      def run_acceptance(*flags)
        run "cucumber --color --format pretty --tags ~@no_run #{flags.join(' ')}"
      end

      def run_quality
        run "cane --gte coverage/.last_run.json,90"
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
berkshelf-1.4.5 Thorfile
berkshelf-2.0.0.beta Thorfile
berkshelf-1.4.4 Thorfile
berkshelf-1.4.3 Thorfile
berkshelf-1.4.2 Thorfile
berkshelf-1.4.1 Thorfile
berkshelf-1.4.0 Thorfile
berkshelf-1.4.0.rc1 Thorfile
berkshelf-1.3.1 Thorfile
berkshelf-1.3.0.rc1 Thorfile
berkshelf-1.2.1 Thorfile
berkshelf-1.2.0.rc1 Thorfile