This repository has been archived by the owner on Dec 8, 2017. It is now read-only.
Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
testing-cookbook/go
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
54 lines (40 sloc)
1.18 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'English' | |
Dir.chdir File.dirname(__FILE__) | |
def try_command_and_restart(command) | |
exit $CHILD_STATUS.exitstatus unless system command | |
exec RbConfig.ruby, *[$PROGRAM_NAME].concat(ARGV) | |
end | |
begin | |
require 'bundler/setup' if File.exist? 'Gemfile' | |
rescue LoadError | |
try_command_and_restart 'gem install bundler' | |
rescue SystemExit | |
try_command_and_restart 'bundle install' | |
end | |
begin | |
require 'go_script' | |
rescue LoadError | |
try_command_and_restart 'gem install go_script' unless File.exist? 'Gemfile' | |
abort "Please add \"gem 'go_script'\" to your Gemfile" | |
end | |
require 'guides_style_18f' | |
extend GoScript | |
check_ruby_version '2.1.5' | |
command_group :dev, 'Development commands' | |
def_command :update_nav, 'Update the \'navigation:\' data in _config.yml' do | |
GuidesStyle18F.update_navigation_configuration Dir.pwd | |
end | |
def_command :update_theme, 'Update the guides_style_18f gem' do | |
exec_cmd 'bundle update --source guides_style_18f' | |
end | |
def_command :update_gems, 'Update Ruby gems' do |gems| | |
update_gems gems | |
end | |
def_command :serve, 'Serve the site at localhost:4000' do | |
serve_jekyll | |
end | |
def_command :build, 'Build the site' do | |
build_jekyll | |
end | |
execute_command ARGV |