Commit 1e70e58
Changed files (1)
bin
bin/community
@@ -174,13 +174,15 @@ class Community
@row[COLUMNS[name]] || @row.fetch(name.to_s.upcase)
end
- def create_directory_in(root_dir)
- FileUtils.mkdir_p("#{root_dir}/#{name.parameterize}", verbose: true)
+ def create_content_in(root_dir)
+ target_dir = "#{root_dir}/#{name.parameterize}"
+ FileUtils.mkdir_p(target_dir, verbose: true)
+ create_readme_in(target_dir)
end
- def create_readme
+ def create_readme_in(dir)
erb = ERB.new(IO.read("templates/community.md.erb"))
- IO.write("yyc/#{name.parameterize}/README.md", erb.result(binding))
+ IO.write("#{dir}/README.md", erb.result(binding))
end
end
@@ -201,8 +203,5 @@ end
Census
.new("data/Census_by_Community_2019_20240524.csv")
.find_all { |x| x[:class].include?("Residential") }
- .each do |community|
- community.create_directory_in("yyc")
- community.create_readme
- end
+ .each { |x| x.create_content_in("yyc") }