Sha256: 2035c96445f5db38ca60e6057fbcdbf6836917d81b742df5fa54e782bfdf0a08

Contents?: true

Size: 1.84 KB

Versions: 6

Compression:

Stored size: 1.84 KB

Contents

# encoding: UTF-8

require 'pathname'

require_relative '../core/core'

module GoodData
  module Command
    class Process
      class << self
        def list(options = {})
          GoodData.with_project(options[:project_id]) do
            GoodData::Process[:all]
          end
        end

        def get(options = {})
          id = options[:process_id]
          fail 'Unspecified process id' if id.nil?

          GoodData.with_project(options[:project_id]) do
            GoodData::Process[id]
          end
        end

        def delete(process_id, options = {})
          GoodData.with_project(options[:project_id]) do
            process = GoodData::Process[process_id]
            process.delete
          end
        end

        # TODO: check files_to_exclude param. Does it do anything? It should check that in case of using CLI, it makes sure the files are not deployed
        def deploy(dir, options = {})
          GoodData.with_project(options[:project_id]) do
            params = options[:params].nil? ? [] : [options[:params]]
            GoodData::Process.deploy(dir, options.merge(:files_to_exclude => params))
          end
        end

        def execute_process(process_id, executable, options = {})
          GoodData.with_project(options[:project_id]) do
            process = GoodData::Process[process_id]
            process.execute_process(executable, options)
          end
        end

        def run(dir, executable, options = {})
          verbose = options[:v]
          dir = Pathname(dir)
          name = options[:name] || "Temporary deploy[#{dir}][#{options[:project_name]}]"

          GoodData::Process.with_deploy(dir, options.merge(:name => name)) do |process|
            puts HighLine.color('Executing', HighLine::BOLD) if verbose
            process.execute(executable, options)
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gooddata-0.6.7 lib/gooddata/commands/process.rb
gooddata-0.6.6 lib/gooddata/commands/process.rb
gooddata-0.6.5 lib/gooddata/commands/process.rb
gooddata-0.6.4 lib/gooddata/commands/process.rb
gooddata-0.6.3 lib/gooddata/commands/process.rb
gooddata-0.6.2 lib/gooddata/commands/process.rb