railspp 0.3.8 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/commands/api_docs.rb +16 -0
- data/lib/templates/api_documentation_service.txt +1 -1
- data/lib/templates/documentation.layout.erb.txt +1 -1
- data/lib/utils/strings.rb +17 -1
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e7215245cedc671809c2ccc05bd90a456fef7293fa1a3c7ad6ec2164e42c0ed
|
4
|
+
data.tar.gz: ea2c1366a0c3dffc799b5873a9ef9c394e1d5c966eafb0e19a8e1b369cc764dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44cde64bea7ac5ef62bb073898992bbb3472f749b58a529d7f45fc742b424bc9d87e1a628a93bfc492ff3b1ca2936309a452ee339553d9f3c38a05c44ccaafa1
|
7
|
+
data.tar.gz: b6b4dd8664d533a8a140d22c896dd5d06dd94cd7a9b2d287d2db7a2e79adda718cee86a71a3a87dde64c32dc26e4a7a5fa07aa2f20d5e7eb246bf7d2649a3908
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Rails++
|
2
2
|
|
3
|
-
|
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
|
data/lib/commands/api_docs.rb
CHANGED
@@ -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
|
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.
|
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.
|
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
|