Sha256: 34b1262925767d58b4d18d5252ee4a49e0e4a3434ace841177e75b9c110580f0

Contents?: true

Size: 1.23 KB

Versions: 26

Compression:

Stored size: 1.23 KB

Contents

require 'ruby_fly'
require_relative '../tasklib'

module RakeFly
  module Tasks
    class GetPipeline < TaskLib
      parameter :name, :default => :get_pipeline
      parameter :argument_names, :default => []

      parameter :target, :required => true
      parameter :pipeline, :required => true

      parameter :ensure_task, :default => :'fly:ensure'

      def process_arguments(args)
        self.name = args[0] if args[0]
      end

      def define
        pipeline_name = pipeline.respond_to?(:call) ? "<derived>" : pipeline
        target_name = target.respond_to?(:call) ? "<derived>" : target

        desc "Get pipeline #{pipeline_name} for target #{target_name}"
        task name, argument_names => [ensure_task] do |_, args|
          derived_target = target.respond_to?(:call) ?
              target.call(*[args].slice(0, target.arity)) :
              target
          derived_pipeline = pipeline.respond_to?(:call) ?
              pipeline.call(*[args].slice(0, pipeline.arity)) :
              pipeline

          puts "Getting pipeline #{derived_pipeline} for target #{derived_target}..."
          RubyFly.get_pipeline(
              target: derived_target,
              pipeline: derived_pipeline)
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
rake_fly-0.21.0 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.20.0.pre.pre.1 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.19.0 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.18.0.pre.pre.6 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.18.0.pre.pre.5 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.18.0.pre.pre.4 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.18.0.pre.pre.3 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.18.0.pre.pre.2 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.18.0.pre.pre.1 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.17.0 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.16.0.pre.pre.1 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.15.0 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.14.0.pre.pre.2 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.14.0.pre.pre.1 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.13.0 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.12.0.pre.pre.2 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.12.0.pre.pre.1 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.11.0 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.10.0.pre.pre.1 lib/rake_fly/tasks/get_pipeline.rb
rake_fly-0.9.0 lib/rake_fly/tasks/get_pipeline.rb