Skip to content

Commit

Permalink
rake bootstrap added and documented
Browse files Browse the repository at this point in the history
  • Loading branch information
mdxp committed Jun 12, 2012
1 parent b8b890d commit 39a654b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.markdown
Expand Up @@ -31,6 +31,14 @@ Usage
* Branch off `master` or work locally for longer running articles
* Always work off the `source` branch

Initial setup
-----

Before you can publish your first changes you will have to bootstrap your environment. For this run:
```
rake bootstrap
```

### Creating a new Post

0. Make sure you have the most recent posts
Expand Down
26 changes: 26 additions & 0 deletions Rakefile
Expand Up @@ -375,3 +375,29 @@ task :list do
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}"
puts "(type rake -T for more detail)\n\n"
end

desc "Bootstrap the environment"
task :bootstrap, :repo do |t, args|
repo_url = 'git@github.com:promet/promet.github.com.git'
user = repo_url.match(/:([^\/]+)/)[1]
branch = (repo_url.match(/\/[\w-]+.github.com/).nil?) ? 'gh-pages' : 'master'
project = (branch == 'gh-pages') ? repo_url.match(/\/([^\.]+)/)[1] : ''

rm_rf deploy_dir
mkdir deploy_dir
cd "#{deploy_dir}" do
system "git init"
system "touch .gitkeep"
system "git add ."
system "git commit -m \"initial commit\""
system "git remote add origin #{repo_url}"

rakefile = IO.read(__FILE__)
rakefile.sub!(/deploy_branch(\s*)=(\s*)(["'])[\w-]*["']/, "deploy_branch\\1=\\2\\3#{branch}\\3")
rakefile.sub!(/deploy_default(\s*)=(\s*)(["'])[\w-]*["']/, "deploy_default\\1=\\2\\3push\\3")
File.open(__FILE__, 'w') do |f|
f.write rakefile
end
end
puts "\n---\n## Now you can deploy with `rake deploy` ##"
end

0 comments on commit 39a654b

Please sign in to comment.