summaryrefslogtreecommitdiff
path: root/tasks
diff options
context:
space:
mode:
authorLamont Granquist <lamont@chef.io>2019-07-08 16:47:38 -0700
committerGitHub <noreply@github.com>2019-07-08 16:47:38 -0700
commitcfdd8523b66c92d988547269380319ac250b3ee9 (patch)
treed4983e2d9ca8b40f791e68152b7bfd99d4cd0fd7 /tasks
parent643899fb580385968465c7e15e4f20908fc6c5ac (diff)
parentac56ffafe24e39fffb02cc1fbc0d3f27303390be (diff)
downloadchef-cfdd8523b66c92d988547269380319ac250b3ee9.tar.gz
Merge pull request #8711 from chef/lcg/new-chefstyle2
More Chefstyle updates
Diffstat (limited to 'tasks')
-rwxr-xr-xtasks/docs.rb12
-rw-r--r--tasks/rspec.rb2
2 files changed, 9 insertions, 5 deletions
diff --git a/tasks/docs.rb b/tasks/docs.rb
index c74bc55523..619d1a2218 100755
--- a/tasks/docs.rb
+++ b/tasks/docs.rb
@@ -21,6 +21,7 @@ namespace :docs_site do
# @return [String, nil] a pretty defaul value string or nil if we want to skip it
def pretty_default(default)
return nil if default.nil? || default == "" || default == "lazy default"
+
if default.is_a?(String)
return default.inspect unless default[0] == ":"
end
@@ -36,13 +37,13 @@ namespace :docs_site do
# build the resource string with property spacing between property names and comments
text = " #{resource_name} 'name' do\n"
properties.each do |p|
- text << " #{p['name'].ljust(padding_size)}"
+ text << " #{p["name"].ljust(padding_size)}"
text << friendly_types_list(p["is"])
text << " # default value: 'name' unless specified" if p["name_property"]
- text << " # default value: #{pretty_default(p['default'])}" unless pretty_default(p["default"]).nil?
+ text << " # default value: #{pretty_default(p["default"])}" unless pretty_default(p["default"]).nil?
text << "\n"
end
- text << " #{'action'.ljust(padding_size)}Symbol # defaults to :#{@default_action.first} if not specified\n"
+ text << " #{"action".ljust(padding_size)}Symbol # defaults to :#{@default_action.first} if not specified\n"
text << " end"
text
end
@@ -64,7 +65,7 @@ namespace :docs_site do
def friendly_properly_list(arr)
return nil if arr.empty? # resources w/o properties
- props = arr.map { |x| "``#{x['name']}``" }
+ props = arr.map { |x| "``#{x["name"]}``" }
# build the text string containing all properties bolded w/ punctuation
if props.size > 1
@@ -98,11 +99,13 @@ namespace :docs_site do
# @return String
def bolded_description(name, description)
return nil if description.nil? # handle resources missing descriptions
+
description.gsub( "#{name} ", "**#{name}** ").split("Note: ").first.strip
end
def note_text(description)
return nil if description.nil?
+
note = description.split("Note: ")[1]
if note
<<-HEREDOC
@@ -327,6 +330,7 @@ Examples
resources = Chef::JSONCompat.parse(ResourceInspector.inspect)
resources.each do |resource, data|
next if ["scm", "whyrun_safe_ruby_block", "l_w_r_p_base", "user_resource_abstract_base_class", "linux_user", "pw_user", "aix_user", "dscl_user", "solaris_user", "windows_user", ""].include?(resource)
+
puts "Writing out #{resource}."
@name = resource
@description = data["description"]
diff --git a/tasks/rspec.rb b/tasks/rspec.rb
index afd7d12705..2d20a0ffa7 100644
--- a/tasks/rspec.rb
+++ b/tasks/rspec.rb
@@ -77,7 +77,7 @@ begin
t.pattern = FileList["spec/unit/node_spec.rb", "spec/unit/role_spec.rb"]
end
- [:unit, :functional, :integration, :stress].each do |sub|
+ %i{unit functional integration stress}.each do |sub|
desc "Run the specs under spec/#{sub}"
RSpec::Core::RakeTask.new(sub) do |t|
t.rspec_opts = %w{--profile}