cts-mpx-aci 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +64 -0
  3. data/Gemfile +30 -0
  4. data/Gemfile.lock +178 -0
  5. data/Guardfile +40 -0
  6. data/LICENSE +201 -0
  7. data/README.md +203 -0
  8. data/Rakefile +6 -0
  9. data/Rules +53 -0
  10. data/bin/console +7 -0
  11. data/bin/setup +8 -0
  12. data/content/CHANGELOG.md +1 -0
  13. data/content/EXAMPLES.md +1 -0
  14. data/content/README.md +1 -0
  15. data/content/assets/bootstrap.min.css +12 -0
  16. data/content/assets/images/cts-logo-wide.svg +121 -0
  17. data/content/assets/images/cts-logo.svg +119 -0
  18. data/content/assets/syntax.css +210 -0
  19. data/content/coverage +1 -0
  20. data/content/doc +1 -0
  21. data/content/specifications.html +1 -0
  22. data/content/stylesheet.css +101 -0
  23. data/cts-mpx-aci.gemspec +23 -0
  24. data/data/stencils/account_record.json +431 -0
  25. data/data/stencils/media_custom_fields.json +37 -0
  26. data/data/stencils/servers.json +31 -0
  27. data/data/stencils/task_templates.json +17 -0
  28. data/data/stencils/test.json +13 -0
  29. data/examples/collect.md +21 -0
  30. data/examples/complete_basic.md +95 -0
  31. data/examples/deploy.md +25 -0
  32. data/examples/image.md +41 -0
  33. data/examples/pre_post_block.md +101 -0
  34. data/layouts/default.html +52 -0
  35. data/lib/cts/mpx/aci/extensions/cts/mpx/entries.rb +29 -0
  36. data/lib/cts/mpx/aci/extensions/cts/mpx/entry.rb +130 -0
  37. data/lib/cts/mpx/aci/extensions/services/data/entry.rb +136 -0
  38. data/lib/cts/mpx/aci/stencil.rb +148 -0
  39. data/lib/cts/mpx/aci/tasks/collect.rb +91 -0
  40. data/lib/cts/mpx/aci/tasks/deploy.rb +117 -0
  41. data/lib/cts/mpx/aci/tasks/image.rb +161 -0
  42. data/lib/cts/mpx/aci/transformations.rb +144 -0
  43. data/lib/cts/mpx/aci/validators.rb +114 -0
  44. data/lib/cts/mpx/aci/version.rb +7 -0
  45. data/lib/cts/mpx/aci.rb +76 -0
  46. data/nanoc.yaml +22 -0
  47. metadata +158 -0
@@ -0,0 +1,37 @@
1
+ [
2
+ {
3
+ "service": "Media Data Service",
4
+ "endpoint": "MediaField",
5
+ "fields": [
6
+ "id",
7
+ "guid",
8
+ "title",
9
+ "description",
10
+ "descriptionLocalized",
11
+ "fullTitle",
12
+ "fullTitleLocalized",
13
+ "label",
14
+ "labelLocalized",
15
+ "level",
16
+ "order",
17
+ "parentId",
18
+ "scheme",
19
+ "titleLocalized",
20
+ "allowedValues",
21
+ "dataStructure",
22
+ "dataType",
23
+ "defaultValue",
24
+ "fieldName",
25
+ "includeInTextSearch",
26
+ "isUnique",
27
+ "length",
28
+ "namespace",
29
+ "namespacePrefix",
30
+ "notifyAlways",
31
+ "notifyChanges",
32
+ "notifyDelete",
33
+ "ownerId",
34
+ "searchFieldName"
35
+ ]
36
+ }
37
+ ]
@@ -0,0 +1,31 @@
1
+ [
2
+ {
3
+ "service": "Media Data Service",
4
+ "endpoint": "Server",
5
+ "fields": [
6
+ "id",
7
+ "guid",
8
+ "title",
9
+ "description",
10
+ "allowedAccountIds",
11
+ "disabled",
12
+ "failoverStreamingUrl",
13
+ "formats",
14
+ "downloadUrl",
15
+ "iconUrl",
16
+ "maximumFolderCount",
17
+ "organizeByOwner",
18
+ "organizeForVolume",
19
+ "ownerId",
20
+ "password",
21
+ "privateKey",
22
+ "promptsToDownload",
23
+ "pullUrl",
24
+ "storageUrl",
25
+ "streamingUrl",
26
+ "userName",
27
+ "zones",
28
+ ":"
29
+ ]
30
+ }
31
+ ]
@@ -0,0 +1,17 @@
1
+ [
2
+ {
3
+ "service": "Task Service",
4
+ "endpoint": "TaskTemplate",
5
+ "fields": [
6
+ "id",
7
+ "guid",
8
+ "title",
9
+ "description",
10
+ "adminTags",
11
+ "ownerId",
12
+ "taskArguments",
13
+ "taskType",
14
+ "taskTypeRevision"
15
+ ]
16
+ }
17
+ ]
@@ -0,0 +1,13 @@
1
+ [
2
+ {
3
+ "service": "Media Data Service",
4
+ "endpoint": "Server",
5
+ "fields": [
6
+ "id",
7
+ "guid",
8
+ "title",
9
+ "description",
10
+ "ownerId"
11
+ ]
12
+ }
13
+ ]
@@ -0,0 +1,21 @@
1
+ # Collect
2
+
3
+ ## Create
4
+
5
+ ```ruby
6
+ media_entries = Cts::Mpx::Aci::Tasks::Collect.create(
7
+ user: user,
8
+ account: account,
9
+ queries: [{
10
+ "service" => "Media Data Service",
11
+ "endpoint" => "media",
12
+ "fields" => ['id', 'guid']
13
+ }]
14
+ )
15
+ ```
16
+
17
+ ## Run
18
+
19
+ ```ruby
20
+ media_entries.collect
21
+ ```
@@ -0,0 +1,95 @@
1
+ # Full example
2
+
3
+ ```ruby
4
+ username = 'mpx/test-user@theplatform.com'
5
+ account = 'http://access.auth.theplatform.com/data/Account/2694754993'
6
+ target_account = 'http://access.auth.theplatform.com/data/Account/2694756913'
7
+
8
+ user = Theplatform::Services::User.new username, Theplatform::Credentials[username]
9
+ user.account = account
10
+ user.sign_in
11
+
12
+ target_account_user = Theplatform::Services::User.new username, Theplatform::Credentials[username]
13
+ target_account_user.account = target_account
14
+ target_account_user.sign_in
15
+
16
+ profile_entries = Cts::Mpx::Aci::Tasks::Collect.create(
17
+ user: user,
18
+ account: account,
19
+ queries: [{
20
+ "service" => "Publish Data Service",
21
+ "endpoint" => "PublishProfile",
22
+ "fields" => ["id",
23
+ "guid",
24
+ "title",
25
+ "added",
26
+ "ownerId",
27
+ "locked",
28
+ "isCustom",
29
+ "disabled",
30
+ "fileTargets",
31
+ "fileTargetCount",
32
+ "publishProfileIds",
33
+ "outletProfileIds",
34
+ "autoPublishScript",
35
+ "disableAutoRevokes",
36
+ "disableAutoUpdates",
37
+ "supportingProfile",
38
+ "ownerId"]
39
+ }]
40
+ )
41
+
42
+ profile_entries.collect
43
+
44
+ profile_image = Cts::Mpx::Aci::Tasks::Image.create(
45
+ user: user,
46
+ account: account,
47
+ collections: profile_entries.collections
48
+ )
49
+
50
+ profile_deploy = Cts::Mpx::Aci::Tasks::Deploy.create account: target_account, user: target_account_user, image: profile_image
51
+ profile_deploy.deploy target_account
52
+ server_entries = Cts::Mpx::Aci::Tasks::Collect.create(
53
+ user: user,
54
+ account: account,
55
+ queries: [{
56
+ "service" => "Media Data Service",
57
+ 'endpoint' => 'Server',
58
+ 'fields' => ["id",
59
+ "guid",
60
+ "title",
61
+ "description",
62
+ "ownerId",
63
+ "allowedAccountIds",
64
+ "failoverStreamingUrl",
65
+ "downloadUrl",
66
+ "formats",
67
+ "iconUrl",
68
+ "maximumFolderCount",
69
+ "organizeByOwner",
70
+ "organizeForVolume",
71
+ "password",
72
+ "privateKey",
73
+ "pullUrl",
74
+ "storageUrl",
75
+ "streamingUrl",
76
+ "userName",
77
+ "zones"]
78
+ }]
79
+ )
80
+
81
+ server_entries.collect
82
+
83
+ server_image = Cts::Mpx::Aci::Tasks::Image.create(
84
+ user: user,
85
+ account: account,
86
+ collections: server_entries.collections
87
+ )
88
+
89
+ server_image.user = target_account_user
90
+ server_image.transform
91
+ server_image.untransform target_account
92
+ server_deploy = Cts::Mpx::Aci::Tasks::Deploy.create account: target_account, user: target_account_user, image: server_image
93
+ server_deploy.dependencies
94
+ server_deploy.deploy target_account
95
+ ```
@@ -0,0 +1,25 @@
1
+ # Deploy
2
+
3
+ ## Create
4
+
5
+ ```ruby
6
+ server_deploy = Cts::Mpx::Aci::Tasks::Deploy.create account: target_account, user: target_account_user, image: server_image
7
+ ```
8
+
9
+ ## Deploy
10
+
11
+ ```ruby
12
+ server_deploy.deploy target_account
13
+ ```
14
+
15
+ ## Deploy dependencies
16
+
17
+ ```ruby
18
+ server_deploy.dependencies
19
+ ```
20
+
21
+ ## Deploy order
22
+
23
+ ```ruby
24
+ server_deploy.deploy_order
25
+ ```
data/examples/image.md ADDED
@@ -0,0 +1,41 @@
1
+ # Image
2
+
3
+ ## Create
4
+
5
+ ```ruby
6
+ media_image = Cts::Mpx::Aci::Tasks::Image.create(
7
+ user: user,
8
+ account: account,
9
+ collections: media_entries.collections
10
+ )
11
+ ```
12
+
13
+ ## Load from directory
14
+
15
+ ```ruby
16
+ Cts::Mpx::Aci::Tasks::Image.load_from_directory 'directory'
17
+ ```
18
+
19
+ ## Save to disk
20
+
21
+ ```ruby
22
+ media_image.save_to_disk 'directory'
23
+ ```
24
+
25
+ ## Transform
26
+
27
+ ```ruby
28
+ media_image.transform
29
+ ```
30
+
31
+ ## Untransform
32
+
33
+ ```ruby
34
+ media_image.untransform target_account
35
+ ```
36
+
37
+ ## Merge
38
+
39
+ ```ruby
40
+ account_staging = account_dev_a_image.merge account_dev_b_image
41
+ ```
@@ -0,0 +1,101 @@
1
+ # Pre and Post block example.
2
+
3
+ ```ruby
4
+ #!/usr/bin/env ruby
5
+ require 'cts/mpx/aci'
6
+ require 'ruby-progressbar'
7
+ require 'pry'
8
+
9
+ include Cts::Mpx::Aci::Tasks
10
+
11
+ username = 'mpx/test-user@theplatform.com'
12
+ account = 'http://access.auth.theplatform.com/data/Account/2694754993'
13
+ record_account = 'http://access.auth.theplatform.com/data/Account/2694756913'
14
+ deploy_account = 'http://access.auth.theplatform.com/data/Account/2694756913'
15
+
16
+ user = Theplatform::Services::User.new username, Theplatform::Credentials[username]
17
+ user.account = record_account
18
+ user.sign_in
19
+
20
+ deploy_user = Theplatform::Services::User.new username, Theplatform::Credentials[username]
21
+ deploy_user.account = deploy_account
22
+ deploy_user.sign_in
23
+
24
+ # All the data that represents our feature.
25
+
26
+ feature = Collect.create user: user, account: record_account, queries: [
27
+ {
28
+ 'service' => 'Media Data Service',
29
+ 'endpoint' => 'Media',
30
+ 'fields' => ['id', 'guid', 'title', 'ownerId', 'eb$trailerUrl']
31
+ }, {
32
+ 'service' => 'Media Data Service',
33
+ 'endpoint' => 'MediaFile',
34
+ 'fields' => ['id', 'guid', 'title', 'originalUrl', 'mediaId', 'ownerId']
35
+ }, {
36
+ 'service' => 'Media Data Service',
37
+ 'endpoint' => 'MediaField',
38
+ 'fields' => ['id', 'guid', 'title', 'ownerId', 'fieldName', 'namespace']
39
+ }, {
40
+ 'service' => 'Media Data Service',
41
+ 'endpoint' => 'Category',
42
+ 'fields' => ['id', 'guid', 'title', 'ownerId']
43
+ }, {
44
+ 'service' => 'Media Data Service',
45
+ 'endpoint' => 'AssetType',
46
+ 'fields' => ['id', 'guid', 'title', 'ownerId']
47
+ }
48
+ ]
49
+
50
+ feature.collect
51
+
52
+ feature_image = Cts::Mpx::Aci::Tasks::Image.create(
53
+ user: user,
54
+ account: record_account,
55
+ collections: feature.collections
56
+ )
57
+
58
+ ### Make everything abstract and save
59
+ feature_image.transform
60
+ feature_image.save_to_directory 'feature-trailers'
61
+
62
+ # binding.pry # uncomment this to break here with feature_image complete and saved.
63
+
64
+ ### Deploy
65
+
66
+ deploy_image = Image.load_from_directory 'feature-trailers'
67
+
68
+ feature_deploy = Cts::Mpx::Aci::Tasks::Deploy.create account: deploy_account, user: deploy_user, image: deploy_image
69
+
70
+ feature_deploy.pre_block = proc do |entry|
71
+ print "Attempting to deploy a #{entry.endpoint} named #{entry.guid} . . . "
72
+ entry
73
+ end
74
+
75
+ feature_deploy.post_block = proc do |entry, args|
76
+ puts "successful."
77
+ args[0].increment
78
+ if entry.endpoint == 'Media'
79
+ print "#{entry.guid} is a media, calling fms to generate mediaFile . . . "
80
+
81
+ output = Theplatform::Services::Web::FileManagementService::FileManagement.linkNewFile(
82
+ user,
83
+ 'mediaId' => entry.id,
84
+ 'sourceUrl' => entry.eb_trailerUrl,
85
+ 'mediaFileInfo' => { 'guid' => "#{entry.guid}-1080p" }
86
+ )
87
+
88
+ puts "#{output["fileId"]}."
89
+ end
90
+ end
91
+
92
+
93
+ feature_deploy.image.user = deploy_user
94
+ feature_deploy.image.untransform deploy_account
95
+
96
+ progressbar = ProgressBar.create total: feature_deploy.image.entries.count
97
+
98
+ feature_deploy.deploy deploy_account, progressbar
99
+
100
+ # binding.pry # uncomment this to interact with the feature_deploy object.
101
+ ```
@@ -0,0 +1,52 @@
1
+ <!DOCTYPE HTML>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title>
7
+ <%= @item.identifier.to_s %>
8
+ </title>
9
+ <link rel="stylesheet" href="/pages/thePlatform/cts-mpx-aci/assets/bootstrap.min.css">
10
+ <link rel="stylesheet" href="/pages/thePlatform/cts-mpx-aci/assets/syntax.css">
11
+ <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
12
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
13
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
14
+ </head>
15
+
16
+ <body>
17
+ <nav class="container navbar navbar-expand-lg navbar-dark bg-dark">
18
+ <a class="navbar-brand" href="#"><img src='/pages/thePlatform/cts-mpx-aci/assets/images/cts-logo.svg'></a>
19
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
20
+ <span class="navbar-toggler-icon"></span>
21
+ </button>
22
+ <div class="collapse navbar-collapse" id="navbarNav">
23
+
24
+ <ul class="navbar-nav">
25
+ <li class="nav-item">
26
+ <a class="nav-link" href="/pages/thePlatform/cts-mpx-aci/index.html">Readme</a>
27
+ </li>
28
+ <li class="nav-item">
29
+ <a class="nav-link" href="/pages/thePlatform/cts-mpx-aci/EXAMPLES.html">Examples</a>
30
+ </li>
31
+ <li class="nav-item">
32
+ <a class="nav-link" href="/pages/thePlatform/cts-mpx-aci/CHANGELOG.html">Changelog</a>
33
+ </li>
34
+ <li class="nav-item">
35
+ <a class="nav-link" href="/pages/thePlatform/cts-mpx-aci/coverage/index.html">Coverage report</a>
36
+ </li>
37
+ <li class="nav-item">
38
+ <a class="nav-link" href="/pages/thePlatform/cts-mpx-aci/specifications.html">Specifications</a>
39
+ </li>
40
+ <li class="nav-item">
41
+ <a class="nav-link" href="/pages/thePlatform/cts-mpx-aci/doc/index.html">Library reference</a>
42
+ </li>
43
+ </ul>
44
+ </div>
45
+ </nav>
46
+
47
+ <div id="main" class="container">
48
+ <%= yield %>
49
+ </div>
50
+ </body>
51
+
52
+ </html>