vcs 0.2.148 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. data/AUTHORS +6 -0
  2. data/NEWS +9 -0
  3. data/README +82 -0
  4. data/Rakefile +7 -72
  5. data/SPEC.dyn.yml +10 -0
  6. data/SPEC.gemspec +14 -0
  7. data/SPEC.yml +39 -0
  8. data/bin/vcs +18 -16
  9. data/lib/vcs/changelog.rb +164 -0
  10. data/lib/vcs/conflict.rb +21 -0
  11. data/{src → lib/vcs}/cvs.rb +1 -1
  12. data/{src → lib/vcs}/diff.rb +2 -2
  13. data/lib/vcs/diffstat.rb +28 -0
  14. data/lib/vcs/edit.rb +16 -0
  15. data/{src → lib/vcs}/last_changed_date.rb +3 -5
  16. data/{src → lib/vcs}/mail.rb +4 -4
  17. data/lib/vcs/message.rb +79 -0
  18. data/{src → lib/vcs}/mycommit.rb +15 -15
  19. data/{src → lib/vcs}/news.rb +6 -6
  20. data/{src → lib/vcs}/prcs.rb +1 -1
  21. data/{src → lib/vcs}/revision.rb +3 -4
  22. data/lib/vcs/script.rb +19 -0
  23. data/{src → lib/vcs}/status.rb +1 -1
  24. data/{src → lib/vcs}/svn.rb +3 -5
  25. data/lib/vcs/url.rb +16 -0
  26. data/lib/vcs/vcs.rb +279 -0
  27. metadata +52 -150
  28. data/TODO +0 -19
  29. data/doc/jamis.rb +0 -564
  30. data/ruby_ex/abstract.rb +0 -254
  31. data/ruby_ex/abstract_node.rb +0 -85
  32. data/ruby_ex/algorithms/simulated_annealing.rb +0 -140
  33. data/ruby_ex/array_each_pair.rb +0 -18
  34. data/ruby_ex/ask.rb +0 -101
  35. data/ruby_ex/attributed_class.rb +0 -302
  36. data/ruby_ex/cache.rb +0 -373
  37. data/ruby_ex/checkout.rb +0 -12
  38. data/ruby_ex/choose.rb +0 -271
  39. data/ruby_ex/commands.rb +0 -18
  40. data/ruby_ex/commands/command.rb +0 -401
  41. data/ruby_ex/commands/datas.rb +0 -16
  42. data/ruby_ex/commands/datas/data.rb +0 -33
  43. data/ruby_ex/commands/datas/factory.rb +0 -66
  44. data/ruby_ex/commands/factory.rb +0 -66
  45. data/ruby_ex/commands/helpers.rb +0 -67
  46. data/ruby_ex/commands/pipe.rb +0 -64
  47. data/ruby_ex/commands/runners.rb +0 -17
  48. data/ruby_ex/commands/runners/exec.rb +0 -49
  49. data/ruby_ex/commands/runners/fork.rb +0 -97
  50. data/ruby_ex/commands/runners/runner.rb +0 -107
  51. data/ruby_ex/commands/seq.rb +0 -27
  52. data/ruby_ex/config_file.rb +0 -96
  53. data/ruby_ex/const_regexp.rb +0 -59
  54. data/ruby_ex/daemon.rb +0 -134
  55. data/ruby_ex/diff.rb +0 -667
  56. data/ruby_ex/dlogger.rb +0 -62
  57. data/ruby_ex/drb/dispatcher.rb +0 -252
  58. data/ruby_ex/drb/dispatcher_server_test.rb +0 -29
  59. data/ruby_ex/drb/drb_observable.rb +0 -97
  60. data/ruby_ex/drb/drb_observable_pool.rb +0 -27
  61. data/ruby_ex/drb/drb_service.rb +0 -43
  62. data/ruby_ex/drb/drb_undumped_attributes.rb +0 -55
  63. data/ruby_ex/drb/drb_undumped_indexed_object.rb +0 -54
  64. data/ruby_ex/drb/insecure_protected_methods.rb +0 -103
  65. data/ruby_ex/drb/session_client_test.rb +0 -40
  66. data/ruby_ex/drb/session_manager.rb +0 -246
  67. data/ruby_ex/drb/session_server.rb +0 -53
  68. data/ruby_ex/dtime.rb +0 -143
  69. data/ruby_ex/dumpable_proc.rb +0 -63
  70. data/ruby_ex/exception.rb +0 -32
  71. data/ruby_ex/filetype.rb +0 -229
  72. data/ruby_ex/fileutils_ex.rb +0 -44
  73. data/ruby_ex/fold.rb +0 -58
  74. data/ruby_ex/generate_id.rb +0 -44
  75. data/ruby_ex/hookable.rb +0 -262
  76. data/ruby_ex/hooker.rb +0 -54
  77. data/ruby_ex/inactive_timeout.rb +0 -137
  78. data/ruby_ex/indexed_node.rb +0 -66
  79. data/ruby_ex/io_marshal.rb +0 -100
  80. data/ruby_ex/ioo.rb +0 -194
  81. data/ruby_ex/labeled_node.rb +0 -63
  82. data/ruby_ex/logger_observer.rb +0 -23
  83. data/ruby_ex/md5sum.rb +0 -66
  84. data/ruby_ex/mktemp.rb +0 -208
  85. data/ruby_ex/module/attr_once.rb +0 -36
  86. data/ruby_ex/module/autoload_tree.rb +0 -75
  87. data/ruby_ex/module/hierarchy.rb +0 -335
  88. data/ruby_ex/module/instance_method_visibility.rb +0 -73
  89. data/ruby_ex/module_ex.rb +0 -11
  90. data/ruby_ex/node.rb +0 -80
  91. data/ruby_ex/object_monitor.rb +0 -145
  92. data/ruby_ex/object_monitor_activity.rb +0 -33
  93. data/ruby_ex/observable.rb +0 -140
  94. data/ruby_ex/observable_pool.rb +0 -293
  95. data/ruby_ex/orderedhash.rb +0 -252
  96. data/ruby_ex/pathname_ex.rb +0 -152
  97. data/ruby_ex/pp_hierarchy.rb +0 -29
  98. data/ruby_ex/pseudo_cache.rb +0 -190
  99. data/ruby_ex/queue.rb +0 -56
  100. data/ruby_ex/random_generators.rb +0 -25
  101. data/ruby_ex/random_generators/random_generator.rb +0 -31
  102. data/ruby_ex/random_generators/ruby.rb +0 -23
  103. data/ruby_ex/safe_eval.rb +0 -348
  104. data/ruby_ex/sendmail.rb +0 -215
  105. data/ruby_ex/service_manager.rb +0 -121
  106. data/ruby_ex/session/administrable.rb +0 -120
  107. data/ruby_ex/session/client.rb +0 -153
  108. data/ruby_ex/session/const.rb +0 -18
  109. data/ruby_ex/session/dispatcher.rb +0 -184
  110. data/ruby_ex/session/error.rb +0 -21
  111. data/ruby_ex/session/fetchable.rb +0 -57
  112. data/ruby_ex/session/fetcher.rb +0 -62
  113. data/ruby_ex/session/hookable.rb +0 -26
  114. data/ruby_ex/session/profile.rb +0 -110
  115. data/ruby_ex/session/server.rb +0 -582
  116. data/ruby_ex/session/test/administrable_test.rb +0 -337
  117. data/ruby_ex/session/test/basic_test.rb +0 -523
  118. data/ruby_ex/session/test/dispatcher_test.rb +0 -409
  119. data/ruby_ex/session/test/fetchable_test.rb +0 -119
  120. data/ruby_ex/session/test/sub_server_test.rb +0 -188
  121. data/ruby_ex/shuffle.rb +0 -30
  122. data/ruby_ex/spring.rb +0 -136
  123. data/ruby_ex/spring_set.rb +0 -137
  124. data/ruby_ex/string_ex.rb +0 -28
  125. data/ruby_ex/symtbl.rb +0 -106
  126. data/ruby_ex/synflow.rb +0 -474
  127. data/ruby_ex/test/unit/ui/yaml/testrunner.rb +0 -164
  128. data/ruby_ex/thread_mutex.rb +0 -10
  129. data/ruby_ex/timeout_ex.rb +0 -81
  130. data/ruby_ex/top_down.rb +0 -73
  131. data/ruby_ex/trace.rb +0 -26
  132. data/ruby_ex/uri/druby.rb +0 -81
  133. data/ruby_ex/uri/file.rb +0 -65
  134. data/ruby_ex/uri/ftp_ex.rb +0 -37
  135. data/ruby_ex/uri/http_ex.rb +0 -43
  136. data/ruby_ex/uri/ssh.rb +0 -92
  137. data/ruby_ex/uri/svn.rb +0 -118
  138. data/ruby_ex/uri_ex.rb +0 -45
  139. data/ruby_ex/verbose_object.rb +0 -30
  140. data/ruby_ex/version.rb +0 -66
  141. data/ruby_ex/yaml/basenode_ext.rb +0 -63
  142. data/ruby_ex/yaml/chop_header.rb +0 -23
  143. data/ruby_ex/yaml/transform.rb +0 -449
  144. data/ruby_ex/yaml/yregexpath.rb +0 -76
  145. data/src/ask.rb +0 -101
  146. data/src/changelog.rb +0 -117
  147. data/src/conflict.rb +0 -20
  148. data/src/diffstat.rb +0 -42
  149. data/src/message.rb +0 -64
  150. data/src/reply-mail.rb +0 -14
  151. data/src/tools.rb +0 -22
  152. data/src/vcs.rb +0 -176
@@ -1,56 +0,0 @@
1
- # Copyright: Copyright (c) 2004 Nicolas Despres. All rights reserved.
2
- # Author: Nicolas Despres <polrop@lrde.epita.fr>.
3
- # License: Gnu General Public License.
4
-
5
- # $LastChangedBy: ertai $
6
- # $Id: queue.rb 53 2004-12-02 22:24:03Z ertai $
7
-
8
-
9
- require 'thread'
10
-
11
-
12
- class Queue
13
-
14
- alias put push
15
- alias get pop
16
-
17
- end # class Queue
18
-
19
-
20
- #
21
- # Unit test suite
22
- #
23
- if defined? TEST_MODE or $0 == __FILE__
24
-
25
-
26
- require 'test/unit/ui/yaml/testrunner'
27
-
28
-
29
- class QueueTest < Test::Unit::TestCase
30
-
31
- #
32
- # tests
33
- #
34
- def test_simple
35
- q = Queue.new
36
- thr1 = Thread.new do
37
- while q.empty? do end
38
- assert_equal(2, q.size)
39
- assert_equal(2, q.length)
40
- assert_equal('hello', q.get)
41
- assert_equal('world', q.get)
42
- assert(q.empty?)
43
- end
44
- thr2 = Thread.new do
45
- sleep(0.2)
46
- q.put('hello')
47
- q.put('world')
48
- end
49
- thr1.join
50
- thr2.join
51
- end
52
-
53
- end # class QueueTest
54
-
55
-
56
- end
@@ -1,25 +0,0 @@
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: random_generators.rb 218 2005-05-09 12:11:21Z ertai $
5
-
6
- require 'module/autoload_tree'
7
- require 'abstract'
8
-
9
- module RandomGenerators
10
-
11
- autoloaded_module(__FILE__)
12
-
13
- @@default = Ruby.new
14
-
15
- module_function
16
-
17
- def default
18
- @@default
19
- end
20
-
21
- def default= ( aClass )
22
- @@default = aClass
23
- end
24
-
25
- end # module RandomGenerators
@@ -1,31 +0,0 @@
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: random_generator.rb 218 2005-05-09 12:11:21Z ertai $
5
-
6
- module RandomGenerators
7
-
8
- class RandomGenerator
9
- abstract
10
-
11
- def check_choose_integer ( n )
12
- unless n.is_a? Integer
13
- raise ArgumentError, "Need an integer (not #{n})"
14
- end
15
- if n <= 0
16
- raise ArgumentError, "Need an positive value (not #{n})"
17
- end
18
- end
19
-
20
- def check_choose_float ( f )
21
- unless f.is_a? Float
22
- raise ArgumentError, "Need a float (not #{f})"
23
- end
24
- if f <= 0
25
- raise ArgumentError, "Need an positive value (not #{f})"
26
- end
27
- end
28
-
29
- end # class RandomGenerator
30
-
31
- end # module RandomGenerators
@@ -1,23 +0,0 @@
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: ruby.rb 218 2005-05-09 12:11:21Z ertai $
5
-
6
- module RandomGenerators
7
-
8
- class Ruby < RandomGenerator
9
- concrete
10
-
11
- def choose_integer ( n )
12
- check_choose_integer(n)
13
- Kernel.rand(n)
14
- end
15
-
16
- def choose_float ( f=1.0 )
17
- check_choose_float(f)
18
- Kernel.rand() * f
19
- end
20
-
21
- end # class Ruby
22
-
23
- end # module RandomGenerators
@@ -1,348 +0,0 @@
1
- # Copyright: Copyright (c) 2004 Nicolas Despres. All rights reserved.
2
- # Author: Nicolas Despres <polrop@lrde.epita.fr>.
3
- # License: Gnu General Public License.
4
-
5
- # $LastChangedBy: polrop $
6
- # $Id: safe_eval.rb 91 2005-01-09 22:24:40Z polrop $
7
-
8
-
9
- class SafeEval
10
-
11
- attr_accessor :collect, :safe
12
- attr_reader :output
13
-
14
- def initialize(safe=3, collect=true)
15
- @safe = safe
16
- @collect = collect
17
- end
18
-
19
- def run(code_str='', binding=nil, filename='(SafeEval)', lineno=1)
20
- binding = yield if block_given?
21
- lineno -= 1
22
- @output = nil
23
- @output = [] if @collect
24
- result = nil
25
- code_str.strip!
26
- return result if code_str.empty?
27
- rd_result, wr_result = IO.pipe
28
- open('|-') do |io|
29
- if io.nil? then # son
30
- status = 0
31
- rd_result.close
32
- set_environment
33
- begin
34
- code = "$SAFE = #@safe\n#{code_str}"
35
- result = eval(code, binding, filename, lineno)
36
- status = 0 # needed if the user change the status
37
- rescue Exception => exception
38
- status = 1
39
- result = exception
40
- ensure
41
- Marshal.dump(result, wr_result)
42
- wr_result.close
43
- exit!(status)
44
- end
45
- else # father
46
- wr_result.close
47
- io.each_line { |l| @output << l.chomp } if @collect
48
- result = Marshal.load(rd_result)
49
- rd_result.close
50
- Process.waitpid(io.pid)
51
- end
52
- end
53
- raise result if $?.exitstatus == 1
54
- @output = nil unless @collect
55
- return result
56
- end
57
- public :run
58
-
59
- # Can be overloaded to specify environment restriction.
60
- def set_environment
61
- end
62
- protected :set_environment
63
-
64
- end # class SafeEval
65
-
66
-
67
- #
68
- # Unit test suite
69
- #
70
- if defined? TEST_MODE or $0 == __FILE__
71
-
72
-
73
- require 'test/unit/ui/yaml/testrunner'
74
-
75
-
76
- class SafeEvalTest < Test::Unit::TestCase
77
-
78
- #
79
- # Tests
80
- #
81
- def test_interface
82
- se = SafeEval.new
83
- assert_respond_to(se, :run)
84
- assert_respond_to(se, :output)
85
- assert_respond_to(se, :safe)
86
- assert_respond_to(se, :collect)
87
- assert(se.protected_methods.include?('set_environment'),
88
- "no protected method 'set_environment'")
89
- end
90
-
91
- def test_nil
92
- se = SafeEval.new
93
- assert_equal(nil, se.run)
94
- assert_equal([], se.output)
95
- end
96
-
97
- def test_true
98
- se = SafeEval.new
99
- assert_equal(true, se.run('true'))
100
- assert_equal([], se.output)
101
- end
102
-
103
- def test_false
104
- se = SafeEval.new
105
- assert_equal(false, se.run('false'))
106
- assert_equal([], se.output)
107
- end
108
-
109
- def test_nil_no_collect
110
- se = SafeEval.new(3, false)
111
- assert_equal(nil, se.run)
112
- assert_equal(nil, se.output)
113
- end
114
-
115
- def test_almost_empty_code
116
- se = SafeEval.new
117
- assert_equal(nil, se.run(' '))
118
- assert_equal([], se.output)
119
- end
120
-
121
- def test_true_no_collect
122
- se = SafeEval.new(3, false)
123
- assert_equal(true, se.run('true'))
124
- assert_equal(nil, se.output)
125
- end
126
-
127
- def test_binding_argument
128
- def getBinding; a = 42; return binding; end
129
- se = SafeEval.new
130
- assert_equal(nil, se.run('puts a', getBinding))
131
- assert_equal(['42'], se.output)
132
- end
133
-
134
- def test_binding_block
135
- se = SafeEval.new
136
- assert_equal(true, se.run('puts a; true') { a = 42; return binding })
137
- assert_equal(['42'], se.output)
138
- end
139
-
140
- def test_binding_both
141
- def getBinding2; a = 51; return binding; end
142
- se = SafeEval.new
143
- ret = se.run('puts a; true', getBinding2) { a = 42; return binding }
144
- assert_equal(true, ret)
145
- assert_equal(['42'], se.output)
146
- end
147
-
148
- def test_exception
149
- mypid = $$
150
- se = SafeEval.new
151
- $tmp = 42
152
- begin
153
- $tmp = se.run('raise NoMethodError')
154
- rescue NoMethodError
155
- assert_equal(mypid, $$, "bad pid")
156
- assert_equal(42, $tmp, "result must be nil")
157
- assert_equal([], se.output)
158
- ensure
159
- assert_equal(mypid, $$, "bad pid")
160
- end
161
- end
162
-
163
- def test_exception_collect
164
- se = SafeEval.new
165
- assert_raises(Exception) do
166
- se.run('puts "toto"; raise Exception')
167
- end
168
- assert_equal(['toto'], se.output)
169
- end
170
-
171
- # FIXME: this test block if DRb::SessionManager test suite is executed before
172
- # this test suite in check-ruby_ex.
173
- # def test_exception_no_collect
174
- # se = SafeEval.new(3, false)
175
- # assert_raises(Exception) do
176
- # se.run('puts "toto"; raise Exception')
177
- # end
178
- # assert_equal(nil, se.output)
179
- # end
180
-
181
- def test_require_forbidden
182
- se = SafeEval.new
183
- assert_raises(SecurityError) do
184
- se.run("require 'foo'")
185
- end
186
- assert_equal([], se.output)
187
- end
188
-
189
- def test_File_chmod_forbidden
190
- se = SafeEval.new
191
- assert_raises(SecurityError) do
192
- se.run("File.chmod('/tmp', 0755)")
193
- end
194
- assert_equal([], se.output)
195
- end
196
-
197
- def test_system_forbidden
198
- se = SafeEval.new
199
- assert_raises(SecurityError) do
200
- se.run("system('rm /tmp/x')")
201
- end
202
- assert_equal([], se.output)
203
- end
204
-
205
- def test_system_allowed
206
- se = SafeEval.new(2)
207
- se.run("system(\"echo 'toto'\")")
208
- assert_equal(['toto'], se.output)
209
- end
210
-
211
- def test_print
212
- se = SafeEval.new
213
- assert_equal(nil, se.run('print "hello"'))
214
- assert_equal(['hello'], se.output)
215
- end
216
-
217
- def test_puts
218
- se = SafeEval.new
219
- assert_equal(nil, se.run('puts "hello"'))
220
- assert_equal(['hello'], se.output)
221
- end
222
-
223
- def test_print_no_collect
224
- se = SafeEval.new(3, false)
225
- assert_equal(nil, se.run('print "hello"'))
226
- assert_equal(nil, se.output)
227
- end
228
-
229
- def test_puts_several_lines
230
- se = SafeEval.new
231
- assert_equal(nil, se.run('puts "hello\nworld"'))
232
- assert_equal(['hello', 'world'], se.output)
233
- end
234
-
235
- def test_syntax_error
236
- se = SafeEval.new
237
- assert_raises(SyntaxError) do
238
- se.run('4syntaxerror')
239
- end
240
- assert_equal([], se.output)
241
- end
242
-
243
- def test_bad_identifier
244
- se = SafeEval.new
245
- assert_raises(NameError) do
246
- se.run('bad_identifier.directory?')
247
- end
248
- assert_equal([], se.output)
249
- end
250
-
251
- def test_syntax_error_location
252
- se = SafeEval.new
253
- exc = assert_raises(SyntaxError) do
254
- se.run('4syntaxerror', nil, 'toto.yml', 1)
255
- end
256
- expected_message = <<EOF
257
- compile error
258
- toto.yml:1: syntax error
259
- 4syntaxerror
260
- ^
261
- EOF
262
- expected_message.chomp!
263
- assert_equal(expected_message, exc.message)
264
- end
265
-
266
- def test_syntax_error_location_several_line
267
- code = <<EOF
268
- puts "hello"
269
- puts "world"
270
- 4syntaxerror;
271
- EOF
272
- se = SafeEval.new
273
- exc = assert_raises(SyntaxError) do
274
- se.run(code, nil, 'toto.yml', 1)
275
- end
276
- expected_message = <<EOF
277
- compile error
278
- toto.yml:3: syntax error
279
- 4syntaxerror;
280
- ^
281
- EOF
282
- expected_message.chomp!
283
- assert_equal(expected_message, exc.message)
284
- end
285
-
286
- def test_exit_forbidden
287
- se = SafeEval.new(3, false)
288
- assert_raises(SystemExit) do
289
- se.run('exit(42)')
290
- end
291
- assert_equal(nil, se.output)
292
- end
293
-
294
- def test_exit_strong_forbidden
295
- se = SafeEval.new
296
- assert_raises(EOFError) do
297
- se.run('exit!(42)')
298
- end
299
- assert_equal([], se.output)
300
- end
301
-
302
- def test_undef_me
303
- se = SafeEval.new
304
- assert_raises(NoMethodError) do
305
- se.run('undef_method :run')
306
- end
307
- end
308
-
309
- def test_read_my_var
310
- se = SafeEval.new
311
- str = 'puts code'
312
- se.run(str)
313
- assert_equal(str, se.output[-1])
314
- end
315
-
316
- def test_write_status
317
- se = SafeEval.new
318
- assert_equal(1, se.run('status = 1'))
319
- end
320
-
321
- def test_write_safe
322
- se = SafeEval.new
323
- assert_equal(1, se.run('@safe = 1'))
324
- assert_equal(true, se.run('@safe == 3'))
325
- end
326
-
327
- def test_write_output
328
- se = SafeEval.new
329
- assert_equal(['foo'], se.run('@output << "foo"'))
330
- assert_equal([], se.output)
331
- end
332
-
333
- def test_write_output_and_print
334
- se = SafeEval.new
335
- assert_equal(nil, se.run('@output << "foo"; p @output'))
336
- assert_equal(["[\"foo\"]"], se.output)
337
- end
338
-
339
- def test_sleep
340
- se = SafeEval.new
341
- assert(se.run('sleep(1)') >= 1)
342
- assert_equal([], se.output)
343
- end
344
-
345
- end # class SafeEvalTest
346
-
347
-
348
- end