Skip to content

Commit

Permalink
(PDOC-206) removes input method and support_noop always visible
Browse files Browse the repository at this point in the history
After talking to @adreyer, input method is not worth mentioning in the docs but supports_noop should always be mentioned whether true or false.
  • Loading branch information
eputnam committed Mar 12, 2018
1 parent 5bb3167 commit 6881656
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 44 deletions.
12 changes: 1 addition & 11 deletions lib/puppet-strings/markdown/templates/puppet_task.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,8 @@
<%= "The #{name} task." %>
<% end -%>
<% if supports_noop || input_method -%>
#### Input
**Supports noop?** <%= supports_noop %>
<% if input_method -%>
Input method: <%= input_method %>
<% end -%>
<% if supports_noop -%>
Supports noop? <%= supports_noop %>
<% end -%>
<% end -%>
<% if params -%>
#### Parameters

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet-strings/yard/code_objects/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def to_hash
tags: parameters
},
source: statement.source,
supports_noop: statement.json['supports_noop'],
supports_noop: statement.json['supports_noop'] || false,
input_method: statement.json['input_method']
}
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<% if json['input_method'] || json['supports_noop'] %>
<div class="tags">
<p class="tag_title"> Input </p>
<ul>
<% if json['input_method'] %>
<li> Input method: <%= json['input_method'] %> </li>
<% end %>
<li> Supports noop? <%= json['supports_noop'] ? "true" : "false" %></li>
</ul>
<p><strong>Supports noop?</strong> <%= json['supports_noop'] ? "true" : "false" %></p>
</div>
<% end %>
2 changes: 1 addition & 1 deletion spec/fixtures/unit/json/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
]
},
"source": "{\n \"description\": \"Allows you to backup your database to local file.\",\n \"input_method\": \"stdin\",\n \"parameters\": {\n \"database\": {\n \"description\": \"Database to connect to\",\n \"type\": \"Optional[String[1]]\"\n },\n \"user\": {\n \"description\": \"The user\",\n \"type\": \"Optional[String[1]]\"\n },\n \"password\": {\n \"description\": \"The password\",\n \"type\": \"Optional[String[1]]\"\n },\n \"sql\": {\n \"description\": \"Path to file you want backup to\",\n \"type\": \"String[1]\"\n }\n }\n}\n",
"supports_noop": null,
"supports_noop": false,
"input_method": "stdin"
}
]
Expand Down
4 changes: 1 addition & 3 deletions spec/fixtures/unit/markdown/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,7 @@ The first parameter.

Allows you to backup your database to local file.

#### Input

Input method: stdin
**Supports noop?** false

#### Parameters

Expand Down
57 changes: 36 additions & 21 deletions spec/unit/puppet-strings/yard/code_objects/task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,42 @@

describe '#to_hash' do
let(:expected) do
{ :name => "test",
"description" => "Allows you to backup your database to local file.",
"input_method" => "stdin",
"parameters" =>
{"database" => {
"description" => "Database to connect to",
"type" => "Optional[String[1]]"
},
"user"=> {
"description"=>"The user",
"type"=>"Optional[String[1]]"
},
"password"=> {
"description"=>"The password",
"type"=>"Optional[String[1]]"
},
"sql"=> {
"description"=>"Path to file you want backup to",
"type"=>"String[1]"
}
}
{
:name => "test",
:supports_noop => false,
:docstring => {
:text=>"Allows you to backup your database to local file.",
:tags=> [
{
:name=>"database",
:tag_name=>"param",
:text=>"Database to connect to",
:types=> ["Optional[String[1]]"]
},
{
:name=>"user",
:tag_name=>"param",
:text=>"The user",
:types=> ["Optional[String[1]]"]
},
{
:name=>"password",
:tag_name=>"param",
:text=>"The password",
:types=> ["Optional[String[1]]"]
},
{
:name=>"sql",
:tag_name=>"param",
:text=>"Path to file you want backup to",
:types=>["String[1]"]
}
]
},
:file => "test.json",
:input_method => "stdin",
:line => 0,
:source => "{\n \"description\": \"Allows you to backup your database to local file.\",\n \"input_method\": \"stdin\",\n \"parameters\": {\n \"database\": {\n \"description\": \"Database to connect to\",\n \"type\": \"Optional[String[1]]\"\n },\n \"user\": {\n \"description\": \"The user\",\n \"type\": \"Optional[String[1]]\"\n },\n \"password\": {\n \"description\": \"The password\",\n \"type\": \"Optional[String[1]]\"\n },\n \"sql\": {\n \"description\": \"Path to file you want backup to\",\n \"type\": \"String[1]\"\n }\n }\n}\n"
}
end

Expand Down

0 comments on commit 6881656

Please sign in to comment.