Commit 966c19f70b02e2395d0ea1ba7260c305dce61eef

Authored by Will Farrington
1 parent 553c2e33d0

Update for script/sync

Showing 11 changed files with 142 additions and 3 deletions Inline Diff

source "http://rubygems.org" 1 1 source "http://rubygems.org"
2 2
gem "boxen", "~> 0.1" 3 3 gem "boxen", "~> 0.4"
4
5 group :development do
6 gem "aws-sdk"
7 end
GEM 1 1 GEM
remote: http://rubygems.org/ 2 2 remote: http://rubygems.org/
specs: 3 3 specs:
addressable (2.3.2) 4 4 addressable (2.3.2)
ansi (1.4.3) 5 5 ansi (1.4.3)
6 aws-sdk (1.6.9)
7 httparty (~> 0.7)
8 json (~> 1.4)
9 nokogiri (>= 1.4.4)
10 uuidtools (~> 2.1)
boxen (0.4.0) 6 11 boxen (0.4.0)
ansi (~> 1.4) 7 12 ansi (~> 1.4)
hiera (~> 1.0.0) 8 13 hiera (~> 1.0.0)
highline (~> 1.6) 9 14 highline (~> 1.6)
json_pure (~> 1.7) 10 15 json_pure (~> 1.7)
librarian-puppet (~> 0.9) 11 16 librarian-puppet (~> 0.9)
octokit (~> 1.15) 12 17 octokit (~> 1.15)
puppet (~> 3.0) 13 18 puppet (~> 3.0)
facter (1.6.12) 14 19 facter (1.6.12)
faraday (0.8.4) 15 20 faraday (0.8.4)
multipart-post (~> 1.1) 16 21 multipart-post (~> 1.1)
faraday_middleware (0.8.8) 17 22 faraday_middleware (0.8.8)
faraday (>= 0.7.4, < 0.9) 18 23 faraday (>= 0.7.4, < 0.9)
hashie (1.2.0) 19 24 hashie (1.2.0)
hiera (1.0.0) 20 25 hiera (1.0.0)
highline (1.6.15) 21 26 highline (1.6.15)
27 httparty (0.9.0)
28 multi_json (~> 1.0)
29 multi_xml
30 json (1.7.5)
json_pure (1.7.5) 22 31 json_pure (1.7.5)
librarian-puppet (0.9.6) 23 32 librarian-puppet (0.9.6)
json_pure 24 33 json_pure
puppet 25 34 puppet
thor (~> 0.15) 26 35 thor (~> 0.15)
multi_json (1.3.6) 27 36 multi_json (1.3.6)
37 multi_xml (0.5.1)
multipart-post (1.1.5) 28 38 multipart-post (1.1.5)
39 nokogiri (1.5.5)
octokit (1.15.1) 29 40 octokit (1.15.1)
addressable (~> 2.2) 30 41 addressable (~> 2.2)
faraday (~> 0.8) 31 42 faraday (~> 0.8)
faraday_middleware (~> 0.8) 32 43 faraday_middleware (~> 0.8)
hashie (~> 1.2) 33 44 hashie (~> 1.2)
multi_json (~> 1.3) 34 45 multi_json (~> 1.3)
puppet (3.0.0) 35 46 puppet (3.0.0)
facter (>= 1.6.11) 36 47 facter (>= 1.6.11)
hiera (>= 1.0.0rc) 37 48 hiera (>= 1.0.0rc)
thor (0.16.0) 38 49 thor (0.16.0)
50 uuidtools (2.1.3)
39 51
PLATFORMS 40 52 PLATFORMS
ruby 41 53 ruby
42 54
DEPENDENCIES 43 55 DEPENDENCIES
boxen (~> 0.1) 44 56 aws-sdk
# Our Boxen 1 1 # Our Boxen
2 2
This is a template Boxen project designed for your organization to fork and 3 3 This is a template Boxen project designed for your organization to fork and
modify appropriately. 4 4 modify appropriately.
The Boxen rubygem and the Boxen puppet modules are only a framework for getting 5 5 The Boxen rubygem and the Boxen puppet modules are only a framework for getting
things done. 6 6 things done.
This repository template is just a basic example of _how_ to do things with them. 7 7 This repository template is just a basic example of _how_ to do things with them.
8 8
## Getting Started 9 9 ## Getting Started
10 10
1. Install XCode Command Line Tools and/or full XCode. 11 11 1. Install XCode Command Line Tools and/or full XCode.
1. Create a new repository on GitHub as your user for your Boxen. (eg. 12 12 1. Create a new repository on GitHub as your user for your Boxen. (eg.
`wfarr/my-boxen`). **Make sure it is a private repository!** for now 13 13 `wfarr/my-boxen`). **Make sure it is a private repository!**
1. Get running like so: 14 14 1. Get running like so:
``` 15 15 ```
mkdir -p ~/src/my-boxen 16 16 mkdir -p ~/src/my-boxen
cd ~/src/my-boxen 17 17 cd ~/src/my-boxen
git init 18 18 git init
git remote add upstream https://github.com/boxen/our-boxen 19 19 git remote add upstream https://github.com/boxen/our-boxen
git fetch upstream 20 20 git fetch upstream
git co -b master upstream/master 21 21 git co -b master upstream/master
git remote add origin https://github.com/wfarr/my-boxen 22 22 git remote add origin https://github.com/wfarr/my-boxen
git push origin master 23 23 git push origin master
24 24
script/boxen 25 25 script/boxen
``` 26 26 ```
1. Close and reopen your Terminal. If you have a shell config file 27 27 1. Close and reopen your Terminal. If you have a shell config file
(eg. `~/.bashrc`) you'll need to add this at the very end: 28 28 (eg. `~/.bashrc`) you'll need to add this at the very end:
`[ -f /opt/boxen/env.sh ] && source /opt/boxen/env.sh`, and reload 29 29 `[ -f /opt/boxen/env.sh ] && source /opt/boxen/env.sh`, and reload
your shell. 30 30 your shell.
1. Confirm the Boxen env has loaded: `boxen --env` 31 31 1. Confirm the Boxen env has loaded: `boxen --env`
32 32
Now you have your own my-boxen repo that you can hack on. 33 33 Now you have your own my-boxen repo that you can hack on.
You may have noticed we didn't ask you to fork the repo. 34 34 You may have noticed we didn't ask you to fork the repo.
This is because when our-boxen goes open source that'd have some 35 35 This is because when our-boxen goes open source that'd have some
implications about your fork also potentially being public. 36 36 implications about your fork also potentially being public.
That's obviously quite bad, so that's why we strongly suggest you 37 37 That's obviously quite bad, so that's why we strongly suggest you
create an entirely separate repo and simply pull the code in, as shown above. 38 38 create an entirely separate repo and simply pull the code in, as shown above.
39 39
## What You Get 40 40 ## What You Get
41 41
This template project provides the following by default: 42 42 This template project provides the following by default:
43 43
* Homebrew 44 44 * Homebrew
* Git 45 45 * Git
* Hub 46 46 * Hub
* DNSMasq w/ .dev resolver for localhost 47 47 * DNSMasq w/ .dev resolver for localhost
* NVM 48 48 * NVM
* RBenv 49 49 * RBenv
* Full Disk Encryption requirement 50 50 * Full Disk Encryption requirement
* NodeJS 0.4 51 51 * NodeJS 0.4
* NodeJS 0.6 52 52 * NodeJS 0.6
* NodeJS 0.8 53 53 * NodeJS 0.8
* Ruby 1.8.7 54 54 * Ruby 1.8.7
* Ruby 1.9.2 55 55 * Ruby 1.9.2
* Ruby 1.9.3 56 56 * Ruby 1.9.3
* Ack 57 57 * Ack
* Findutils 58 58 * Findutils
* GNU-Tar 59 59 * GNU-Tar
60 60
## Customizing 61 61 ## Customizing
62 62
You can always check out the number of existing modules we already 63 63 You can always check out the number of existing modules we already
provide as optional installs under the 64 64 provide as optional installs under the
[boxen organization](https://github.com/boxen). These modules are all 65 65 [boxen organization](https://github.com/boxen). These modules are all
tested to be compatible with Boxen. Use the `Puppetfile` to pull them 66 66 tested to be compatible with Boxen. Use the `Puppetfile` to pull them
in dependencies automatically whenever `boxen` is run. You'll have to 67 67 in dependencies automatically whenever `boxen` is run. You'll have to
make sure your "node" (Puppet's term for your laptop, basically) 68 68 make sure your "node" (Puppet's term for your laptop, basically)
includes or requires them. You can do this by either modifying 69 69 includes or requires them. You can do this by either modifying
`manifests/site.pp` for each module, _or_ we would generally recommend 70 70 `manifests/site.pp` for each module, _or_ we would generally recommend
you create a module for your organization (eg. `modules/github`) and 71 71 you create a module for your organization (eg. `modules/github`) and
create an environment class in that. Then you need only adjust 72 72 create an environment class in that. Then you need only adjust
# This file will be loaded by config/basic early in a Boxen run. Use 1 1 # This file will be loaded by config/basic early in a Boxen run. Use
# it to provide any custom code or behavior your Boxen setup requires. 2 2 # it to provide any custom code or behavior your Boxen setup requires.
3 3
# Change the prefix boxen is installed to. 4 4 # Change the prefix boxen is installed to.
# ENV['BOXEN_HOME'] = '/opt/boxen' 5 5 # ENV['BOXEN_HOME'] = '/opt/boxen'
6 6
# Change the repo boxen will use. 7 7 # Change the repo boxen will use.
# ENV['BOXEN_REPO_NAME'] = 'boxen/our-boxen' 8 8 # ENV['BOXEN_REPO_NAME'] = 'boxen/our-boxen'
9
10 # Boxen binary packaging
11 # ENV["BOXEN_S3_ACCESS_KEY"] = ''
File was created 1 #!/usr/bin/ruby
2 # Sync binary snapshots to S3.
3
4 require "pathname"
5 require "tempfile"
6
7 # Put us where we belong, in the root dir of our boxen repo.
8
9 Dir.chdir Pathname.new(__FILE__).realpath + "../.."
10
11 # Make sure our local dependencies are up to date.
12
13 abort "Sorry, can't bootstrap." unless system "script/bootstrap"
14
15 # Set up our local configuration, deps, and load path.
16
17 load "config/basic.rb"
18
19 require "aws-sdk"
20 require "boxen/config"
21
22 access_key = ENV["BOXEN_S3_ACCESS_KEY"]
23 secret_key = ENV["BOXEN_S3_SECRET_KEY"]
24 bucket_name = ENV["BOXEN_S3_BUCKET"]
25
26 unless access_key && secret_key && bucket_name
27 abort "Please set the BOXEN_S3_{ACCESS_KEY,SECRET_KEY,BUCKET} env vars."
28 end
29
30 s3 = AWS::S3.new :access_key_id => access_key, :secret_access_key => secret_key
31 os = `sw_vers -productVersion`.strip.split(".")[0..1].join "."
32
33 bucket = s3.buckets[bucket_name]
34 config = Boxen::Config.load
35
36 # Sync Homebrew packages.
37
38 Dir.chdir "#{config.homedir}/homebrew/Cellar" do
39 Dir["*/*"].each do |dir|
40 name, version = File.split dir
41
42 file = "homebrew/#{os}/#{name}-#{version}.tar.bz2"
43 temp = Tempfile.new "homebrew"
44 obj = bucket.objects[file]
45
46 next if obj.exists?
47
48 printf "Snapshotting #{name} #{version}... "
49 $stdout.flush
50
51 system "tar", "-cjf", temp.path, dir
52 puts "done."
53
54 printf "Shipping #{name} #{version} to S3... "
55 $stdout.flush
56
57 obj.write :acl => :public_read, :file => temp.path
58 puts "done."
59 end
60 end
61
62 # Sync rbenv rubies.
63
64 Dir.chdir "#{config.homedir}/rbenv/versions" do
65 Dir["*"].each do |dir|
66 next if File.symlink? dir
67
68 version = File.basename dir
69 file = "rbenv/#{os}/#{version}.tar.bz2"
70 temp = Tempfile.new "rbenv"
71 obj = bucket.objects[file]
72
73 next if obj.exists?
74
75 printf "Snapshotting ruby #{version}... "
76 $stdout.flush
77
vendor/cache/aws-sdk-1.6.9.gem
No preview for this file type
vendor/cache/httparty-0.9.0.gem
No preview for this file type
vendor/cache/json-1.7.5.gem
No preview for this file type
vendor/cache/multi_xml-0.5.1.gem
No preview for this file type
vendor/cache/nokogiri-1.5.5.gem
No preview for this file type
vendor/cache/uuidtools-2.1.3.gem
No preview for this file type