core_ex 0.1.1 → 0.1.2

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.
data/SPEC.dyn.yml CHANGED
@@ -1,9 +1,10 @@
1
1
  --- !ruby/object:OpenStruct
2
2
  table:
3
- :date: "Wed, 01 Jun 2005"
3
+ :date: "Fri, 03 Jun 2005"
4
4
  :version: !ruby/object:Version
5
- build: 1
5
+ build: 2
6
6
  major: 0
7
7
  minor: 1
8
- revision: 264
8
+ revision: 276
9
9
  :version_id: ''
10
+ :url: svn://svn.feydakins.org/ruby_ex/trunk/core_ex
data/SPEC.gem.yml ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.10
3
+ specification_version: 1
4
+ name: core_ex
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.2
7
+ date: 2005-06-03
8
+ summary: CoreEx is a proposal for a standard library extension.
9
+ require_paths:
10
+ - lib
11
+ email:
12
+ - nicolas.despres@gmail.com
13
+ - ertai@feydakins.org
14
+ homepage: http://api.feydakins.org/core_ex
15
+ rubyforge_project: core_ex
16
+ description: "CoreEx is designed to provides a simple but quite useful extension of the
17
+ standard library of Ruby. So some classes and modules like Pathname, Time,
18
+ Enumerable, Exception, FileUtils, String, and YAML are extended. There is
19
+ also some new features like attr_once, DTime, TempPath, Version,
20
+ embedded_tests, filelist (almost from rake), a common Rakefile, and an
21
+ extension of the require system."
22
+ autorequire:
23
+ default_executable:
24
+ bindir: bin
25
+ has_rdoc: true
26
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
27
+ requirements:
28
+ -
29
+ - ">"
30
+ - !ruby/object:Gem::Version
31
+ version: 0.0.0
32
+ version:
33
+ platform: ruby
34
+ authors:
35
+ -
36
+ - Nicolas Despr�s
37
+ - Nicolas Pouillard
38
+ files:
39
+ - lib/core_ex.rb
40
+ - lib/core_ex/attr_once.rb
41
+ - lib/core_ex/dtime.rb
42
+ - lib/core_ex/embedded_tests.rb
43
+ - lib/core_ex/enumerable.rb
44
+ - lib/core_ex/exception.rb
45
+ - lib/core_ex/filelist.rb
46
+ - lib/core_ex/fileutils.rb
47
+ - lib/core_ex/pathname.rb
48
+ - lib/core_ex/rakefile_base.rf
49
+ - lib/core_ex/require.rb
50
+ - lib/core_ex/string.rb
51
+ - lib/core_ex/temp_path.rb
52
+ - lib/core_ex/time.rb
53
+ - lib/core_ex/version.rb
54
+ - lib/core_ex/yaml.rb
55
+ - lib/core_ex/test/unit/ui/yaml/testrunner.rb
56
+ - test/check-core_ex.yml
57
+ - test/check-pkg-core_ex.yml
58
+ - test/resources
59
+ - test/sanity
60
+ - test/sanity-suite.yml
61
+ - test/test-unit-setup.rb
62
+ - test/unit-suite.yml
63
+ - test/resources/require
64
+ - test/resources/use-from-gems.rb
65
+ - test/resources/yaml_testrunner
66
+ - test/resources/require/test_require
67
+ - test/resources/require/test_require_rb.rb
68
+ - test/resources/require/test_require_so.so
69
+ - test/resources/yaml_testrunner/unit_test.rb
70
+ - test/sanity/multiple-requires.yml
71
+ - test/sanity/single-requires.yml
72
+ - AUTHORS
73
+ - NEWS
74
+ - Rakefile
75
+ - README
76
+ - SPEC.dyn.yml
77
+ - SPEC.gem.yml
78
+ - SPEC.yml
79
+ test_files: []
80
+ rdoc_options:
81
+ - "--inline-source"
82
+ - "--main"
83
+ - README
84
+ - "--title"
85
+ - "CoreEx -- A proposal for a standard library extension."
86
+ - "-T"
87
+ - html
88
+ extra_rdoc_files:
89
+ - README
90
+ - AUTHORS
91
+ - NEWS
92
+ - lib/core_ex.rb
93
+ - lib/core_ex/attr_once.rb
94
+ - lib/core_ex/dtime.rb
95
+ - lib/core_ex/embedded_tests.rb
96
+ - lib/core_ex/enumerable.rb
97
+ - lib/core_ex/exception.rb
98
+ - lib/core_ex/filelist.rb
99
+ - lib/core_ex/fileutils.rb
100
+ - lib/core_ex/pathname.rb
101
+ - lib/core_ex/require.rb
102
+ - lib/core_ex/string.rb
103
+ - lib/core_ex/temp_path.rb
104
+ - lib/core_ex/time.rb
105
+ - lib/core_ex/version.rb
106
+ - lib/core_ex/yaml.rb
107
+ - lib/core_ex/test/unit/ui/yaml/testrunner.rb
108
+ executables: []
109
+ extensions: []
110
+ requirements: []
111
+ dependencies: []
data/SPEC.yml CHANGED
@@ -16,10 +16,14 @@ description: >
16
16
  extension of the require system.
17
17
  homepage: http://api.feydakins.org/core_ex
18
18
  rubyforge_project: ttk
19
+ rubyforge_sub_package_name: core_ex
19
20
 
20
21
  root_test_suite: test/check-pkg-core_ex.yml
21
22
  rdoc_dir: doc/html
22
- tags_dir: ../../tags
23
+ tags_url: svn://svn.feydakins.org/ruby_ex/tags
24
+
25
+ commit_command: rxci
26
+ commit_dir: ..
23
27
 
24
28
  rdoc_files: !filelist
25
29
  - README
@@ -3,7 +3,7 @@
3
3
  # License: Gnu General Public License.
4
4
 
5
5
  # $LastChangedBy: ertai $
6
- # $Id: pathname.rb 252 2005-05-31 23:41:42Z ertai $
6
+ # $Id: pathname.rb 272 2005-06-02 23:47:29Z ertai $
7
7
 
8
8
 
9
9
  require 'pathname'
@@ -32,6 +32,10 @@ class Pathname
32
32
  FileUtils.cp self.to_s, aPath.to_s
33
33
  end
34
34
 
35
+ def mv ( aPath )
36
+ FileUtils.mv self.to_s, aPath.to_s
37
+ end
38
+
35
39
  def cp_r ( aPath )
36
40
  FileUtils.cp_r self.to_s, aPath.to_s
37
41
  end
@@ -1,7 +1,7 @@
1
1
  # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
2
2
  # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
3
3
  # License:: Gnu General Public License.
4
- # Revision:: $Id: rakefile_base.rf 262 2005-06-01 02:58:29Z ertai $
4
+ # Revision:: $Id: rakefile_base.rf 276 2005-06-03 00:53:59Z ertai $
5
5
 
6
6
  require 'core_ex'
7
7
  require 'ostruct'
@@ -139,6 +139,7 @@ def update_dyn_spec
139
139
  SPEC.dyn = OpenStruct.new('version' => Version.new(0, 0, 0, revision))
140
140
  end
141
141
  SPEC.dyn.date = /\((.*)\)/.match(svn_info['Last Changed Date'])[1]
142
+ SPEC.dyn.url = svn_info['URL']
142
143
  SPEC_DYN_YML.open('w') do |out|
143
144
  out.puts(SPEC.dyn.to_yaml)
144
145
  end
@@ -231,12 +232,13 @@ file GEM_SPEC.to_s => [ :spec, :dyn_spec, :rdoc_spec ] do
231
232
  end
232
233
 
233
234
  s.has_rdoc = true
234
- s.extra_rdoc_files = SPEC.rdoc.rdoc_files
235
- s.rdoc_options = SPEC.rdoc.option_list.map { |x| x.sub(/^'?(.*?)'?$/, '\1') }
235
+ s.extra_rdoc_files = SPEC.rdoc.rdoc_files.to_a
236
+ s.rdoc_options = SPEC.rdoc.option_list.map { |x| x[/^'?(.*?)'?$/, 1] }
236
237
 
237
238
  authors_file = YAML::load(AUTHORS.read).values.first
238
239
  list = authors_file.map { |x| /^(.*?)\s*<(.*)>/.match(x.keys.first)[1..2] }
239
240
  s.authors = list.map { |x| x.first }
241
+ s.author = s.authors
240
242
  s.email = list.map { |x| x.last }
241
243
  s.homepage = SPEC.homepage
242
244
  s.rubyforge_project = s.name
@@ -275,13 +277,34 @@ end
275
277
 
276
278
 
277
279
 
278
- # desc 'Make an Svn tag'
280
+ desc 'Commit with Vcs'
281
+ task :commit => [ :spec ] do
282
+ subject = ask('Commit subject: ') do |q|
283
+ q.confirm = true
284
+ q.validate = /^[^a-z].*\.$/
285
+ end
286
+ pos = ARGV.index('--')
287
+ args = (pos.nil?)? [] : ARGV[pos .. -1]
288
+ cmd = SPEC.commit_command || 'commit'
289
+ Dir.chdir(SPEC.commit_dir || '.') do
290
+ sh 'vcs-svn', cmd, "'#{subject}'", *args
291
+ end
292
+ end
293
+
294
+
295
+
296
+ desc 'Make an Svn tag'
279
297
  task :tag => [ :spec, :dyn_spec ] do
280
298
  tag_name = (SPEC.release)? SPEC.release : "#{SPEC.name}-#{SPEC.dyn.version}"
281
- tags = (SPEC.tags_dir || '../tags').to_path.expand_path.cleanpath
282
- if agree "Make the SVN tag (#{tags/tag_name}) (y/n)", true
283
- svn.copy(Pathname.pwd, tags/tag_name)
284
- svn.commit(Pathname.pwd, tags, '-m', "'Releasing #{tag_name}'")
299
+ tags = SPEC.tags_url.to_s + "/#{tag_name}"
300
+ trunk = SPEC.trunk_url || SPEC.dyn.url
301
+ while agree "Make the SVN tag (#{trunk} -> #{tags}) (y/n)", true
302
+ begin
303
+ svn.copy(trunk.to_s, tags, '-m', "'Releasing #{tag_name}'")
304
+ break
305
+ rescue RuntimeError => ex
306
+ STDERR.puts ex
307
+ end
285
308
  end
286
309
  end
287
310
 
@@ -289,14 +312,21 @@ end
289
312
 
290
313
  desc 'Publish to RubyForge'
291
314
  task :publish_doc => [ :spec ] do
292
- user = SPEC.user || ENV['USER']
293
- Rake::SshDirPublisher.new(
294
- # "#{user}@rubyforge.org",
295
- # "/var/www/gforge-projects/#{SPEC.name}/test",
296
- "#{user}@ssh.feydakins.org",
297
- "/var/www/api.feydakins.org/public/#{SPEC.name}/",
298
- SPEC.rdoc_dir
299
- ).upload
315
+ while agree 'Publish the documentation? ', true
316
+ begin
317
+ user = SPEC.user || ENV['USER']
318
+ Rake::SshDirPublisher.new(
319
+ # "#{user}@rubyforge.org",
320
+ # "/var/www/gforge-projects/#{SPEC.name}/test",
321
+ "#{user}@ssh.feydakins.org",
322
+ "/var/www/api.feydakins.org/public/#{SPEC.name}/",
323
+ SPEC.rdoc_dir
324
+ ).upload
325
+ break
326
+ rescue Exception => ex
327
+ STDERR.puts ex
328
+ end
329
+ end
300
330
  end
301
331
 
302
332
 
@@ -309,6 +339,7 @@ task :common_release =>
309
339
  :doc,
310
340
  :package,
311
341
  :distcheck,
342
+ :commit,
312
343
  :tag,
313
344
  :publish_doc,
314
345
  :publish_package
@@ -332,19 +363,25 @@ end
332
363
  SPEC.dyn.version.send(name)
333
364
  q = 'Specify an identifier for this version (or press return): '
334
365
  SPEC.dyn.version_id = ask(q)
335
- SPEC_DYN_YML.open('w') do |out|
336
- out.puts(SPEC.dyn.to_yaml)
337
- end
338
- begin
339
- sh 'rake', 'clobber'
340
- sh 'rake', 'common_release'
341
- rescue
342
- SPEC_DYN_YML.unlink
366
+ TempPath.new('SPEC.dyn.yml.bak') do |bak|
367
+ SPEC_DYN_YML.mv(bak)
368
+ SPEC_DYN_YML.open('w') do |out|
369
+ out.puts(SPEC.dyn.to_yaml)
370
+ end
371
+ begin
372
+ sh 'rake', 'clobber'
373
+ sh 'rake', 'common_release'
374
+ rescue
375
+ bak.mv(SPEC_DYN_YML)
376
+ end
343
377
  end
344
378
  end
345
379
  end
346
380
 
347
381
 
382
+ release_notes = ',release_notes'.to_path
383
+ release_changes = ',release_changes'.to_path
384
+
348
385
 
349
386
  desc "Publish the release files to RubyForge."
350
387
  task :publish_package => [ :spec, :package ] do
@@ -412,8 +449,13 @@ task :publish_package => [ :spec, :package ] do
412
449
 
413
450
  release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
414
451
  release_data = open(release_uri, headers) { |data| data.read }
415
- package_id = release_data[/[?&]package_id=(\d+)/, 1]
416
- raise "Couldn't get package id" unless package_id
452
+ ids, names = [], []
453
+ release_data.gsub(/name="package_id" value="(\d+)"/) { ids << $1 ; nil }
454
+ release_data.gsub(/name="package_name" value="([^"]+)"/) { names << $1 ; nil }
455
+ package_name = SPEC.rubyforge_sub_package_name || SPEC.name
456
+
457
+ package_id = names.zip(ids).find { |name, id| name == package_name }.last
458
+ raise "Couldn't get package id or package name" unless package_id
417
459
 
418
460
  first_file = true
419
461
  release_id = ''
@@ -433,18 +475,15 @@ task :publish_package => [ :spec, :package ] do
433
475
  boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
434
476
 
435
477
  if first_file then
436
- release = {
437
- :notes => ',release_notes'.to_path,
438
- :changes => ',release_changes'.to_path
439
- }
478
+ release = { :notes => release_notes, :changes => release_changes }
440
479
  [:notes, :changes].each do |x|
441
480
  while not release[x].exist?
442
481
  say "No release #{x} (editing...)"
443
482
  edit release[x]
444
- say "Publish these release #{x}:"
445
- say release[x].read
446
- exit unless agree 'Agree? (y/n) ', true
447
483
  end
484
+ say "Publish these release #{x}:"
485
+ say release[x].read
486
+ exit unless agree 'Agree? (y/n) ', true
448
487
  end
449
488
  query_hash = {
450
489
  'group_id' => group_id,
@@ -491,6 +530,7 @@ task :publish_package => [ :spec, :package ] do
491
530
  end
492
531
 
493
532
  if first_file then
533
+ puts release_response.body
494
534
  release_id = release_response.body[/release_id=(\d+)/, 1]
495
535
  raise("Couldn't get release id") unless release_id
496
536
  end
@@ -498,3 +538,9 @@ task :publish_package => [ :spec, :package ] do
498
538
  first_file = false
499
539
  end
500
540
  end
541
+
542
+ clean_task :publish_package do
543
+ [release_notes, release_changes].each do |x|
544
+ x.rm_f
545
+ end
546
+ end
@@ -3,7 +3,7 @@
3
3
  # License: Gnu General Public License.
4
4
 
5
5
  # $LastChangedBy: ertai $
6
- # $Id: temp_path.rb 252 2005-05-31 23:41:42Z ertai $
6
+ # $Id: temp_path.rb 271 2005-06-02 23:46:36Z ertai $
7
7
 
8
8
  require 'core_ex'
9
9
  require 'tempfile'
@@ -58,7 +58,7 @@ class TempPath < Pathname
58
58
  # which follow this format:
59
59
  # => 'base.pid.uniq.ext
60
60
  #
61
- def initialize ( base=@@progname, ext='', &block )
61
+ def initialize ( base=@@progname, ext='' )
62
62
  if base.to_s =~ /\//
63
63
  raise ArgumentError, "bad basename, you give me a pathname #{base}"
64
64
  end
@@ -74,12 +74,15 @@ class TempPath < Pathname
74
74
  super(res)
75
75
  @@tmps << self
76
76
  end
77
- if block_given?
78
- begin
79
- block[self.dup]
80
- ensure
81
- clean
82
- end
77
+ end
78
+
79
+ def self.new ( *a, &block )
80
+ tmp = super(*a)
81
+ return tmp unless block_given?
82
+ begin
83
+ return block[tmp.dup]
84
+ ensure
85
+ clean
83
86
  end
84
87
  end
85
88
 
@@ -153,7 +156,7 @@ end # class Pathname
153
156
 
154
157
  test_section __FILE__ do
155
158
 
156
- class MkTempTest < Test::Unit::TestCase
159
+ class TempPathTest < Test::Unit::TestCase
157
160
 
158
161
  def setup
159
162
  assert_nothing_raised { @foo = TempPath.new('foo') }
@@ -189,6 +192,13 @@ test_section __FILE__ do
189
192
  end
190
193
  end
191
194
 
195
+ def test_block_return
196
+ assert_nothing_raised do
197
+ @x = TempPath.new { |tmp| 42 }
198
+ end
199
+ assert_equal(42, @x)
200
+ end
201
+
192
202
  end # class MkTempTest
193
203
 
194
204
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: core_ex
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.1
7
- date: 2005-06-01
6
+ version: 0.1.2
7
+ date: 2005-06-03
8
8
  summary: CoreEx is a proposal for a standard library extension.
9
9
  require_paths:
10
10
  - lib
@@ -32,8 +32,9 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
32
32
  version:
33
33
  platform: ruby
34
34
  authors:
35
- - Nicolas Despr�s
36
- - Nicolas Pouillard
35
+ -
36
+ - Nicolas Despr�s
37
+ - Nicolas Pouillard
37
38
  files:
38
39
  - lib/core_ex.rb
39
40
  - lib/core_ex/attr_once.rb
@@ -59,14 +60,9 @@ files:
59
60
  - test/sanity-suite.yml
60
61
  - test/test-unit-setup.rb
61
62
  - test/unit-suite.yml
62
- - test/resources/autoload_tree
63
63
  - test/resources/require
64
64
  - test/resources/use-from-gems.rb
65
65
  - test/resources/yaml_testrunner
66
- - test/resources/autoload_tree/A.rb
67
- - test/resources/autoload_tree/B.rb
68
- - test/resources/autoload_tree/foo
69
- - test/resources/autoload_tree/foo/C.rb
70
66
  - test/resources/require/test_require
71
67
  - test/resources/require/test_require_rb.rb
72
68
  - test/resources/require/test_require_so.so
@@ -78,6 +74,7 @@ files:
78
74
  - Rakefile
79
75
  - README
80
76
  - SPEC.dyn.yml
77
+ - SPEC.gem.yml
81
78
  - SPEC.yml
82
79
  test_files: []
83
80
  rdoc_options:
@@ -1,11 +0,0 @@
1
-
2
-
3
- module AutoloadTree
4
-
5
- class A
6
-
7
- end
8
-
9
- end
10
-
11
-
@@ -1,10 +0,0 @@
1
-
2
- require 'A'
3
-
4
- module AutoloadTree
5
-
6
- class B < A
7
-
8
- end
9
-
10
- end
@@ -1,18 +0,0 @@
1
-
2
-
3
- require 'A'
4
-
5
- module AutoloadTree
6
-
7
- module Foo
8
-
9
- class C < A
10
-
11
- end
12
-
13
- end
14
-
15
- end
16
-
17
-
18
-