user_docs 0.5.0 → 0.6.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: 64df02f91cb36adad712ca2f19b58e4d71eea217de85d85d4bfe4fa57b3ac1dd
4
- data.tar.gz: 4baa6edafb2e67d7712468ec529dc919659b707a196e01e8508a64431f0a9da7
3
+ metadata.gz: 17570ca7f142aca7a866a337055a720d2acae9ea4c851f0b9a6b8ca3274c5be9
4
+ data.tar.gz: 7b7226c0791a3256f6c718d5388d001c9cab842e9798fe5b32ef02b4e32f532e
5
5
  SHA512:
6
- metadata.gz: d7cfe269de8a69090bbfdd3837c6dc6053a8a954358e1860e6f591d542e860a058110989fb43abd6eb8817463952b9f57a9f0dd9773972a813f271de2cd1443d
7
- data.tar.gz: 5058a48858055378b230d543a9ada63fe0b907d117ca56d9111e04499f0b81604e5bc5be58c41322e80ac0b8118d5036d4527e06ec6ffe876a982647624b3708
6
+ metadata.gz: bff557e8d7dc2f577bbd9789c1f4bd928f45b776cb7b4f824303d2513e20a4498ec439f90eee27c29d0589f30f586b3b224226f76a4251a37a60ef534a5c2b2f
7
+ data.tar.gz: 94710b2d8796ab802bf14068787ea5dccc007477289b0b42a0a13e7a30be1394c153e403bd2fbeb2b35df99ed3d9bc07282384844b3f861a8d231dc0fc301f83
@@ -10,6 +10,7 @@ module UserDocs
10
10
  def create
11
11
  check_for_version
12
12
 
13
+ template "_config", ".docs/_config.yml"
13
14
  template "index", ".docs/index.html"
14
15
  template "_layouts/default", ".docs/_layouts/default.html"
15
16
  template "_includes/index", ".docs/_includes/index.html"
@@ -0,0 +1 @@
1
+ keep_files: ['versions', 'assets']
@@ -13,6 +13,6 @@ namespace :user_docs do
13
13
  jekyll build
14
14
  --source #{temp_dir} --destination #{output_dir} --baseurl /docs
15
15
  CMD
16
- FileUtils.rm_rf(Rails.root.join(".docs"))
16
+ FileUtils.rm_rf(temp_dir)
17
17
  end
18
18
  end
@@ -11,23 +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
18
  Capybara.save_path =
19
- Rails.root.join(".docs", "assets", @class_name, @method)
19
+ Rails.root.join(".docs/assets/#{version}/#{klass_name}/#{@method}")
20
20
 
21
21
  @json = { name: @method.humanize, steps: [] }
22
22
  end
23
23
 
24
24
  def before_teardown
25
- File.write(
26
- Rails.root.join(
27
- ".docs", "_data", "versions", version_data_directory_name,
28
- @class_name, "#{@method}.json"
29
- ), @json.to_json
30
- )
25
+ path = ".docs/_data/versions/#{version}/#{klass_name}/#{@method}.json"
26
+ File.write(Rails.root.join(path), @json.to_json)
31
27
 
32
28
  super
33
29
  end
@@ -46,22 +42,22 @@ module UserDocs
46
42
  Rails.application.class.module_parent::VERSION
47
43
  end
48
44
 
49
- def version_data_directory_name
50
- version.tr(".", "_")
45
+ def klass_name
46
+ @class_name.underscore
51
47
  end
52
48
 
53
49
  def make_version_data_directory
54
- FileUtils.mkdir_p(
55
- Rails.root.join(".docs", "_data", "versions",
56
- version_data_directory_name, @class_name)
57
- )
50
+ data_path = Rails.root.join(".docs/_data/versions/#{version}/#{klass_name}")
51
+ FileUtils.mkdir_p(data_path)
58
52
  end
59
53
 
60
54
  # rubocop:disable Metrics/MethodLength
61
55
  def make_version_index
62
- directory = "#{Rails.root}/.docs/versions/#{version}"
63
- FileUtils.mkdir_p directory
64
- output_file = "#{directory}/index.html"
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)
65
61
  File.write(
66
62
  output_file,
67
63
  <<~HTML
@@ -73,7 +69,6 @@ module UserDocs
73
69
  HTML
74
70
  )
75
71
 
76
- entry_file = Rails.root.join(".docs/index.html")
77
72
  FileUtils.cp_r(output_file, entry_file, remove_destination: true)
78
73
  end
79
74
  # rubocop:enable Metrics/MethodLength
@@ -102,7 +97,7 @@ module UserDocs
102
97
  image += ".png"
103
98
  super
104
99
 
105
- path = "/docs/assets/#{@class_name}/#{@method}/#{image}"
100
+ path = "/docs/assets/#{version}/#{klass_name}/#{@method}/#{image}"
106
101
  @json[:steps] << "<img src='#{path}' class='img-fluid'>"
107
102
  end
108
103
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UserDocs
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.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.5.0
4
+ version: 0.6.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-21 00:00:00.000000000 Z
11
+ date: 2020-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -175,6 +175,7 @@ files:
175
175
  - README.md
176
176
  - Rakefile
177
177
  - lib/generators/user_docs/install_generator.rb
178
+ - lib/generators/user_docs/templates/_config.tt
178
179
  - lib/generators/user_docs/templates/_includes/index.tt
179
180
  - lib/generators/user_docs/templates/_layouts/default.tt
180
181
  - lib/generators/user_docs/templates/index.tt