summaryrefslogtreecommitdiff
path: root/tasks
diff options
context:
space:
mode:
authorKartik Null Cating-Subramanian <ksubramanian@chef.io>2016-01-26 13:10:20 -0500
committerKartik Null Cating-Subramanian <ksubramanian@chef.io>2016-01-27 16:59:22 -0500
commit1058cc5286428267a49a6966553912d86e9b354f (patch)
tree7db948de5ae0187b323385d9fa6b9ac5f7a543ae /tasks
parent1994fdd88e478d3961449d1be51e6f8a802b5e1d (diff)
downloadchef-1058cc5286428267a49a6966553912d86e9b354f.tar.gz
Don't fail CI build if tomlrb isn't available.
Diffstat (limited to 'tasks')
-rw-r--r--tasks/cbgb.rb96
1 files changed, 51 insertions, 45 deletions
diff --git a/tasks/cbgb.rb b/tasks/cbgb.rb
index 97d374e297..f128afbf1c 100644
--- a/tasks/cbgb.rb
+++ b/tasks/cbgb.rb
@@ -18,61 +18,67 @@
#
require "rake"
-require "tomlrb"
CBGB_SOURCE = File.join(File.dirname(__FILE__), "..", "CBGB.toml")
CBGB_TARGET = File.join(File.dirname(__FILE__), "..", "CBGB.md")
-task :default => :generate
+begin
+ require "tomlrb"
-namespace :cbgb do
- desc "Generate MarkDown version of CBGB file"
- task :generate do
- cbgb = Tomlrb.load_file CBGB_SOURCE
- out = "<!-- This is a generated file. Please do not edit directly -->\n"
- out << "<!-- Modify CBGB.toml file and run `rake cbgb:generate` to regenerate -->\n\n"
- out << "# " + cbgb["Preamble"]["title"] + "\n\n"
- out << cbgb["Preamble"]["text"] + "\n"
- out << "# Board of Governors\n\n"
- out << "## " + cbgb["Org"]["Lead"]["title"] + "\n\n"
- out << person(cbgb["people"], cbgb["Org"]["Lead"]["person"]) + "\n\n"
- out << "### " + cbgb["Org"]["Contributors"]["title"] + "\n\n"
- out << cbgb(cbgb["people"], cbgb["Org"]["Contributors"]["governers"]) + "\n\n"
- out << "### " + cbgb["Org"]["Corporate-Contributors"]["title"] + "\n\n"
- out << cbgb(cbgb["corporations"], cbgb["Org"]["Corporate-Contributors"]["governers"]) + "\n\n"
- out << "### " + cbgb["Org"]["Lieutenants"]["title"] + "\n\n"
- out << cbgb(cbgb["people"], cbgb["Org"]["Lieutenants"]["governers"]) + "\n\n"
- File.open(CBGB_TARGET, "w") { |fn|
- fn.write out
- }
- end
-end
+ task :default => :generate
-def components(list, cmp)
- out = ""
- cmp.each do |k,v|
- out << "\n#### #{v['title'].gsub('#','\\#')}\n"
- out << cbgb(list, v["cbgb"])
+ namespace :cbgb do
+ desc "Generate MarkDown version of CBGB file"
+ task :generate do
+ cbgb = Tomlrb.load_file CBGB_SOURCE
+ out = "<!-- This is a generated file. Please do not edit directly -->\n"
+ out << "<!-- Modify CBGB.toml file and run `rake cbgb:generate` to regenerate -->\n\n"
+ out << "# " + cbgb["Preamble"]["title"] + "\n\n"
+ out << cbgb["Preamble"]["text"] + "\n"
+ out << "# Board of Governors\n\n"
+ out << "## " + cbgb["Org"]["Lead"]["title"] + "\n\n"
+ out << person(cbgb["people"], cbgb["Org"]["Lead"]["person"]) + "\n\n"
+ out << "### " + cbgb["Org"]["Contributors"]["title"] + "\n\n"
+ out << cbgb(cbgb["people"], cbgb["Org"]["Contributors"]["governers"]) + "\n\n"
+ out << "### " + cbgb["Org"]["Corporate-Contributors"]["title"] + "\n\n"
+ out << cbgb(cbgb["corporations"], cbgb["Org"]["Corporate-Contributors"]["governers"]) + "\n\n"
+ out << "### " + cbgb["Org"]["Lieutenants"]["title"] + "\n\n"
+ out << cbgb(cbgb["people"], cbgb["Org"]["Lieutenants"]["governers"]) + "\n\n"
+ File.open(CBGB_TARGET, "w") { |fn|
+ fn.write out
+ }
+ end
end
- out
-end
-def cbgb(list, people)
- o = ""
- people.each do |p|
- o << person(list, p) + "\n"
+ def components(list, cmp)
+ out = ""
+ cmp.each do |k,v|
+ out << "\n#### #{v['title'].gsub('#','\\#')}\n"
+ out << cbgb(list, v["cbgb"])
+ end
+ out
end
- o
-end
-def person(list, person)
- if list[person].has_key?("GitHub")
- out = "* [#{list[person]["Name"]}](https://github.com/#{list[person]["GitHub"]})"
- else
- out = "* #{list[person]["Name"]}"
+ def cbgb(list, people)
+ o = ""
+ people.each do |p|
+ o << person(list, p) + "\n"
+ end
+ o
end
- if list[person].has_key?("Person")
- out << " - #{list[person]["Person"]}"
+
+ def person(list, person)
+ if list[person].has_key?("GitHub")
+ out = "* [#{list[person]["Name"]}](https://github.com/#{list[person]["GitHub"]})"
+ else
+ out = "* #{list[person]["Name"]}"
+ end
+ if list[person].has_key?("Person")
+ out << " - #{list[person]["Person"]}"
+ end
+ out
end
- out
+
+rescue LoadError
+ STDERR.puts "\n*** TomlRb not available.\n\n"
end