gooddata 0.6.0.pre11 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +12 -1
  3. data/.yardopts +2 -0
  4. data/README.md +6 -3
  5. data/Rakefile +24 -7
  6. data/gooddata +2 -2
  7. data/gooddata.gemspec +4 -3
  8. data/lib/gooddata.rb +17 -12
  9. data/lib/gooddata/bricks/base_downloader.rb +7 -7
  10. data/lib/gooddata/bricks/brick.rb +7 -8
  11. data/lib/gooddata/bricks/bricks.rb +4 -1
  12. data/lib/gooddata/bricks/middleware/base_middleware.rb +2 -2
  13. data/lib/gooddata/bricks/middleware/bench_middleware.rb +5 -6
  14. data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +21 -22
  15. data/lib/gooddata/bricks/middleware/fs_upload_middleware.rb +3 -4
  16. data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +14 -14
  17. data/lib/gooddata/bricks/middleware/logger_middleware.rb +6 -6
  18. data/lib/gooddata/bricks/middleware/middleware.rb +4 -1
  19. data/lib/gooddata/bricks/middleware/restforce_middleware.rb +29 -32
  20. data/lib/gooddata/bricks/middleware/stdout_middleware.rb +5 -5
  21. data/lib/gooddata/bricks/middleware/twitter_middleware.rb +6 -8
  22. data/lib/gooddata/bricks/utils.rb +3 -3
  23. data/lib/gooddata/cli/cli.rb +4 -2
  24. data/lib/gooddata/cli/commands/api_cmd.rb +6 -4
  25. data/lib/gooddata/cli/commands/auth_cmd.rb +5 -3
  26. data/lib/gooddata/cli/commands/console_cmd.rb +1 -1
  27. data/lib/gooddata/cli/commands/process_cmd.rb +6 -4
  28. data/lib/gooddata/cli/commands/profile_cmd.rb +5 -3
  29. data/lib/gooddata/cli/commands/project_cmd.rb +24 -22
  30. data/lib/gooddata/cli/commands/run_ruby_cmd.rb +12 -10
  31. data/lib/gooddata/cli/commands/scaffold_cmd.rb +8 -6
  32. data/lib/gooddata/cli/hooks.rb +4 -2
  33. data/lib/gooddata/cli/shared.rb +3 -1
  34. data/lib/gooddata/cli/terminal.rb +16 -0
  35. data/lib/gooddata/client.rb +28 -22
  36. data/lib/gooddata/commands/api.rb +43 -26
  37. data/lib/gooddata/commands/auth.rb +22 -53
  38. data/lib/gooddata/commands/base.rb +2 -0
  39. data/lib/gooddata/commands/commands.rb +3 -0
  40. data/lib/gooddata/commands/datasets.rb +39 -136
  41. data/lib/gooddata/commands/process.rb +134 -130
  42. data/lib/gooddata/commands/profile.rb +2 -0
  43. data/lib/gooddata/commands/projects.rb +91 -129
  44. data/lib/gooddata/commands/runners.rb +11 -11
  45. data/lib/gooddata/commands/scaffold.rb +28 -26
  46. data/lib/gooddata/connection.rb +61 -68
  47. data/lib/gooddata/core/core.rb +1 -2
  48. data/lib/gooddata/data/data.rb +7 -0
  49. data/lib/gooddata/data/guesser.rb +114 -0
  50. data/lib/gooddata/exceptions/command_failed.rb +7 -0
  51. data/lib/gooddata/exceptions/exceptions.rb +7 -0
  52. data/lib/gooddata/{exceptions.rb → exceptions/project_not_found.rb} +2 -2
  53. data/lib/gooddata/extensions/big_decimal.rb +5 -0
  54. data/lib/gooddata/extract.rb +2 -0
  55. data/lib/gooddata/goodzilla/goodzilla.rb +11 -12
  56. data/lib/gooddata/helpers.rb +49 -35
  57. data/lib/gooddata/models/attribute.rb +7 -5
  58. data/lib/gooddata/models/dashboard.rb +44 -45
  59. data/lib/gooddata/models/data_result.rb +10 -13
  60. data/lib/gooddata/models/data_set.rb +6 -6
  61. data/lib/gooddata/models/display_form.rb +4 -4
  62. data/lib/gooddata/models/empty_result.rb +4 -3
  63. data/lib/gooddata/models/fact.rb +5 -5
  64. data/lib/gooddata/models/links.rb +3 -1
  65. data/lib/gooddata/models/metadata.rb +34 -32
  66. data/lib/gooddata/models/metric.rb +33 -34
  67. data/lib/gooddata/models/model.rb +165 -173
  68. data/lib/gooddata/models/models.rb +3 -0
  69. data/lib/gooddata/models/process.rb +18 -17
  70. data/lib/gooddata/models/profile.rb +3 -1
  71. data/lib/gooddata/models/project.rb +107 -35
  72. data/lib/gooddata/models/project_metadata.rb +12 -12
  73. data/lib/gooddata/models/report.rb +31 -30
  74. data/lib/gooddata/models/report_data_result.rb +22 -19
  75. data/lib/gooddata/models/report_definition.rb +101 -80
  76. data/lib/gooddata/version.rb +5 -3
  77. data/lib/templates/bricks/brick.rb.erb +3 -3
  78. data/lib/templates/bricks/main.rb.erb +3 -2
  79. data/lib/templates/project/Goodfile.erb +2 -2
  80. data/lib/templates/project/model/model.rb.erb +19 -19
  81. data/spec/data/.gooddata +4 -0
  82. data/spec/helpers/blueprint_helper.rb +2 -2
  83. data/spec/helpers/cli_helper.rb +28 -0
  84. data/spec/helpers/connection_helper.rb +2 -2
  85. data/spec/integration/command_projects_spec.rb +1 -1
  86. data/spec/integration/create_from_template_spec.rb +12 -0
  87. data/spec/integration/full_project_spec.rb +2 -2
  88. data/spec/integration/partial_md_export_import_spec.rb +36 -0
  89. data/spec/logging_in_logging_out_spec.rb +1 -1
  90. data/spec/spec_helper.rb +29 -2
  91. data/spec/unit/cli/cli_spec.rb +3 -3
  92. data/spec/unit/cli/commands/cmd_api_spec.rb +21 -4
  93. data/spec/unit/cli/commands/cmd_auth_spec.rb +2 -4
  94. data/spec/unit/cli/commands/cmd_process_spec.rb +20 -4
  95. data/spec/unit/cli/commands/cmd_profile_spec.rb +9 -4
  96. data/spec/unit/cli/commands/cmd_project_spec.rb +53 -4
  97. data/spec/unit/cli/commands/cmd_run_ruby_spec.rb +2 -4
  98. data/spec/unit/cli/commands/cmd_scaffold_spec.rb +14 -4
  99. data/spec/unit/commands/command_api_spec.rb +21 -2
  100. data/spec/unit/commands/command_auth_spec.rb +62 -1
  101. data/spec/unit/commands/command_dataset_spec.rb +31 -3
  102. data/spec/unit/commands/command_process_spec.rb +75 -1
  103. data/spec/unit/commands/command_profile_spec.rb +7 -1
  104. data/spec/unit/commands/command_projects_spec.rb +1 -1
  105. data/spec/unit/commands/command_scaffold_spec.rb +46 -1
  106. data/spec/unit/core/connection_spec.rb +1 -0
  107. data/spec/unit/data/guesser_spec.rb +54 -0
  108. data/spec/unit/helpers_spec.rb +47 -0
  109. data/spec/unit/model/schema_builder_spec.rb +2 -0
  110. data/spec/unit/model/tools_spec.rb +89 -0
  111. data/test/test_upload.rb +39 -15
  112. metadata +98 -75
  113. data/test/test_commands.rb +0 -85
  114. data/test/test_guessing.rb +0 -46
  115. data/test/test_model.rb +0 -81
  116. 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
- require File.join(File.dirname(__FILE__), "base_middleware")
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["GDC_LOGGER"] = params[:GDC_LOGGER_FILE].nil? ? Logger.new(STDOUT) : Logger.new(params[:GDC_LOGGER_FILE])
10
- logger.info("Pipeline starts")
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("Pipeline ending")
13
+ logger.info('Pipeline ending')
13
14
  end
14
15
  end
15
-
16
16
  end
17
17
  end
@@ -1,4 +1,7 @@
1
+ # encoding: UTF-8
2
+ require 'pathname'
3
+
1
4
  base = Pathname(__FILE__).dirname.expand_path
2
- Dir.glob(base + '*_middleware.*').each do | file |
5
+ Dir.glob("#{base}/*_middleware.rb").each do |file|
3
6
  require file
4
7
  end
@@ -1,48 +1,45 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'gooddata'
2
4
 
3
- require File.join(File.dirname(__FILE__), "base_middleware")
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
- username = params[:salesforce_username]
11
- password = params[:salesforce_password]
12
- token = params[:salesforce_token]
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 = params[:salesforce_oauth_token]
15
+ oauth_token = params[:salesforce_oauth_token]
16
16
  refresh_token = params[:salesforce_refresh_token]
17
- host = params[:salesforce_host]
18
-
19
- credentials = {}
17
+ host = params[:salesforce_host]
20
18
 
21
19
  credentials = if (username && password && token)
22
- {
23
- :username => username,
24
- :password => password,
25
- :security_token => token
26
- }
27
- elsif (oauth_token && refresh_token)
28
- {
29
- :oauth_token => oauth_token,
30
- :refresh_token => refresh_token
31
- }
32
- end
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
- credentials.merge!({
36
- :client_id => client_id,
37
- :client_secret => client_secret,
38
- })
39
- credentials[:host] = host unless host.nil?
40
-
41
- Restforce.log = true if params[:salesforce_client_logger]
42
- Restforce.new(credentials)
43
- end
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
- require File.join(File.dirname(__FILE__), "base_middleware")
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("Pipeline starting with STDOUT logger")
10
+ logger.info('Pipeline starting with STDOUT logger')
10
11
  returning(@app.call(params)) do
11
- logger.info("Pipeline ending")
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
- require File.join(File.dirname(__FILE__), "base_middleware")
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 = params[:twitter_consumer_key]
13
- config.consumer_secret = params[:twitter_consumer_secret]
14
- config.access_token = params[:twitter_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 "Block was not provided" if block.nil?
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
@@ -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
- require File.join(File.dirname(__FILE__), 'shared.rb')
12
+ require_relative 'shared.rb'
11
13
 
12
14
  # Require Hooks
13
- require File.join(File.dirname(__FILE__), 'hooks.rb')
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
- require File.join(File.dirname(__FILE__), "../shared")
4
- require File.join(File.dirname(__FILE__), "../../commands/api")
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 "Info about the API version etc"
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 "GET request on our API"
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
- require File.join(File.dirname(__FILE__), "../shared")
2
- require File.join(File.dirname(__FILE__), "../../commands/auth")
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 "Store your credentials to ~/.gooddata so client does not have to ask you every single time"
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,6 +1,6 @@
1
1
  require 'pp'
2
2
 
3
- require File.join(File.dirname(__FILE__), "../shared")
3
+ require_relative "../shared"
4
4
 
5
5
  GoodData::CLI.module_eval do
6
6
  desc 'Interactive session with gooddata sdk loaded'
@@ -1,7 +1,9 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'pp'
2
4
 
3
- require File.join(File.dirname(__FILE__), "../shared")
4
- require File.join(File.dirname(__FILE__), "../../commands/process")
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 "Gives you some basic info about the process"
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 "Deploys provided directory to the server"
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
- require File.join(File.dirname(__FILE__), "../shared")
4
- require File.join(File.dirname(__FILE__), "../../commands/profile")
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 "Show your profile"
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
- require File.join(File.dirname(__FILE__), "../shared")
4
- require File.join(File.dirname(__FILE__), "../../commands/projects")
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 "If you are in a gooddata project blueprint or if you provide a project id it will start an interactive session inside that project"
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
- "project_live_sesion: "
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 = JSON.parse(File.read(goodfile_path), :symbolize_names => true)
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 "Create a gooddata project"
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 "Project name"
64
- summary = ask("Project summary") { |q| q.default = "" }
65
- template = ask("Project template")
66
- token = ask("token")
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
- :title => title,
72
- :summary => summary,
73
- :template => template,
74
- :token => token
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 "Delete a project. Be careful this is impossible to revert"
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 "Clones a project. Useful for testing"
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 "Shows basic info about a project"
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 "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."
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 "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."
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
- require File.join(File.dirname(__FILE__), "../shared")
4
- require File.join(File.dirname(__FILE__), "../../commands/process")
5
- require File.join(File.dirname(__FILE__), "../../commands/runners")
6
- require File.join(File.dirname(__FILE__), "../../client")
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
- JSON.parse(File.read(options[:params]))
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 => "RUBY"})
43
+ opts = options.merge(global_options).merge({:type => 'RUBY'})
42
44
  GoodData.connect(opts)
43
45
  if options[:remote]
44
- fail "You have to specify name of the deploy when deploying remotely" if options[:name].nil? || options[:name].empty?
45
- require 'gooddata/commands/process'
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
- require 'gooddata/commands/runners'
50
+ require_relative '../../commands/runners'
49
51
  GoodData::Command::Runners.run_ruby_locally(options[:dir], opts)
50
52
  end
51
- puts HighLine::color("Running ruby brick - DONE", HighLine::GREEN) if verbose
53
+ puts HighLine::color('Running ruby brick - DONE', HighLine::GREEN) if verbose
52
54
  end
53
55
  end
54
56