vcs 0.1 → 0.2.148

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.
Files changed (132) hide show
  1. data/Rakefile +17 -3
  2. data/bin/vcs +57 -34
  3. data/doc/jamis.rb +564 -0
  4. data/ruby_ex/abstract.rb +254 -0
  5. data/ruby_ex/abstract_node.rb +85 -0
  6. data/ruby_ex/algorithms/simulated_annealing.rb +140 -0
  7. data/ruby_ex/array_each_pair.rb +18 -0
  8. data/ruby_ex/ask.rb +101 -0
  9. data/ruby_ex/attributed_class.rb +302 -0
  10. data/ruby_ex/cache.rb +373 -0
  11. data/ruby_ex/checkout.rb +12 -0
  12. data/ruby_ex/choose.rb +271 -0
  13. data/ruby_ex/commands.rb +18 -0
  14. data/ruby_ex/commands/command.rb +401 -0
  15. data/ruby_ex/commands/datas.rb +16 -0
  16. data/ruby_ex/commands/datas/data.rb +33 -0
  17. data/ruby_ex/commands/datas/factory.rb +66 -0
  18. data/ruby_ex/commands/factory.rb +66 -0
  19. data/ruby_ex/commands/helpers.rb +67 -0
  20. data/ruby_ex/commands/pipe.rb +64 -0
  21. data/ruby_ex/commands/runners.rb +17 -0
  22. data/ruby_ex/commands/runners/exec.rb +49 -0
  23. data/ruby_ex/commands/runners/fork.rb +97 -0
  24. data/ruby_ex/commands/runners/runner.rb +107 -0
  25. data/ruby_ex/commands/seq.rb +27 -0
  26. data/ruby_ex/config_file.rb +96 -0
  27. data/ruby_ex/const_regexp.rb +59 -0
  28. data/ruby_ex/daemon.rb +134 -0
  29. data/ruby_ex/diff.rb +667 -0
  30. data/ruby_ex/dlogger.rb +62 -0
  31. data/ruby_ex/drb/dispatcher.rb +252 -0
  32. data/ruby_ex/drb/dispatcher_server_test.rb +29 -0
  33. data/ruby_ex/drb/drb_observable.rb +97 -0
  34. data/ruby_ex/drb/drb_observable_pool.rb +27 -0
  35. data/ruby_ex/drb/drb_service.rb +43 -0
  36. data/ruby_ex/drb/drb_undumped_attributes.rb +55 -0
  37. data/ruby_ex/drb/drb_undumped_indexed_object.rb +54 -0
  38. data/ruby_ex/drb/insecure_protected_methods.rb +103 -0
  39. data/ruby_ex/drb/session_client_test.rb +40 -0
  40. data/ruby_ex/drb/session_manager.rb +246 -0
  41. data/ruby_ex/drb/session_server.rb +53 -0
  42. data/ruby_ex/dtime.rb +143 -0
  43. data/ruby_ex/dumpable_proc.rb +63 -0
  44. data/ruby_ex/exception.rb +32 -0
  45. data/ruby_ex/filetype.rb +229 -0
  46. data/ruby_ex/fileutils_ex.rb +44 -0
  47. data/ruby_ex/fold.rb +58 -0
  48. data/ruby_ex/generate_id.rb +44 -0
  49. data/ruby_ex/hookable.rb +262 -0
  50. data/ruby_ex/hooker.rb +54 -0
  51. data/ruby_ex/inactive_timeout.rb +137 -0
  52. data/ruby_ex/indexed_node.rb +66 -0
  53. data/ruby_ex/io_marshal.rb +100 -0
  54. data/ruby_ex/ioo.rb +194 -0
  55. data/ruby_ex/labeled_node.rb +63 -0
  56. data/ruby_ex/logger_observer.rb +23 -0
  57. data/ruby_ex/md5sum.rb +66 -0
  58. data/ruby_ex/mktemp.rb +208 -0
  59. data/ruby_ex/module/attr_once.rb +36 -0
  60. data/ruby_ex/module/autoload_tree.rb +75 -0
  61. data/ruby_ex/module/hierarchy.rb +335 -0
  62. data/ruby_ex/module/instance_method_visibility.rb +73 -0
  63. data/ruby_ex/module_ex.rb +11 -0
  64. data/ruby_ex/node.rb +80 -0
  65. data/ruby_ex/object_monitor.rb +145 -0
  66. data/ruby_ex/object_monitor_activity.rb +33 -0
  67. data/ruby_ex/observable.rb +140 -0
  68. data/ruby_ex/observable_pool.rb +293 -0
  69. data/ruby_ex/orderedhash.rb +252 -0
  70. data/ruby_ex/pathname_ex.rb +152 -0
  71. data/ruby_ex/pp_hierarchy.rb +29 -0
  72. data/ruby_ex/pseudo_cache.rb +190 -0
  73. data/ruby_ex/queue.rb +56 -0
  74. data/ruby_ex/random_generators.rb +25 -0
  75. data/ruby_ex/random_generators/random_generator.rb +31 -0
  76. data/ruby_ex/random_generators/ruby.rb +23 -0
  77. data/ruby_ex/safe_eval.rb +348 -0
  78. data/ruby_ex/sendmail.rb +215 -0
  79. data/ruby_ex/service_manager.rb +121 -0
  80. data/ruby_ex/session/administrable.rb +120 -0
  81. data/ruby_ex/session/client.rb +153 -0
  82. data/ruby_ex/session/const.rb +18 -0
  83. data/ruby_ex/session/dispatcher.rb +184 -0
  84. data/ruby_ex/session/error.rb +21 -0
  85. data/ruby_ex/session/fetchable.rb +57 -0
  86. data/ruby_ex/session/fetcher.rb +62 -0
  87. data/ruby_ex/session/hookable.rb +26 -0
  88. data/ruby_ex/session/profile.rb +110 -0
  89. data/ruby_ex/session/server.rb +582 -0
  90. data/ruby_ex/session/test/administrable_test.rb +337 -0
  91. data/ruby_ex/session/test/basic_test.rb +523 -0
  92. data/ruby_ex/session/test/dispatcher_test.rb +409 -0
  93. data/ruby_ex/session/test/fetchable_test.rb +119 -0
  94. data/ruby_ex/session/test/sub_server_test.rb +188 -0
  95. data/ruby_ex/shuffle.rb +30 -0
  96. data/ruby_ex/spring.rb +136 -0
  97. data/ruby_ex/spring_set.rb +137 -0
  98. data/ruby_ex/string_ex.rb +28 -0
  99. data/ruby_ex/symtbl.rb +106 -0
  100. data/ruby_ex/synflow.rb +474 -0
  101. data/ruby_ex/test/unit/ui/yaml/testrunner.rb +164 -0
  102. data/ruby_ex/thread_mutex.rb +10 -0
  103. data/ruby_ex/timeout_ex.rb +81 -0
  104. data/ruby_ex/top_down.rb +73 -0
  105. data/ruby_ex/trace.rb +26 -0
  106. data/ruby_ex/uri/druby.rb +81 -0
  107. data/ruby_ex/uri/file.rb +65 -0
  108. data/ruby_ex/uri/ftp_ex.rb +37 -0
  109. data/ruby_ex/uri/http_ex.rb +43 -0
  110. data/ruby_ex/uri/ssh.rb +92 -0
  111. data/ruby_ex/uri/svn.rb +118 -0
  112. data/ruby_ex/uri_ex.rb +45 -0
  113. data/ruby_ex/verbose_object.rb +30 -0
  114. data/ruby_ex/version.rb +66 -0
  115. data/ruby_ex/yaml/basenode_ext.rb +63 -0
  116. data/ruby_ex/yaml/chop_header.rb +23 -0
  117. data/ruby_ex/yaml/transform.rb +449 -0
  118. data/ruby_ex/yaml/yregexpath.rb +76 -0
  119. data/src/changelog.rb +28 -18
  120. data/src/conflict.rb +20 -0
  121. data/src/diff.rb +18 -0
  122. data/src/diffstat.rb +9 -3
  123. data/src/last_changed_date.rb +18 -0
  124. data/src/mail.rb +33 -65
  125. data/src/message.rb +15 -9
  126. data/src/mycommit.rb +29 -14
  127. data/src/news.rb +24 -3
  128. data/src/status.rb +17 -0
  129. data/src/svn.rb +2 -2
  130. data/src/vcs.rb +24 -3
  131. metadata +124 -5
  132. data/lrdetools.rb +0 -12
@@ -0,0 +1,16 @@
1
+ # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
2
+ # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
3
+ # License:: GNU General Public License (GPL).
4
+ # Revision:: $Id: datas.rb 221 2005-05-09 12:40:57Z ertai $
5
+
6
+ require 'module/autoload_tree'
7
+
8
+ module Commands
9
+
10
+ module Datas
11
+
12
+ autoloaded_module(__FILE__)
13
+
14
+ end # module Datas
15
+
16
+ end # module Commands
@@ -0,0 +1,33 @@
1
+ # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
2
+ # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
3
+ # License:: GNU General Public License (GPL).
4
+ # Revision:: $Id: data.rb 221 2005-05-09 12:40:57Z ertai $
5
+
6
+ module Commands
7
+
8
+ module Datas
9
+
10
+ #
11
+ # A CommandData instance contains all information returned by a Command#run:
12
+ #
13
+ # * It's exit status:
14
+ # - Exit number.
15
+ # - Signals
16
+ # - ...
17
+ #
18
+ # * It's outputs:
19
+ # - What it writes on stdout.
20
+ # - stderr.
21
+ class Data
22
+
23
+ attr_accessor :pid
24
+ attr_accessor :input
25
+ attr_accessor :output
26
+ attr_accessor :error
27
+ attr_accessor :status
28
+
29
+ end # class Data
30
+
31
+ end # module Datas
32
+
33
+ end # module Commands
@@ -0,0 +1,66 @@
1
+ # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
2
+ # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
3
+ # License:: GNU General Public License (GPL).
4
+ # Revision:: $Id: factory.rb 221 2005-05-09 12:40:57Z ertai $
5
+
6
+ module Commands
7
+
8
+ module Datas
9
+
10
+ class Factory < Data
11
+
12
+ attr_accessor :command_data_class
13
+
14
+ def initialize
15
+ @command_data_class = Data
16
+ end
17
+
18
+ def new_command_data ( *a, &b )
19
+ data = @command_data_class.new(*a, &b)
20
+ instance_variables.each do |var|
21
+ next if var =~ /command_data_class/
22
+ data.send(var[1..-1] + '=', instance_variable_get(var))
23
+ end
24
+ data
25
+ end
26
+
27
+ alias :create :new_command_data
28
+
29
+ end # class Factory
30
+
31
+
32
+
33
+ if $0 == __FILE__
34
+ require 'test/unit'
35
+
36
+ class FactoryTest < Test::Unit::TestCase
37
+
38
+ def setup
39
+ assert_nothing_raised { @fa = Factory.new }
40
+ end
41
+
42
+ def test_0_initialize
43
+ end
44
+
45
+ def test_new_command_data
46
+ assert_nothing_raised do
47
+ assert_kind_of(Data, @fa.create)
48
+ assert_kind_of(Data, @fa.new_command_data)
49
+ end
50
+ end
51
+
52
+ def test_simple
53
+ assert_nothing_raised do
54
+ @fa.pid = 42
55
+ @data = @fa.create
56
+ end
57
+ assert_equal(42, @data.pid)
58
+ end
59
+
60
+ end # class FactoryTest
61
+
62
+ end
63
+
64
+ end # module Datas
65
+
66
+ end # module Commands
@@ -0,0 +1,66 @@
1
+ # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
2
+ # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
3
+ # License:: GNU General Public License (GPL).
4
+ # Revision:: $Id: factory.rb 221 2005-05-09 12:40:57Z ertai $
5
+
6
+ module Commands
7
+
8
+ class Factory < Command
9
+
10
+ def initialize
11
+ super(nil)
12
+ @command_class = Command
13
+ end
14
+
15
+ def new_command ( *a, &b )
16
+ cmd = @command_class.new(*a, &b)
17
+ instance_variables.each do |var|
18
+ next if var =~ /^@command(_class)?$/
19
+ cmd.send(var[1..-1] + '=', instance_variable_get(var))
20
+ end
21
+ cmd
22
+ end
23
+
24
+ alias :create :new_command
25
+
26
+ end # class Factory
27
+
28
+
29
+
30
+ if $0 == __FILE__
31
+ require 'test/unit'
32
+
33
+ class FactoryTest < Test::Unit::TestCase
34
+
35
+ def setup
36
+ assert_nothing_raised { @fa = Factory.new }
37
+ end
38
+
39
+ def test_0_initialize
40
+ end
41
+
42
+ def test_new_command
43
+ assert_nothing_raised do
44
+ assert_kind_of(Command, @fa.create('wc'))
45
+ assert_kind_of(Command, @fa.new_command('ls'))
46
+ end
47
+ end
48
+
49
+ def test_simple
50
+ assert_nothing_raised do
51
+ @fa << 42
52
+ @fa.input = 'inp'
53
+ @fa = @fa > 'out'
54
+ @cmd = @fa.create('foo')
55
+ end
56
+ assert_equal('foo', @cmd.command)
57
+ assert_equal(42, @cmd.arg_list.first)
58
+ assert_equal('inp', @cmd.input)
59
+ assert_equal('out', @cmd.output)
60
+ end
61
+
62
+ end # class FactoryTest
63
+
64
+ end
65
+
66
+ end # module Commands
@@ -0,0 +1,67 @@
1
+ # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
2
+ # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
3
+ # License:: GNU General Public License (GPL).
4
+ # Revision:: $Id: helpers.rb 221 2005-05-09 12:40:57Z ertai $
5
+
6
+ module Commands
7
+
8
+ module Helpers
9
+
10
+ class ::String
11
+
12
+ #
13
+ # Make a command from a String.
14
+ #
15
+ # Split your command when no quotations are used.
16
+ #
17
+ # Do not touch the String and give as one argument.
18
+ def to_cmd
19
+ if self =~ /['"`]/
20
+ Command.new(self)
21
+ else
22
+ Command.new(*split(/\s+/))
23
+ end
24
+ end
25
+
26
+ end # class ::String
27
+
28
+
29
+
30
+ class ::Array
31
+
32
+ def to_cmd
33
+ Command.new(*self)
34
+ end
35
+
36
+ end # class ::Array
37
+
38
+ end # module Helpers
39
+
40
+
41
+
42
+ if __FILE__ == $0
43
+
44
+ require 'test/unit'
45
+
46
+ class HelpersTest < Test::Unit::TestCase
47
+
48
+ def test_string_to_cmd
49
+ assert_equal(['foo', 'bar'], "foo bar".to_cmd.to_a)
50
+
51
+ assert_equal(['foo', 'b/ar', 'qu44x32'],
52
+ "foo b/ar \t \n qu44x32".to_cmd.to_a)
53
+
54
+ s = "foo 'b/ar \t' \n qu44x32"
55
+ assert_equal([s], s.to_cmd.to_a)
56
+ end
57
+
58
+ def test_array_to_cmd
59
+ a = ['foo', "b/ar \t", "\n qu44x32"]
60
+ assert_equal(a, a.to_cmd.to_a)
61
+ end
62
+
63
+ end # class HelpersTest
64
+
65
+ end
66
+
67
+ end # module Commands
@@ -0,0 +1,64 @@
1
+ # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
2
+ # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
3
+ # License:: GNU General Public License (GPL).
4
+ # Revision:: $Id: pipe.rb 221 2005-05-09 12:40:57Z ertai $
5
+
6
+ module Commands
7
+
8
+ class Pipe < Command
9
+
10
+ def initialize ( *cmds )
11
+ @cmds = cmds.map { |x| x.dup }
12
+ end
13
+
14
+ def run ( *a )
15
+ pids = []
16
+ ([nil] + @cmds).zip(@cmds + [nil]).each do |cmd1, cmd2|
17
+ next if cmd1.nil? or cmd2.nil?
18
+ rd, wr = IO.pipe
19
+ cmd1.output = wr
20
+ cmd2.input = rd
21
+ pids << fork do
22
+ rd.close
23
+ cmd1.exec
24
+ end
25
+ wr.close
26
+ end
27
+ pids << fork do
28
+ @cmds.last.exec
29
+ end
30
+ pids.each { |pid| Process.waitpid pid }
31
+ end
32
+
33
+ def input= ( arg )
34
+ @cmds.first.input = arg
35
+ end
36
+
37
+ def input
38
+ @cmds.first.input
39
+ end
40
+
41
+ def output= ( arg )
42
+ @cmds.last.output = arg
43
+ end
44
+
45
+ def output
46
+ @cmds.last.output
47
+ end
48
+
49
+ def error= ( arg )
50
+ @cmds.last.error = arg
51
+ end
52
+
53
+ def error
54
+ @cmds.last.error
55
+ end
56
+
57
+ def to_sh
58
+ strs = @cmds.map { |cmd| "(#{cmd.to_sh})" }
59
+ "(#{strs.join(' | ')})#{sh_args}"
60
+ end
61
+
62
+ end # class Pipe
63
+
64
+ end # module Commands
@@ -0,0 +1,17 @@
1
+ # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
2
+ # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
3
+ # License:: GNU General Public License (GPL).
4
+ # Revision:: $Id: runners.rb 221 2005-05-09 12:40:57Z ertai $
5
+
6
+ require 'module/autoload_tree'
7
+ require 'abstract'
8
+ require 'hookable'
9
+ require 'hooker'
10
+
11
+ module Commands
12
+
13
+ module Runners
14
+ autoloaded_module(__FILE__)
15
+ end # module Runners
16
+
17
+ end # module Commands
@@ -0,0 +1,49 @@
1
+ # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
2
+ # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
3
+ # License:: GNU General Public License (GPL).
4
+ # Revision:: $Id: exec.rb 221 2005-05-09 12:40:57Z ertai $
5
+
6
+ module Commands
7
+
8
+ module Runners
9
+
10
+ class Exec < Runner
11
+ concrete
12
+
13
+ def exec ( aCommand, data )
14
+ Kernel.exec(*aCommand.to_a)
15
+ end
16
+
17
+ end # class Exec
18
+
19
+
20
+
21
+ if $0 == __FILE__
22
+ require 'test/unit'
23
+
24
+ class ExecTest < Test::Unit::TestCase
25
+
26
+ def setup
27
+ assert_nothing_raised { @runner = Exec.new }
28
+ end
29
+
30
+ def test_0_initialize
31
+ end
32
+
33
+ def test_simple
34
+ TempPath.new do |tmp|
35
+ cmd = %Q[ruby -e "File.open('#{tmp}', 'w') { |f| f.puts :foo }"]
36
+ pid = fork do
37
+ @runner.run(cmd.to_cmd)
38
+ end
39
+ Process.waitpid pid
40
+ end
41
+ end
42
+
43
+ end # class ExecTest
44
+
45
+ end
46
+
47
+ end # module Runners
48
+
49
+ end # module Commands
@@ -0,0 +1,97 @@
1
+ # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
2
+ # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
3
+ # License:: GNU General Public License (GPL).
4
+ # Revision:: $Id: fork.rb 221 2005-05-09 12:40:57Z ertai $
5
+
6
+ module Commands
7
+
8
+ module Runners
9
+
10
+ class Fork < Exec
11
+ concrete
12
+
13
+ #
14
+ # Hooks declaration
15
+ #
16
+
17
+ hook_declare :exception_raised_during_exec
18
+ hook_declare :already_killed
19
+ hook_declare :waitpid
20
+ hook_declare :son
21
+ hook_declare :kill
22
+
23
+ #
24
+ # Methods
25
+ #
26
+
27
+ def run_impl ( aCommand, data )
28
+ data.pid = Kernel.fork do
29
+ begin
30
+ hook_trigger :son, aCommand, data
31
+ super
32
+ rescue Exception => ex
33
+ hook_trigger :exception_raised_during_exec, ex
34
+ end
35
+ end
36
+ hook_trigger :waitpid, data
37
+ end
38
+
39
+
40
+ def abort ( data )
41
+ if data.pid
42
+ begin
43
+ hook_trigger :kill, data
44
+ hook_trigger :waitpid, data
45
+ rescue Errno::ESRCH
46
+ hook_trigger :already_killed, data.pid
47
+ end
48
+ end
49
+ super
50
+ end
51
+
52
+
53
+ def waitpid ( data )
54
+ Process.waitpid(data.pid)
55
+ data.status = $?
56
+ end
57
+
58
+
59
+ def exception_raised_during_exec ( anException )
60
+ exit! 127
61
+ end
62
+
63
+
64
+ def kill ( data )
65
+ Process.kill('-KILL', -data.pid)
66
+ end
67
+
68
+ end # class Fork
69
+
70
+
71
+
72
+ if $0 == __FILE__
73
+ require 'test/unit'
74
+
75
+ class ForkTest < Test::Unit::TestCase
76
+
77
+ def setup
78
+ assert_nothing_raised { @runner = Fork.new }
79
+ end
80
+
81
+ def test_0_initialize
82
+ end
83
+
84
+ def test_simple
85
+ TempPath.new do |tmp|
86
+ cmd = %Q[ruby -e "File.open('#{tmp}', 'w') { |f| f.puts :foo }"]
87
+ @runner.run(cmd.to_cmd)
88
+ end
89
+ end
90
+
91
+ end # class Fork
92
+
93
+ end
94
+
95
+ end # module Runners
96
+
97
+ end # module Commands