shellutils 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -160,6 +160,10 @@ module ShellUtils
160
160
  File.open(file_path, "w") {|f| f.write(text)}
161
161
  end
162
162
 
163
+ def current_user
164
+ `whoami`.chomp
165
+ end
166
+
163
167
  private
164
168
 
165
169
  def get_config_header(config_title, comment_char)
@@ -1,3 +1,3 @@
1
1
  module Shellutils
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -4,19 +4,25 @@ require 'tempfile'
4
4
  module ShellUtils
5
5
  describe ShellUtils do
6
6
  describe ".sh" do
7
- it "exec shell command" do
7
+ it "should exec shell command" do
8
8
  ShellUtils.sh "pwd"
9
9
  end
10
10
  end
11
11
 
12
12
  describe ".sudo" do
13
- #it "exec shell command" do
14
- # ShellUtils.sudo "pwd"
15
- #end
13
+ it "should exec shell command" do
14
+ ShellUtils.sudo "pwd"
15
+ end
16
+ end
17
+
18
+ describe ".current_user" do
19
+ it "should get current user" do
20
+ ShellUtils.current_user.should == `whoami`.chomp
21
+ end
16
22
  end
17
23
 
18
- describe ".add_config_text" do
19
- it "add config text" do
24
+ describe ".add_config" do
25
+ it "should add config" do
20
26
  config_text = <<-EOF
21
27
  config1=value1
22
28
  config2=value2
@@ -29,7 +35,7 @@ config2=value2
29
35
  tf.close!
30
36
  end
31
37
 
32
- it "overwrite config text" do
38
+ it "should overwrite config if already exists" do
33
39
  config_text = <<-EOF
34
40
  config3=value3
35
41
  config4=value4
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shellutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: