diff --git a/lib/puppet-strings/markdown/templates/puppet_task.erb b/lib/puppet-strings/markdown/templates/puppet_task.erb index ff949f670..5fbc53ef3 100644 --- a/lib/puppet-strings/markdown/templates/puppet_task.erb +++ b/lib/puppet-strings/markdown/templates/puppet_task.erb @@ -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 diff --git a/lib/puppet-strings/yard/code_objects/task.rb b/lib/puppet-strings/yard/code_objects/task.rb index ceff39346..bf3a40e6b 100644 --- a/lib/puppet-strings/yard/code_objects/task.rb +++ b/lib/puppet-strings/yard/code_objects/task.rb @@ -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 diff --git a/lib/puppet-strings/yard/templates/default/puppet_task/html/input.erb b/lib/puppet-strings/yard/templates/default/puppet_task/html/input.erb index 107300f6c..d1c9930e0 100644 --- a/lib/puppet-strings/yard/templates/default/puppet_task/html/input.erb +++ b/lib/puppet-strings/yard/templates/default/puppet_task/html/input.erb @@ -1,11 +1,5 @@ <% if json['input_method'] || json['supports_noop'] %>
-

Input

- +

Supports noop? <%= json['supports_noop'] ? "true" : "false" %>

<% end %> diff --git a/spec/fixtures/unit/json/output.json b/spec/fixtures/unit/json/output.json index 3e5ece6cd..73815d8b0 100644 --- a/spec/fixtures/unit/json/output.json +++ b/spec/fixtures/unit/json/output.json @@ -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" } ] diff --git a/spec/fixtures/unit/markdown/output.md b/spec/fixtures/unit/markdown/output.md index ee42a92e5..51a160d16 100644 --- a/spec/fixtures/unit/markdown/output.md +++ b/spec/fixtures/unit/markdown/output.md @@ -389,9 +389,7 @@ The first parameter. Allows you to backup your database to local file. -#### Input - -Input method: stdin +**Supports noop?** false #### Parameters diff --git a/spec/unit/puppet-strings/yard/code_objects/task_spec.rb b/spec/unit/puppet-strings/yard/code_objects/task_spec.rb index 35992fa06..ea72cf157 100644 --- a/spec/unit/puppet-strings/yard/code_objects/task_spec.rb +++ b/spec/unit/puppet-strings/yard/code_objects/task_spec.rb @@ -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