railspp 0.3.8 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eca7b249ceb2e4bbcf0d1aa6342ae7afe0924be9a398f2b548fbe43d92e423d0
4
- data.tar.gz: 9a94fe3f41f2b1d2c14ddd2432b1c0d129b8fbb1dcb5f5012ef72209de63509b
3
+ metadata.gz: 1e7215245cedc671809c2ccc05bd90a456fef7293fa1a3c7ad6ec2164e42c0ed
4
+ data.tar.gz: ea2c1366a0c3dffc799b5873a9ef9c394e1d5c966eafb0e19a8e1b369cc764dc
5
5
  SHA512:
6
- metadata.gz: 126f873356cda9eebc3bab498e024c7ce145b9b0bbd2da54543290f326b660617aa8ae550fbd576c9393f30345ac276e9430b681eca151eb82e084b8aca741a2
7
- data.tar.gz: 6224328af2e5b333c0cc289bce3caa194cd0935f21972be0b69e9e539d7dcc00dc7ccdf245dab9186f073d5edfda1d27b8651f3718f48221580120af31eb30b0
6
+ metadata.gz: 44cde64bea7ac5ef62bb073898992bbb3472f749b58a529d7f45fc742b424bc9d87e1a628a93bfc492ff3b1ca2936309a452ee339553d9f3c38a05c44ccaafa1
7
+ data.tar.gz: b6b4dd8664d533a8a140d22c896dd5d06dd94cd7a9b2d287d2db7a2e79adda718cee86a71a3a87dde64c32dc26e4a7a5fa07aa2f20d5e7eb246bf7d2649a3908
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Rails++
2
2
 
3
- Autogenerate your CRUD operations with Swagger like API documentation without extra configuration
3
+ Auto-generate your CRUD operations with Swagger like API documentation without extra configuration
4
4
  and generate mini test unit tests.
5
5
 
6
6
  Automatic API Documentation is not supported in Rails version 6
@@ -7,7 +7,16 @@ class ApiDocsCommand < MoreUtils
7
7
  def run(*args)
8
8
  lookup = flag_lookup(args)
9
9
 
10
+ version = versions(lookup)
11
+ return version if !version
12
+
13
+ regex = '{{ DOC_PATH }}'
14
+ doc_regex = '{{ DOC_NAME }}'
15
+
16
+ doc_name = version == 6 ? "javascript_pack_tag 'documentation'" : "javascript_include_tag 'application'"
17
+
10
18
  # Add Initializers
19
+ doc_str = version.to_i == 6 ? '/../javascript/packs/documentation.js' : version.to_i == 5 ? '/../assets/javascripts/documentation.js' : ''
11
20
  adi_template = get_file_str("#{this_dir}/../templates/api_documentation_initializer.txt")
12
21
  write_file("#{root}/config/initializers/api_documentation_js.rb", adi_template)
13
22
 
@@ -18,6 +27,7 @@ class ApiDocsCommand < MoreUtils
18
27
  # Add Service
19
28
  system("mkdir -p #{root}/app/services")
20
29
  aps_template = get_file_str("#{this_dir}/../templates/api_documentation_service.txt")
30
+ aps_template = aps_template.gsub(regex, doc_str)
21
31
  write_file("#{root}/app/services/api_documentation_service.rb", aps_template)
22
32
 
23
33
  # Add Views
@@ -26,6 +36,7 @@ class ApiDocsCommand < MoreUtils
26
36
  write_file("#{root}/app/views/documentation/index.html.erb", dihtml_template)
27
37
 
28
38
  dlhtml_template = get_file_str("#{this_dir}/../templates/documentation.layout.erb.txt")
39
+ dlhtml_template = dlhtml_template.gsub(doc_regex, doc_name)
29
40
  write_file("#{root}/app/views/layouts/documentation.html.erb", dlhtml_template)
30
41
 
31
42
  # Add Routes
@@ -46,5 +57,10 @@ class ApiDocsCommand < MoreUtils
46
57
  end
47
58
  end
48
59
 
60
+ def wrong_version_error
61
+ puts 'Must provide a version option'
62
+ return nil
63
+ end
64
+
49
65
  end
50
66
  end
@@ -34,7 +34,7 @@ class ApiDocumentationService
34
34
  private
35
35
 
36
36
  def output_path
37
- __dir__ + '/../../app/assets/javascripts/documentation.js'
37
+ __dir__ + '{{ DOC_PATH }}'
38
38
  end
39
39
 
40
40
  def get_all_routes
@@ -10,6 +10,6 @@
10
10
 
11
11
  <body style="width: 100%; overflow-x: hidden;">
12
12
  <%= yield %>
13
- <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
13
+ <%= {{ DOC_NAME }}, 'data-turbolinks-track': 'reload' %>
14
14
  </body>
15
15
  </html>
data/lib/utils/strings.rb CHANGED
@@ -20,8 +20,24 @@ end
20
20
  class MoreUtils
21
21
  class << self
22
22
 
23
+ def versions lookup
24
+ version = nil
25
+ begin
26
+ version = lookup[:version].to_i
27
+ rescue
28
+ version = 0
29
+ end
30
+
31
+ return version < 5 ? wrong_version_error : version
32
+ end
33
+
34
+ def wrong_version_error
35
+ puts 'Must provide a version option'
36
+ return false
37
+ end
38
+
23
39
  def gem_version
24
- "0.3.8"
40
+ "0.4.1"
25
41
  end
26
42
 
27
43
  def get_file_str path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railspp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Layne Faler
@@ -10,20 +10,6 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rails
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '5'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '5'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: faker
29
15
  requirement: !ruby/object:Gem::Requirement