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,215 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
3
- # Copyright:: Copyright (c) 2004, 2005 Nicolas Pouillard. All rights reserved.
4
- # License:: GNU General Public License (GPL).
5
- # Revision:: $Id: header 98 2004-09-29 12:07:43Z ertai $
6
-
7
- require 'pathname'
8
- require 'ostruct'
9
- require 'optparse'
10
-
11
-
12
- class Sendmail
13
-
14
- MAIL_FILE = Pathname.new(',mail')
15
-
16
- def initialize
17
- require 'string_ex'
18
- require 'mktemp'
19
- require 'yaml/chop_header'
20
- end
21
-
22
- def parse_mail_options ( *args )
23
- email = (defined? EMAIL)? EMAIL : ENV['EMAIL']
24
- full_name = (defined? FULLNAME)? FULLNAME : ENV['FULLNAME']
25
- full_email = (defined? FULL_EMAIL)? FULL_EMAIL : "#{full_name} <#{email}>"
26
- options = OpenStruct.new(
27
- :from_name => full_email,
28
- :from => email,
29
- :to => [],
30
- :server => ENV['SMTPSERVER'] || 'localhost:25',
31
- :body => STDIN
32
- )
33
- string_args, hash_args = args.partition { |x| x.is_a?(String) }
34
- hash_args.each do |hash|
35
- raise ArgumentError, "Bad argument #{hash}" unless hash.is_a?(Hash)
36
- hash.each do |k,v|
37
- options.send("#{k}=", v)
38
- end
39
- end
40
- OptionParser.new do |opts|
41
- opts.separator ''
42
- opts.on('-b', '--body FILE', 'Choose a file for the mail body') do |aFile|
43
- options.body = File.open(aFile)
44
- end
45
- opts.on('-t', '--mail-to NAME', 'Choose a recipient') do |aString|
46
- options.to << aString
47
- end
48
- opts.on('-s', '--server NAME:PORT', 'Choose a mail server') do |aString|
49
- options.server, options.port = aString.split(/:/)
50
- options.port ||= 25
51
- end
52
- opts.on('-S', '--subject NAME', 'Choose your mail subject') do |aString|
53
- options.subject = aString.sub(/\.?$/, '.')
54
- end
55
- opts.on('--[no-]sign', 'Sign the message with gpg') do |signed|
56
- options.signed = signed
57
- end
58
- opts.on('--passphrase FILE', 'the passphrase file') do |aFile|
59
- options.pass = Pathname.new(aFile)
60
- end
61
- opts.on('-a', '--[no-]ask', 'Ask a confirmation before sending') do |ask|
62
- options.ask = ask
63
- end
64
- opts.on('--comment STRING', 'Choose a comment for GPG') do |aComment|
65
- options.comment = aComment
66
- end
67
- opts.on('-m', '--[no-]mime', 'Choose the mime protocole') do |mime|
68
- options.mime = mime
69
- end
70
- opts.on_tail('-h', '--help', 'Show this message') do
71
- puts opts
72
- exit
73
- end
74
- end.parse!(string_args)
75
- check_mail_options(options)
76
- options
77
- end
78
-
79
-
80
- def check_mail_options ( options )
81
- raise ArgumentError, 'No recipents' if options.to.empty?
82
- raise ArgumentError, 'No mail server' if options.server.nil?
83
- raise ArgumentError, 'No mail subject' if options.subject.nil?
84
- end
85
-
86
- #
87
- # Mail.
88
- #
89
- def sendmail ( *args )
90
-
91
- body, opts = nil, nil
92
- if MAIL_FILE.exist?
93
- STDERR.puts "Using the cache file #{MAIL_FILE}"
94
- MAIL_FILE.open do |mail_file|
95
- opts = YAML::chop_header(mail_file)
96
- body = mail_file.read
97
- end
98
- else
99
- opts = parse_mail_options(*args)
100
- body = (opts.body.nil?)? '' : opts.body.read
101
- end
102
- server, port = opts.server.split(/:/)
103
- port ||= 25
104
- STDERR.puts "Smtp Server: #{server}"
105
-
106
- #
107
- # Ask the user
108
- #
109
- if opts.ask
110
- require 'ask'
111
- question = %Q[
112
- |Send a mail, with this subject: #{opts.subject}
113
- | to #{opts.to.join(', ')}
114
- | from #{opts.from_name}
115
- | #{(opts.signed.nil?)? 'not signed !' : 'signed by ' + opts.from}
116
- |Are you sure?].head_cut!
117
- raise 'Aborting' if ask(question, :y) == :n
118
- end
119
-
120
- require 'net/smtp'
121
- Net::SMTP.start(server, port) do |smtp|
122
- smtp.open_message_stream(opts.from, opts.to) do |f|
123
- f.print %Q[From: #{opts.from_name}
124
- |Subject: #{opts.subject}
125
- |To: #{opts.to.join(', ')}\n].head_cut!
126
- if opts.signed
127
- TempPath.new do |mail_body|
128
- mail_body.open('w') do |out|
129
- if opts.mime
130
- out.puts '
131
- |Content-Type: text/plain; charset=ISO-8859-1; format=flowed
132
- |Content-Transfer-Encoding: 8bit
133
- |
134
- |'.head_cut!
135
- end
136
- out.print body
137
- end
138
- f.print sign_wrap(opts, mail_body)
139
- end
140
- else
141
- f.print "\n" + body
142
- end
143
- end
144
- end
145
- end
146
-
147
-
148
- def new_id ( n )
149
- ([0] * n).map!{ |x| "%X" % rand(15) }.join
150
- end
151
- protected :new_id
152
-
153
-
154
- def sign_wrap ( opts, body )
155
- id = "===============#{new_id 10}==" if opts.mime
156
-
157
- TempPath.new do |tmp_name|
158
- tmp_name.open('w') do |tmp|
159
- if opts.mime
160
- tmp.print %Q[
161
- |MIME-Version: 1.0
162
- |Content-Type: multipart/signed; micalg=pgp-sha1;
163
- | protocol="application/pgp-signature";
164
- | boundary="#{id}"
165
- |Content-Transfer-Encoding: 8bit
166
- |
167
- |This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
168
- |--#{id}
169
- |].head_cut!
170
-
171
- tmp.print body.read
172
-
173
- tmp.print %Q[
174
- |
175
- |--#{id}
176
- |Content-Type: application/pgp-signature; name="signature.asc"
177
- |Content-Description: OpenPGP digital signature
178
- |Content-Disposition: attachment; filename="signature.asc"
179
- |
180
- |].head_cut!
181
- end
182
-
183
- TempPath.new do |tmp_out|
184
- pid = fork do
185
- cmd = %w[ gpg --status-fd 2 --sign --textmode --armor
186
- --digest-algo sha1 --no-use-agent -u ]
187
- cmd << "<#{opts.from}>"
188
- cmd << ((opts.mime)? '--detach-sign' : '--clearsign')
189
- cmd += [ '--output', tmp_out ]
190
- if opts.pass
191
- cmd += [ '--no-tty', '--batch',
192
- '--passphrase-fd', opts.pass.open.to_i.to_s ]
193
- end
194
- cmd += [ '--comment', "'#{opts.comment}'" ] if opts.comment
195
- STDIN.reopen(body.open)
196
- exec(*cmd)
197
- end
198
- Process.waitpid pid
199
-
200
- tmp.print tmp_out.read
201
- tmp.puts "\n--#{id}--" if opts.mime
202
- end
203
- end
204
-
205
- return tmp_name.read
206
- end
207
- end
208
-
209
- end # class Sendmail
210
-
211
-
212
- if $0 == __FILE__
213
- $: << Pathname.new(__FILE__).dirname.to_s
214
- Sendmail.new.sendmail(*ARGV)
215
- end
@@ -1,121 +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: service_manager.rb 186 2005-04-03 00:07:45Z ertai $
7
-
8
-
9
- # A service must implement at least:
10
- # - start_service(uri, *args, &block)
11
- # - stop_service
12
- # - server
13
- # - thread
14
- # - uri
15
- module ServiceManager
16
-
17
- def start_service(service, uri=nil, *args, &block)
18
- @services = {} unless defined? @services
19
- service.start_service(uri, *args, &block)
20
- @services[service.uri] = service
21
- end
22
-
23
- def stop_service(uri)
24
- if defined? @services
25
- if service = @services.delete(uri)
26
- service.stop_service
27
- end
28
- end
29
- end
30
-
31
- def stop_services
32
- if defined? @services
33
- @services.keys.each do |uri|
34
- stop_service(uri)
35
- end
36
- end
37
- end
38
-
39
- def count_services
40
- if defined? @services
41
- @services.size
42
- else
43
- 0
44
- end
45
- end
46
-
47
- def list_services
48
- if defined? @services
49
- @services.values
50
- else
51
- []
52
- end
53
- end
54
-
55
- def join_services
56
- if defined? @services
57
- @services.each { |uri, service| service.thread.join }
58
- end
59
- end
60
-
61
- def each_services(&block)
62
- if defined? @services
63
- @services.each { |uri, service| block[uri, service] }
64
- end
65
- end
66
-
67
- def service_server(uri)
68
- @services[uri].server if defined? @services
69
- end
70
-
71
- end # module ServiceManager
72
-
73
-
74
- if defined? TEST_MODE or __FILE__ == $0
75
-
76
-
77
- require 'test/unit/ui/yaml/testrunner'
78
- require 'drb'
79
-
80
-
81
- class ServiceManagerTest < Test::Unit::TestCase
82
-
83
- class Foo
84
- include ServiceManager
85
-
86
- end
87
-
88
- module MyService
89
-
90
- module_function
91
- def start_service(uri); end
92
- def stop_service; end
93
- def uri; 'toto'; end
94
-
95
- end
96
-
97
- def test_simple
98
- f = Foo.new
99
- f.start_service(DRb)
100
- assert_equal(1, f.count_services)
101
- f.start_service(DRb)
102
- assert_equal(2, f.count_services)
103
- f.start_service(MyService)
104
- [ DRb, DRb, MyService ].each do |s|
105
- assert(f.list_services.include?(s))
106
- end
107
- assert_equal(3, f.count_services)
108
- f.stop_service(MyService.uri)
109
- assert_equal(2, f.count_services)
110
- f.start_service(MyService)
111
- [ DRb, DRb, MyService ].each do |s|
112
- assert(f.list_services.include?(s))
113
- end
114
- f.stop_services
115
- assert_equal([], f.list_services)
116
- end
117
-
118
- end # class ServiceManagerTest
119
-
120
- end
121
-
@@ -1,120 +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: administrable.rb 67 2004-12-07 01:00:10Z polrop $
7
-
8
-
9
- require 'session/server'
10
-
11
-
12
- module Session
13
-
14
- module Administrable
15
-
16
- #
17
- # Sessions-oriented requests
18
- #
19
- protected
20
- def request_sessions(sid, profile)
21
- @mutex.synchronize { @sessions }
22
- end
23
-
24
- protected
25
- def request_kick(sid, profile, sid_to_kick)
26
- prof = nil
27
- @mutex.synchronize do
28
- prof = get_profile(sid_to_kick).dup
29
- if prof[:admin]
30
- raise(Session::PermissionError,
31
- "`#{sid_to_kick}' - cannot kick an admin session")
32
- end
33
- end
34
- request(sid_to_kick, :logout)
35
- end
36
-
37
- protected
38
- def request_add_usr(sid, profile, usrname, usrdesc)
39
- @mutex.synchronize do
40
- check_usrname(usrname)
41
- check_usrdesc(usrdesc)
42
- if @usrdb[usrname].nil?
43
- @usrdb[usrname] = usrdesc
44
- else
45
- raise(Session::UserError, "`#{usrname}' - user already registered")
46
- end
47
- usrdesc
48
- end
49
- end
50
-
51
- protected
52
- def request_del_usr(sid, profile, usrname)
53
- @mutex.synchronize do
54
- usrdesc = get_usr_desc(usrname)
55
- if usrdesc[:admin]
56
- raise(Session::UserError, "`#{usrname}' - cannot delete admin user")
57
- end
58
- @usrdb.delete(usrname)
59
- end
60
- end
61
-
62
- protected
63
- def request_get_usr_desc(sid, profile, usrname)
64
- @mutex.synchronize { get_usr_desc(check_usrname(usrname)) }
65
- end
66
-
67
- protected
68
- def request_set_usr_desc(sid, profile, usrname, usrdesc)
69
- @mutex.synchronize do
70
- check_usrdesc(usrdesc)
71
- get_usr_desc(usrname)
72
- @usrdb[usrname] = usrdesc
73
- end
74
- end
75
-
76
- protected
77
- def request_set_usrdb(sid, profile, usrdb)
78
- @mutex.synchronize { @usrdb = check_usrdb(usrdb) }
79
- end
80
-
81
- protected
82
- def request_get_usrdb(sid, profile)
83
- @mutex.synchronize { @usrdb }
84
- end
85
-
86
- protected
87
- def request_set_max_usr(sid, profile, max_usr)
88
- @mutex.synchronize { @max_usr = check_max_usr(max_usr) }
89
- end
90
-
91
- protected
92
- def request_get_max_usr(sid, profile)
93
- @mutex.synchronize { @max_usr }
94
- end
95
-
96
- protected
97
- def request_set_wipeout_delay(sid, profile, wipeout_delay)
98
- @mutex.synchronize { @wipeout_delay = check_wipeout_delay(wipeout_delay) }
99
- end
100
-
101
- protected
102
- def request_get_wipeout_delay(sid, profile)
103
- @mutex.synchronize { @wipeout_delay }
104
- end
105
-
106
- #
107
- # Methods
108
- #
109
- protected
110
- def get_usr_desc(usrname)
111
- usrdesc = @usrdb[usrname]
112
- if usrdesc.nil?
113
- raise(Session::UserError, "`#{usrname}' - not a registered user")
114
- end
115
- usrdesc
116
- end
117
-
118
- end # module Administrable
119
-
120
- end # module Session