Sha256: 43dfe2fd3123169cd008250009225866db4d43f18933372c41548f837d93477e

Contents?: true

Size: 1.83 KB

Versions: 42

Compression:

Stored size: 1.83 KB

Contents

# Copyright (c) 2010-2019 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

require_relative '../shared'
require_relative '../../commands/api'

require 'json'
require 'tty-spinner'

module GoodData
  module CLI
    desc 'Manage processes (ETLs, Ruby bricks..)'
    command :process do |c|
      c.desc 'Create a new process'
      c.command :create do |s|
        s.desc 'Create a new process from a webdav or gerrit appstore path'
        s.command :from_path do |cs|
          cs.action do |global_options, options, args|
            opts = options.merge(global_options)
            path = args.first
            spinner = TTY::Spinner.new ":spinner Creating process"
            spinner.auto_spin
            client = GoodData.connect opts
            project = client.projects(opts[:project_id])
            res = GoodData::Process.deploy(path, project: project, client: client)
            spinner.stop
            puts res.to_json
          end
        end

        s.desc 'Create a new process as a pluggable component'
        s.command :as_component do |ac|
          ac.action do |global_options, options, args|
            opts = options.merge(global_options)
            file = args.first
            fail 'Deploying a component requires a JSON formatted payload as a parameter' unless file

            payload = JSON.parse(File.read(file))
            spinner = TTY::Spinner.new ":spinner Creating process"
            spinner.auto_spin
            client = GoodData.connect opts
            project = client.projects(opts[:project_id])
            res = GoodData::Process.deploy_component(payload, project: project, client: client)
            spinner.stop
            puts res.to_json
          end
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
gooddata-2.3.1-java lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.3.1 lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.3.0-java lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.3.0 lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.2.0-java lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.2.0 lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.19-java lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.19 lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.17-java lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.17 lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.15-java lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.15 lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.14-java lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.14 lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.13-java lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.13 lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.12-java lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.12 lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.11-java lib/gooddata/cli/commands/process_cmd.rb
gooddata-2.1.11 lib/gooddata/cli/commands/process_cmd.rb