Skip to content

Instantly share code, notes, and snippets.

@jackjennings
Created April 24, 2015 23:06
Show Gist options
  • Save jackjennings/c3476244d3e1056bcc1e to your computer and use it in GitHub Desktop.
Save jackjennings/c3476244d3e1056bcc1e to your computer and use it in GitHub Desktop.
after_bundle do
# Create the database and basic tables
rake "db:create"
rake "db:migrate"
# Create the git repository
git :init
git add: '--all'
git commit: "-m 'Initial commit'"
# If hub is installed, try to create a new remote repository on GitHub
if `which hub`.empty?
puts "This template can create a github repository for you if you have `hub` installed"
puts "https://hub.github.com"
return
end
if yes?('Create a new GitHub repository? [yN]')
name = ask_with_default("Name (name or organization/name):", @app_name)
description = ask("Description:")
flags = []
flags << "-d #{description}" unless description.blank?
flags << '-p' unless no?("Make this repository private? [Yn]")
run ['hub', 'create', *flags, name].join(' ')
git push: 'origin master'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment