boxen 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/README.md +39 -1
- data/boxen.gemspec +1 -1
- data/lib/boxen/puppeteer.rb +8 -2
- data/lib/facter/boxen.rb +3 -2
- data/script/release +8 -1
- data/script/sync-puppet +41 -0
- metadata +4 -3
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,45 @@
|
|
1
1
|
# Boxen
|
2
2
|
|
3
|
-
Manage development boxes with love (and Puppet).
|
3
|
+
Manage Mac development boxes with love (and Puppet).
|
4
|
+
|
5
|
+
## Rules for Services
|
6
|
+
|
7
|
+
0. Run on a nonstandard port, usually default port + 1000 or 10000.
|
8
|
+
|
9
|
+
0. Install with a custom Boxen homebrew formula.
|
10
|
+
|
11
|
+
0. Suffix the Homebrew package's version, starting with `-boxen1`.
|
12
|
+
|
13
|
+
0. Run as a launchd service in the `com.boxen` namespace, e.g.,
|
14
|
+
`com.boxen.dnsmasq`.
|
15
|
+
|
16
|
+
0. Store config, data, and log files in
|
17
|
+
`$BOXEN_HOME/{config,data,log}. This will normally require
|
18
|
+
customization of a service's Homebrew formula.
|
19
|
+
|
20
|
+
Sometimes it's not possible to follow these rules, but try hard.
|
4
21
|
|
5
22
|
## Contributing
|
6
23
|
|
7
24
|
Use the OS X system Ruby (1.8.7). Run `script/tests` often. Open PR's.
|
25
|
+
|
26
|
+
### Managing Boxen's Puppet Modules
|
27
|
+
|
28
|
+
There are roughly nine million puppet modules under the
|
29
|
+
[Boxen GitHub organization][boxen]. To clone them all, run
|
30
|
+
`script/sync-puppet`. This script will make sure every
|
31
|
+
`boxen/puppet-*` repo is cloned under the `./puppet`, which is ignored
|
32
|
+
by Git.
|
33
|
+
|
34
|
+
[boxen]: https://github.com/boxen
|
35
|
+
|
36
|
+
Because it uses the GitHub API, `script/sync-puppet` requires the
|
37
|
+
`GITHUB_LOGIN` and `GITHUB_PASSWORD` environment variables to be set.
|
38
|
+
If you don't want to provide them every time, you can set them in
|
39
|
+
`.env.local.rb`, which is also ignored by Git. For example, your
|
40
|
+
`.env.local.rb` might look like this:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
ENV["GITHUB_LOGIN"] = "jbarnette"
|
44
|
+
ENV["GITHUB_PASSWORD"] = "adventures"
|
45
|
+
```
|
data/boxen.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "boxen"
|
5
|
-
gem.version = "0.2.
|
5
|
+
gem.version = "0.2.4"
|
6
6
|
gem.authors = ["John Barnette", "Will Farrington"]
|
7
7
|
gem.email = ["jbarnette@github.com", "wfarr@github.com"]
|
8
8
|
gem.description = "Manage Mac development boxes with love (and Puppet)."
|
data/lib/boxen/puppeteer.rb
CHANGED
@@ -12,11 +12,15 @@ module Boxen
|
|
12
12
|
@config = config
|
13
13
|
end
|
14
14
|
|
15
|
+
def caffeinate
|
16
|
+
"/usr/bin/caffeinate -dis"
|
17
|
+
end
|
18
|
+
|
15
19
|
def command
|
16
20
|
manifest = "#{config.repodir}/manifests/site.pp"
|
17
21
|
puppet = "#{config.repodir}/bin/puppet"
|
18
22
|
|
19
|
-
[puppet, "apply", flags, manifest].flatten
|
23
|
+
[caffeinate, puppet, "apply", flags, manifest].flatten
|
20
24
|
end
|
21
25
|
|
22
26
|
def flags
|
@@ -69,7 +73,9 @@ module Boxen
|
|
69
73
|
|
70
74
|
ENV["GITHUB_API_TOKEN"] = config.token
|
71
75
|
|
72
|
-
|
76
|
+
# caffeinate ensures the system will not sleep during a run
|
77
|
+
unless system caffeinate,
|
78
|
+
librarian, "install", "--path=#{config.repodir}/shared"
|
73
79
|
abort "Can't run Puppet, fetching dependencies with librarian failed."
|
74
80
|
end
|
75
81
|
end
|
data/lib/facter/boxen.rb
CHANGED
@@ -3,7 +3,7 @@ require "boxen/config"
|
|
3
3
|
|
4
4
|
config = Boxen::Config.load
|
5
5
|
facts = {}
|
6
|
-
factsdir =
|
6
|
+
factsdir = "#{config.homedir}/config/facts"
|
7
7
|
|
8
8
|
facts["github_login"] = config.login
|
9
9
|
facts["github_email"] = config.email
|
@@ -13,7 +13,8 @@ facts["github_token"] = config.token
|
|
13
13
|
facts["boxen_home"] = config.homedir
|
14
14
|
facts["boxen_srcdir"] = config.srcdir
|
15
15
|
facts["boxen_repodir"] = config.repodir
|
16
|
-
facts["
|
16
|
+
facts["boxen_user"] = config.user
|
17
|
+
facts["luser"] = config.user # this is goin' away
|
17
18
|
|
18
19
|
Dir["#{config.homedir}/config/facts/*.json"].each do |file|
|
19
20
|
facts.merge! JSON.parse File.read file
|
data/script/release
CHANGED
@@ -9,9 +9,16 @@ cd $(dirname "$0")/..
|
|
9
9
|
|
10
10
|
# Build a new gem archive.
|
11
11
|
|
12
|
-
rm boxen-*.gem
|
12
|
+
rm -rf boxen-*.gem
|
13
13
|
gem build -q boxen.gemspec
|
14
14
|
|
15
|
+
# Make sure we're on the master branch.
|
16
|
+
|
17
|
+
(git branch | grep '* master') || {
|
18
|
+
echo "Only release from the master branch."
|
19
|
+
exit 1
|
20
|
+
}
|
21
|
+
|
15
22
|
# Figure out what version we're releasing.
|
16
23
|
|
17
24
|
tag=v`ls boxen-*.gem | sed 's/^boxen-\(.*\)\.gem$/\1/'`
|
data/script/sync-puppet
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Make sure all boxen/puppet-* repos are cloned under ./puppet.
|
3
|
+
|
4
|
+
require "fileutils"
|
5
|
+
require "pathname"
|
6
|
+
|
7
|
+
# Put us where we belong, in the root dir of boxen.
|
8
|
+
|
9
|
+
Dir.chdir Pathname.new(__FILE__).realpath + "../.."
|
10
|
+
|
11
|
+
# Load the local env in case creds are set there.
|
12
|
+
|
13
|
+
load ".env.local.rb" if File.file? ".env.local.rb"
|
14
|
+
|
15
|
+
# Make sure we're up to date.
|
16
|
+
|
17
|
+
abort "Bootstrap failed." unless system "script/bootstrap"
|
18
|
+
|
19
|
+
require "bundler/setup"
|
20
|
+
require "octokit"
|
21
|
+
|
22
|
+
unless ENV["GITHUB_LOGIN"] && ENV["GITHUB_PASSWORD"]
|
23
|
+
abort "Please set the GITHUB_LOGIN and GITHUB_PASSWORD env vars."
|
24
|
+
end
|
25
|
+
|
26
|
+
api = Octokit::Client.new \
|
27
|
+
:login => ENV["GITHUB_LOGIN"], :password => ENV["GITHUB_PASSWORD"]
|
28
|
+
|
29
|
+
# Gotta have a ./puppet dir.
|
30
|
+
|
31
|
+
FileUtils.mkdir_p "puppet"
|
32
|
+
|
33
|
+
# Clone boxen/puppet-* unless we have it already.
|
34
|
+
|
35
|
+
api.organization_repositories("boxen").each do |repo|
|
36
|
+
next unless /^puppet-/ =~ repo.name
|
37
|
+
|
38
|
+
unless File.directory? dest = "puppet/#{repo.name}"
|
39
|
+
system "git", "clone", repo.clone_url, dest
|
40
|
+
end
|
41
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 4
|
9
|
+
version: 0.2.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- John Barnette
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-10-
|
18
|
+
date: 2012-10-04 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- lib/facter/boxen.rb
|
176
176
|
- script/bootstrap
|
177
177
|
- script/release
|
178
|
+
- script/sync-puppet
|
178
179
|
- script/tests
|
179
180
|
- test/boxen/test.rb
|
180
181
|
- test/boxen_check_test.rb
|