gooddata 0.6.0.pre11 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +12 -1
- data/.yardopts +2 -0
- data/README.md +6 -3
- data/Rakefile +24 -7
- data/gooddata +2 -2
- data/gooddata.gemspec +4 -3
- data/lib/gooddata.rb +17 -12
- data/lib/gooddata/bricks/base_downloader.rb +7 -7
- data/lib/gooddata/bricks/brick.rb +7 -8
- data/lib/gooddata/bricks/bricks.rb +4 -1
- data/lib/gooddata/bricks/middleware/base_middleware.rb +2 -2
- data/lib/gooddata/bricks/middleware/bench_middleware.rb +5 -6
- data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +21 -22
- data/lib/gooddata/bricks/middleware/fs_upload_middleware.rb +3 -4
- data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +14 -14
- data/lib/gooddata/bricks/middleware/logger_middleware.rb +6 -6
- data/lib/gooddata/bricks/middleware/middleware.rb +4 -1
- data/lib/gooddata/bricks/middleware/restforce_middleware.rb +29 -32
- data/lib/gooddata/bricks/middleware/stdout_middleware.rb +5 -5
- data/lib/gooddata/bricks/middleware/twitter_middleware.rb +6 -8
- data/lib/gooddata/bricks/utils.rb +3 -3
- data/lib/gooddata/cli/cli.rb +4 -2
- data/lib/gooddata/cli/commands/api_cmd.rb +6 -4
- data/lib/gooddata/cli/commands/auth_cmd.rb +5 -3
- data/lib/gooddata/cli/commands/console_cmd.rb +1 -1
- data/lib/gooddata/cli/commands/process_cmd.rb +6 -4
- data/lib/gooddata/cli/commands/profile_cmd.rb +5 -3
- data/lib/gooddata/cli/commands/project_cmd.rb +24 -22
- data/lib/gooddata/cli/commands/run_ruby_cmd.rb +12 -10
- data/lib/gooddata/cli/commands/scaffold_cmd.rb +8 -6
- data/lib/gooddata/cli/hooks.rb +4 -2
- data/lib/gooddata/cli/shared.rb +3 -1
- data/lib/gooddata/cli/terminal.rb +16 -0
- data/lib/gooddata/client.rb +28 -22
- data/lib/gooddata/commands/api.rb +43 -26
- data/lib/gooddata/commands/auth.rb +22 -53
- data/lib/gooddata/commands/base.rb +2 -0
- data/lib/gooddata/commands/commands.rb +3 -0
- data/lib/gooddata/commands/datasets.rb +39 -136
- data/lib/gooddata/commands/process.rb +134 -130
- data/lib/gooddata/commands/profile.rb +2 -0
- data/lib/gooddata/commands/projects.rb +91 -129
- data/lib/gooddata/commands/runners.rb +11 -11
- data/lib/gooddata/commands/scaffold.rb +28 -26
- data/lib/gooddata/connection.rb +61 -68
- data/lib/gooddata/core/core.rb +1 -2
- data/lib/gooddata/data/data.rb +7 -0
- data/lib/gooddata/data/guesser.rb +114 -0
- data/lib/gooddata/exceptions/command_failed.rb +7 -0
- data/lib/gooddata/exceptions/exceptions.rb +7 -0
- data/lib/gooddata/{exceptions.rb → exceptions/project_not_found.rb} +2 -2
- data/lib/gooddata/extensions/big_decimal.rb +5 -0
- data/lib/gooddata/extract.rb +2 -0
- data/lib/gooddata/goodzilla/goodzilla.rb +11 -12
- data/lib/gooddata/helpers.rb +49 -35
- data/lib/gooddata/models/attribute.rb +7 -5
- data/lib/gooddata/models/dashboard.rb +44 -45
- data/lib/gooddata/models/data_result.rb +10 -13
- data/lib/gooddata/models/data_set.rb +6 -6
- data/lib/gooddata/models/display_form.rb +4 -4
- data/lib/gooddata/models/empty_result.rb +4 -3
- data/lib/gooddata/models/fact.rb +5 -5
- data/lib/gooddata/models/links.rb +3 -1
- data/lib/gooddata/models/metadata.rb +34 -32
- data/lib/gooddata/models/metric.rb +33 -34
- data/lib/gooddata/models/model.rb +165 -173
- data/lib/gooddata/models/models.rb +3 -0
- data/lib/gooddata/models/process.rb +18 -17
- data/lib/gooddata/models/profile.rb +3 -1
- data/lib/gooddata/models/project.rb +107 -35
- data/lib/gooddata/models/project_metadata.rb +12 -12
- data/lib/gooddata/models/report.rb +31 -30
- data/lib/gooddata/models/report_data_result.rb +22 -19
- data/lib/gooddata/models/report_definition.rb +101 -80
- data/lib/gooddata/version.rb +5 -3
- data/lib/templates/bricks/brick.rb.erb +3 -3
- data/lib/templates/bricks/main.rb.erb +3 -2
- data/lib/templates/project/Goodfile.erb +2 -2
- data/lib/templates/project/model/model.rb.erb +19 -19
- data/spec/data/.gooddata +4 -0
- data/spec/helpers/blueprint_helper.rb +2 -2
- data/spec/helpers/cli_helper.rb +28 -0
- data/spec/helpers/connection_helper.rb +2 -2
- data/spec/integration/command_projects_spec.rb +1 -1
- data/spec/integration/create_from_template_spec.rb +12 -0
- data/spec/integration/full_project_spec.rb +2 -2
- data/spec/integration/partial_md_export_import_spec.rb +36 -0
- data/spec/logging_in_logging_out_spec.rb +1 -1
- data/spec/spec_helper.rb +29 -2
- data/spec/unit/cli/cli_spec.rb +3 -3
- data/spec/unit/cli/commands/cmd_api_spec.rb +21 -4
- data/spec/unit/cli/commands/cmd_auth_spec.rb +2 -4
- data/spec/unit/cli/commands/cmd_process_spec.rb +20 -4
- data/spec/unit/cli/commands/cmd_profile_spec.rb +9 -4
- data/spec/unit/cli/commands/cmd_project_spec.rb +53 -4
- data/spec/unit/cli/commands/cmd_run_ruby_spec.rb +2 -4
- data/spec/unit/cli/commands/cmd_scaffold_spec.rb +14 -4
- data/spec/unit/commands/command_api_spec.rb +21 -2
- data/spec/unit/commands/command_auth_spec.rb +62 -1
- data/spec/unit/commands/command_dataset_spec.rb +31 -3
- data/spec/unit/commands/command_process_spec.rb +75 -1
- data/spec/unit/commands/command_profile_spec.rb +7 -1
- data/spec/unit/commands/command_projects_spec.rb +1 -1
- data/spec/unit/commands/command_scaffold_spec.rb +46 -1
- data/spec/unit/core/connection_spec.rb +1 -0
- data/spec/unit/data/guesser_spec.rb +54 -0
- data/spec/unit/helpers_spec.rb +47 -0
- data/spec/unit/model/schema_builder_spec.rb +2 -0
- data/spec/unit/model/tools_spec.rb +89 -0
- data/test/test_upload.rb +39 -15
- metadata +98 -75
- data/test/test_commands.rb +0 -85
- data/test/test_guessing.rb +0 -46
- data/test/test_model.rb +0 -81
- data/test/test_rest_api_basic.rb +0 -41
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
1
3
|
require 'logger'
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
require_relative 'base_middleware'
|
|
4
6
|
|
|
5
7
|
module GoodData::Bricks
|
|
6
8
|
class LoggerMiddleware < GoodData::Bricks::Middleware
|
|
7
|
-
|
|
8
9
|
def call(params)
|
|
9
|
-
logger = params[
|
|
10
|
-
logger.info(
|
|
10
|
+
logger = params['GDC_LOGGER'] = params[:GDC_LOGGER_FILE].nil? ? Logger.new(STDOUT) : Logger.new(params[:GDC_LOGGER_FILE])
|
|
11
|
+
logger.info('Pipeline starts')
|
|
11
12
|
returning(@app.call(params)) do |result|
|
|
12
|
-
logger.info(
|
|
13
|
+
logger.info('Pipeline ending')
|
|
13
14
|
end
|
|
14
15
|
end
|
|
15
|
-
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -1,48 +1,45 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
1
3
|
require 'gooddata'
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
require_relative 'base_middleware'
|
|
4
6
|
|
|
5
7
|
module GoodData::Bricks
|
|
6
8
|
class RestForceMiddleware < GoodData::Bricks::Middleware
|
|
7
|
-
|
|
8
9
|
def call(params)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
client_id = params[:salesforce_client_id]
|
|
10
|
+
username = params[:salesforce_username]
|
|
11
|
+
password = params[:salesforce_password]
|
|
12
|
+
token = params[:salesforce_token]
|
|
13
|
+
client_id = params[:salesforce_client_id]
|
|
14
14
|
client_secret = params[:salesforce_client_secret]
|
|
15
|
-
oauth_token
|
|
15
|
+
oauth_token = params[:salesforce_oauth_token]
|
|
16
16
|
refresh_token = params[:salesforce_refresh_token]
|
|
17
|
-
host
|
|
18
|
-
|
|
19
|
-
credentials = {}
|
|
17
|
+
host = params[:salesforce_host]
|
|
20
18
|
|
|
21
19
|
credentials = if (username && password && token)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
{
|
|
21
|
+
:username => username,
|
|
22
|
+
:password => password,
|
|
23
|
+
:security_token => token
|
|
24
|
+
}
|
|
25
|
+
elsif (oauth_token && refresh_token)
|
|
26
|
+
{
|
|
27
|
+
:oauth_token => oauth_token,
|
|
28
|
+
:refresh_token => refresh_token
|
|
29
|
+
}
|
|
30
|
+
end
|
|
33
31
|
|
|
34
32
|
client = if credentials
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
credentials.merge!({
|
|
34
|
+
:client_id => client_id,
|
|
35
|
+
:client_secret => client_secret,
|
|
36
|
+
})
|
|
37
|
+
credentials[:host] = host unless host.nil?
|
|
38
|
+
|
|
39
|
+
Restforce.log = true if params[:salesforce_client_logger]
|
|
40
|
+
Restforce.new(credentials)
|
|
41
|
+
end
|
|
44
42
|
@app.call(params.merge(:salesforce_client => client))
|
|
45
43
|
end
|
|
46
|
-
|
|
47
44
|
end
|
|
48
45
|
end
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
require_relative 'base_middleware'
|
|
2
4
|
|
|
3
5
|
module GoodData::Bricks
|
|
4
6
|
class STDOUTLoggingMiddleware < GoodData::Bricks::Middleware
|
|
5
|
-
|
|
6
7
|
def call(params)
|
|
7
8
|
logger = Logger.new(STDOUT)
|
|
8
9
|
params[:logger] = logger
|
|
9
|
-
logger.info(
|
|
10
|
+
logger.info('Pipeline starting with STDOUT logger')
|
|
10
11
|
returning(@app.call(params)) do
|
|
11
|
-
logger.info(
|
|
12
|
+
logger.info('Pipeline ending')
|
|
12
13
|
end
|
|
13
14
|
end
|
|
14
|
-
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
1
3
|
# require 'twitter'
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
require_relative 'base_middleware'
|
|
4
6
|
|
|
5
7
|
module GoodData::Bricks
|
|
6
|
-
|
|
7
8
|
class TwitterMiddleware < GoodData::Bricks::Middleware
|
|
8
|
-
|
|
9
9
|
def call(params)
|
|
10
|
-
|
|
11
10
|
client = Twitter::REST::Client.new do |config|
|
|
12
|
-
config.consumer_key
|
|
13
|
-
config.consumer_secret
|
|
14
|
-
config.access_token
|
|
11
|
+
config.consumer_key = params[:twitter_consumer_key]
|
|
12
|
+
config.consumer_secret = params[:twitter_consumer_secret]
|
|
13
|
+
config.access_token = params[:twitter_access_token]
|
|
15
14
|
config.access_token_secret = params[:twitter_access_token_secret]
|
|
16
15
|
end
|
|
17
16
|
|
|
@@ -19,6 +18,5 @@ module GoodData::Bricks
|
|
|
19
18
|
client.update(result)
|
|
20
19
|
end
|
|
21
20
|
end
|
|
22
|
-
|
|
23
21
|
end
|
|
24
22
|
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
1
3
|
module GoodData::Bricks
|
|
2
4
|
module Utils
|
|
3
|
-
|
|
4
5
|
def returning(value, &block)
|
|
5
|
-
fail
|
|
6
|
+
fail 'Block was not provided' if block.nil?
|
|
6
7
|
return_val = value
|
|
7
8
|
block.call(value)
|
|
8
9
|
return_val
|
|
9
10
|
end
|
|
10
|
-
|
|
11
11
|
end
|
|
12
12
|
end
|
data/lib/gooddata/cli/cli.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
1
3
|
require 'gli'
|
|
2
4
|
require 'pp'
|
|
3
5
|
|
|
@@ -7,10 +9,10 @@ module GoodData
|
|
|
7
9
|
include GLI::App
|
|
8
10
|
|
|
9
11
|
# Require shared part of GLI::App - flags, meta, etc
|
|
10
|
-
|
|
12
|
+
require_relative 'shared.rb'
|
|
11
13
|
|
|
12
14
|
# Require Hooks
|
|
13
|
-
|
|
15
|
+
require_relative 'hooks.rb'
|
|
14
16
|
|
|
15
17
|
GLI::App.commands_from(File.join(File.dirname(__FILE__), 'commands'))
|
|
16
18
|
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
1
3
|
require 'pp'
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
require_relative '../shared'
|
|
6
|
+
require_relative '../../commands/api'
|
|
5
7
|
|
|
6
8
|
GoodData::CLI.module_eval do
|
|
7
9
|
desc 'Some basic API stuff directly from CLI'
|
|
8
10
|
arg_name 'info|test|get|delete'
|
|
9
11
|
command :api do |c|
|
|
10
12
|
|
|
11
|
-
c.desc
|
|
13
|
+
c.desc 'Info about the API version etc'
|
|
12
14
|
c.command :info do |info|
|
|
13
15
|
info.action do |global_options, options, args|
|
|
14
16
|
opts = options.merge(global_options)
|
|
@@ -17,7 +19,7 @@ GoodData::CLI.module_eval do
|
|
|
17
19
|
end
|
|
18
20
|
end
|
|
19
21
|
|
|
20
|
-
c.desc
|
|
22
|
+
c.desc 'GET request on our API'
|
|
21
23
|
c.command :get do |get|
|
|
22
24
|
get.action do |global_options, options, args|
|
|
23
25
|
opts = options.merge(global_options)
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
require_relative '../shared'
|
|
4
|
+
require_relative '../../commands/auth'
|
|
3
5
|
|
|
4
6
|
GoodData::CLI.module_eval do
|
|
5
7
|
|
|
6
8
|
desc 'Work with your locally stored credentials'
|
|
7
9
|
command :auth do |c|
|
|
8
10
|
|
|
9
|
-
c.desc
|
|
11
|
+
c.desc 'Store your credentials to ~/.gooddata so client does not have to ask you every single time'
|
|
10
12
|
c.command :store do |store|
|
|
11
13
|
store.action do |global_options, options, args|
|
|
12
14
|
GoodData::Command::Auth.store
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
1
3
|
require 'pp'
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
require_relative '../shared'
|
|
6
|
+
require_relative '../../commands/process'
|
|
5
7
|
|
|
6
8
|
GoodData::CLI.module_eval do
|
|
7
9
|
|
|
@@ -34,7 +36,7 @@ GoodData::CLI.module_eval do
|
|
|
34
36
|
end
|
|
35
37
|
end
|
|
36
38
|
|
|
37
|
-
c.desc
|
|
39
|
+
c.desc 'Gives you some basic info about the process'
|
|
38
40
|
c.command :get do |get|
|
|
39
41
|
get.action do |global_options, options, args|
|
|
40
42
|
opts = options.merge(global_options)
|
|
@@ -43,7 +45,7 @@ GoodData::CLI.module_eval do
|
|
|
43
45
|
end
|
|
44
46
|
end
|
|
45
47
|
|
|
46
|
-
c.desc
|
|
48
|
+
c.desc 'Deploys provided directory to the server'
|
|
47
49
|
c.command :deploy do |deploy|
|
|
48
50
|
deploy.action do |global_options, options, args|
|
|
49
51
|
opts = options.merge(global_options)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
1
3
|
require 'pp'
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
require_relative '../shared'
|
|
6
|
+
require_relative '../../commands/profile'
|
|
5
7
|
|
|
6
8
|
GoodData::CLI.module_eval do
|
|
7
9
|
|
|
@@ -9,7 +11,7 @@ GoodData::CLI.module_eval do
|
|
|
9
11
|
arg_name 'show'
|
|
10
12
|
command :profile do |c|
|
|
11
13
|
|
|
12
|
-
c.desc
|
|
14
|
+
c.desc 'Show your profile'
|
|
13
15
|
c.command :show do |show|
|
|
14
16
|
show.action do |global_options, options, args|
|
|
15
17
|
opts = options.merge(global_options)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
1
3
|
require 'pp'
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
require_relative '../shared'
|
|
6
|
+
require_relative '../../commands/projects'
|
|
5
7
|
|
|
6
8
|
GoodData::CLI.module_eval do
|
|
7
9
|
|
|
@@ -15,11 +17,11 @@ GoodData::CLI.module_eval do
|
|
|
15
17
|
opts = options.merge(global_options)
|
|
16
18
|
GoodData.connect(opts)
|
|
17
19
|
list = GoodData::Command::Projects.list()
|
|
18
|
-
puts list.map { |p| [p.uri, p.title].join(
|
|
20
|
+
puts list.map { |p| [p.uri, p.title].join(',') }
|
|
19
21
|
end
|
|
20
22
|
end
|
|
21
23
|
|
|
22
|
-
c.desc
|
|
24
|
+
c.desc 'If you are in a gooddata project blueprint or if you provide a project id it will start an interactive session inside that project'
|
|
23
25
|
c.command :jack_in do |jack|
|
|
24
26
|
jack.action do |global_options, options, args|
|
|
25
27
|
goodfile_path = GoodData::Helpers.find_goodfile(Pathname('.'))
|
|
@@ -36,7 +38,7 @@ GoodData::CLI.module_eval do
|
|
|
36
38
|
puts "Use 'exit' to quit the live session. Use 'q' to jump out of displaying a large output."
|
|
37
39
|
binding.pry(:quiet => true,
|
|
38
40
|
:prompt => [proc { |target_self, nest_level, pry|
|
|
39
|
-
|
|
41
|
+
'project_live_sesion: '
|
|
40
42
|
}])
|
|
41
43
|
end
|
|
42
44
|
rescue GoodData::ProjectNotFound => e
|
|
@@ -45,7 +47,7 @@ GoodData::CLI.module_eval do
|
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
if goodfile_path
|
|
48
|
-
goodfile =
|
|
50
|
+
goodfile = MultiJson.load(File.read(goodfile_path), :symbolize_keys => true)
|
|
49
51
|
model_key = goodfile[:model]
|
|
50
52
|
blueprint = GoodData::Model::ProjectBlueprint.new(eval(File.read(model_key)).to_hash) if File.exist?(model_key) && !File.directory?(model_key)
|
|
51
53
|
FileUtils::cd(goodfile_path.dirname) do
|
|
@@ -57,27 +59,27 @@ GoodData::CLI.module_eval do
|
|
|
57
59
|
end
|
|
58
60
|
end
|
|
59
61
|
|
|
60
|
-
c.desc
|
|
62
|
+
c.desc 'Create a gooddata project'
|
|
61
63
|
c.command :create do |create|
|
|
62
64
|
create.action do |global_options, options, args|
|
|
63
|
-
title = ask
|
|
64
|
-
summary = ask(
|
|
65
|
-
template = ask(
|
|
66
|
-
token = ask(
|
|
65
|
+
title = ask 'Project name'
|
|
66
|
+
summary = ask('Project summary') { |q| q.default = '' }
|
|
67
|
+
template = ask('Project template')
|
|
68
|
+
token = ask('token')
|
|
67
69
|
|
|
68
70
|
opts = options.merge(global_options)
|
|
69
71
|
GoodData.connect(opts)
|
|
70
72
|
project = GoodData::Command::Projects.create({
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
:title => title,
|
|
74
|
+
:summary => summary,
|
|
75
|
+
:template => template,
|
|
76
|
+
:token => token
|
|
75
77
|
})
|
|
76
78
|
puts "Project '#{project.title}' with id #{project.uri} created successfully!"
|
|
77
79
|
end
|
|
78
80
|
end
|
|
79
81
|
|
|
80
|
-
c.desc
|
|
82
|
+
c.desc 'Delete a project. Be careful this is impossible to revert'
|
|
81
83
|
c.command :delete do |delete|
|
|
82
84
|
delete.action do |global_options, options, args|
|
|
83
85
|
id = global_options[:project_id]
|
|
@@ -87,7 +89,7 @@ GoodData::CLI.module_eval do
|
|
|
87
89
|
end
|
|
88
90
|
end
|
|
89
91
|
|
|
90
|
-
c.desc
|
|
92
|
+
c.desc 'Clones a project. Useful for testing'
|
|
91
93
|
c.command :clone do |clone|
|
|
92
94
|
clone.desc 'Name of the new project'
|
|
93
95
|
clone.default_value nil
|
|
@@ -104,7 +106,7 @@ GoodData::CLI.module_eval do
|
|
|
104
106
|
end
|
|
105
107
|
end
|
|
106
108
|
|
|
107
|
-
c.desc
|
|
109
|
+
c.desc 'Shows basic info about a project'
|
|
108
110
|
c.command :show do |show|
|
|
109
111
|
show.action do |global_options, options, args|
|
|
110
112
|
id = global_options[:project_id]
|
|
@@ -115,24 +117,24 @@ GoodData::CLI.module_eval do
|
|
|
115
117
|
end
|
|
116
118
|
end
|
|
117
119
|
|
|
118
|
-
c.desc
|
|
120
|
+
c.desc 'If you are in a gooddata project blueprint it will apply the changes. If you do not provide a project id it will build it from scratch and create a project for you.'
|
|
119
121
|
c.command :build do |show|
|
|
120
122
|
show.action do |global_options, options, args|
|
|
121
123
|
opts = options.merge(global_options)
|
|
122
124
|
GoodData.connect(opts)
|
|
123
|
-
spec, project_id = GoodData::Command::Projects.get_spec_and_project_id(
|
|
125
|
+
spec, project_id = GoodData::Command::Projects.get_spec_and_project_id('.')
|
|
124
126
|
new_project = GoodData::Command::Projects.build(opts.merge(:spec => spec))
|
|
125
127
|
puts "Project was created. New project PID is #{new_project.pid}, URI is #{new_project.uri}."
|
|
126
128
|
end
|
|
127
129
|
end
|
|
128
130
|
|
|
129
|
-
c.desc
|
|
131
|
+
c.desc 'If you are in a gooddata project blueprint it will apply the changes. If you do not provide a project id it will build it from scratch and create a project for you.'
|
|
130
132
|
c.command :update do |show|
|
|
131
133
|
show.action do |global_options, options, args|
|
|
132
134
|
|
|
133
135
|
opts = options.merge(global_options)
|
|
134
136
|
GoodData.connect(opts)
|
|
135
|
-
spec, project_id = GoodData::Command::Projects.get_spec_and_project_id(
|
|
137
|
+
spec, project_id = GoodData::Command::Projects.get_spec_and_project_id('.')
|
|
136
138
|
project = GoodData::Command::Projects.update(opts.merge(:spec => spec, :project_id => global_options[:project_id] || project_id))
|
|
137
139
|
puts "Migration was done. Project PID is #{project.pid}, URI is #{project.uri}."
|
|
138
140
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
1
3
|
require 'pp'
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
require_relative '../shared'
|
|
6
|
+
require_relative '../../commands/process'
|
|
7
|
+
require_relative '../../commands/runners'
|
|
8
|
+
require_relative '../../client'
|
|
7
9
|
|
|
8
10
|
GoodData::CLI.module_eval do
|
|
9
11
|
|
|
@@ -33,22 +35,22 @@ GoodData::CLI.module_eval do
|
|
|
33
35
|
c.action do |global_options, options, args|
|
|
34
36
|
verbose = global_options[:verbose]
|
|
35
37
|
options[:expanded_params] = if (options[:params])
|
|
36
|
-
|
|
38
|
+
MultiJson.load(File.read(options[:params]))
|
|
37
39
|
else
|
|
38
40
|
{}
|
|
39
41
|
end
|
|
40
42
|
|
|
41
|
-
opts = options.merge(global_options).merge({:type =>
|
|
43
|
+
opts = options.merge(global_options).merge({:type => 'RUBY'})
|
|
42
44
|
GoodData.connect(opts)
|
|
43
45
|
if options[:remote]
|
|
44
|
-
fail
|
|
45
|
-
|
|
46
|
+
fail 'You have to specify name of the deploy when deploying remotely' if options[:name].nil? || options[:name].empty?
|
|
47
|
+
require_relative '../../commands/process'
|
|
46
48
|
GoodData::Command::Process.run(options[:dir], opts)
|
|
47
49
|
else
|
|
48
|
-
|
|
50
|
+
require_relative '../../commands/runners'
|
|
49
51
|
GoodData::Command::Runners.run_ruby_locally(options[:dir], opts)
|
|
50
52
|
end
|
|
51
|
-
puts HighLine::color(
|
|
53
|
+
puts HighLine::color('Running ruby brick - DONE', HighLine::GREEN) if verbose
|
|
52
54
|
end
|
|
53
55
|
end
|
|
54
56
|
|