user_docs 0.2.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a29682463845307876f721711cc7c35fb66b740b57fa04c7a2aae82972db7d1
4
- data.tar.gz: 1cb0f5c6697ad276f401968f4b342da581d81e33f92e468c1c40862e8c59d48e
3
+ metadata.gz: f228c6cb3ca1e8592a67e4e0ee6dc8e6a209544606772749a246502176babe6c
4
+ data.tar.gz: e4ba2e9cda4db54c58b119bcce3dcd10d8885c67e3b624d540b987b16464b0ac
5
5
  SHA512:
6
- metadata.gz: f3741fb6d581ea85e6ce3f63ae00ba213c2d452a2af19b1a36b2f6c0eba2b09c36cf34ac87d94c75fe94cc451147cf408930ece29024f61f60f45c9f804a7350
7
- data.tar.gz: ccda61469eaf5bf01c1cbe52c7abbc4aa325a362cd6b5a4ef8351bf1e38da94f75411f820a295eb19565f4022321f3dd8dd04921e1d38ad7e4e09af8da0aca00
6
+ metadata.gz: cb27d9911c94b771df7694184f2d15cd608deba4502e95b4691d6572367739112e982e63095367707fed1f14aa940b615dc50a31cc41532b4d8a263edaa75ef1
7
+ data.tar.gz: 5dd84a8f0cd6fe49236d5af72fe7189a89cf7f11cec57486acc42d80bed7bf8ba18f729a3ec6ff3c6d8278a896358d48b45560ad55234c37d76591976d1c931f
@@ -10,11 +10,11 @@ module UserDocs
10
10
  def create
11
11
  check_for_version
12
12
 
13
- template "index", "docs/index.html"
14
- template "_layouts/default", "docs/_layouts/default.html"
15
- template "_includes/index", "docs/_includes/index.html"
16
- empty_directory "docs/_data/versions"
17
- empty_directory "docs/versions"
13
+ template "index", ".docs/index.html"
14
+ template "_layouts/default", ".docs/_layouts/default.html"
15
+ template "_includes/index", ".docs/_includes/index.html"
16
+ empty_directory ".docs/_data/versions"
17
+ empty_directory ".docs/versions"
18
18
  end
19
19
 
20
20
  private
@@ -2,7 +2,7 @@
2
2
 
3
3
  {% assign version_directory = page.version | default: site.version | replace: '.', '_' %}
4
4
  {% for feature in site.data.versions[version_directory] %}
5
- <h2 class="mt-3">{{feature[0]}}</h2>
5
+ <h2 class="mt-3">{{feature[0] | replace: '_', ' ' | capitalize}}</h2>
6
6
 
7
7
  <div class="accordian" id="{{feature[0]}}">
8
8
  {% for methods in feature[1] %}
@@ -4,13 +4,13 @@
4
4
  <head>
5
5
  <meta charset="utf-8">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
7
+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
8
8
  <title>End User Documentation</title>
9
9
  </head>
10
10
 
11
11
  <body class="container">
12
12
  <nav class="navbar navbar-expand-lg navbar-light bg-light rounded">
13
- <a class="navbar-brand" href="index.html">End User Documentation v{{ current_page_version }}</a>
13
+ <a class="navbar-brand" href="{{ 'index.html' | relative_url }}">End User Documentation v{{ current_page_version }}</a>
14
14
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
15
15
  <span class="navbar-toggler-icon"></span>
16
16
  </button>
@@ -24,7 +24,7 @@
24
24
  <div class="dropdown-menu" aria-labelledby="navbarDropdown">
25
25
  {% for version in site.data.versions %}
26
26
  {% assign dot_version = version.first | replace: '_', '.' %}
27
- {% assign version_path = "/versions/" | append: dot_version %}
27
+ {% assign version_path = "/versions/" | append: version.first %}
28
28
  {% assign css_class = "" %}
29
29
  {% if dot_version == current_page_version %}
30
30
  {% assign css_class = " active" %}
@@ -37,8 +37,8 @@
37
37
  </div>
38
38
  </nav>
39
39
  {{ content }}
40
- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
41
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
42
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
40
+ <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
41
+ <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
42
+ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
43
43
  </body>
44
44
  </html>
@@ -1,6 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # desc "Explaining what the task does"
4
- # task :user_docs do
5
- # # Task goes here
6
- # end
3
+ namespace :user_docs do
4
+ desc "Build site"
5
+ task build_site: :environment do
6
+ procedures_dir = Rails.root.join("docs")
7
+ hidden_dir = Rails.root.join(".docs")
8
+ output_dir = Rails.root.join("public/docs")
9
+
10
+ Rails::Generators.invoke("user_docs:install") unless Dir.exist?(hidden_dir)
11
+
12
+ system("rails test #{procedures_dir}/*")
13
+ system <<~CMD.squish
14
+ jekyll build
15
+ --source #{hidden_dir} --destination #{output_dir} --baseurl /docs
16
+ CMD
17
+ end
18
+ end
@@ -11,22 +11,19 @@ module UserDocs
11
11
 
12
12
  check_installation
13
13
 
14
- @class_name = class_name.chomp("Test")
14
+ @class_name = class_name.chomp("Procedure")
15
15
  @method = name.sub("test_", "")
16
16
  make_version_data_directory
17
17
  make_version_index
18
- Capybara.save_path = Rails.root.join("docs", "assets", @class_name, @method)
18
+ Capybara.save_path =
19
+ Rails.root.join(".docs/assets/#{version}/#{klass_name}/#{@method}")
19
20
 
20
21
  @json = { name: @method.humanize, steps: [] }
21
22
  end
22
23
 
23
24
  def before_teardown
24
- File.write(
25
- Rails.root.join(
26
- "docs", "_data", "versions", version_data_directory_name,
27
- @class_name, "#{@method}.json"
28
- ), @json.to_json
29
- )
25
+ path = ".docs/_data/versions/#{version}/#{klass_name}/#{@method}.json"
26
+ File.write(Rails.root.join(path), @json.to_json)
30
27
 
31
28
  super
32
29
  end
@@ -42,34 +39,37 @@ module UserDocs
42
39
  end
43
40
 
44
41
  def version
45
- Rails.application.class.module_parent::VERSION
42
+ Rails.application.class.module_parent::VERSION.tr(".", "_")
46
43
  end
47
44
 
48
- def version_data_directory_name
49
- version.tr(".", "_")
45
+ def klass_name
46
+ @class_name.underscore
50
47
  end
51
48
 
52
49
  def make_version_data_directory
53
- FileUtils.mkdir_p(
54
- Rails.root.join("docs", "_data", "versions",
55
- version_data_directory_name, @class_name)
56
- )
50
+ data_path = Rails.root.join(".docs/_data/versions/#{version}/#{klass_name}")
51
+ FileUtils.mkdir_p(data_path)
57
52
  end
58
53
 
59
54
  # rubocop:disable Metrics/MethodLength
60
55
  def make_version_index
61
- directory = "#{Rails.root}/docs/versions/#{version}"
62
- FileUtils.mkdir_p directory
56
+ directory = Rails.root.join(".docs/versions/#{version}")
57
+ output_file = directory + "index.html"
58
+ entry_file = Rails.root.join(".docs/index.html")
59
+
60
+ FileUtils.mkdir_p(directory)
63
61
  File.write(
64
- "#{directory}/index.html",
62
+ output_file,
65
63
  <<~HTML
66
64
  ---
67
65
  layout: default
68
- version: #{version}
66
+ version: #{version.tr!('_', '.')}
69
67
  ---
70
68
  {% include index.html %}
71
69
  HTML
72
70
  )
71
+
72
+ FileUtils.cp_r(output_file, entry_file, remove_destination: true)
73
73
  end
74
74
  # rubocop:enable Metrics/MethodLength
75
75
 
@@ -93,10 +93,12 @@ module UserDocs
93
93
  @json[:steps] << "Click **OK**."
94
94
  end
95
95
 
96
- def save_screenshot(image)
96
+ def save_screenshot(image = Time.now.to_i.to_s)
97
+ image += ".png"
97
98
  super
98
- @json[:steps] <<
99
- "<img src='assets/#{@class_name}/#{@method}/#{image}' class='img-fluid'>"
99
+
100
+ path = "/docs/assets/#{version}/#{klass_name}/#{@method}/#{image}"
101
+ @json[:steps] << "<img src='#{path}' class='img-fluid'>"
100
102
  end
101
103
 
102
104
  def comment(string)
@@ -1,6 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :nocov:
3
4
  module UserDocs
5
+ # Extend Rails and/or modify the initialization process.
4
6
  class Railtie < ::Rails::Railtie
7
+ rake_tasks do
8
+ load "tasks/user_docs_tasks.rake"
9
+ end
5
10
  end
6
11
  end
12
+ # :nocov:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UserDocs
4
- VERSION = "0.2.0"
4
+ VERSION = "0.7.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: user_docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jtopgi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
11
+ date: 2020-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -24,20 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.32.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: jekyll
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 4.0.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 4.0.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rails
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: 6.0.3
47
+ version: 6.0.3.1
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: 6.0.3
54
+ version: 6.0.3.1
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: selenium-webdriver
43
57
  requirement: !ruby/object:Gem::Requirement