
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Generate documentation from your rack application & request-spec.
gem "autodoc", group: :test
If you want to generate toc_html, you should install redcarpet gem (optional).
gem "redcarpet", group: :test
Run rspec with AUTODOC=1 to generate documents for your request-specs tagged with :autodoc
.
example: Autodoc generates doc/recipes.md and doc/toc.md from spec/requests/recipes_spec.rb.
# shell-command
AUTODOC=1 rspec
# spec/requests/entries_spec.rb
describe "Entries" do
include Rack::Test::Methods
let(:app) do
MyRackApplication
end
describe "GET /entries", autodoc: true do
it "returns entries" do
get "/entries"
last_response.status.should == 200
end
end
end
# spec/requests/recipes_spec.rb
describe "Recipes" do
describe "POST /recipes", autodoc: true do
it "creates a new recipe" do
post "/recipes", name: "alice", type: 1
response.status.should == 201
end
end
end
You can write more detailed descriptions with let(:description)
.
describe "Recipes" do
describe "PUT /recipes/:id", autodoc: true do
let(:description) do
"Updates a recipe. `name` parameter is required."
end
it "updates a recipe" do
put "/recipes/#{recipe.id}", name: "Bob"
response.status.should == 204
end
end
end
You can configure Autodoc.configuration
to change its behavior:
Autodoc.configuration.path = "doc/api"
Autodoc.configuration.toc = true
Autodoc.configuration.toc_html = true
Autodoc.configuration.template = File.read(File.expand_path("../autodoc/templates/document.md.erb", __FILE__))
Autodoc.configuration.document_path_from_example = -> (example) do
example.file_path.gsub(%r<\./spec/requests/api/(.+)_spec\.rb>, '\1.md')
end
If your app uses WeakParameters to define parameters schema
in your controller, autodoc scans them and provides ### Parameters
section to generated docs.
class RecipesController < ApplicationController
validates :create do
string :name, required: true, except: ["charlie", "dave"]
integer :type, only: 1..3
end
FAQs
Unknown package
We found that autodoc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.