mirror of
https://github.com/zhigang1992/boxen.git
synced 2026-01-12 17:12:46 +08:00
Kill script/sync-puppet
This commit is contained in:
21
README.md
21
README.md
@@ -22,24 +22,3 @@ Sometimes it's not possible to follow these rules, but try hard.
|
||||
## Contributing
|
||||
|
||||
Use the OS X system Ruby (1.8.7). Run `script/tests` often. Open PR's.
|
||||
|
||||
### Managing Boxen's Puppet Modules
|
||||
|
||||
There are roughly nine million puppet modules under the
|
||||
[Boxen GitHub organization][boxen]. To clone them all, run
|
||||
`script/sync-puppet`. This script will make sure every
|
||||
`boxen/puppet-*` repo is cloned under the `./puppet` directory, which is
|
||||
ignored by Git.
|
||||
|
||||
[boxen]: https://github.com/boxen
|
||||
|
||||
Because it uses the GitHub API, `script/sync-puppet` requires the
|
||||
`GITHUB_LOGIN` and `GITHUB_PASSWORD` environment variables to be set.
|
||||
If you don't want to provide them every time, you can set them in
|
||||
`.env.local.rb`, which is also ignored by Git. For example, your
|
||||
`.env.local.rb` might look like this:
|
||||
|
||||
```ruby
|
||||
ENV["GITHUB_LOGIN"] = "jbarnette"
|
||||
ENV["GITHUB_PASSWORD"] = "adventures"
|
||||
```
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
# Make sure all boxen/puppet-* repos are cloned under ./puppet.
|
||||
|
||||
require "fileutils"
|
||||
require "pathname"
|
||||
|
||||
# Put us where we belong, in the root dir of boxen.
|
||||
|
||||
Dir.chdir Pathname.new(__FILE__).realpath + "../.."
|
||||
|
||||
# Load the local env in case creds are set there.
|
||||
|
||||
load ".env.local.rb" if File.file? ".env.local.rb"
|
||||
|
||||
# Make sure we're up to date.
|
||||
|
||||
abort "Bootstrap failed." unless system "script/bootstrap"
|
||||
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
require "octokit"
|
||||
|
||||
unless ENV["GITHUB_LOGIN"] && ENV["GITHUB_PASSWORD"]
|
||||
abort "Please set the GITHUB_LOGIN and GITHUB_PASSWORD env vars."
|
||||
end
|
||||
|
||||
api = Octokit::Client.new \
|
||||
:login => ENV["GITHUB_LOGIN"], :password => ENV["GITHUB_PASSWORD"]
|
||||
|
||||
# Gotta have a ./puppet dir.
|
||||
|
||||
FileUtils.mkdir_p "puppet"
|
||||
|
||||
# Clone boxen/puppet-* unless we have it already.
|
||||
|
||||
api.organization_repositories("boxen").each do |repo|
|
||||
next unless /^puppet-/ =~ repo.name
|
||||
|
||||
dest = "puppet/" + repo.name[7..-1]
|
||||
|
||||
unless File.directory? dest
|
||||
system "git", "clone", repo.clone_url, dest
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user