Class: GoodData::Command::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/gooddata/commands/process.rb

Class Method Summary collapse

Class Method Details

.delete(process_id, options = { :client => GoodData.connection, :project => GoodData.project }) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/gooddata/commands/process.rb', line 27

def delete(process_id, options = { :client => GoodData.connection, :project => GoodData.project })
  c = options[:client]
  pid = options[:project_id]
  process = c.with_project(pid) do |project|
    project.processes(process_id)
  end
  process.delete
end

.deploy(dir, options = { :client => GoodData.connection, :project => GoodData.project }) ⇒ Object

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



37
38
39
40
41
42
43
44
# File 'lib/gooddata/commands/process.rb', line 37

def deploy(dir, options = { :client => GoodData.connection, :project => GoodData.project })
  params = options[:params].nil? ? [] : [options[:params]]
  c = options[:client]
  pid = options[:project_id]
  c.with_project(pid) do |project|
    project.deploy_process(dir, options.merge(:files_to_exclude => params))
  end
end

.execute_process(process_id, executable, options = { :client => GoodData.connection, :project => GoodData.project }) ⇒ Object



46
47
48
49
# File 'lib/gooddata/commands/process.rb', line 46

def execute_process(process_id, executable, options = { :client => GoodData.connection, :project => GoodData.project })
  process = GoodData::Process[process_id, options]
  process.execute_process(executable, options)
end

.get(options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gooddata/commands/process.rb', line 15

def get(options = {})
  pid = options[:project_id]
  fail ArgumentError, 'None or invalid project_id specified' if pid.nil? || pid.empty?

  id = options[:process_id]
  fail ArgumentError, 'None or invalid process_id' if id.nil? || id.empty?
  c = options[:client]
  c.with_project(pid) do |project|
    project.processes(id)
  end
end

.list(options = { :client => GoodData.connection, :project => GoodData.project }) ⇒ Object



11
12
13
# File 'lib/gooddata/commands/process.rb', line 11

def list(options = { :client => GoodData.connection, :project => GoodData.project })
  GoodData::Process[:all, options]
end

.run(dir, executable, options = { :client => GoodData.connection, :project => GoodData.project }) ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/gooddata/commands/process.rb', line 51

def run(dir, executable, options = { :client => GoodData.connection, :project => GoodData.project })
  verbose = options[:v]
  dir = Pathname(dir)
  name = options[:name] || "Temporary deploy[#{dir}][#{options[:project_name]}]"
  GoodData::Process.with_deploy(dir, options.merge(:name => name, :project_id => ProjectHelper::PROJECT_ID)) do |process|
    puts HighLine.color('Executing', HighLine::BOLD) if verbose
    process.execute(executable, options)
  end
end