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,153 +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: client.rb 67 2004-12-07 01:00:10Z polrop $
7
-
8
-
9
- require 'drb'
10
-
11
- require 'session/const'
12
- require 'session/hookable'
13
- require 'session/profile'
14
- require 'const_regexp'
15
-
16
-
17
- module Session
18
-
19
- class Client
20
- include Hookable
21
-
22
- #
23
- # Constants
24
- #
25
- URI = 'druby://localhost:42000'
26
- USRNAME = 'guest'
27
- PASSWD = 'guest'.crypt(Const::SALT_KEY)
28
-
29
- #
30
- # Attributs
31
- #
32
- attr_reader :sid, :uri, :protocol, :hostname, :port, :usrname, :passwd,
33
- :local_uri, :force_login
34
-
35
- #
36
- # Constructor
37
- #
38
- def initialize(uri=URI,
39
- usrname=USRNAME,
40
- passwd=PASSWD,
41
- force_login=false,
42
- *hooks)
43
- unless force_login.is_a?(TrueClass) or force_login.is_a?(FalseClass)
44
- raise(ArgumentError, 'force_login must be a boolean')
45
- end
46
- hooks.each do |hook|
47
- unless hook.respond_to?(:hook)
48
- raise(ArgumentError, 'hookable object must respond to hook')
49
- end
50
- end
51
- self.uri = uri
52
- @usrname = usrname
53
- @passwd = passwd
54
- @force_login = force_login
55
- @hooks = hooks
56
- @srv = nil
57
- @sid = nil
58
- @online = false
59
- @local_nb_requests = 0
60
- @online_mutex = Mutex.new
61
- @local_logout_mutex = Mutex.new
62
- login if @force_login
63
- end
64
-
65
- #
66
- # Methods
67
- #
68
- def uri=(uri)
69
- @uri = uri
70
- @protocol, @hostname, @port = Profile.parse_uri(uri)
71
- end
72
-
73
- def online?
74
- @online_mutex.synchronize { @online }
75
- end
76
-
77
- def login
78
- @online_mutex.synchronize do
79
- return true if @online
80
- start_service
81
- begin
82
- @sid = @srv_front.login(@usrname, @passwd, DRb.uri, self, *@hooks)
83
- rescue Exception
84
- stop_service
85
- raise
86
- end
87
- @online = true
88
- @local_nb_requests = 0
89
- end
90
- end
91
-
92
- def logout
93
- @online_mutex.synchronize do
94
- return true unless @online
95
- @srv_front.request(@sid, :logout)
96
- local_logout
97
- true
98
- end
99
- end
100
-
101
- def method_missing(meth, *args, &block)
102
- request(meth, *args, &block)
103
- end
104
-
105
- def request(meth, *args, &block)
106
- login
107
- @online_mutex.synchronize { @local_nb_requests += 1 }
108
- result = @srv_front.request(@sid, meth, *args, &block)
109
- @online_mutex.synchronize { @local_nb_requests -= 1 }
110
- result
111
- end
112
-
113
- # sid equal @sid when I'm loging out.
114
- protected
115
- def hook_logout(sid, profile)
116
- local_logout if sid == @sid
117
- end
118
-
119
- # sid equal nil when I'm loging in.
120
- protected
121
- def hook_login(sid, profile)
122
- end
123
-
124
- protected
125
- def local_logout
126
- @local_logout_mutex.synchronize do
127
- @online = false
128
- @sid = nil
129
- @local_nb_requests = 0
130
- end
131
- end
132
-
133
- protected
134
- def start_service
135
- stop_service unless @srv.nil?
136
- @srv = DRb.start_service
137
- @srv_front = DRbObject.new(nil, @uri)
138
- @local_uri = @srv.uri
139
- end
140
-
141
- protected
142
- def stop_service
143
- @srv.stop_service
144
- @srv_front = nil
145
- @local_uri = nil
146
- @srv = nil
147
- end
148
-
149
- end # Client
150
-
151
- end # module Session
152
-
153
-
@@ -1,18 +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: const.rb 64 2004-12-06 13:28:14Z polrop $
7
-
8
-
9
- module Session
10
-
11
- module Const
12
-
13
- SALT_KEY = 'ab'
14
-
15
- end # module Const
16
-
17
- end # module Session
18
-
@@ -1,184 +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: dispatcher.rb 186 2005-04-03 00:07:45Z ertai $
7
-
8
-
9
- require 'drb'
10
-
11
- require 'session/client'
12
-
13
-
14
- module Session
15
-
16
- class Dispatcher
17
- include DRb::DRbUndumped
18
-
19
- #
20
- # Constants
21
- #
22
- MAX_JOBS = 5
23
- MAX_JOBS_LIMIT = 100
24
- SRVDB = {
25
- 'druby://localhost:42000' => {
26
- :usrname => 'guest',
27
- :passwd => 'guest'.crypt(Const::SALT_KEY)
28
- }
29
- }
30
- BASE_CLIENT_CLASS = Client
31
-
32
- #
33
- # Attributes
34
- #
35
- attr_reader :max_jobs
36
-
37
- #
38
- # Constructor
39
- #
40
- def initialize(srvdb=SRVDB,
41
- max_jobs=MAX_JOBS,
42
- client_class=BASE_CLIENT_CLASS,
43
- *args)
44
- unless 1 <= max_jobs && max_jobs <= MAX_JOBS_LIMIT
45
- raise(ArgumentError,
46
- "`#{max_jobs}' - too big max jobs (must be <= #{MAX_JOBS_LIMIT})")
47
- end
48
- @max_jobs = max_jobs
49
- @srvdb = {}
50
- srvdb.each do |uri, srv|
51
- add(uri, srv[:usrname], srv[:passwd], client_class, *args)
52
- end
53
- end
54
-
55
- def dispatch(clts, request, *args, &block)
56
- mutex = Mutex.new
57
- threads = []
58
- nb_threads = [ clts.size, @max_jobs].min
59
- clts_q = clts.dup
60
- result = {}
61
- nb_threads.times do
62
- threads << Thread.new do
63
- loop do
64
- clt = mutex.synchronize { clts_q.shift }
65
- break if clt.nil?
66
- res = request(clt, request, *args, &block)
67
- mutex.synchronize { result.update(res) }
68
- end
69
- end
70
- end
71
- threads.each { |thread| thread.join }
72
- result
73
- end
74
-
75
- alias update dispatch
76
-
77
- def select(&comp)
78
- clts = []
79
- each_client { |uri, clt| clts << clt if comp[clt] }
80
- clts
81
- end
82
-
83
- def select_all
84
- select { |clt| true }
85
- end
86
-
87
- def select_by(attr, value)
88
- select { |clt| test_client_attribut(clt, attr, value) }
89
- end
90
-
91
- def multi_select_by(hash, init_val=true, &bool_fun)
92
- select do |clt|
93
- ret = init_val
94
- hash.each do |k, v|
95
- ret = bool_fun[ret, test_client_attribut(clt, k, v)]
96
- end
97
- ret
98
- end
99
- end
100
-
101
- def and_multi_select_by(hash)
102
- select do |clt|
103
- ret = true
104
- hash.each do |k, v|
105
- ret = (ret and test_client_attribut(clt, k, v))
106
- end
107
- ret
108
- end
109
- end
110
-
111
- def or_multi_select_by(hash)
112
- select do |clt|
113
- ret = false
114
- hash.each { |k, v| ret = (ret or test_client_attribut(clt, k, v)) }
115
- ret
116
- end
117
- end
118
-
119
- def dispatch_all(request, *args, &block)
120
- dispatch(select_all, request, *args, &block)
121
- end
122
-
123
- def method_missing(request, *args, &block)
124
- dispatch_all(request, *args, &block)
125
- end
126
-
127
- # overload me
128
- def choose(clients)
129
- raise(NotImplementedError, "`choose' - not implemented at this level")
130
- end
131
-
132
- def choose_and_select(&block)
133
- choose(select(&block))
134
- end
135
-
136
- def each
137
- @srvdb.each { |uri, desc| yield(uri, desc) }
138
- end
139
-
140
- def each_client
141
- @srvdb.each { |uri, desc| yield(uri, desc[:client]) }
142
- end
143
-
144
- def [](uri)
145
- @srvdb[uri]
146
- end
147
-
148
- def add(uri, usrname, passwd, client_class, *args)
149
- return nil if @srvdb[uri]
150
- @srvdb[uri] = {
151
- :usrname => usrname,
152
- :passwd => passwd,
153
- :client => client_class.new(uri, usrname, passwd, *args)
154
- }
155
- end
156
-
157
- def del(uri)
158
- @srvdb.delete(uri)
159
- end
160
-
161
- def request(clt, request, *args, &block)
162
- res = nil
163
- begin
164
- res = clt.send(request, *args, &block)
165
- rescue Exception => err
166
- res = err
167
- end
168
- { clt.uri => res }
169
- end
170
-
171
- protected
172
- def test_client_attribut(clt, attr, value)
173
- if value.is_a? Regexp
174
- clt.send(attr).to_s =~ value
175
- else
176
- clt.send(attr) == value
177
- end
178
- end
179
-
180
- end # module Dispatcher
181
-
182
- end # module Session
183
-
184
-
@@ -1,21 +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: error.rb 67 2004-12-07 01:00:10Z polrop $
7
-
8
-
9
- module Session
10
-
11
- class Error < DRb::DRbError; end
12
- class PermissionError < Error; end
13
- class RequestError < Error; end
14
- class SessionError < Error; end
15
- class FullError < Error; end
16
- class AuthError < Error; end
17
- class UserError < Error; end
18
- class ParameterError < Error; end
19
-
20
- end # module Session
21
-
@@ -1,57 +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: fetchable.rb 186 2005-04-03 00:07:45Z ertai $
7
-
8
-
9
- module Session
10
-
11
- module Fetchable
12
-
13
- #
14
- # Sessions-oriented requests
15
- #
16
- protected
17
- def request_fetch(sid, profile, filename, mode='r', perm=0644, &block)
18
- f = nil
19
- ret = false
20
- exc = nil
21
- begin
22
- f = File.open(filename, mode, perm)
23
- f.flock(File::LOCK_EX)
24
- md5 = Digest::MD5.new
25
- case mode
26
- when 'a', 'w'
27
- while (str = block[])
28
- f.write(str)
29
- md5 << str
30
- end
31
- ret = (md5.to_s == block[].to_s)
32
- when 'r'
33
- until f.eof?
34
- str = f.read(1024)
35
- md5 << str
36
- block[str]
37
- end
38
- ret = (md5.to_s == block[nil].to_s)
39
- else
40
- raise(ArgumentError, "`#{mode}' - bad mode")
41
- end
42
- rescue Exception => exc
43
- ensure
44
- unless f.nil?
45
- f.flock(File::LOCK_UN)
46
- f.close
47
- end
48
- raise exc unless exc.nil?
49
- return ret
50
- end
51
- end
52
-
53
- end # module Fetchable
54
-
55
- end # module Session
56
-
57
-
@@ -1,62 +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: fetcher.rb 67 2004-12-07 01:00:10Z polrop $
7
-
8
-
9
- require 'md5'
10
-
11
-
12
- module Session
13
-
14
- module Fetcher
15
-
16
- #
17
- # Requests
18
- #
19
- def upload(local_filename, remote_filename)
20
- ret = false
21
- File.open(local_filename, 'r') do |f|
22
- md5 = Digest::MD5.new
23
- local_eof = false
24
- ret = request(:fetch, remote_filename, 'w') do
25
- if f.eof?
26
- unless local_eof
27
- local_eof = true
28
- nil
29
- else
30
- md5
31
- end
32
- else
33
- str = f.read(1024)
34
- md5 << str
35
- str
36
- end
37
- end
38
- end
39
- ret
40
- end
41
-
42
- def download(remote_filename, local_filename)
43
- ret = false
44
- File.open(local_filename, 'w') do |f|
45
- md5 = Digest::MD5.new
46
- ret = request(:fetch, remote_filename) do |str|
47
- if str.nil?
48
- md5
49
- else
50
- md5 << str
51
- f.write(str)
52
- end
53
- end
54
- end
55
- ret
56
- end
57
-
58
- end # Fetcher
59
-
60
- end # module Session
61
-
62
-