gooddata 1.1.0-java → 1.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (285) hide show
  1. checksums.yaml +4 -4
  2. data/.document +0 -0
  3. data/.flayignore +2 -0
  4. data/.travis.yml +24 -7
  5. data/.yardopts +0 -0
  6. data/CHANGELOG.md +144 -0
  7. data/CLI.md +0 -0
  8. data/Dockerfile.jruby +7 -2
  9. data/Dockerfile.ruby +1 -1
  10. data/Gemfile +0 -0
  11. data/Guardfile +0 -0
  12. data/Rakefile +23 -9
  13. data/TODO.md +0 -0
  14. data/bin/gitflow-init.sh +8 -0
  15. data/ci.rake +3 -3
  16. data/data/2008.crt +39 -0
  17. data/data/new_ca.cer +22 -0
  18. data/dependency_decisions.yml +0 -0
  19. data/docker-compose.lcm.yml +31 -0
  20. data/docker-compose.yml +4 -2
  21. data/gooddata.gemspec +3 -3
  22. data/lcm.rake +288 -0
  23. data/lib/gooddata.rb +1 -0
  24. data/lib/gooddata/bricks/base_downloader.rb +1 -1
  25. data/lib/gooddata/bricks/brick.rb +0 -1
  26. data/lib/gooddata/bricks/middleware/aws_middleware.rb +1 -1
  27. data/lib/gooddata/bricks/middleware/logger_middleware.rb +1 -1
  28. data/lib/gooddata/bricks/pipeline.rb +67 -0
  29. data/lib/gooddata/bricks/provisioning_brick.rb +18 -0
  30. data/lib/gooddata/bricks/release_brick.rb +18 -0
  31. data/lib/gooddata/bricks/rollout_brick.rb +14 -0
  32. data/lib/gooddata/bricks/user_filters_brick.rb +13 -0
  33. data/lib/gooddata/bricks/users_brick.rb +13 -0
  34. data/lib/gooddata/core/logging.rb +1 -1
  35. data/lib/gooddata/exceptions/maql_execution.rb +1 -1
  36. data/lib/gooddata/extensions/string.rb +0 -0
  37. data/lib/gooddata/lcm/actions/associate_clients.rb +34 -8
  38. data/lib/gooddata/lcm/actions/collect_data_product.rb +8 -1
  39. data/lib/gooddata/lcm/actions/collect_segment_clients.rb +13 -23
  40. data/lib/gooddata/lcm/actions/collect_segments.rb +10 -0
  41. data/lib/gooddata/lcm/actions/synchronize_clients.rb +3 -1
  42. data/lib/gooddata/lcm/actions/synchronize_ldm.rb +61 -34
  43. data/lib/gooddata/lcm/actions/synchronize_user_filters.rb +6 -4
  44. data/lib/gooddata/lcm/actions/update_release_table.rb +4 -12
  45. data/lib/gooddata/lcm/dsl/params_dsl.rb +0 -4
  46. data/lib/gooddata/lcm/dsl/type_dsl.rb +0 -4
  47. data/lib/gooddata/lcm/helpers/check_helper.rb +1 -1
  48. data/lib/gooddata/lcm/lcm2.rb +0 -2
  49. data/lib/gooddata/lcm/types/special/enum.rb +6 -0
  50. data/lib/gooddata/lcm/types/special/enum/synchronize_ldm.rb +20 -0
  51. data/lib/gooddata/lcm/types/special/types.rb +1 -1
  52. data/lib/gooddata/mixins/is_folder.rb +0 -0
  53. data/lib/gooddata/mixins/to_json.rb +0 -0
  54. data/lib/gooddata/mixins/uri_getter.rb +0 -0
  55. data/lib/gooddata/models/project_creator.rb +38 -30
  56. data/lib/gooddata/models/user_filters/user_filter_builder.rb +1 -0
  57. data/lib/gooddata/rest/README.md +0 -0
  58. data/lib/gooddata/version.rb +1 -1
  59. data/lib/templates/bricks/brick.rb.erb +0 -0
  60. data/lib/templates/bricks/main.rb.erb +0 -0
  61. data/lib/templates/project/Goodfile.erb +0 -0
  62. data/lib/templates/project/data/commits.csv +0 -0
  63. data/lib/templates/project/data/devs.csv +0 -0
  64. data/lib/templates/project/data/repos.csv +0 -0
  65. data/lib/templates/project/model/model.rb.erb +0 -0
  66. metadata +23 -452
  67. data/lib/gooddata/lcm/actions/ensure_data_product.rb +0 -63
  68. data/spec/.rubocop.yml +0 -16
  69. data/spec/bricks/bricks_spec.rb +0 -110
  70. data/spec/bricks/default-config.json +0 -8
  71. data/spec/data/.gooddata +0 -4
  72. data/spec/data/blueprints/additional_dataset_module.json +0 -32
  73. data/spec/data/blueprints/attribute_sort_order_blueprint.json +0 -72
  74. data/spec/data/blueprints/big_blueprint_not_pruned.json +0 -2079
  75. data/spec/data/blueprints/invalid_blueprint.json +0 -103
  76. data/spec/data/blueprints/m_n_model.json +0 -104
  77. data/spec/data/blueprints/model_module.json +0 -25
  78. data/spec/data/blueprints/test_blueprint.json +0 -39
  79. data/spec/data/blueprints/test_project_model_spec.json +0 -106
  80. data/spec/data/cc/data/source/commits.csv +0 -4
  81. data/spec/data/cc/data/source/devs.csv +0 -4
  82. data/spec/data/cc/data/source/repos.csv +0 -3
  83. data/spec/data/cc/devel.prm +0 -0
  84. data/spec/data/cc/graph/graph.grf +0 -11
  85. data/spec/data/cc/workspace.prm +0 -19
  86. data/spec/data/column_based_permissions.csv +0 -7
  87. data/spec/data/column_based_permissions2.csv +0 -6
  88. data/spec/data/dynamic_schedule_params_table.csv +0 -7
  89. data/spec/data/gd_gse_data_blueprint.json +0 -1371
  90. data/spec/data/gd_gse_data_manifest.json +0 -1424
  91. data/spec/data/gd_gse_data_model.json +0 -1772
  92. data/spec/data/gooddata_version_process/gooddata_version.rb +0 -9
  93. data/spec/data/gooddata_version_process/gooddata_version.zip +0 -0
  94. data/spec/data/hello_world_process/hello_world.rb +0 -9
  95. data/spec/data/hello_world_process/hello_world.zip +0 -0
  96. data/spec/data/integration_model.json +0 -252
  97. data/spec/data/integration_policies.csv +0 -9134
  98. data/spec/data/line_based_permissions.csv +0 -3
  99. data/spec/data/manifests/test_blueprint.json +0 -32
  100. data/spec/data/manifests/test_project.json +0 -107
  101. data/spec/data/reports/left_attr_report.json +0 -108
  102. data/spec/data/reports/metric_only_one_line.json +0 -83
  103. data/spec/data/reports/report_1.json +0 -197
  104. data/spec/data/reports/top_attr_report.json +0 -108
  105. data/spec/data/ruby_params_process/ruby_params.rb +0 -9
  106. data/spec/data/ruby_process/deep_files/deep_stuff.txt +0 -1
  107. data/spec/data/ruby_process/process.rb +0 -8
  108. data/spec/data/ruby_process/stuff.txt +0 -1
  109. data/spec/data/superfluous_titles_view.json +0 -81
  110. data/spec/data/test-ci-data.csv +0 -2
  111. data/spec/data/user_filters.csv +0 -2
  112. data/spec/data/users.csv +0 -12
  113. data/spec/data/wire_models/attribute_sort_by_model.json +0 -73
  114. data/spec/data/wire_models/model_view.json +0 -1775
  115. data/spec/data/wire_models/nu_model.json +0 -3046
  116. data/spec/data/wire_models/test_blueprint.json +0 -66
  117. data/spec/data/wire_test_project.json +0 -150
  118. data/spec/data/workspace_table.csv +0 -3
  119. data/spec/environment/default.rb +0 -43
  120. data/spec/environment/development.rb +0 -32
  121. data/spec/environment/environment.rb +0 -38
  122. data/spec/environment/production.rb +0 -27
  123. data/spec/environment/staging.rb +0 -32
  124. data/spec/environment/testing.rb +0 -32
  125. data/spec/helpers/appstore_project_helper.rb +0 -221
  126. data/spec/helpers/blueprint_helper.rb +0 -27
  127. data/spec/helpers/cli_helper.rb +0 -38
  128. data/spec/helpers/connection_helper.rb +0 -43
  129. data/spec/helpers/constants.rb +0 -32
  130. data/spec/helpers/crypto_helper.rb +0 -19
  131. data/spec/helpers/csv_helper.rb +0 -20
  132. data/spec/helpers/process_helper.rb +0 -35
  133. data/spec/helpers/project_helper.rb +0 -74
  134. data/spec/helpers/schedule_helper.rb +0 -33
  135. data/spec/helpers/spec_helper.rb +0 -17
  136. data/spec/integration/ads_output_stage_spec.rb +0 -45
  137. data/spec/integration/blueprint_updates_spec.rb +0 -107
  138. data/spec/integration/blueprint_with_ca_spec.rb +0 -56
  139. data/spec/integration/blueprint_with_grain_spec.rb +0 -74
  140. data/spec/integration/channel_configuration_spec.rb +0 -67
  141. data/spec/integration/clients_spec.rb +0 -164
  142. data/spec/integration/command_datawarehouse_spec.rb +0 -45
  143. data/spec/integration/command_projects_spec.rb +0 -32
  144. data/spec/integration/commands/command_projects_spec.rb +0 -22
  145. data/spec/integration/connection_spec.rb +0 -37
  146. data/spec/integration/core/connection_spec.rb +0 -56
  147. data/spec/integration/core/logging_spec.rb +0 -132
  148. data/spec/integration/core/project_spec.rb +0 -54
  149. data/spec/integration/create_from_template_spec.rb +0 -29
  150. data/spec/integration/create_project_spec.rb +0 -27
  151. data/spec/integration/date_dim_switch_spec.rb +0 -154
  152. data/spec/integration/deprecated_load_spec.rb +0 -60
  153. data/spec/integration/full_process_schedule_spec.rb +0 -367
  154. data/spec/integration/full_project_spec.rb +0 -592
  155. data/spec/integration/helpers_spec.rb +0 -16
  156. data/spec/integration/lcm_spec.rb +0 -54
  157. data/spec/integration/mandatory_user_filter_spec.rb +0 -53
  158. data/spec/integration/mixins/id_to_uri_spec.rb +0 -56
  159. data/spec/integration/models/data_product_spec.rb +0 -71
  160. data/spec/integration/models/domain_spec.rb +0 -162
  161. data/spec/integration/models/invitation_spec.rb +0 -17
  162. data/spec/integration/models/label_spec.rb +0 -49
  163. data/spec/integration/models/membership_spec.rb +0 -127
  164. data/spec/integration/models/metadata/report_spec.rb +0 -54
  165. data/spec/integration/models/metric_spec.rb +0 -24
  166. data/spec/integration/models/params_spec.rb +0 -118
  167. data/spec/integration/models/process_spec.rb +0 -35
  168. data/spec/integration/models/profile_spec.rb +0 -210
  169. data/spec/integration/models/project_role_spec.rb +0 -94
  170. data/spec/integration/models/project_spec.rb +0 -225
  171. data/spec/integration/models/schedule_spec.rb +0 -477
  172. data/spec/integration/models/unit_project_spec.rb +0 -130
  173. data/spec/integration/over_to_user_filters_spec.rb +0 -98
  174. data/spec/integration/partial_md_export_import_spec.rb +0 -41
  175. data/spec/integration/project_spec.rb +0 -381
  176. data/spec/integration/rest_spec.rb +0 -214
  177. data/spec/integration/schedule_spec.rb +0 -611
  178. data/spec/integration/segments_spec.rb +0 -100
  179. data/spec/integration/subscription_spec.rb +0 -88
  180. data/spec/integration/urn_date_dim_spec.rb +0 -53
  181. data/spec/integration/user_filters_spec.rb +0 -310
  182. data/spec/integration/user_group_spec.rb +0 -147
  183. data/spec/integration/variables_spec.rb +0 -189
  184. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/can_assign_a_custom_logger.yml +0 -2287
  185. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/client_logs_when_given_custom_message.yml +0 -2287
  186. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/has_the_request_id_logged_when_I_passed_it.yml +0 -2287
  187. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_off/Disables_logging.yml +0 -2287
  188. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_on/Enables_logging.yml +0 -2287
  189. data/spec/integration/vcr_cassettes/GoodData_-_project/_project/Returns_project_assigned.yml +0 -354
  190. data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_nil.yml +0 -299
  191. data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_directly.yml +0 -354
  192. data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_ID.yml +0 -354
  193. data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_URL.yml +0 -354
  194. data/spec/integration/vcr_cassettes/GoodData_-_project/_with_project/Uses_project_specified.yml +0 -354
  195. data/spec/integration/vcr_cassettes/GoodData_Metric/all.yml +0 -2065
  196. data/spec/integration/vcr_cassettes/GoodData_Metric/should_be_able_to_update_folders.yml +0 -119
  197. data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/all.yml +0 -9812
  198. data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_get_json_containing_correct_id.yml +0 -174
  199. data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_return_nil_for_unknown_id.yml +0 -58
  200. data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_throw_BadRequest_for_-1.yml +0 -63
  201. data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_connect/Connects_using_username_and_password.yml +0 -299
  202. data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_disconnect/Connects_using_username_and_password.yml +0 -299
  203. data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_generate_request_id/Generates_a_non-empty_string.yml +0 -2287
  204. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_/Should_list_user_groups_as_Array.yml +0 -56
  205. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_add_members/Should_add_member.yml +0 -315
  206. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_members/Should_return_members_as_array.yml +0 -54
  207. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_remove_members/Should_remove_existing_members.yml +0 -258
  208. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_save/updates_existing_group.yml +0 -159
  209. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_set_members/Should_set_new_members.yml +0 -158
  210. data/spec/integration/vcr_cassettes/GoodData_UserGroup/all.yml +0 -809
  211. data/spec/logging_in_logging_out_spec.rb +0 -91
  212. data/spec/spec_helper.rb +0 -110
  213. data/spec/unit/actions/associate_clients_spec.rb +0 -48
  214. data/spec/unit/actions/collect_client_projects_spec.rb +0 -47
  215. data/spec/unit/actions/collect_clients_spec.rb +0 -65
  216. data/spec/unit/actions/collect_data_product_spec.rb +0 -58
  217. data/spec/unit/actions/collect_dynamic_schedule_params_spec.rb +0 -56
  218. data/spec/unit/actions/collect_meta_spec.rb +0 -88
  219. data/spec/unit/actions/collect_segment_clients_spec.rb +0 -82
  220. data/spec/unit/actions/collect_tagged_objects_spec.rb +0 -126
  221. data/spec/unit/actions/collect_users_brick_users_spec.rb +0 -36
  222. data/spec/unit/actions/create_segment_masters_spec.rb +0 -65
  223. data/spec/unit/actions/ensure_data_product_spec.rb +0 -39
  224. data/spec/unit/actions/ensure_technical_users_domain_spec.rb +0 -53
  225. data/spec/unit/actions/ensure_technical_users_project_spec.rb +0 -76
  226. data/spec/unit/actions/execute_schedules_spec.rb +0 -94
  227. data/spec/unit/actions/provision_clients_spec.rb +0 -46
  228. data/spec/unit/actions/purge_clients_spec.rb +0 -47
  229. data/spec/unit/actions/rename_existing_client_projects_spec.rb +0 -54
  230. data/spec/unit/actions/segments_filter_spec.rb +0 -46
  231. data/spec/unit/actions/shared_examples_for_user_actions.rb +0 -43
  232. data/spec/unit/actions/synchronize_cas_spec.rb +0 -58
  233. data/spec/unit/actions/synchronize_clients_spec.rb +0 -71
  234. data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +0 -206
  235. data/spec/unit/actions/synchronize_ldm_spec.rb +0 -70
  236. data/spec/unit/actions/synchronize_user_filters_spec.rb +0 -208
  237. data/spec/unit/actions/synchronize_user_groups_spec.rb +0 -49
  238. data/spec/unit/actions/synchronize_users_spec.rb +0 -180
  239. data/spec/unit/bricks/bricks_spec.rb +0 -34
  240. data/spec/unit/bricks/middleware/aws_middelware_spec.rb +0 -98
  241. data/spec/unit/bricks/middleware/bench_middleware_spec.rb +0 -15
  242. data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +0 -15
  243. data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +0 -15
  244. data/spec/unit/bricks/middleware/logger_middleware_spec.rb +0 -30
  245. data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +0 -15
  246. data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +0 -15
  247. data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +0 -15
  248. data/spec/unit/cli/cli_spec.rb +0 -17
  249. data/spec/unit/cli/commands/cmd_auth_spec.rb +0 -17
  250. data/spec/unit/core/nil_logger_spec.rb +0 -13
  251. data/spec/unit/extensions/hash_spec.rb +0 -22
  252. data/spec/unit/godzilla/goodzilla_spec.rb +0 -74
  253. data/spec/unit/helpers/check_helper_production_spec.rb +0 -34
  254. data/spec/unit/helpers/check_helper_spec.rb +0 -134
  255. data/spec/unit/helpers/csv_helper_spec.rb +0 -22
  256. data/spec/unit/helpers/data_helper_spec.rb +0 -67
  257. data/spec/unit/helpers/global_helpers_spec.rb +0 -264
  258. data/spec/unit/helpers_spec.rb +0 -254
  259. data/spec/unit/lcm/lcm2_spec.rb +0 -100
  260. data/spec/unit/lcm/user_bricks_helper_spec.rb +0 -58
  261. data/spec/unit/models/blueprint/attribute_sort_by_spec.rb +0 -20
  262. data/spec/unit/models/blueprint/attributes_spec.rb +0 -28
  263. data/spec/unit/models/blueprint/dataset_spec.rb +0 -120
  264. data/spec/unit/models/blueprint/label_blueprint_field_spec.rb +0 -43
  265. data/spec/unit/models/blueprint/project_blueprint_spec.rb +0 -642
  266. data/spec/unit/models/blueprint/reference_spec.rb +0 -28
  267. data/spec/unit/models/blueprint/schema_builder_spec.rb +0 -36
  268. data/spec/unit/models/blueprint/to_wire_spec.rb +0 -196
  269. data/spec/unit/models/dataset_blueprint.rb +0 -14
  270. data/spec/unit/models/execution_spec.rb +0 -109
  271. data/spec/unit/models/from_wire_spec.rb +0 -321
  272. data/spec/unit/models/metadata_spec.rb +0 -140
  273. data/spec/unit/models/metric_spec.rb +0 -129
  274. data/spec/unit/models/model_spec.rb +0 -87
  275. data/spec/unit/models/project_creator_spec.rb +0 -90
  276. data/spec/unit/models/project_spec.rb +0 -94
  277. data/spec/unit/models/report_result_data_spec.rb +0 -194
  278. data/spec/unit/models/to_manifest_spec.rb +0 -165
  279. data/spec/unit/models/user_filters/user_filter_builder_spec.rb +0 -149
  280. data/spec/unit/models/user_filters_spec.rb +0 -95
  281. data/spec/unit/models/variable_spec.rb +0 -280
  282. data/spec/unit/rest/phmap_spec.rb +0 -117
  283. data/spec/unit/rest/polling_spec.rb +0 -101
  284. data/spec/unit/rest/resource_spec.rb +0 -10
  285. data/spec/vcr_configurer.rb +0 -63
data/docker-compose.yml CHANGED
@@ -9,9 +9,10 @@ services:
9
9
  - PRONTO_GITHUB_ACCESS_TOKEN
10
10
  - PRONTO_PULL_REQUEST_ID
11
11
  - GD_ENV
12
+ - VCR_ON
12
13
  volumes:
13
14
  - /etc/passwd:/etc/passwd:ro
14
- - .:/var/lib/jenkins-slave
15
+ - .:/src
15
16
  volumes_from:
16
17
  - bundle
17
18
  gooddata-jruby:
@@ -23,9 +24,10 @@ services:
23
24
  - GD_PROJECT_TOKEN
24
25
  - GD_SPEC_PASSWORD
25
26
  - GD_ENV
27
+ - VCR_ON
26
28
  volumes:
27
29
  - /etc/passwd:/etc/passwd:ro
28
- - .:/var/lib/jenkins-slave
30
+ - .:/src
29
31
  volumes_from:
30
32
  - bundle
31
33
  bundle:
data/gooddata.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.extra_rdoc_files = %w(LICENSE README.md)
23
23
 
24
24
  s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
25
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.files.reject! { |fn| fn.start_with? 'spec/' }
26
26
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
27
27
 
28
28
  s.homepage = 'http://github.com/gooddata/gooddata-ruby'
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
37
37
  s.add_development_dependency 'rspec_junit_formatter', '~> 0.3.0'
38
38
  s.add_development_dependency 'rubocop', '< 0.48' # TODO: remove it after dealing with new rules introduced in 0.48 version
39
39
  s.add_development_dependency 'simplecov', '~> 0.12'
40
- s.add_development_dependency 'webmock', '~> 1.21'
40
+ s.add_development_dependency 'webmock', '~> 2.3.1'
41
41
  s.add_development_dependency 'yard', '~> 0.9.11'
42
42
  s.add_development_dependency 'yard-rspec', '~> 0.1'
43
43
  s.add_development_dependency 'ZenTest', '~> 4.11'
@@ -49,7 +49,7 @@ Gem::Specification.new do |s|
49
49
  s.add_development_dependency 'vcr'
50
50
 
51
51
  s.add_dependency 'activesupport', '~> 4.2.9'
52
- s.add_dependency 'aws-sdk', '~> 2.9', '>= 2.9.42'
52
+ s.add_dependency 'aws-sdk-s3', '~> 1.16'
53
53
  s.add_dependency 'docile', '~> 1.1'
54
54
  s.add_dependency 'erubis', '~> 2.7'
55
55
  s.add_dependency 'gli', '~> 2.15'
data/lcm.rake ADDED
@@ -0,0 +1,288 @@
1
+ require 'pp'
2
+ require 'fileutils'
3
+ require 'pathname'
4
+ require 'rspec/core/rake_task'
5
+
6
+ # Schema for new Bricks.
7
+ brick_info_schema = {
8
+ "type" => "object",
9
+ "required" => ["name","version","language","created"],
10
+ "properties" => {
11
+ "name" => {"type" => "string"},
12
+ "author" => {
13
+ "type" => "object",
14
+ "properties" => {
15
+ "name" => {"type" => "string"},
16
+ "email" => {"type" => "string"}
17
+ }
18
+ },
19
+ "created" => {"type" => "string"},
20
+ "version" => {"type" => "string"},
21
+ "category" => {"type" => "string"},
22
+ "language" => {"type" => "string"},
23
+ "description" => { "type" => "string"},
24
+ "tags" => {"type" => "string"},
25
+ "is_live" => {"type" => "boolean"},
26
+ "parameters" => {
27
+ "type" => "array",
28
+ "properties" => {
29
+ "name" => {"type" => "string"},
30
+ "description" => {"type" => "string"},
31
+ "type" => {"type" => "string"},
32
+ "mandatory" => {"type" => "boolean"},
33
+ }
34
+ }
35
+ },
36
+ }
37
+
38
+ check_exit_code = <<-EOT
39
+ docker-compose --file=docker-compose.lcm.yml ps -q | xargs docker inspect -f '{{ .State.ExitCode }}' | while read code; do
40
+ if [ "$code" == "1" ]; then
41
+ exit -1
42
+ fi
43
+ done
44
+ EOT
45
+
46
+ desc 'Gets info.json from /apps/ and validates.'
47
+ task :default do
48
+ require 'json-schema'
49
+
50
+ root = Pathname(__FILE__).expand_path.dirname
51
+ bricks_root = root + "./apps/*/info.json"
52
+
53
+ production_bricks = []
54
+ bricks = Dir.glob(bricks_root).map do |path|
55
+ brick = JSON.parse(File.read(path))
56
+ if JSON::Validator.validate!(brick_info_schema, brick)
57
+ production_bricks << brick
58
+ else
59
+ fail JSON::Schema::ValidationError
60
+ end
61
+ end
62
+
63
+ task(:write).invoke(production_bricks)
64
+ end
65
+
66
+ desc 'Writes JSON file to location.'
67
+ task :write, :file do |w, bricks|
68
+ require 'json'
69
+
70
+ File.open("./build/bricks.json", 'w') do |f|
71
+ f.puts bricks.file.to_json
72
+ end
73
+ end
74
+
75
+ RSpec::Core::RakeTask.new(:test)
76
+ namespace :test do
77
+ desc 'Run integration tests'
78
+ RSpec::Core::RakeTask.new(:integration) do |t|
79
+ t.pattern = 'spec/lcm/integration/**/*.rb'
80
+ end
81
+
82
+ desc 'Run load tests'
83
+ RSpec::Core::RakeTask.new(:load) do |t|
84
+ t.pattern = 'spec/lcm/load/**/*.rb'
85
+ end
86
+
87
+ desc 'Run slow tests'
88
+ RSpec::Core::RakeTask.new(:slow) do |t|
89
+ t.pattern = 'spec/lcm/slow/**/*.rb'
90
+ end
91
+
92
+ namespace :integration do
93
+ desc 'Run integration tests in Docker'
94
+ task :docker do
95
+ system('docker-compose -f docker-compose.lcm.yml up --force-recreate --abort-on-container-exit appstore')
96
+
97
+ # TODO: use exit-code-from after update to docker-compose >= 1.12
98
+ # system('docker-compose up --exit-code-from appstore') ||
99
+ # fail('Test execution failed')
100
+ system(check_exit_code) || fail('Test execution failed!')
101
+ end
102
+ end
103
+ namespace :load do
104
+ desc 'Run load tests in Docker'
105
+ task :docker do
106
+ system('docker-compose -f docker-compose.lcm.yml run --rm appstore bundle exec rake -f lcm.rake test:load')
107
+
108
+ system(check_exit_code) || fail('Test execution failed!')
109
+ end
110
+ end
111
+ end
112
+
113
+ namespace :localstack do
114
+ desc 'Run localstack'
115
+ task :start do
116
+ system('docker run -it --rm -e "SERVICES=s3:4572" -p 4572:4572 -p 8080:8080 localstack/localstack:0.8.1')
117
+ end
118
+ end
119
+
120
+ namespace :docker do
121
+ desc 'Build Docker image'
122
+ task :build do
123
+ system('docker build -f Dockerfile.jruby -t gooddata/appstore .')
124
+ end
125
+
126
+ desc 'Bundles gems using cache'
127
+ task :bundle do
128
+ system('docker-compose -f docker-compose.lcm.yml run appstore bundle')
129
+ end
130
+ end
131
+
132
+ namespace :sdk do
133
+ desc 'Updates gooddata-ruby to the version specified in the root Gemfile'
134
+ task :update do
135
+ directories = %w(.
136
+ ./apps/release_brick
137
+ ./apps/provisioning_brick
138
+ ./apps/rollout_brick
139
+ ./apps/generic_lifecycle_brick
140
+ ./apps/users_brick
141
+ ./apps/user_filters_brick)
142
+ directories.map! { |d| File.expand_path(d) }
143
+ root_gemfile = directories.first + '/Gemfile'
144
+ new_ref = File.readlines(root_gemfile)
145
+ .find { |line| line.include?("gem 'gooddata'") }
146
+ directories.each do |d|
147
+ gemfile_path = d + '/Gemfile'
148
+ new_lines = File.readlines(gemfile_path).map do |line|
149
+ line.include?("gem 'gooddata'") ? new_ref : line
150
+ end
151
+ File.write(gemfile_path, new_lines.join)
152
+ Dir.chdir(d) { Bundler.with_clean_env { system('bundle install') || raise } }
153
+ end
154
+ to_commit = directories.map { |d| "#{d}/Gemfile #{d}/Gemfile.lock" }
155
+ .join(' ')
156
+ new_ref = new_ref.split(',').last.strip.scan(/'([\w,\.]+)'/).flatten.first
157
+ system("git commit #{to_commit} -m 'Update gooddata-ruby #{new_ref}'") || raise
158
+ end
159
+
160
+ def gdruby_version_from_gemfile
161
+ new_ref = File.readlines('Gemfile')
162
+ .find { |line| line.include?("gem 'gooddata'") }
163
+ new_ref.split(',').last.strip.scan(/'([\w,\.]+)'/).flatten.first
164
+ end
165
+
166
+ def cmd cmdname, *args, &block
167
+ require 'open3'
168
+ begin
169
+ puts "running $ #{([cmdname] + args).join(' ')}"
170
+ stdin, stdout, stderr, wait_thr = Open3.popen3(cmdname, *args)
171
+ so = stdout.gets(nil)
172
+ stderr.gets(nil)
173
+ exit_code = wait_thr.value
174
+ if block
175
+ block.call(exit_code.exitstatus.to_i == 0, so.nil? ? '' : so)
176
+ else
177
+ so
178
+ end
179
+ rescue => e
180
+ p "Error running $ #{([cmdname] + args).join(' ')}"
181
+ pp e
182
+ block.call(false, '')
183
+ ensure
184
+ stdin.close
185
+ stdout.close
186
+ stderr.close
187
+ end
188
+ end
189
+
190
+ desc 'Synchronizes changelogs with gooddata-ruby'
191
+ task :changelog, [:new_appstore_version] do |t, args|
192
+ new_appstore_version = args[:new_appstore_version]
193
+
194
+ last_vers = '0.0.0'
195
+ cmd 'git', 'tag' do |ok, res|
196
+ if ok
197
+ res.lines.each do |line|
198
+ line.strip!
199
+ if line =~ /^[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?.*$/
200
+ first = line.split(/[^\d]+/)
201
+ second = last_vers.split(/[^\d]+/)
202
+ (0..[first.length, second.length].max-1).each_with_index do |val, index|
203
+ if first[index].to_i > second[index].to_i
204
+ last_vers = line
205
+ break
206
+ elsif second[index].to_i > first[index].to_i
207
+ break
208
+ end
209
+ end
210
+ end
211
+ end
212
+ end
213
+ end
214
+
215
+ last_tag_hash = cmd 'git', 'rev-parse', last_vers
216
+ puts "Lastest AppStore tag is #{last_vers}, #{last_tag_hash}"
217
+
218
+ possible_gdruby_version_from_log = cmd 'git', 'log', last_vers do |ok, res|
219
+ shortid = []
220
+ if ok
221
+ res.lines.each do |line|
222
+ if line =~ /^commit [0-9a-z]+/
223
+ commit = line.split[1]
224
+ elsif line =~ /^ Update gooddata-ruby [0-9a-z]+/
225
+ shortid << line.split[2]
226
+ end
227
+ end
228
+ end
229
+ shortid
230
+ end
231
+
232
+ if gdruby_version_from_gemfile == possible_gdruby_version_from_log.first
233
+ gdruby_version_from_log = possible_gdruby_version_from_log[1]
234
+ else
235
+ gdruby_version_from_log = possible_gdruby_version_from_log.first
236
+ end
237
+ puts "Short id of gooddata-ruby from Gemfile #{gdruby_version_from_gemfile}"
238
+ puts "Second latest gooddata-ruby commit short id #{gdruby_version_from_log}"
239
+
240
+ cmd 'git', 'remote', 'add', 'gdcrb', 'https://github.com/gooddata/gooddata-ruby.git'
241
+ cmd 'git', 'fetch', '--all'
242
+ File.open('CHANGELOG.md', 'r') do |origfile|
243
+ File.unlink('CHANGELOG.md')
244
+ newsection = false
245
+ File.open('CHANGELOG.md', 'w') do |file|
246
+ file.write("# GoodData AppStore Changelog, changes from gooddata-ruby\n\n")
247
+ file.write("## AppStore #{new_appstore_version}\n")
248
+ cmd 'git', 'log', '--no-merges', "#{gdruby_version_from_log}..#{gdruby_version_from_gemfile}" do |ok, out|
249
+ if ok
250
+ out.lines.each do |gitline|
251
+ if gitline =~/^commit [0-9a-z]+$/ and not newsection
252
+ newsection = true
253
+ next
254
+ elsif gitline =~ /^ .+$/ and newsection
255
+ file.write("- " + gitline.strip + "\n")
256
+ newsection = false
257
+ end
258
+ end
259
+ end
260
+ end
261
+ file.write origfile.drop(1).join('')
262
+ end
263
+ end
264
+
265
+ cmd 'git', 'add', 'CHANGELOG.md'
266
+ end
267
+ end
268
+
269
+ desc 'Releases new AppStore version. Uses version passed as an argument. \
270
+ Otherwise increments patch version.'
271
+ task :release, [:version] do |t, args|
272
+ new_appstore_version = args[:version]
273
+ if new_appstore_version.nil?
274
+ new_appstore_version = File.open('VERSION').read().strip
275
+ version = new_appstore_version.split('.')
276
+ version[2] = (version[2].to_i + 1).to_s
277
+ new_appstore_version = version.join('.')
278
+ end
279
+
280
+ File.open('VERSION', 'w+t') {|file| file.write(new_appstore_version + "\n")}
281
+ cmd 'git', 'add', 'VERSION'
282
+
283
+ Rake::Task["sdk:changelog"].invoke(new_appstore_version)
284
+ cmd 'git', 'commit', '-m', "Bump version to #{new_appstore_version}"
285
+
286
+ cmd 'git', 'tag', "#{new_appstore_version}"
287
+ # cmd 'git', 'push', 'gerrit', "#{new_appstore_version}"
288
+ end
data/lib/gooddata.rb CHANGED
@@ -21,6 +21,7 @@ require_relative 'gooddata/helpers/helpers'
21
21
  require_relative 'gooddata/lcm/lcm'
22
22
  require_relative 'gooddata/lcm/lcm2'
23
23
  require_relative 'gooddata/models/models'
24
+ require_relative 'gooddata/bricks/pipeline'
24
25
 
25
26
  # Files
26
27
  require_relative 'gooddata/app/app'
@@ -5,7 +5,7 @@
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
7
  require 'pathname'
8
- require 'aws-sdk'
8
+ require 'aws-sdk-s3'
9
9
 
10
10
  module GoodData
11
11
  module Bricks
@@ -6,7 +6,6 @@
6
6
 
7
7
  require_relative 'utils'
8
8
  require_relative 'middleware/middleware'
9
- require_relative 'pipeline'
10
9
 
11
10
  module GoodData
12
11
  module Bricks
@@ -4,7 +4,7 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
- require 'aws-sdk'
7
+ require 'aws-sdk-s3'
8
8
  require_relative 'base_middleware'
9
9
 
10
10
  module GoodData
@@ -18,7 +18,7 @@ module GoodData
18
18
  logger = NilLogger.new
19
19
  else
20
20
  logger = params[:GDC_LOGGER_FILE].nil? ? Logger.new(STDOUT) : Logger.new(params[:GDC_LOGGER_FILE])
21
- logger.level = params['GDC_LOG_LEVEL'] if params['GDC_LOG_LEVEL']
21
+ logger.level = params['GDC_LOG_LEVEL'] || 'info'
22
22
  logger.info('Pipeline starts')
23
23
  end
24
24
  params['GDC_LOGGER'] = logger
@@ -4,6 +4,12 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ require_relative 'users_brick'
8
+ require_relative 'user_filters_brick'
9
+ require_relative 'release_brick'
10
+ require_relative 'provisioning_brick'
11
+ require_relative 'rollout_brick'
12
+
7
13
  module GoodData
8
14
  module Bricks
9
15
  class Pipeline
@@ -20,6 +26,67 @@ module GoodData
20
26
  end
21
27
  end
22
28
  end
29
+
30
+ def self.users_brick_pipeline
31
+ prepare([
32
+ DecodeParamsMiddleware,
33
+ LoggerMiddleware,
34
+ BenchMiddleware,
35
+ GoodDataMiddleware,
36
+ AWSMiddleware,
37
+ WarehouseMiddleware,
38
+ FsProjectUploadMiddleware.new(:destination => :staging),
39
+ UsersBrick])
40
+ end
41
+
42
+ def self.user_filters_brick_pipeline
43
+ prepare([
44
+ DecodeParamsMiddleware,
45
+ LoggerMiddleware,
46
+ BenchMiddleware,
47
+ GoodDataMiddleware,
48
+ AWSMiddleware,
49
+ FsProjectDownloadMiddleware.new(:source => :staging),
50
+ FsProjectUploadMiddleware.new(:destination => :staging),
51
+ WarehouseMiddleware,
52
+ UserFiltersBrick])
53
+ end
54
+
55
+ def self.release_brick_pipeline
56
+ prepare([
57
+ DecodeParamsMiddleware,
58
+ LoggerMiddleware,
59
+ BenchMiddleware,
60
+ GoodDataMiddleware,
61
+ AWSMiddleware,
62
+ WarehouseMiddleware,
63
+ ReleaseBrick
64
+ ])
65
+ end
66
+
67
+ def self.provisioning_brick_pipeline
68
+ prepare([
69
+ DecodeParamsMiddleware,
70
+ LoggerMiddleware,
71
+ BenchMiddleware,
72
+ GoodDataMiddleware,
73
+ AWSMiddleware,
74
+ WarehouseMiddleware,
75
+ ProvisioningBrick
76
+ ])
77
+ end
78
+
79
+ def self.rollout_brick_pipeline
80
+ prepare([
81
+ DecodeParamsMiddleware,
82
+ LoggerMiddleware,
83
+ BenchMiddleware,
84
+ GoodDataMiddleware,
85
+ AWSMiddleware,
86
+ WarehouseMiddleware,
87
+ RolloutBrick
88
+ ])
89
+ end
23
90
  end
24
91
  end
25
92
  end