masquerade 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = Changelog
2
2
 
3
+ == Release 0.30 - April 14, 2011
4
+
5
+ * CHANGE: Use yield instead of block.call to invoke block
6
+
3
7
  == Release 0.2.0 - April 13, 2011
4
8
 
5
9
  * NEW: Support for uid and gid as valid :user and :group values
data/Manifest CHANGED
@@ -3,3 +3,4 @@ Manifest
3
3
  README.rdoc
4
4
  Rakefile
5
5
  lib/masquerade.rb
6
+ masquerade.gemspec
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require "rubygems"
2
2
  require "rake"
3
3
  require "echoe"
4
4
 
5
- Echoe.new("masquerade", "0.2.0") do |p|
5
+ Echoe.new("masquerade", "0.3.0") do |p|
6
6
  p.description = "A user/group impersonator"
7
7
  p.summary = "Run a block of code as another user/group."
8
8
  p.url = "http://rubygems.org/gems/masquerade"
data/lib/masquerade.rb CHANGED
@@ -46,11 +46,11 @@ Returns the result of the block call. So you can do:
46
46
  end
47
47
  =end
48
48
  module Masquerade
49
- def self.as(who, &block)
49
+ def self.as(who)
50
50
  begin
51
51
  current_uid = Process.uid
52
52
  current_gid = Process.gid
53
- if who.include?(:user)
53
+ if who.include? :user
54
54
  user_struct = nil
55
55
  if who[:user].kind_of? String
56
56
  # get user info by name
@@ -62,7 +62,7 @@ module Masquerade
62
62
  # set the uid of the current process to that of the chosen user
63
63
  Process.uid = user_struct.uid
64
64
  end
65
- if who.include?(:group)
65
+ if who.include? :group
66
66
  group_struct = nil
67
67
  if who[:group].kind_of? String
68
68
  # get group info by name
@@ -75,7 +75,7 @@ module Masquerade
75
75
  Process.gid = group_struct.gid
76
76
  end
77
77
  # run the block
78
- response = block.call(who)
78
+ response = yield who
79
79
  # restore process uid and gid
80
80
  Process.uid = current_uid
81
81
  Process.gid = current_gid
data/masquerade.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{masquerade}
5
- s.version = "0.2.0"
5
+ s.version = "0.3.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Nitesh Goel"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masquerade
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nitesh Goel