sysadmin 0.0.1 → 0.0.2

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.1
1
+ 0.0.2
data/doc/ChangeLog CHANGED
@@ -1,73 +1,7 @@
1
- === 12.4.0 / 2012-04-30
2
-
3
- * Inspect SubCommand added to automatic-config.
4
-
5
- * Added Plugins.
6
-
7
- * Filter::Reverse
8
- * Publish::SMTP
9
- * Publish::Mail
10
-
11
- * Running all Integration Tests with CI.
12
-
13
-
14
- === 12.3.1 / 2012-03-16
15
-
16
- * English Documents.
17
-
18
- * doc/README
19
- * doc/PLUGINS
20
-
21
- * The user who installed the gem package be able to create own plugins.
22
-
23
- * ~/.automatic/plugins
24
-
25
- * Utils merged to automatic-config command and added following subcommand.
26
-
27
- * scaffold
28
- * autodiscovery
29
- * opmlparser
30
- * feedparser
31
- * log
32
-
33
- * Added Integration Test Script for CI.
34
-
35
- * script/build
36
-
37
-
38
- === 12.03 / 2012-03-07
39
-
40
- * Distribute as a gem library.
41
-
42
- * Plugins added.
43
-
44
- * CustomFeed::SVNLog
45
- * Notify::Ikachan
46
- * Filter::TumblrResize
47
- * Filter::Image
48
- * Store::TargetLink
49
-
50
- * CI / Build scripts.
51
-
52
- * script/bootstrap
53
-
54
- * Signficant Refactoring.
55
-
56
-
57
- === 12.02.1 / 2012-02-25
58
-
59
- * Point release.
60
-
61
- * Big Refactoring for core.
62
- * Reorganization of the namespace.
63
- * A few plugins added.
64
-
65
-
66
- === 12.02 / 2012-02-18
1
+ === 0.0.1 / 2012-05-23
67
2
 
68
3
  * First release.
69
4
 
70
- * Scratch of this script.
71
- * Plugin existing only for hatenabookmark.
5
+ * Add Sysadmin::FileString
72
6
 
73
7
 
data/lib/sysadmin.rb CHANGED
@@ -1,44 +1,19 @@
1
1
  #!/usr/bin/env ruby
2
2
  # Name:: Sysadmin::Ruby
3
3
  # Author:: 774 <http://id774.net>
4
- # Version:: 0.0.1
4
+ # Version:: 0.0.2
5
5
  # Created:: Mar 23, 2012
6
- # Updated:: Mar 23, 2012
6
+ # Updated:: Mar 24, 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
- require 'sysadmin/file_string'
12
-
13
- VERSION = "0.0.1"
11
+ VERSION = "0.0.2"
14
12
  USER_DIR = "/."
13
+ ROOT_DIR = File.expand_path("..", File.dirname(__FILE__))
14
+ $:.unshift ROOT_DIR
15
+ $:.unshift ROOT_DIR + '/lib'
16
+ $:.unshift ROOT_DIR + '/lib/sysadmin'
15
17
 
16
- class << self
17
- attr_accessor :root_dir
18
-
19
- def lib_dir
20
- File.join(@root_dir, "lib")
21
- end
22
-
23
- def config_dir
24
- File.join(@root_dir, "config")
25
- end
26
-
27
- def user_dir
28
- @user_dir
29
- end
30
-
31
- def user_dir=(_user_dir)
32
- if ENV["SYSADMIN_RUBY_ENV"] == "test" && !(_user_dir.nil?)
33
- @user_dir = _user_dir
34
- else
35
- @user_dir = File.expand_path("~/") + USER_DIR
36
- end
37
- end
38
-
39
- def user_plugins_dir
40
- File.join(@user_dir, "lib")
41
- end
42
- end
43
-
18
+ require 'file_string'
44
19
  end
@@ -1,7 +1,7 @@
1
1
  # Name:: Sysadmin::FileString
2
2
  # Author:: 774 <http://id774.net>
3
3
  # Created:: Mar 23, 2012
4
- # Updated:: Mar 23, 2012
4
+ # Updated:: Mar 24, 2012
5
5
  # Copyright:: 774 Copyright (c) 2012
6
6
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
7
7
 
@@ -18,6 +18,13 @@ module Sysadmin
18
18
  f.close
19
19
  end
20
20
 
21
+ def self.newfile(file, str)
22
+ f = open(file, 'w')
23
+ f << str
24
+ f << "\n"
25
+ f.close
26
+ end
27
+
21
28
  def self.replaceFile(f, src, out)
22
29
  f.rewind
23
30
  body = f.read
@@ -29,9 +36,9 @@ module Sysadmin
29
36
  end
30
37
 
31
38
  def self.replace(file, src, out)
32
- open(file,"r+") { |f|
39
+ open(file, "r+") { |f|
33
40
  f.flock(File::LOCK_EX)
34
- replaceFile(f,src,out)
41
+ replaceFile(f, src, out)
35
42
  f.truncate(f.tell)
36
43
  }
37
44
  end
@@ -41,7 +48,7 @@ module Sysadmin
41
48
  IO.foreach(file) { |line|
42
49
  out << line unless line.include?(str)
43
50
  }
44
- open(file,"w") { |f|
51
+ open(file, "w") { |f|
45
52
  f.write out
46
53
  }
47
54
  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.1"
8
+ s.version = "0.0.2"
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-23"
12
+ s.date = "2012-05-24"
13
13
  s.description = "System Administration General Library"
14
14
  s.email = "idnanashi@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -26,6 +26,21 @@ class Test_FileString < Test::Unit::TestCase
26
26
  }
27
27
  end
28
28
 
29
+ def test_newfile
30
+ init = 'init'
31
+ second = 'second'
32
+ expect = "second\n"
33
+
34
+ Sysadmin::FileString.newfile(@testfile, init)
35
+ Sysadmin::FileString.newfile(@testfile, second)
36
+
37
+ open(@testfile) { |file|
38
+ while line = file.gets
39
+ assert_equal(expect, line)
40
+ end
41
+ }
42
+ end
43
+
29
44
  def test_replace
30
45
  src = 'hoge'
31
46
  try = 'fuga'
@@ -8,6 +8,9 @@ require 'sysadmin'
8
8
 
9
9
  class Test_Sysadmin < Test::Unit::TestCase
10
10
  def test_version
11
- p Sysadmin.const_get(:VERSION)
11
+ expect = '0.0.2'
12
+ version = Sysadmin.const_get(:VERSION)
13
+ p "sysadmin #{version}"
14
+ assert_equal(expect, version)
12
15
  end
13
16
  end
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.1
4
+ version: 0.0.2
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-23 00:00:00.000000000 Z
12
+ date: 2012-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber