epi 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3407cf0d6cd14e76d66934e948493fa65c4999d5
4
- data.tar.gz: bfc5f0c3ec9a6ae778799e3ab160627cd3459fa9
3
+ metadata.gz: 66b9988a9dbc6d3cbacd39fd072b343c6175eaab
4
+ data.tar.gz: a0f18a237c97efb644e0afeb7e8a61b9d5680edf
5
5
  SHA512:
6
- metadata.gz: 1db54013d3e5e312aaca6cebbaf9d02fe2b0ec5823190807e2c288b6458f51147c50faf6761d959e92e2cd27c8d3d756b5f0c5804ad8750bddb8526982aab077
7
- data.tar.gz: 7609356cc3624f8b81bc25b8e156cbdb3690f4747d49796f40298fbfd8d41df23d39d7c8e5b6a235e28639cdb089c49466750e15f68481556603b41b62763f14
6
+ metadata.gz: 584215c982e7ba5c564033e6ae248f123ae8935b487c90be273795e4ecf45b82a89a526e1ffcb76ff57c85bc459e978c0b87e896abc2fffc4e1a3bda2f163c90
7
+ data.tar.gz: 55665a0b346ca8188f1c9945ee21610b759ca70f0e31ef70ca4b0e1aaa7b09d2427e6a4675c313628427dc11dbce9180af7ffbd5f3ef2cdb3e6df087ce99e179
@@ -11,7 +11,7 @@ module Epi
11
11
  class << self
12
12
 
13
13
  def user_name(uid)
14
- @users[uid.to_i] ||= `id -un #{uid}`.chomp
14
+ @users[uid.to_i] ||= %x[#{username_lookup_cmd % uid}].chomp
15
15
  end
16
16
 
17
17
  def group_name(gid)
@@ -24,6 +24,11 @@ module Epi
24
24
  @groups ||= read_groups
25
25
  end
26
26
 
27
+ def username_lookup_cmd
28
+ # Use `id -un` on Mac OS, and `getent passwd` on Linux
29
+ @username_lookup_cmd ||= `uname`.chomp == 'Darwin' ? 'id -un %s' : 'getent passwd %s | cut -d: -f1'
30
+ end
31
+
27
32
  def read_groups
28
33
  {}.tap do |result|
29
34
  File.readlines('/etc/group').each do |line|
@@ -1,3 +1,3 @@
1
1
  module Epi
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil E. Pearson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-24 00:00:00.000000000 Z
11
+ date: 2014-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -106,4 +106,3 @@ signing_key:
106
106
  specification_version: 4
107
107
  summary: Epinephrine
108
108
  test_files: []
109
- has_rdoc: