documentation-zero 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b9268dac205c84212366821a80fbfc1b415c194acd5013bfd4263b95abb3b46d
4
+ data.tar.gz: b14a79c073247962b148fa46a61220fbb0669b49d12c8df24b38e5ca17975782
5
+ SHA512:
6
+ metadata.gz: fc628c160b2404f99ffa77d0d491d55e43ed902ba45379355b672783578fd89c98290aaa71dc12d725169bcccd93927cc302e9167fadb4b574a1e4f07dfde73d
7
+ data.tar.gz: 0d555dc8941e2599c25fee949790aadfadea4bd1610c5d152e29ecd28bd3a6dbd1e65ea2f82fbecbe793aadf9100a2546574827cc71f2b11d3a7b73ce12f17d7
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.0.1] - 2022-03-17
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at lazaronixon@hotmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in documentation_zero.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Nixon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Documentation Zero
2
+
3
+ The purpose of documentation zero is to generate a scaffold for rails api documentations using markdown.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem "documentation-zero"
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ rails generate documentation:readme
17
+ ```
18
+
19
+ ```
20
+ rails generate documentation:scaffold posts title:string body:text published:boolean
21
+ ```
22
+
23
+ Add ```- [Posts](.documentation-api/sections/posts.md)``` to API endpoints section.
24
+
25
+ ## Development
26
+
27
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/lazaronixon/documentation-zero. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/lazaronixon/documentation-zero/blob/master/CODE_OF_CONDUCT.md).
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
36
+
37
+ ## Code of Conduct
38
+
39
+ Everyone interacting in the DocumentationZero project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/lazaronixon/documentation-zero/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,24 @@
1
+ require_relative "lib/documentation_zero/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "documentation-zero"
5
+ spec.version = DocumentationZero::VERSION
6
+ spec.authors = ["Nixon"]
7
+ spec.email = ["lazaronixon@hotmail.com"]
8
+
9
+ spec.summary = "An documentation system generator for Rails applications"
10
+ spec.homepage = "https://github.com/lazaronixon/documentation-zero"
11
+ spec.license = "MIT"
12
+
13
+ spec.metadata["homepage_uri"] = spec.homepage
14
+ spec.metadata["source_code_uri"] = "https://github.com/lazaronixon/documentation-zero"
15
+ spec.metadata["changelog_uri"] = "https://github.com/lazaronixon/documentation-zero/blob/main/CHANGELOG.md"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0").reject do |f|
21
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
22
+ end
23
+ end
24
+ end
@@ -0,0 +1 @@
1
+ require "documentation_zero"
@@ -0,0 +1,3 @@
1
+ module DocumentationZero
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require_relative "documentation_zero/version"
2
+
3
+ module DocumentationZero
4
+ end
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ bin/rails generate documentation:readme
@@ -0,0 +1,20 @@
1
+ module Documentation
2
+ module Generators
3
+ class ReadmeGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("templates", __dir__)
5
+
6
+ def copy_files
7
+ template "README.md", ".documentation_api/README.md"
8
+ end
9
+
10
+ private
11
+ def application_name
12
+ if defined?(Rails) && Rails.application
13
+ Rails.application.class.name.split("::").first.underscore
14
+ else
15
+ "application"
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,77 @@
1
+ # The <%= application_name.humanize %> API
2
+
3
+ Welcome to the <%= application_name.humanize %> API! If you're looking to integrate your application with <%= application_name.humanize %> or create your own application in concert with data inside of <%= application_name.humanize %>, you're in the right place. We're happy to have you!
4
+
5
+ ## Making a request
6
+
7
+ All URLs start with **`https://example.com/api/`**. URLs are HTTPS only. The path is prefixed with the `/api` prefix.
8
+
9
+ To make a request for all the resources on your account, append the `resources` index path to the base URL to form something like `https://example.com/api/resources.json`. In cURL, it looks like this:
10
+
11
+ ``` shell
12
+ curl -H "Authorization: Bearer $ACCESS_TOKEN" -H 'User-Agent: MyApp (yourname@example.com)' https://example.com/api/resources.json
13
+ ```
14
+
15
+ ## Identifying your application
16
+
17
+ You must include a `User-Agent` header with **both**:
18
+
19
+ * The name of your application
20
+ * A link to your application or your email address
21
+
22
+ We use this information to get in touch if you're doing something wrong (so we can warn you before you're blacklisted) or something awesome (so we can congratulate you). Here are examples of acceptable `User-Agent` headers:
23
+
24
+ * `User-Agent: Freshbooks (http://freshbooks.com/contact.php)`
25
+ * `User-Agent: Fabian's Ingenious Integration (fabian@example.com)`
26
+
27
+ If you don't include a `User-Agent` header, you'll get a `400 Bad Request` response.
28
+
29
+ ## JSON only
30
+
31
+ We use JSON for all API data. The style is no root element and snake\_case for object keys. This means that you have to send the `Content-Type` header `Content-Type: application/json; charset=utf-8` when you're POSTing or PUTing data into <%= application_name.humanize %>. All API URLs end in `.json` to indicate that they return JSON. Alternatively you can send `Accept: application/json`.
32
+
33
+ You'll receive a `415 Unsupported Media Type` response code if you don't include the `Content-Type` header.
34
+
35
+ ## Pagination
36
+
37
+ Most collection APIs paginate their results. The number of requests that'll appear on each page is variable. In most cases, we use a [geared pagination ratio](https://github.com/basecamp/geared_pagination) with 15 results on page 1, 30 on page 2, 50 on 3, and then 100 on 4 and above. The <%= application_name.humanize %> API follows the [RFC5988 convention](https://tools.ietf.org/html/rfc5988) of using the `Link` header to provide URLs for the `next` page. Follow this convention to retrieve the next page of data—please don't build the pagination URLs yourself!
38
+
39
+ Here's an example response header from requesting the third page of some resource:
40
+
41
+ ```
42
+ Link: <https://example.com/api/resources.json?page=4>; rel="next"
43
+ ```
44
+
45
+ If the `Link` header is blank, that's the last page. The <%= application_name.humanize %> API also provides the `X-Total-Count` header, which displays the total number of resources in the collection you are fetching.
46
+
47
+ ## Using HTTP caching
48
+
49
+ You must use HTTP freshness headers to speed up your application and lighten the load on our servers. Most API responses will include an `ETag` or `Last-Modified` header. When you first request a resource, store these values. On subsequent requests, submit them back to us as `If-None-Match` and `If-Modified-Since`, respectively. If the resource hasn't changed since your last request, you'll get a `304 Not Modified` response with no body, saving you the time and bandwidth of sending something you already have.
50
+
51
+ ## Handling errors
52
+
53
+ API clients must expect and gracefully handle transient errors, such as rate limiting or server errors. We recommend baking 5xx and 429 response handling into your low-level HTTP client so your integration can handle most errors automatically.
54
+
55
+ ### Rate limiting (429 Too Many Requests)
56
+
57
+ You can perform up to 50 requests per 10-second period from the same IP address. If you exceed this limit, you'll get a [429 Too Many Requests](http://tools.ietf.org/html/draft-nottingham-http-new-status-02#section-4) response for subsequent requests. Check the `Retry-After` header to see how many seconds to wait before retrying the request.
58
+
59
+ ### [5xx server errors](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#5xx_Server_errors)
60
+
61
+ If <%= application_name.humanize %> is having trouble, you will get a response with a 5xx status code indicating a server error. 500 (Internal Server Error), 502 (Bad Gateway), 503 (Service Unavailable), and 504 (Gateway Timeout) may be retried with [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff).
62
+
63
+ ### 404 Not Found
64
+
65
+ API requests may 404 due to deleted content, an inactive account, missing user permissions, etc. Detect these conditions to give your users a clear explanation about why they can't connect to <%= application_name.humanize %>. Do not automatically retry these requests.
66
+
67
+ ## API endpoints
68
+
69
+ <!-- START API ENDPOINTS -->
70
+
71
+ <!-- END API ENDPOINTS -->
72
+
73
+ ---
74
+
75
+ If you have a specific feature request or find a bug, please open a GitHub issue. We encourage you to fork these docs for local reference and happily accept pull requests with improvements.
76
+
77
+ To talk with us and other developers about the API, [post a question on StackOverflow](http://stackoverflow.com/questions/ask) tagged `<%= application_name.dasherize %>`. If you need help from us directly, please open a support ticket.
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ bin/rails generate admin:scaffold model field:type field:type
@@ -0,0 +1,12 @@
1
+ module Documentation
2
+ module Generators
3
+ class ScaffoldGenerator < Rails::Generators::NamedBase
4
+ argument :attributes, type: :array, default: [], banner: "field:type field:type"
5
+ source_root File.expand_path("templates", __dir__)
6
+
7
+ def copy_files
8
+ template "resource.md", ".documentation_api/sections/#{plural_file_name}.md"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,77 @@
1
+ # <%= human_name.pluralize %>
2
+
3
+ Endpoints:
4
+
5
+ - [Get <%= human_name.pluralize.downcase %>](#get-<%= plural_name.dasherize %>)
6
+ - [Get <%= human_name.downcase %>](#get-<%= singular_name.dasherize %>)
7
+ - [Create <%= human_name.downcase %>](#create-<%= singular_name.dasherize %>)
8
+ - [Update <%= human_name.downcase %>](#update-<%= singular_name.dasherize %>)
9
+ - [Delete <%= human_name.downcase %>](#delete-<%= singular_name.dasherize %>)
10
+
11
+ ## Get <%= human_name.pluralize.downcase %>
12
+
13
+ - `GET /<%= plural_name %>.json` will return a [paginated list](../readme.md#pagination) of <%= human_name.pluralize.downcase %>.
14
+
15
+ <!--
16
+ _Optional query parameters_:
17
+
18
+ * `attribute1` - when set to true, will only return resources that are completed.
19
+ * `attribute2` - when set to true, will only return resources that are completed.
20
+ -->
21
+
22
+ See the [<%= human_name.downcase %>](#model) model for more info on the response payload.
23
+
24
+ ## Get <%= human_name.downcase %>
25
+
26
+ - `GET /<%= plural_name %>/1.json` will return the <%= human_name.downcase %> with an ID of `1`.
27
+
28
+ See the [<%= human_name.downcase %>](#model) model for more info on the response payload.
29
+
30
+ ## Create <%= human_name.downcase %>
31
+
32
+ - `POST /<%= plural_name %>.json` creates <%= human_name.downcase %>.
33
+
34
+ <!--
35
+ **Required parameters**: `attribute1` and `attribute2`.
36
+ -->
37
+
38
+ _Optional parameters_:
39
+
40
+ <% attributes.each do |attribute| -%>
41
+ * `<%= attribute.column_name %>` - attribute from <%= human_name.downcase %>.
42
+ <% end -%>
43
+
44
+ This endpoint will return `201 Created` with the current JSON representation of the <%= human_name.downcase %> if the creation was a success. See the [<%= human_name.downcase %>](#model) model for more info on the payload.
45
+
46
+ ## Update <%= human_name.downcase %>
47
+
48
+ - `PUT /<%= plural_name %>/1.json` allows changing the <%= human_name.downcase %> with an ID of `1`.
49
+
50
+ This endpoint will return `200 OK` with the current JSON representation of the <%= human_name.downcase %> if the update was a success. See the [<%= human_name.downcase %>](#model) model for more info on the payload.
51
+
52
+ <!--
53
+ **Required parameters**: `attribute1` and `attribute2`.
54
+ -->
55
+
56
+ _Optional parameters_:
57
+
58
+ <% attributes.each do |attribute| -%>
59
+ * `<%= attribute.column_name %>` - attribute from <%= human_name.downcase %>.
60
+ <% end -%>
61
+
62
+ ## Delete <%= human_name.downcase %>
63
+
64
+ - `DELETE /<%= plural_name %>/1.json` will delete the <%= human_name.downcase %> with an ID of `1`.
65
+
66
+ This endpoint will return `204 No Content` if successful. No parameters are required.
67
+
68
+ ---
69
+
70
+ ## Model
71
+ ```javascript
72
+ {
73
+ <% attributes.each do |attribute| -%>
74
+ <%= attribute.column_name %>: "<%= attribute.type %>",
75
+ <% end -%>
76
+ }
77
+ ```
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: documentation-zero
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nixon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-03-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - lazaronixon@hotmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - CHANGELOG.md
21
+ - CODE_OF_CONDUCT.md
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - documentation_zero.gemspec
27
+ - lib/documentation-zero.rb
28
+ - lib/documentation_zero.rb
29
+ - lib/documentation_zero/version.rb
30
+ - lib/generators/documentation/readme/USAGE
31
+ - lib/generators/documentation/readme/readme_generator.rb
32
+ - lib/generators/documentation/readme/templates/README.md.tt
33
+ - lib/generators/documentation/scaffold/USAGE
34
+ - lib/generators/documentation/scaffold/scaffold_generator.rb
35
+ - lib/generators/documentation/scaffold/templates/resource.md.tt
36
+ homepage: https://github.com/lazaronixon/documentation-zero
37
+ licenses:
38
+ - MIT
39
+ metadata:
40
+ homepage_uri: https://github.com/lazaronixon/documentation-zero
41
+ source_code_uri: https://github.com/lazaronixon/documentation-zero
42
+ changelog_uri: https://github.com/lazaronixon/documentation-zero/blob/main/CHANGELOG.md
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubygems_version: 3.3.7
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: An documentation system generator for Rails applications
62
+ test_files: []