Sha256: be21c17036144e1ef135132cd330c0702ede3d2ec5f67250f8161b4ff06c91a3

Contents?: true

Size: 1.04 KB

Versions: 31

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module RakeGitCrypt
  module Mixins
    module Support
      def task_by_name(task, name)
        task.application.lookup(name, task.scope)
      end

      def task_defined?(task, name)
        !task_by_name(task, name).nil?
      end

      def ensure_task_with_name_available(task, name)
        raise_task_undefined(name) unless task_defined?(task, name)
      end

      def invoke_task_with_name(task, name, args)
        ensure_task_with_name_available(task, name)
        task_by_name(task, name).invoke(*args)
      end

      def reenable_task_with_name(task, name)
        ensure_task_with_name_available(task, name)
        task_by_name(task, name).reenable
      end

      def invoke_and_reenable_task_with_name(task, name, args)
        invoke_task_with_name(task, name, args)
        reenable_task_with_name(task, name)
      end

      def raise_task_undefined(name)
        raise(
          RakeFactory::DependencyTaskMissing,
          "The task with name #{name} does not exist."
        )
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
rake_git_crypt-0.3.0.pre.2 lib/rake_git_crypt/mixins/support.rb
rake_git-0.3.0.pre.2 lib/rake_git/mixins/support.rb
rake_git_crypt-0.3.0.pre.1 lib/rake_git_crypt/mixins/support.rb
rake_git-0.3.0.pre.1 lib/rake_git/mixins/support.rb
rake_git-0.2.0 lib/rake_git/mixins/support.rb
rake_git-0.1.0.pre.12 lib/rake_git/mixins/support.rb
rake_git_crypt-0.2.0 lib/rake_git_crypt/mixins/support.rb
rake_git_crypt-0.1.0.pre.34 lib/rake_git_crypt/mixins/support.rb
rake_git-0.1.0.pre.11 lib/rake_git/mixins/support.rb
rake_git_crypt-0.1.0.pre.33 lib/rake_git_crypt/mixins/support.rb
rake_git_crypt-0.1.0.pre.32 lib/rake_git_crypt/mixins/support.rb
rake_git_crypt-0.1.0.pre.31 lib/rake_git_crypt/mixins/support.rb
rake_git_crypt-0.1.0.pre.30 lib/rake_git_crypt/mixins/support.rb
rake_git_crypt-0.1.0.pre.29 lib/rake_git_crypt/mixins/support.rb
rake_git-0.1.0.pre.10 lib/rake_git/mixins/support.rb
rake_git_crypt-0.1.0.pre.28 lib/rake_git_crypt/mixins/support.rb
rake_git-0.1.0.pre.9 lib/rake_git/mixins/support.rb
rake_git_crypt-0.1.0.pre.27 lib/rake_git_crypt/mixins/support.rb
rake_git-0.1.0.pre.8 lib/rake_git/mixins/support.rb
rake_git-0.1.0.pre.7 lib/rake_git/mixins/support.rb