Sha256: e3ab84d078ff5176ea92f540f5b4c6b91847b0113eec308563edec588d263d5c

Contents?: true

Size: 1.75 KB

Versions: 14

Compression:

Stored size: 1.75 KB

Contents

require 'rake_factory'

require_relative '../tasks'

module RakeGithub
  module TaskSets
    class Repository < RakeFactory::TaskSet
      prepend RakeFactory::Namespaceable

      parameter :repository, required: true
      parameter :access_token, required: true
      parameter :deploy_keys, default: []

      parameter :deploy_keys_namespace, default: :deploy_keys
      parameter :deploy_keys_destroy_task_name, default: :destroy
      parameter :deploy_keys_provision_task_name, default: :provision
      parameter :deploy_keys_ensure_task_name, default: :ensure

      task Tasks::DeployKeys::Provision,
          name: RakeFactory::DynamicValue.new { |ts|
            ts.deploy_keys_provision_task_name
          }
      task Tasks::DeployKeys::Destroy,
          name: RakeFactory::DynamicValue.new { |ts|
            ts.deploy_keys_destroy_task_name
          }
      task Tasks::DeployKeys::Ensure,
          name: RakeFactory::DynamicValue.new { |ts|
            ts.deploy_keys_ensure_task_name
          },
          provision_task_name: RakeFactory::DynamicValue.new { |ts|
            ts.deploy_keys_provision_task_name
          },
          destroy_task_name: RakeFactory::DynamicValue.new { |ts|
            ts.deploy_keys_destroy_task_name
          }

      def define_on(application)
        around_define(application) do
          self.class.tasks.each do |task_definition|
            ns = case task_definition.klass.to_s
            when /DeployKeys/
              deploy_keys_namespace
            else
              nil
            end

            application.in_namespace(ns) do
              task_definition
                  .for_task_set(self)
                  .define_on(application)
            end
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rake_github-0.8.0.pre.7 lib/rake_github/task_sets/repository.rb
rake_github-0.8.0.pre.6 lib/rake_github/task_sets/repository.rb
rake_github-0.8.0.pre.5 lib/rake_github/task_sets/repository.rb
rake_github-0.8.0.pre.4 lib/rake_github/task_sets/repository.rb
rake_github-0.8.0.pre.3 lib/rake_github/task_sets/repository.rb
rake_github-0.8.0.pre.2 lib/rake_github/task_sets/repository.rb
rake_github-0.8.0.pre.1 lib/rake_github/task_sets/repository.rb
rake_github-0.7.0 lib/rake_github/task_sets/repository.rb
rake_github-0.6.0.pre.2 lib/rake_github/task_sets/repository.rb
rake_github-0.6.0.pre.1 lib/rake_github/task_sets/repository.rb
rake_github-0.5.0 lib/rake_github/task_sets/repository.rb
rake_github-0.4.0.pre.1 lib/rake_github/task_sets/repository.rb
rake_github-0.3.0 lib/rake_github/task_sets/repository.rb
rake_github-0.2.0.pre.8 lib/rake_github/task_sets/repository.rb