boxen 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Boxen
1
+ # Boxen [![Build Status](https://travis-ci.org/boxen/boxen.png?branch=master)](https://travis-ci.org/boxen/boxen)
2
2
 
3
3
  Manage Mac development boxes with love (and Puppet).
4
4
 
@@ -44,3 +44,7 @@ and we can't just modify the sudoers file due to a chicken-egg problem.
44
44
 
45
45
  Use the OS X system Ruby (1.8.7). Run `script/tests` often. Open PR's.
46
46
  Use the CI.
47
+
48
+ ## Halp!
49
+
50
+ Use Issues or #boxen on irc.freenode.net.
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 = "1.0.1"
5
+ gem.version = "1.0.2"
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/config.rb CHANGED
@@ -102,10 +102,6 @@ module Boxen
102
102
  # Is full disk encryption required? Default is `true`. Respects
103
103
  # the `BOXEN_NO_FDE` environment variable.
104
104
 
105
- def fde=(val)
106
- @fde = val
107
- end
108
-
109
105
  def fde?
110
106
  !ENV["BOXEN_NO_FDE"] && @fde
111
107
  end
@@ -230,7 +226,7 @@ module Boxen
230
226
  # `"/Users/#{user}/src"`.
231
227
 
232
228
  def srcdir
233
- @srcdir || "/Users/#{user}/src"
229
+ @srcdir || ENV["BOXEN_SRC_DIR"] || "/Users/#{user}/src"
234
230
  end
235
231
 
236
232
  attr_writer :srcdir
data/lib/boxen/flags.rb CHANGED
@@ -109,7 +109,7 @@ module Boxen
109
109
  @user = user
110
110
  end
111
111
 
112
- o.on "--no-color", "Enable colors." do
112
+ o.on "--no-color", "Disable colors." do
113
113
  @color = false
114
114
  end
115
115
  end
@@ -3,7 +3,7 @@ require "boxen/preflight"
3
3
  class Boxen::Preflight::EtcMyCnf < Boxen::Preflight
4
4
  def run
5
5
  abort "You have an /etc/my.cnf file.",
6
- "This will confuse The Setup's MySQL a lot. Please remove it."
6
+ "This will confuse Boxen's MySQL a lot. Please remove it."
7
7
  end
8
8
 
9
9
  def ok?
@@ -3,7 +3,7 @@ require "boxen/preflight"
3
3
  class Boxen::Preflight::RVM < Boxen::Preflight
4
4
  def run
5
5
  abort "You have an rvm installed in ~/.rvm.",
6
- "The Setup uses rbenv to install ruby, so please `rvm implode`"
6
+ "Boxen uses rbenv to install ruby, so please `rvm implode`"
7
7
  end
8
8
 
9
9
  def ok?
@@ -81,12 +81,15 @@ module Boxen
81
81
 
82
82
  ENV["GITHUB_API_TOKEN"] = config.token
83
83
 
84
- unless system librarian, "install", "--path=#{config.repodir}/shared"
84
+ librarian_command = [librarian, "install", "--path=#{config.repodir}/shared"]
85
+ librarian_command << "--verbose" if config.debug?
86
+
87
+ warn librarian_command.join(" ") if config.debug?
88
+ unless system *librarian_command
85
89
  abort "Can't run Puppet, fetching dependencies with librarian failed."
86
90
  end
87
91
  end
88
92
 
89
- warn command.join " " if config.debug?
90
93
  Boxen::Util.sudo *command
91
94
 
92
95
  Status.new($?.exitstatus)
data/script/Boxen CHANGED
Binary file
@@ -3,4 +3,4 @@
3
3
  set -e
4
4
 
5
5
  cd $(dirname "$0")/..
6
- cc -g -O2 -Wall -framework Security -o script/Boxen src/keychain-helper.c
6
+ cc -g -O2 -Wall -framework Security -framework CoreFoundation -mmacosx-version-min=10.6 -o script/Boxen src/keychain-helper.c
@@ -1,6 +1,12 @@
1
1
  #include <stdio.h>
2
2
  #include <stdlib.h>
3
3
  #include <Security/Security.h>
4
+ #include <CoreFoundation/CFString.h>
5
+
6
+ #define REPORT_KEYCHAIN_ERROR(err_val) do { \
7
+ fprintf(stderr, "Boxen Keychain Helper: Encountered error code: %d\n", err_val); \
8
+ fprintf(stderr, "Error: %s\n", CFStringGetCStringPtr(SecCopyErrorMessageString(err_val, NULL), kCFStringEncodingMacRoman)); \
9
+ } while(0)
4
10
 
5
11
  int key_exists_p(
6
12
  const char *service,
@@ -17,7 +23,10 @@ int key_exists_p(
17
23
  if (ret == 0) {
18
24
  return 0;
19
25
  } else {
20
- fprintf(stderr, "Boxen Keychain Helper: Encountered error code: %d\n", ret);
26
+ if (ret != errSecItemNotFound) {
27
+ // Item not found is not an error in predicate method context.
28
+ REPORT_KEYCHAIN_ERROR(ret);
29
+ }
21
30
  return ret;
22
31
  }
23
32
  }
@@ -47,7 +56,7 @@ int main(int argc, char **argv) {
47
56
  );
48
57
 
49
58
  if (create_key != 0) {
50
- fprintf(stderr, "Boxen Keychain Helper: Encountered error code: %d\n", create_key);
59
+ REPORT_KEYCHAIN_ERROR(create_key);
51
60
  return 1;
52
61
  }
53
62
 
@@ -56,7 +65,7 @@ int main(int argc, char **argv) {
56
65
  NULL, strlen(service), service, strlen(login), login, &len, &buf, &item);
57
66
 
58
67
  if (find_key != 0) {
59
- fprintf(stderr, "Boxen Keychain Helper: Encountered error code: %d\n", find_key);
68
+ REPORT_KEYCHAIN_ERROR(find_key);
60
69
  return 1;
61
70
  }
62
71
 
@@ -29,28 +29,33 @@ class BoxenConfigTest < Boxen::Test
29
29
  end
30
30
 
31
31
  def test_fde_env_var
32
- val = ENV['BOXEN_NO_FDE']
32
+ val = ENV["BOXEN_NO_FDE"]
33
33
 
34
- ENV['BOXEN_NO_FDE'] = '1'
34
+ ENV["BOXEN_NO_FDE"] = "1"
35
35
  refute @config.fde?
36
36
 
37
- ENV['BOXEN_NO_FDE'] = val
37
+ ENV["BOXEN_NO_FDE"] = val
38
38
  end
39
39
 
40
40
  def test_homedir
41
+ val = ENV["BOXEN_HOME"]
42
+ ENV["BOXEN_HOME"] = nil
43
+
41
44
  assert_equal "/opt/boxen", @config.homedir
42
45
 
43
46
  @config.homedir = "foo"
44
47
  assert_equal "foo", @config.homedir
48
+
49
+ ENV["BOXEN_HOME"] = val
45
50
  end
46
51
 
47
52
  def test_homedir_env_var_boxen_home
48
- val = ENV['BOXEN_NO_FDE']
53
+ val = ENV["BOXEN_HOME"]
49
54
 
50
- ENV['BOXEN_HOME'] = 'foo'
55
+ ENV["BOXEN_HOME"] = "foo"
51
56
  assert_equal "foo", @config.homedir
52
57
 
53
- ENV['BOXEN_HOME'] = val
58
+ ENV["BOXEN_HOME"] = val
54
59
  end
55
60
 
56
61
  def test_initialize
@@ -69,12 +74,12 @@ class BoxenConfigTest < Boxen::Test
69
74
  end
70
75
 
71
76
  def test_logfile_env_var
72
- val = ENV['BOXEN_LOG_FILE']
77
+ val = ENV["BOXEN_LOG_FILE"]
73
78
 
74
- ENV['BOXEN_LOG_FILE'] = 'foo'
79
+ ENV["BOXEN_LOG_FILE"] = "foo"
75
80
  assert_equal "foo", @config.logfile
76
81
 
77
- ENV['BOXEN_LOG_FILE'] = val
82
+ ENV["BOXEN_LOG_FILE"] = val
78
83
  end
79
84
 
80
85
  def test_login
@@ -122,12 +127,12 @@ class BoxenConfigTest < Boxen::Test
122
127
  end
123
128
 
124
129
  def test_puppetdir_env_var
125
- val = ENV['BOXEN_PUPPET_DIR']
130
+ val = ENV["BOXEN_PUPPET_DIR"]
126
131
 
127
- ENV['BOXEN_PUPPET_DIR'] = 'foo'
132
+ ENV["BOXEN_PUPPET_DIR"] = "foo"
128
133
  assert_equal "foo", @config.puppetdir
129
134
 
130
- ENV['BOXEN_PUPPET_DIR'] = val
135
+ ENV["BOXEN_PUPPET_DIR"] = val
131
136
  end
132
137
 
133
138
  def test_repodir
@@ -141,12 +146,12 @@ class BoxenConfigTest < Boxen::Test
141
146
  def test_repodir_env_var
142
147
  @config.repodir = nil
143
148
 
144
- val = ENV['BOXEN_REPO_DIR']
149
+ val = ENV["BOXEN_REPO_DIR"]
145
150
 
146
- ENV['BOXEN_REPO_DIR'] = 'foo'
151
+ ENV["BOXEN_REPO_DIR"] = "foo"
147
152
  assert_equal "foo", @config.repodir
148
153
 
149
- ENV['BOXEN_REPO_DIR'] = val
154
+ ENV["BOXEN_REPO_DIR"] = val
150
155
  end
151
156
 
152
157
  def test_reponame
@@ -155,12 +160,12 @@ class BoxenConfigTest < Boxen::Test
155
160
  end
156
161
 
157
162
  def test_reponame_env_var
158
- val = ENV['BOXEN_REPO_NAME']
163
+ val = ENV["BOXEN_REPO_NAME"]
159
164
 
160
- ENV['BOXEN_REPO_NAME'] = 'env/var'
165
+ ENV["BOXEN_REPO_NAME"] = "env/var"
161
166
  assert_equal "env/var", @config.reponame
162
167
 
163
- ENV['BOXEN_REPO_NAME'] = val
168
+ ENV["BOXEN_REPO_NAME"] = val
164
169
  end
165
170
 
166
171
  def test_reponame_git_config
@@ -194,11 +199,27 @@ class BoxenConfigTest < Boxen::Test
194
199
  end
195
200
 
196
201
  def test_srcdir
202
+ val = ENV["BOXEN_SRC_DIR"]
203
+ ENV["BOXEN_SRC_DIR"] = nil
204
+
197
205
  @config.expects(:user).returns "foo"
198
206
  assert_equal "/Users/foo/src", @config.srcdir
199
207
 
200
208
  @config.srcdir = "elsewhere"
201
209
  assert_equal "elsewhere", @config.srcdir
210
+
211
+ ENV["BOXEN_SRC_DIR"] = val
212
+ end
213
+
214
+ def test_srcdir_env_var
215
+ @config.srcdir = nil
216
+
217
+ val = ENV["BOXEN_SRC_DIR"]
218
+
219
+ ENV["BOXEN_SRC_DIR"] = "Projects"
220
+ assert_equal "Projects", @config.srcdir
221
+
222
+ ENV["BOXEN_SRC_DIR"] = val
202
223
  end
203
224
 
204
225
  def test_stealth?
@@ -209,12 +230,12 @@ class BoxenConfigTest < Boxen::Test
209
230
  end
210
231
 
211
232
  def test_stealth_env_var
212
- val = ENV['BOXEN_NO_ISSUE']
233
+ val = ENV["BOXEN_NO_ISSUE"]
213
234
 
214
- ENV['BOXEN_NO_ISSUE'] = '1'
235
+ ENV["BOXEN_NO_ISSUE"] = "1"
215
236
  assert @config.stealth?
216
237
 
217
- ENV['BOXEN_NO_ISSUE'] = val
238
+ ENV["BOXEN_NO_ISSUE"] = val
218
239
  end
219
240
 
220
241
  def test_token
@@ -225,7 +246,7 @@ class BoxenConfigTest < Boxen::Test
225
246
  end
226
247
 
227
248
  def test_user
228
- ENV['USER'] = 'foo'
249
+ ENV["USER"] = "foo"
229
250
  assert_equal "foo", @config.user
230
251
 
231
252
  @config.user = "bar"
@@ -233,8 +254,8 @@ class BoxenConfigTest < Boxen::Test
233
254
  end
234
255
 
235
256
  def test_api
236
- @config.login = login = 'someuser'
237
- @config.password = pass = 's3kr!7'
257
+ @config.login = login = "someuser"
258
+ @config.password = pass = "s3kr!7"
238
259
 
239
260
  api = Object.new
240
261
  Octokit::Client.expects(:new).with(:login => login, :password => pass).once.returns(api)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 1
9
- version: 1.0.1
8
+ - 2
9
+ version: 1.0.2
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: 2013-02-14 00:00:00 -08:00
18
+ date: 2013-03-05 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency