module GuidesStyle18F
@author Mike Bland (michael.bland@gsa.gov)
@author Mike Bland (michael.bland@gsa.gov)
Constants
- GIT_COMMANDS
- TEMPLATE_FILES
- VERSION
Public Class Methods
clear_template_files_and_create_new_repository( basedir, outstream = $stdout)
click to toggle source
# File lib/guides_style_18f/repository.rb, line 26 def self.clear_template_files_and_create_new_repository( basedir, outstream = $stdout) remove_template_files basedir, outstream delete_create_repo_command_from_go_script basedir, outstream create_new_git_repository basedir, outstream end
delete_create_repo_command_from_go_script(basedir, outstream)
click to toggle source
# File lib/guides_style_18f/repository.rb, line 42 def self.delete_create_repo_command_from_go_script(basedir, outstream) Dir.chdir basedir do outstream.puts 'Removing `:create_repo` command from the `./go` script.' go_script = File.join basedir, 'go' content = File.read go_script match = /\ndef_command\(\n :create_repo,.*?end\n/m.match content content = "#{match.pre_match}#{match.post_match}" unless match.nil? File.write go_script, content end end
exec_cmd_capture_output(command, outstream)
click to toggle source
# File lib/guides_style_18f/repository.rb, line 71 def self.exec_cmd_capture_output(command, outstream) opts = { out: outstream, err: outstream } exit $CHILD_STATUS.exitstatus unless system command, opts end
remove_template_files(basedir, outstream)
click to toggle source
# File lib/guides_style_18f/repository.rb, line 33 def self.remove_template_files(basedir, outstream) Dir.chdir basedir do outstream.puts 'Clearing Guides Template files.' files = TEMPLATE_FILES.map { |f| File.join basedir, f } .select { |f| File.exist? f } File.delete(*files) end end
update_theme()
click to toggle source
# File lib/guides_style_18f/update.rb, line 4 def self.update_theme exec({ 'RUBYOPT' => nil }, 'bundle', *%w(update --source guides_style_18f)) end
Private Class Methods
create_new_git_repository(basedir, outstream)
click to toggle source
# File lib/guides_style_18f/repository.rb, line 58 def self.create_new_git_repository(basedir, outstream) Dir.chdir basedir do outstream.puts 'Removing old git repository.' FileUtils.rm_rf '.git' GIT_COMMANDS.each do |description, command| outstream.puts description exec_cmd_capture_output command, outstream end outstream.puts "All done! Run \'git commit\' to create your first commit." end end