sysadmin 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/lib/sysadmin.rb CHANGED
@@ -3,12 +3,12 @@
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Version:: 0.0.3
5
5
  # Created:: Mar 23, 2012
6
- # Updated:: Mar 28, 2012
6
+ # Updated:: Jun 05, 2012
7
7
  # Copyright:: 774 Copyright (c) 2012
8
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
9
 
10
10
  module Sysadmin
11
- VERSION = "0.0.3"
11
+ VERSION = "0.0.4"
12
12
  USER_DIR = "/."
13
13
  ROOT_DIR = File.expand_path("..", File.dirname(__FILE__))
14
14
  $:.unshift ROOT_DIR
@@ -36,25 +36,20 @@ module Sysadmin
36
36
  end
37
37
 
38
38
  def self.replace(file, src, out)
39
- file.flock(File::LOCK_EX)
40
39
  open(file, "r+") { |f|
41
40
  replaceFile(f, src, out)
42
41
  f.truncate(f.tell)
43
42
  }
44
- file.flock(File::LOCK_UN)
45
43
  end
46
44
 
47
45
  def self.delete(file, str)
48
46
  out = ""
49
- file.flock(File::LOCK_SH)
50
47
  IO.foreach(file) { |line|
51
48
  out << line unless line.include?(str)
52
49
  }
53
- file.flock(File::LOCK_EX)
54
50
  open(file, "w") { |f|
55
51
  f.write out
56
52
  }
57
- file.flock(File::LOCK_UN)
58
53
  end
59
54
  end
60
55
  end
data/sysadmin.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "sysadmin"
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["id774"]
12
- s.date = "2012-05-28"
12
+ s.date = "2012-06-05"
13
13
  s.description = "System Administration General Library"
14
14
  s.email = "idnanashi@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -16,10 +16,10 @@ class Test_FileString < Test::Unit::TestCase
16
16
  expect = "hoge\n"
17
17
 
18
18
  3.times do
19
- Sysadmin::FileString.append(@testfile, src)
19
+ Sysadmin::FileString.append(@testfile.path, src)
20
20
  end
21
21
 
22
- open(@testfile) { |file|
22
+ open(@testfile.path) { |file|
23
23
  while line = file.gets
24
24
  assert_equal(expect, line)
25
25
  end
@@ -32,11 +32,11 @@ class Test_FileString < Test::Unit::TestCase
32
32
  expect = "fuga\n"
33
33
 
34
34
  3.times do
35
- Sysadmin::FileString.append(@testfile, src)
35
+ Sysadmin::FileString.append(@testfile.path, src)
36
36
  end
37
- Sysadmin::FileString.replace(@testfile, src, try)
37
+ Sysadmin::FileString.replace(@testfile.path, src, try)
38
38
 
39
- open(@testfile) { |file|
39
+ open(@testfile.path) { |file|
40
40
  while line = file.gets
41
41
  assert_equal(expect, line)
42
42
  end
@@ -50,15 +50,15 @@ class Test_FileString < Test::Unit::TestCase
50
50
  expect = "fuga\n"
51
51
 
52
52
  3.times do
53
- Sysadmin::FileString.append(@testfile, src)
53
+ Sysadmin::FileString.append(@testfile.path, src)
54
54
  end
55
- Sysadmin::FileString.replace(@testfile, src, replace)
55
+ Sysadmin::FileString.replace(@testfile.path, src, replace)
56
56
  2.times do
57
- Sysadmin::FileString.append(@testfile, src)
57
+ Sysadmin::FileString.append(@testfile.path, src)
58
58
  end
59
- Sysadmin::FileString.delete(@testfile, erase)
59
+ Sysadmin::FileString.delete(@testfile.path, erase)
60
60
 
61
- open(@testfile) { |file|
61
+ open(@testfile.path) { |file|
62
62
  while line = file.gets
63
63
  assert_equal(expect, line)
64
64
  end
@@ -16,10 +16,10 @@ class Test_FileString < Test::Unit::TestCase
16
16
  second = 'second'
17
17
  expect = "second\n"
18
18
 
19
- Sysadmin::FileString.newfile(@testfile, init)
20
- Sysadmin::FileString.newfile(@testfile, second)
19
+ Sysadmin::FileString.newfile(@testfile.path, init)
20
+ Sysadmin::FileString.newfile(@testfile.path, second)
21
21
 
22
- open(@testfile) { |file|
22
+ open(@testfile.path) { |file|
23
23
  while line = file.gets
24
24
  assert_equal(expect, line)
25
25
  end
@@ -8,7 +8,7 @@ require 'sysadmin'
8
8
 
9
9
  class Test_Sysadmin < Test::Unit::TestCase
10
10
  def test_version
11
- expect = '0.0.3'
11
+ expect = '0.0.4'
12
12
  version = Sysadmin.const_get(:VERSION)
13
13
  p "sysadmin #{version}"
14
14
  assert_equal(expect, version)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sysadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-28 00:00:00.000000000 Z
12
+ date: 2012-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber