station 0.0.107 → 0.0.108

Sign up to get free protection for your applications and to get access to all the features.
@@ -116,16 +116,6 @@ class StaticController < ApplicationController
116
116
  render 'robots.txt'
117
117
  end
118
118
 
119
- def podcast
120
- # Get URL and split the / to retrieve the landing page name
121
- yaml_name = request.fullpath.split('/')[1]
122
-
123
- # Load the YAML for that particular page
124
- @content = YAML.load_file("#{Rails.root}/config/landing_pages/#{yaml_name}.yml")
125
-
126
- render layout: 'landing'
127
- end
128
-
129
119
  def team
130
120
  @team ||= LoadConfig.load_file('config/team.yml')
131
121
  @careers = Greenhouse.devrel_careers
@@ -84,20 +84,18 @@ class Tutorial
84
84
  subtasks[current_task_index - 1]
85
85
  end
86
86
 
87
+ def tasks
88
+ @tasks ||= (yaml['tasks'] || []).map do |t|
89
+ Task.make_from(
90
+ name: t,
91
+ code_language: code_language,
92
+ current_step: current_step
93
+ )
94
+ end
95
+ end
96
+
87
97
  def subtasks
88
98
  @subtasks ||= begin
89
- tasks = []
90
-
91
- (yaml['tasks'] || []).map do |t|
92
- tasks.push(
93
- Task.make_from(
94
- name: t,
95
- code_language: code_language,
96
- current_step: current_step
97
- )
98
- )
99
- end
100
-
101
99
  tasks.unshift(prerequisite_task)
102
100
  tasks.unshift(introduction_task)
103
101
  tasks.push(conclusion_task)
@@ -1,5 +1,7 @@
1
1
  class Tutorial::Prerequisite
2
- delegate :content, :yaml, to: :@file_loader
2
+ attr_reader :name
3
+
4
+ delegate :content, :yaml, :path, to: :@file_loader
3
5
 
4
6
  def initialize(current_step:, code_language:, name:)
5
7
  @current_step = current_step
@@ -1,11 +1,24 @@
1
1
  class Tutorial::Task
2
- attr_reader :name, :title, :description, :current_step
2
+ attr_reader :name, :code_language, :current_step
3
3
 
4
- def initialize(name:, title:, description:, current_step:)
4
+ delegate :yaml, :path, to: :@file_loader
5
+
6
+ def initialize(name:, current_step:, code_language: nil, title: nil, description: nil)
5
7
  @name = name
6
8
  @title = title
7
9
  @description = description
10
+ @code_language = code_language
8
11
  @current_step = current_step
12
+ @file_loader = load_file!
13
+ end
14
+
15
+ def load_file!
16
+ Tutorial::FileLoader.new(
17
+ root: Tutorial.task_content_path,
18
+ doc_name: @name,
19
+ code_language: @code_language,
20
+ format: 'md'
21
+ )
9
22
  end
10
23
 
11
24
  def active?
@@ -13,17 +26,9 @@ class Tutorial::Task
13
26
  end
14
27
 
15
28
  def self.make_from(name:, code_language:, current_step:)
16
- file_loader = Tutorial::FileLoader.new(
17
- root: Tutorial.task_content_path,
18
- doc_name: name,
19
- code_language: code_language,
20
- format: 'md'
21
- )
22
-
23
29
  new(
24
30
  name: name,
25
- title: file_loader.yaml['title'],
26
- description: file_loader.yaml['description'],
31
+ code_language: code_language,
27
32
  current_step: current_step
28
33
  )
29
34
  end
@@ -42,4 +47,12 @@ class Tutorial::Task
42
47
  def hash
43
48
  name.hash ^ title.hash ^ description.hash ^ current_step.hash
44
49
  end
50
+
51
+ def title
52
+ @title || yaml['title']
53
+ end
54
+
55
+ def description
56
+ @description || yaml['description']
57
+ end
45
58
  end
@@ -0,0 +1,90 @@
1
+ module Translator
2
+ class FilesListCoordinator
3
+ def self.call(attrs = {})
4
+ new(attrs).call
5
+ end
6
+
7
+ def initialize(days:)
8
+ @days = days
9
+ end
10
+
11
+ def call
12
+ process_files(files)
13
+ end
14
+
15
+ def files
16
+ @files ||= `(git fetch origin master:master) && (git log --since="#{@days} days" --name-only --oneline --diff-filter=ACM --pretty=format: master #{Rails.configuration.docs_base_path}/_documentation/en #{Rails.configuration.docs_base_path}/_tutorials/en #{Rails.configuration.docs_base_path}/_use_cases/en) | uniq | awk 'NF'`.split("\n")
17
+ end
18
+
19
+ def process_files(files)
20
+ files.each_with_object([]) do |file, list|
21
+ if file.include?('_documentation')
22
+ list << file if translatable_doc_file?(file)
23
+ elsif file.include?('_use_cases')
24
+ list << file if translatable_use_case_file?(file)
25
+ elsif file.include?('_tutorials')
26
+ list << file if translatable_tutorial_file?(file)
27
+ else
28
+ raise ArgumentError, "The following file did not match documentation, use cases or tutorials: #{file}"
29
+ end
30
+ end
31
+ end
32
+
33
+ def translatable_doc_file?(file)
34
+ return nil unless File.exist?("#{Rails.configuration.docs_base_path}/#{file}")
35
+
36
+ allowed_products.any? do |product|
37
+ product['path'].include?(file.split('/')[2])
38
+ end
39
+ end
40
+
41
+ def translatable_use_case_file?(file)
42
+ return nil unless File.exist?("#{Rails.configuration.docs_base_path}/#{file}")
43
+
44
+ allowed_products.any? do |product|
45
+ use_case_product(file).include?(product['path'])
46
+ end
47
+ end
48
+
49
+ def use_case_product(file)
50
+ @use_case_product = YAML.safe_load(File.read("#{Rails.configuration.docs_base_path}/#{file}"))['products']
51
+
52
+ @use_case_product
53
+ end
54
+
55
+ def translatable_tutorial_file?(file)
56
+ return nil unless File.exist?("#{Rails.configuration.docs_base_path}/#{file}")
57
+
58
+ allowed_tutorial_files.any? do |tutorial|
59
+ tutorial.include?(file)
60
+ end
61
+ end
62
+
63
+ def allowed_products
64
+ @allowed_products ||= YAML.safe_load(File.read("#{Rails.configuration.docs_base_path}/config/products.yml"))['products'].select { |product| product['translate'] == true }
65
+ end
66
+
67
+ def allowed_tutorial_files
68
+ file_names = []
69
+ tutorials_list = []
70
+
71
+ TutorialList.all.each do |item|
72
+ allowed_products.each do |product|
73
+ tutorials_list << item if item.products.to_s.include?(product['path'])
74
+ end
75
+ end
76
+
77
+ tutorials_list.each do |item|
78
+ item.tutorial.prerequisites&.each do |prereq|
79
+ file_names << prereq.path
80
+ end
81
+
82
+ item.tutorial.tasks&.each do |task|
83
+ file_names << task.path
84
+ end
85
+ end
86
+
87
+ file_names.uniq
88
+ end
89
+ end
90
+ end
@@ -35,7 +35,7 @@
35
35
  <% step['fields'].each_with_index do |field, field_index| %>
36
36
  <div>
37
37
  <b><%= field['label'] %>:</b>
38
- <small><%= feedback.steps[step_index][field['name']] %></small>
38
+ <small><%= feedback.steps[step_index].try(:[], field['name']) %></small>
39
39
  </div>
40
40
  <% end %>
41
41
  <% end %>
@@ -1,31 +1,34 @@
1
1
  <div class="Nxd-products-list">
2
2
  <div class="Vlt-grid Vlt-grid--center Vlt-grid--margin-top2">
3
+
4
+
3
5
  <div class="Vlt-col Vlt-col--1of3 Vlt-col--M-1of2">
4
6
  <div class="Vlt-card Vlt-article--reverse Vlt-card--image Nxd-card--products">
5
7
  <div class="Vlt-card__content">
6
8
  <svg class="Vlt-icon Vlt-icon--larger Vlt-purple-dark"><use xlink:href="/symbol/volta-icons.svg#Vlt-icon-message" /></svg>
7
- <div class="Nxd-card--product__subtitle"><small>SEND AND RECEIVE</small></div>
8
-
9
+ <div class="Nxd-card--product__subtitle"><small>PRODUCT AREA</small></div>
9
10
  <h2>
10
11
  <a href="/messaging/sms/overview">
11
- SMS
12
+ PRODUCT NAME
12
13
  </a>
13
14
  </h2>
14
15
  <nav>
15
- <a href="/messaging/sms/overview"><svg class="Vlt-icon Vlt-icon--small Vlt-icon--text-bottom Vlt-gray-darker"
16
+ <a href="#"><svg class="Vlt-icon Vlt-icon--small Vlt-icon--text-bottom Vlt-gray-darker"
16
17
  aria-hidden="true">
17
- <use xlink:href="/symbol/volta-icons.svg#Vlt-icon-home" /></svg>Overview</a>
18
- <a href="/messaging/sms/guides"><svg class="Vlt-icon Vlt-icon--small Vlt-icon--text-bottom Vlt-gray-darker"
18
+ <use xlink:href="/symbol/volta-icons.svg#Vlt-icon-home" /></svg>Product Topic 1</a>
19
+ <a href="#"><svg class="Vlt-icon Vlt-icon--small Vlt-icon--text-bottom Vlt-gray-darker"
19
20
  aria-hidden="true">
20
- <use xlink:href="/symbol/volta-icons.svg#Vlt-icon-books" /></svg>Guides</a>
21
- <a href="/messaging/sms/code-snippets"><svg class="Vlt-icon Vlt-icon--small Vlt-icon--text-bottom Vlt-gray-darker"
21
+ <use xlink:href="/symbol/volta-icons.svg#Vlt-icon-books" /></svg>Product Topic 2</a>
22
+ <a href="#"><svg class="Vlt-icon Vlt-icon--small Vlt-icon--text-bottom Vlt-gray-darker"
22
23
  aria-hidden="true">
23
- <use xlink:href="/symbol/volta-icons.svg#Vlt-icon-code" /></svg>Code Snippets</a>
24
- <a href="/messaging/sms/tutorials"><svg class="Vlt-icon Vlt-icon--small Vlt-icon--text-bottom Vlt-gray-darker"
24
+ <use xlink:href="/symbol/volta-icons.svg#Vlt-icon-code" /></svg>Product Topic 3</a>
25
+ <a href="#"><svg class="Vlt-icon Vlt-icon--small Vlt-icon--text-bottom Vlt-gray-darker"
25
26
  aria-hidden="true">
26
27
  <use xlink:href="/symbol/volta-icons.svg#Vlt-icon-mockup" /></svg>Tutorials</a>
27
28
  <hr class="hr--short">
28
- <a href="/api/sms">API Reference</a>
29
+ <a href="https://nexmo.github.io/station/How-To-Use#customization-options">
30
+ To modify this view, copy <a href="https://raw.githubusercontent.com/Nexmo/station/master/lib/nexmo_developer/app/views/static/_products.html.erb">the file</a> to your `custom/views/static` folder and customize the copied file.
31
+ </a>
29
32
  </nav>
30
33
  </div>
31
34
  </div>
@@ -2,8 +2,8 @@
2
2
 
3
3
  <div class="row">
4
4
  <div class="center">
5
- <h1 class="Vlt-title--margin-top2">Connected Code</h1>
6
- <p class="p-large">Everything you need to build connected applications with Vonage APIs</p>
5
+ <h1 class="Vlt-title--margin-top2">Default Entry Page</h1>
6
+ <p class="p-large">This is the default landing page for a developer portal running on Station.</p>
7
7
  </div>
8
8
  <div class="columns small-12">
9
9
  <a name="products"></a>
@@ -17,10 +17,10 @@
17
17
  <h2>
18
18
  <a href="/tools">
19
19
  <div><svg class="Vlt-icon Vlt-icon--large Vlt-purple-dark"><use xlink:href="/symbol/volta-icons.svg#Vlt-icon-design-tools"/></svg></div>
20
- SDKs &amp; Tools
20
+ Featured Topic 1
21
21
  </a>
22
22
  </h2>
23
- <p>The Nexmo libraries allow you to get up and running with<br>Nexmo APIs quickly in your language of choice.</p>
23
+ <p>You can choose to highlight an area of your portal on the landing page.</p>
24
24
  </div>
25
25
  </div>
26
26
  <div class="Vlt-col Vlt-col--M-1of2">
@@ -28,10 +28,10 @@
28
28
  <h2>
29
29
  <a href="/community">
30
30
  <div><svg class="Vlt-icon Vlt-icon--large Vlt-purple-dark"><use xlink:href="/symbol/volta-icons.svg#Vlt-icon-group"/></svg></div>
31
- Community
31
+ Featured Topic 2
32
32
  </a>
33
33
  </h2>
34
- <p>Find out about our talks, community hacks,<br>and what events we'll be at.</p>
34
+ <p>You can highlight more than one area.</p>
35
35
  </div>
36
36
  </div>
37
37
  </div>
@@ -39,8 +39,8 @@
39
39
  <hr class="hr--tall">
40
40
 
41
41
  <div class="center">
42
- <h3>Do you have a question?</h3>
43
- <p class="p-large">We're always here to help. Check out our <a href="https://help.nexmo.com">support FAQs</a>, contact our super helpful <a href="https://help.nexmo.com/hc/en-us/requests/new">support team</a> or get in touch on <a href="http://stackoverflow.com/questions/tagged/nexmo">Stack Overflow</a>.<br />Your data will be treated in accordance with our <a href="https://www.nexmo.com/privacy-policy">Privacy Policy</a>, which sets out the rights you have in respect of your data.</p>
42
+ <h3>Modifying This Content</h3>
43
+ <p class="p-large">To modify this content you can copy <a href="https://raw.githubusercontent.com/Nexmo/station/master/lib/nexmo_developer/app/views/static/landing.html.erb">this file</a> to the `custom/views/static` folder in your documentation folder and modify that copy. More detailed instructions to create your own landing page can be found on the <a href="https://nexmo.github.io/station/How-To-Use#customization-options">Station documentation</a>.</p>
44
44
  </div>
45
45
  </div>
46
46
  </div>
@@ -1455,7 +1455,7 @@ Volta.tab = function () {
1455
1455
 
1456
1456
  this._activeLink.setAttribute('tabindex', '0');
1457
1457
  this._activeLink.setAttribute('aria-selected', 'true');
1458
- this._activeLink.focus();
1458
+ this._activeLink.focus({ preventScroll: true });
1459
1459
  if (this._activePanel) {
1460
1460
  this._activePanel.removeAttribute('hidden');
1461
1461
  }
@@ -49,6 +49,13 @@ namespace :smartling do
49
49
  puts 'Done!'
50
50
  end
51
51
 
52
+ desc 'Create list of changed documentation files within a given number of days'
53
+ task :check_docs_changes, %i[days] => [:environment] do |_, args|
54
+ files = Translator::FilesListCoordinator.new(days: args[:days]).call
55
+
56
+ puts files
57
+ end
58
+
52
59
  desc 'Upload recently modified docs to Smartling for translation'
53
60
  task :upload, %i[paths frequency] => [:environment] do |_, args|
54
61
  # RAILS_ENV=production RAILS_LOG_TO_STDOUT=1 be nexmo-developer --docs=`pwd` --rake-smartling-upload 15 _documentation/en/messages/test.md _documentation/en/messages/external-accounts/overview.md
@@ -1,3 +1,3 @@
1
1
  module NexmoDeveloper
2
- VERSION = '0.0.107'.freeze
2
+ VERSION = '0.0.108'.freeze
3
3
  end
@@ -2,7 +2,7 @@
2
2
  "dependencies": {
3
3
  "@babel/core": "^7.12.10",
4
4
  "@babel/plugin-proposal-class-properties": "^7.12.1",
5
- "@babel/plugin-proposal-decorators": "^7.12.1",
5
+ "@babel/plugin-proposal-decorators": "^7.12.12",
6
6
  "@babel/plugin-proposal-export-namespace-from": "^7.12.1",
7
7
  "@babel/plugin-proposal-function-sent": "^7.12.1",
8
8
  "@babel/plugin-proposal-json-strings": "^7.12.1",
@@ -11,11 +11,11 @@
11
11
  "@babel/plugin-proposal-throw-expressions": "^7.12.1",
12
12
  "@babel/plugin-syntax-dynamic-import": "^7.0.0",
13
13
  "@babel/plugin-syntax-import-meta": "^7.10.4",
14
- "@babel/preset-env": "^7.12.10",
15
- "@rails/ujs": "^6.1.0",
14
+ "@babel/preset-env": "^7.12.11",
15
+ "@rails/ujs": "^6.1.1",
16
16
  "@rails/webpacker": "^5.2.1",
17
17
  "algoliasearch": "^4.8.3",
18
- "@vonagevolta/volta2": "^0.1.5",
18
+ "@vonagevolta/volta2": "^0.1.6",
19
19
  "autoprefixer": "^9.8.6",
20
20
  "babel-loader": "^8.2.2",
21
21
  "babel-preset-babili": "^0.1.4",
@@ -28,10 +28,10 @@
28
28
  "file-loader": "^6.2.0",
29
29
  "foundation-sites": "^6.6.3",
30
30
  "glob": "^7.1.2",
31
- "gsap": "^3.5.1",
31
+ "gsap": "^3.6.0",
32
32
  "https-proxy-agent": "^5.0.0",
33
33
  "jquery": "^3.5.0",
34
- "js-yaml": "3.14.1",
34
+ "js-yaml": "4.0.0",
35
35
  "jsrsasign": "^10.1.4",
36
36
  "kind-of": "^6.0.3",
37
37
  "lodash": "^4.17.20",
@@ -46,16 +46,16 @@
46
46
  "puppeteer": "^5.5.0",
47
47
  "rails-erb-loader": "^5.1.0",
48
48
  "resolve-url-loader": "^3.1.2",
49
- "sass-loader": "^10.1.0",
49
+ "sass-loader": "^10.1.1",
50
50
  "serialize-javascript": "^5.0.1",
51
51
  "sha1-file": "^1.0.0",
52
52
  "style-loader": "^2.0.0",
53
53
  "vue": "^2.6.12",
54
- "vue-loader": "^15.9.5",
54
+ "vue-loader": "^15.9.6",
55
55
  "vue-template-compiler": "^2.6.12",
56
56
  "webpack": "^4.44.2",
57
57
  "webpack-manifest-plugin": "^3.0.0",
58
- "webpack-merge": "^5.7.0",
58
+ "webpack-merge": "^5.7.3",
59
59
  "webpacker": "^4",
60
60
  "websocket-extensions": "^0.1.4",
61
61
  "whatwg-fetch": "^3.5.0"
@@ -71,11 +71,11 @@
71
71
  "marked": "^0.7.0"
72
72
  },
73
73
  "devDependencies": {
74
- "@vue/test-utils": "1.1.1",
74
+ "@vue/test-utils": "1.1.2",
75
75
  "alex": "^9.1.0",
76
76
  "babel-core": "^7.0.0-bridge.0",
77
77
  "babel-jest": "^26.6.3",
78
- "eslint": "^7.15.0",
78
+ "eslint": "^7.17.0",
79
79
  "eslint-config-standard": "^16.0.2",
80
80
  "eslint-plugin-import": "^2.22.1",
81
81
  "eslint-plugin-node": "^11.1.0",
@@ -86,8 +86,8 @@
86
86
  "jest": "^26.6.3",
87
87
  "node-fetch": "^2.6.1",
88
88
  "vue-jest": "^3.0.7",
89
- "webpack-bundle-analyzer": "^4.2.0",
90
- "webpack-dev-server": "^3.11.0"
89
+ "webpack-bundle-analyzer": "^4.3.0",
90
+ "webpack-dev-server": "^3.11.1"
91
91
  },
92
92
  "version": "1.1.0",
93
93
  "engines": {
@@ -40,7 +40,7 @@ Gem::Specification.new do |spec|
40
40
  spec.add_runtime_dependency('rails', '~> 6.0')
41
41
  spec.add_runtime_dependency('bootsnap', '~> 1.4')
42
42
  spec.add_runtime_dependency('nexmo-oas-renderer', '~> 2.4')
43
- spec.add_runtime_dependency('nexmo_markdown_renderer', '~> 0.7.3')
43
+ spec.add_runtime_dependency('nexmo_markdown_renderer', '~> 0.7.5')
44
44
  spec.add_runtime_dependency('activesupport', '~> 6.0')
45
45
  spec.add_runtime_dependency('bugsnag', '~> 6.13')
46
46
  spec.add_runtime_dependency('railties', '~> 6.0')
@@ -75,12 +75,12 @@ Gem::Specification.new do |spec|
75
75
  spec.add_runtime_dependency('uglifier', '4.2.0')
76
76
  spec.add_runtime_dependency('jquery-rails', '4.4.0')
77
77
  spec.add_runtime_dependency('jbuilder', '2.10.1')
78
- spec.add_runtime_dependency('nokogiri', '1.10.10')
79
- spec.add_runtime_dependency('ruby-progressbar', '1.10.1')
78
+ spec.add_runtime_dependency('nokogiri', '1.11.1')
79
+ spec.add_runtime_dependency('ruby-progressbar', '1.11.0')
80
80
  spec.add_runtime_dependency('colorize', '0.8.1')
81
81
  spec.add_runtime_dependency('neatjson', '0.9')
82
82
  spec.add_runtime_dependency('slack-notifier', '2.3.2')
83
- spec.add_runtime_dependency('autoprefixer-rails', '10.1.0.0')
83
+ spec.add_runtime_dependency('autoprefixer-rails', '10.2.0.0')
84
84
  spec.add_runtime_dependency('titleize', '1.4.1')
85
85
  spec.add_runtime_dependency('countries', '3.0.1')
86
86
  spec.add_runtime_dependency('country_select', '4.0.0')
@@ -88,7 +88,7 @@ Gem::Specification.new do |spec|
88
88
  spec.add_runtime_dependency('newrelic_rpm', '6.14.0')
89
89
  spec.add_runtime_dependency('redis', '4.2.5')
90
90
 
91
- spec.add_development_dependency('rubocop', '~> 1.6.0')
91
+ spec.add_development_dependency('rubocop', '~> 1.8.0')
92
92
  spec.add_development_dependency('rubocop-rails', '~> 2.6')
93
93
 
94
94
  spec.metadata = {