facets 2.1.1 → 2.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/CHANGES ADDED
@@ -0,0 +1,5 @@
1
+ facets 2.1.2 / 2007-11-22
2
+
3
+ * Dir::multiglob no longer handels -/+ modifiers. Use FileList instead.
4
+ * Fixed task/install script.
5
+ * Improved task/changes.
@@ -1,3 +1,7 @@
1
+ Ruby Facets
2
+
3
+ Copyright (c) 2005,2006,2007 Thomas Sawyer
4
+
1
5
 
2
6
  THE RUBY LICENSE
3
7
  (http://www.ruby-lang.org/en/LICENSE.txt)
@@ -1,4 +1,8 @@
1
- Facets 2.1.0 is in the wild!
1
+ Facets 2.1.2 has been released!
2
+
3
+ This release fixes then manual install script (task/install).
4
+
5
+ As of 2.1.0:
2
6
 
3
7
  Major changes include a new and much-improved
4
8
  command.rb, a new BiCrypt class for simple two-way
@@ -9,3 +13,4 @@ alias_xxx methods for all attr_xxx methods.
9
13
  Enjoy!
10
14
 
11
15
  http://facets.rubyforge.org
16
+
data/README CHANGED
@@ -14,6 +14,11 @@ The core extensions is a large collection of methods which extend the core capab
14
14
  The "more" additions are a collection of classes, modules and light meta-systems which constitutes an ever improving source of reusable components. Some very nice additions are provided, from the simple Functor class to a full-blown annotations system.
15
15
 
16
16
 
17
+ == Documentation
18
+
19
+ Note that Facets has special documentation needs due to it's extensive bredth. For this reason, rdocs are not automatically built by RubyGems on install. To find documentation, please see http://facets.rubyforge.org/learn.html. If you need off-line docs, there is a separate package available on the Files page of the Facets RubyForge project site.
20
+
21
+
17
22
  == Installation
18
23
 
19
24
  The easiest way to install is via RubyGems.
@@ -1 +1 @@
1
- require 'facets/facets.rb'
1
+ require 'facets/main.rb'
@@ -58,29 +58,12 @@ class Dir
58
58
 
59
59
  patterns = [patterns].flatten.compact
60
60
 
61
- if options[:default]
62
- default = [options[:default]].flatten.compact
63
- #if patterns.empty?
64
- # patterns = default
65
- if patterns.first =~ /^[+-]/ || patterns.empty?
66
- patterns = default + patterns
67
- end
68
- end
69
-
70
- patterns_include = patterns.select{ |f| f !~ /^[-]/ }
71
- patterns_exclude = patterns.select{ |f| f =~ /^[-]/ }
72
-
73
- patterns_include.collect!{ |f| f =~ /^[+]/ ? f[1..-1] : f }
74
- patterns_exclude.collect!{ |f| f =~ /^[-]/ ? f[1..-1] : f }
75
-
76
61
  if options[:recurse]
77
- patterns_include += patterns_include.collect{ |f| File.join(f, '**', '*') }
78
- patterns_exclude += patterns_exclude.collect{ |f| File.join(f, '**', '*') }
62
+ patterns += patterns.collect{ |f| File.join(f, '**', '*') }
79
63
  end
80
64
 
81
65
  files = []
82
- files += patterns_include.collect{ |pattern| Dir.glob(pattern, bitflags) }.flatten.uniq
83
- files -= patterns_exclude.collect{ |pattern| Dir.glob(pattern, bitflags) }.flatten.uniq
66
+ files += patterns.collect{ |pattern| Dir.glob(pattern, bitflags) }.flatten.uniq
84
67
 
85
68
  return files
86
69
  end
@@ -97,58 +80,11 @@ class Dir
97
80
  #
98
81
  # Dir.multiglob( 'folder', 'folder/**/*' )
99
82
 
100
- def self.multiglob_r( *patterns )
83
+ def self.multiglob_r(*patterns)
101
84
  options = (Hash === patterns.last ? patterns.pop : {})
102
85
  options[:recurse] = true
103
86
  patterns << options
104
87
  multiglob(*patterns)
105
88
  end
106
89
 
107
- # This is just like multiglob but handles a base pattern such that
108
- # if the +patterns+ list starts with a '+' or '-' entry, then the base
109
- # will be included in the result, otherwise it will be omitted.
110
- #
111
- # Dir.multiglob_with_default('*.yaml', '-*.rb') #=> [ 'foo.yaml' ]
112
- # Dir.multiglob_with_default('*.yaml', '+*.rb') #=> [ 'foo.yaml', 'foo.rb' ]
113
- # Dir.multiglob_with_default('*.yaml', '*.rb') #=> [ 'foo.rb' ]
114
- #
115
- # This is useful when a configuration option needs to supply a file list
116
- # that may include files, exclude files or append files to a default list.
117
- #
118
- # TODO Deprecate this and replace with :default option on regular multiglob?
119
-
120
- def self.multiglob_with_default(default, *patterns)
121
- default = [default].flatten.compact
122
- patterns = patterns.flatten.compact
123
-
124
- if patterns.empty?
125
- patterns = default
126
- elsif patterns.first =~ /^[+-]/
127
- patterns = default + patterns
128
- end
129
-
130
- multiglob(*patterns)
131
- end
132
-
133
90
  end
134
-
135
-
136
-
137
- # _____ _
138
- # |_ _|__ ___| |_
139
- # | |/ _ \/ __| __|
140
- # | | __/\__ \ |_
141
- # |_|\___||___/\__|
142
- #
143
-
144
- # TODO Need to mock file system.
145
-
146
- =begin #no test yet
147
-
148
- require 'test/unit'
149
-
150
- class TestDir < Test::Unit::TestCase
151
-
152
- end
153
-
154
- =end
@@ -0,0 +1 @@
1
+ require 'facets/exception/detail.rb'
@@ -0,0 +1,20 @@
1
+
2
+ class Exception
3
+
4
+ # Pretty string output of exception/error
5
+ # object useful for helpful debug messages.
6
+ #
7
+ # Input:
8
+ # The Exception/StandardError object
9
+ #
10
+ # Output:
11
+ # the pretty printed string
12
+ #
13
+ # CREDIT: George Moschovitis
14
+
15
+ def detail
16
+ return %{#{message}\n #{backtrace.join("\n ")}\n LOGGED FROM: #{caller[0]}}
17
+ end
18
+
19
+ end
20
+
@@ -24,6 +24,19 @@ module Kernel
24
24
  self
25
25
  end
26
26
 
27
+ # require 'facets/functor'
28
+ #
29
+ # # Yield self -and- return self.
30
+ #
31
+ # def tap(&b)
32
+ # if block_given?
33
+ # b.arity == 1 ? yield(self) : instance_eval(&b)
34
+ # self
35
+ # else
36
+ # Functor.new{ |op, *args| self.send(op, *args); self }
37
+ # end
38
+ # end
39
+
27
40
  # A Ruby-ized realization of the K combinator.
28
41
  #
29
42
  # returning Book.new do |book|
@@ -15,6 +15,7 @@ module Facets
15
15
  require "facets/curry"
16
16
  require "facets/dir"
17
17
  require "facets/enumerable"
18
+ require "facets/exception"
18
19
  require "facets/file"
19
20
  require "facets/filetest"
20
21
  require "facets/float"
@@ -44,3 +45,4 @@ end
44
45
 
45
46
  # Bring it on-line!
46
47
  Facets.require_core
48
+
@@ -1 +1 @@
1
- require 'facets/facets.rb'
1
+ require 'facets/main.rb'
@@ -58,16 +58,16 @@ class Logger
58
58
  alias_method :devel, :debug
59
59
  alias_method :fine, :debug
60
60
 
61
- # Prints a trace message to DEBUGLOG (at debug level).
62
- # Useful for emitting the value of variables, etc. Use
61
+ # Prints a trace message to DEBUGLOG (at debug level).
62
+ # Useful for emitting the value of variables, etc. Use
63
63
  # like this:
64
64
  #
65
65
  # x = y = 5
66
66
  # trace 'x' # -> 'x = 5'
67
67
  # trace 'x ** y' # -> 'x ** y = 3125'
68
68
  #
69
- # If you have a more complicated value, like an array of
70
- # hashes, then you'll probably want to use an alternative
69
+ # If you have a more complicated value, like an array of
70
+ # hashes, then you'll probably want to use an alternative
71
71
  # output format. For instance:
72
72
  #
73
73
  # trace 'value', :yaml
@@ -119,9 +119,9 @@ class Logger
119
119
  :inspect => :inspect, :to_yaml => :to_yaml
120
120
  )
121
121
 
122
- # Dictate the way in which this logger should format the
123
- # messages it displays. This method requires a block. The
124
- # block should return formatted strings given severity,
122
+ # Dictate the way in which this logger should format the
123
+ # messages it displays. This method requires a block. The
124
+ # block should return formatted strings given severity,
125
125
  # timestamp, msg, progname.
126
126
  #
127
127
  # === Example
@@ -136,6 +136,10 @@ class Logger
136
136
  @format_proc = format_proc
137
137
  end
138
138
 
139
+ def format_procedure
140
+ @format_proc
141
+ end
142
+
139
143
  private
140
144
 
141
145
  attr_accessor :format_proc
@@ -0,0 +1,36 @@
1
+ # TITLE:
2
+ #
3
+ # Registerable
4
+ #
5
+ # COPYING:
6
+ #
7
+ # Copyright (c) 2007 Psi T Corp.
8
+ #
9
+
10
+ module Registerable
11
+
12
+ # Register format names.
13
+
14
+ def register(*names)
15
+ names.each do |name|
16
+ registry[name.to_s] = self
17
+ end
18
+ end
19
+
20
+ # Access registry.
21
+
22
+ def registry
23
+ @@registry ||= {}
24
+ end
25
+
26
+ #
27
+
28
+ def registry_invalid?(*types)
29
+ bad = []
30
+ types.each do |type|
31
+ bad << type unless @@registry[type]
32
+ end
33
+ return bad.empty? ? false : bad
34
+ end
35
+
36
+ end
@@ -1,8 +1,14 @@
1
1
  = Facets Revision History
2
2
 
3
+ == 2.1.2 / 2007-11-22
4
+
5
+ * Dir::multiglob no longer handels -/+ modifiers. Use FileList instead.
6
+ * Fixed task/install script.
7
+ * Improved task/changes.
8
+
3
9
  == 2.1.1 / 2007-11-16
4
10
 
5
- * Fixed bug in command.rb that clobber options.
11
+ * Fixed bug in command.rb that clobbered options.
6
12
  * Added kernel/ergo.rb.
7
13
 
8
14
  == 2.1.0 / 2007-11-10
File without changes
@@ -1,8 +1,9 @@
1
1
  # -x dev -x pkg -x doc
2
2
  AUTHORS
3
- LICENSE
3
+ CHANGES
4
+ COPYING
5
+ NOTES
4
6
  README
5
- WHATSNEW
6
7
  demo
7
8
  demo/bench
8
9
  demo/bench/enumerable
@@ -64,7 +65,9 @@ lib/core/facets/enumerable/count.rb
64
65
  lib/core/facets/enumerable/permutation.rb
65
66
  lib/core/facets/enumerable/probability.rb
66
67
  lib/core/facets/enumerable.rb
67
- lib/core/facets/facets.rb
68
+ lib/core/facets/exception
69
+ lib/core/facets/exception/detail.rb
70
+ lib/core/facets/exception.rb
68
71
  lib/core/facets/file
69
72
  lib/core/facets/file/read.rb
70
73
  lib/core/facets/file/topath.rb
@@ -123,6 +126,7 @@ lib/core/facets/kernel/tap.rb
123
126
  lib/core/facets/kernel/val.rb
124
127
  lib/core/facets/kernel/withattr.rb
125
128
  lib/core/facets/kernel.rb
129
+ lib/core/facets/main.rb
126
130
  lib/core/facets/matchdata
127
131
  lib/core/facets/matchdata/matchset.rb
128
132
  lib/core/facets/matchdata.rb
@@ -721,6 +725,7 @@ lib/more/facets/recorder.rb
721
725
  lib/more/facets/recursive.rb
722
726
  lib/more/facets/reference.rb
723
727
  lib/more/facets/reflection.rb
728
+ lib/more/facets/registerable.rb
724
729
  lib/more/facets/rwdelegator.rb
725
730
  lib/more/facets/semaphore.rb
726
731
  lib/more/facets/settings.rb
@@ -742,26 +747,22 @@ lib/more/facets/yaml.rb
742
747
  lib/more/facets/ziputils.rb
743
748
  log
744
749
  log/changelog.txt
745
- log/history.txt
746
- log/release.txt
747
- log/todo.txt
750
+ log/history.rd
751
+ log/todo.rd
748
752
  meta
749
- meta/facets-2.1.1.roll
753
+ meta/MANIFEST
750
754
  meta/google_ad.html
751
755
  meta/icli.yaml
752
- meta/manifest.txt
756
+ meta/project.yaml
757
+ meta/rollrc
753
758
  task
759
+ task/changes
754
760
  task/clean
755
761
  task/clobber
756
762
  task/clobber/package
757
- task/config
758
- task/config/general.yaml
759
- task/config/rdoc.yaml
760
- task/crosstest
763
+ task/config.yaml
761
764
  task/groups
762
765
  task/install
763
- task/isotest
764
- task/loadtest
765
766
  task/log
766
767
  task/methods
767
768
  task/prepare
@@ -772,11 +773,16 @@ task/special
772
773
  task/special/quickopts
773
774
  task/stats
774
775
  task/svn
776
+ task/svn/changelog
775
777
  task/svn/tag
776
- task/syntax
777
778
  task/test
778
- task/testeach
779
- task/testpairs
779
+ task/test/cross
780
+ task/test/each
781
+ task/test/general
782
+ task/test/isotest
783
+ task/test/loadtest
784
+ task/test/pairs
785
+ task/test/syntax
780
786
  test
781
787
  test/lib
782
788
  test/lib/rq.rb
@@ -7,11 +7,11 @@ rubyforge:
7
7
  store : pkg
8
8
  package : All of Facets
9
9
  name : facets
10
- notelog : WHATSNEW
11
- changelog : log/release.txt
10
+ notelog : NOTES
11
+ changelog : CHANGES
12
12
 
13
13
  publish: {}
14
14
 
15
15
  post:
16
- file: WHATSNEW
16
+ file: NOTES
17
17
 
@@ -20,23 +20,16 @@ email : facets-universal@rubyforge.org
20
20
  homepage : 'http://facets.rubyforge.org'
21
21
  download : 'http://rubyforge.org/projects/facets'
22
22
 
23
- index_file: facets.rb
24
-
25
- load_paths:
26
- - lib/core/facets
27
- - lib/more/facets
28
- - lib/methods/facets
23
+ # Packaging Information
29
24
 
30
25
  gem_paths:
31
26
  - lib/core
32
27
  - lib/more
33
28
  - lib/methods
34
29
 
35
- # Packaging information
36
-
37
- formats : [ gem, tgz ]
38
30
  document : false
31
+ formats : [ gem, zip ] #tgz
39
32
 
40
- #manifest : meta/manifest.txt
41
- #distribute : [ -dev, -doc, -pkg ]
33
+ manifest : meta/MANIFEST
34
+ exclude : [ dev, doc, pkg ]
42
35
 
@@ -0,0 +1,5 @@
1
+ facets 2.1.2 stable 2007-11-22
2
+ lib/core/facets
3
+ lib/more/facets
4
+ lib/methods/facets
5
+
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ratch
2
+
3
+ # generate changes from history
4
+
5
+ config = configuration['changes']
6
+
7
+ history_file = config['history'] || 'log/history.rd'
8
+ changes_file = config['changes'] || 'CHANGES'
9
+
10
+ history_file.to_actual_filename!
11
+
12
+ name, version = rollrc.name, rollrc.version
13
+
14
+ main :changes do
15
+ build changes_file
16
+ end
17
+
18
+ file changes_file => [ history_file ] do
19
+ history = File.read(history_file)
20
+ matches = /^==\s*#{version}(.*?)(\n==|\Z)/m.match(history)
21
+ changes = matches[0]
22
+ changes = changes.chomp('==').strip.sub(/^==\s+/, "#{name} ")
23
+ if dryrun?
24
+ puts "#{changes_file} would have been updated (dryrun mode)."
25
+ else
26
+ File.open(changes_file, 'w'){ |f| f << changes }
27
+ puts "#{changes_file} updated."
28
+ end
29
+ end