Sha256: 3ea6b0ea92cf2cecc6ef71c143c409840111e0af4f36e61c860380cce5a5b81b

Contents?: true

Size: 1.3 KB

Versions: 9

Compression:

Stored size: 1.3 KB

Contents

require 'rubygems'
require 'cli/command'

module Factor
  module CLI
    class WorkflowTask < Command
  
      desc "call WORKFLOW","start a workflow"
      method_option :parameters, :type=>:hash, :default=>{}, :required=>false
      def call(workflow_name)
        puts "starting workflow #{workflow_name} with options #{options.parameters.to_s}"
    
        engine = Factor::Runtime::Engine.new(get_config[:email],get_config[:token])
        id = engine.launch(workflow_name,options.parameters)
    
        puts "workflow executed with id #{id}"
      end
  
      
      
      desc "list", "list all the workflows"
      #method_option :key, :alias=>"-k", :type=>:string, :desc=>"key reference"
      def list
        puts @client.get_workflows
      end
    
      desc "add NAME FILENAME", "add a key and value for the credential"
      #method_option :key, :alias=>"-k", :type=>:string, :desc=>"key reference"
      #method_option :value, :alias=>"-v", :type=>:string, :desc=>"values"
      def add(name,filename)
        contents=File.open(File.expand_path(filename), "rb") {|f| f.read}
        puts @client.add_workflow(name,contents)
      end
    
      # desc "remove NAME", "remove a workflow"
      # def remove(name)
      #   puts @client.remove_workflow(name)
      # end
      
      
      
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
factor-0.1.09 lib/cli/workflow_task.rb
factor-0.1.07 lib/cli/workflow_task.rb
factor-0.1.06 lib/cli/workflow_task.rb
factor-0.1.05 lib/cli/workflow_task.rb
factor-0.1.04 lib/cli/workflow_task.rb
factor-0.1.03 lib/cli/workflow_task.rb
factor-0.1.02 lib/cli/workflow_task.rb
factor-0.1.01 lib/cli/workflow_task.rb
factor-0.1.00 lib/cli/workflow_task.rb