forked from lewagon/data-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rb
executable file
·20 lines (17 loc) · 855 Bytes
/
build.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env ruby -wU
WINDOWS = %w[setup_instructions win_anaconda win_sublime win_github_account win_git_bash win_github win_sublime_package win_make win_alumni win_slack].freeze
MAC_OS = %w[setup_instructions setup/osx_command_line_tools setup/github homebrew setup/osx_sublime_text setup/osx_oh_my_zsh setup/github_rsa osx_anaconda setup/dotfiles osx_pip setup/ssh_osx win_alumni].freeze
filenames = {
'WINDOWS.md' => WINDOWS,
'macOS.md' => MAC_OS
}
filenames.each do |filename, partials|
File.open(filename.to_s, 'w:utf-8') do |f|
partials.each do |partial|
match_data = partial.match(/setup\/(?<partial>[a-z_]+)/)
file = match_data ? File.join('../setup', '_partials', "#{match_data[:partial]}.md") : File.join('_partials', "#{partial}.md")
f << File.read(file, encoding: 'utf-8')
f << "\n\n"
end
end
end