From ertai at lrde.epita.fr Sun Oct 2 10:40:59 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 2 Oct 2005 16:40:59 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 381: Add a module extension to ease the use of in place methods. Message-ID: <20051002144059.51B611C00096@mwinf1106.wanadoo.fr> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard Add a module extension to ease the use of in place methods. * lib/core_ex/module/in_place.rb: New. Simply make a new method which dup the object and call the in place method on it. in_place.rb | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+) Index: lib/core_ex/module/in_place.rb --- lib/core_ex/module/in_place.rb (revision 0) +++ lib/core_ex/module/in_place.rb (revision 0) @@ -0,0 +1,28 @@ +# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + +module CoreEx + + module Module + + module InPlace + + def in_place ( *syms ) + syms.each do |sym| + sym = sym.to_s.sub(/!*$/, '') + module_eval " + def #{sym} ( *a, &b ) + dup.#{sym}!(*a, &b) + end + " + end + end + + end # module InPlace + + end # module Module + +end # module CoreEx + Property changes on: lib/core_ex/module/in_place.rb ___________________________________________________________________ Name: svn:keywords + Id -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051002/3dbd75c8/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 2 11:10:50 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 2 Oct 2005 17:10:50 +0200 Subject: [Uttk-Patches] [core_ex] 381: Add a module extension to ease the use of in place methods. In-Reply-To: <20051002144059.51B611C00096@mwinf1106.wanadoo.fr> References: <20051002144059.51B611C00096@mwinf1106.wanadoo.fr> Message-ID: <840b875c0510020810l1fddabdcpc2ecc6ceb4b4cc2b@mail.gmail.com> On 10/2/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk/core_ex > > Index: ChangeLog > from Nicolas Pouillard > > Add a module extension to ease the use of in place methods. > > * lib/core_ex/module/in_place.rb: New. Simply make a new method which > dup the object and call the in place method on it. > [...] Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 2 12:41:19 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 2 Oct 2005 18:41:19 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 382: Two fixes in object extensions. Message-ID: <20051002164119.735BB1C00209@mwinf0512.wanadoo.fr> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard Two fixes in object extensions. * lib/core_ex/object/the_first_time.rb: Rename just_one_time to just_once. * lib/core_ex/object/singleton_class.rb: Adapt the test to the new behavior of superclass in ruby 1.8.3. singleton_class.rb | 3 ++- the_first_time.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) Index: lib/core_ex/object/the_first_time.rb --- lib/core_ex/object/the_first_time.rb (revision 381) +++ lib/core_ex/object/the_first_time.rb (working copy) @@ -19,7 +19,7 @@ block[] end - alias_method :just_one_time, :the_first_time + alias_method :just_once, :the_first_time end # module TheFirstTime Index: lib/core_ex/object/singleton_class.rb --- lib/core_ex/object/singleton_class.rb (revision 381) +++ lib/core_ex/object/singleton_class.rb (working copy) @@ -54,7 +54,8 @@ end assert_equal @string.singleton_class.object_id, @string.singleton_class.object_id, 'not the same object id' - assert_equal ::String, @string.singleton_class.superclass, 'bad super class' + assert_equal ::String, @string.singleton_class.ancestors.first, + 'bad super class' end def test_define_and_undef_singleton_method -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051002/26471c87/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 2 12:48:45 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 2 Oct 2005 18:48:45 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 383: CoreEx now support YAML in ruby 1.8.3. Message-ID: <20051002164845.042E71C0009B@mwinf1208.wanadoo.fr> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard CoreEx now support YAML in ruby 1.8.3. * lib/yaml_extension.rb, * lib/core_ex/pathname.rb, * lib/core_ex/yaml.rb, * lib/core_ex/proc.rb, * lib/core_ex.rb: Adapt to taguri and add some dynamic fixes. Use a global variable for CORE_EX_VENDORS. core_ex.rb | 78 +++++++++++++++++++++++++++++++++++++++++------ core_ex/pathname.rb | 2 - core_ex/proc.rb | 2 - core_ex/yaml.rb | 85 ++++++++++++++++++++++++++++++++++++++-------------- yaml_extension.rb | 25 ++++++++++++++- 5 files changed, 156 insertions(+), 36 deletions(-) Index: lib/yaml_extension.rb --- lib/yaml_extension.rb (revision 382) +++ lib/yaml_extension.rb (working copy) @@ -22,12 +22,19 @@ yamlTypes << theYamlType yamlTypes.map! { |x| x.to_s.sub(/^!/, '') } - suppress(NoMethodError, NameError) { undef_method :to_yaml_type } old_to_yaml = :"#{theYamlType}_to_yaml" alias_method old_to_yaml, :to_yaml suppress(NoMethodError, NameError) { remove_method :to_yaml } + if HAVE_YAML_TAGURI + taguri_ = theYamlType.to_s + domain = 'yaml.org,2002' # FIXME 'feydakins.org,2005' + taguri_ = "tag:#{domain}:#{taguri_}" unless taguri_ =~ /^tag:/ + define_method(:taguri) { taguri_ } + else + suppress(NoMethodError, NameError) { undef_method :to_yaml_type } define_method(:to_yaml_type) { "!#{theYamlType}" } + end theClass = self yamlTypes.each do |yamlType| @@ -37,6 +44,17 @@ end end + if HAVE_YAML_TAGURI + def to_yaml ( opts={} ) + if respond_to? :to_yaml_string + YAML::quick_emit(object_id, opts) do |out| + out.scalar(taguri, to_yaml_string, :plain) + end + else + send(old_to_yaml, opts) + end + end + else def to_yaml ( opts={} ) if respond_to? :to_yaml_string YAML::quick_emit(self.object_id, opts) do |out| @@ -46,6 +64,7 @@ send(old_to_yaml, opts) end end + end module Assertions @@ -56,7 +75,7 @@ attr_accessor :val, :str, :ref def assert_yaml_load ( aString, aClass, anObject=nil ) - assert_nothing_raised { @val = YAML::load(aString) } + assert_nothing_raised { @val = YAML::load("---\n" + aString) } assert_kind_of(aClass, @val) assert_equal(anObject, @val) unless anObject.nil? @ref = aString @@ -64,6 +83,8 @@ def assert_yaml_dump ( anObject, ref, options={} ) assert_nothing_raised { @str = anObject.to_yaml(options) } + @str.gsub!(/---\s*/, '') + @str.chomp! if ref.is_a? Regexp assert_match(ref, @str) else Index: lib/core_ex/pathname.rb --- lib/core_ex/pathname.rb (revision 382) +++ lib/core_ex/pathname.rb (working copy) @@ -291,7 +291,7 @@ def test_yaml str = 'foo/bar/baz.rb' - assert_yaml_load "--- !path #{str}", ::Pathname, str.to_path + assert_yaml_load "!path #{str}", ::Pathname, str.to_path assert_equal('baz.rb', @val.basename.to_s) assert_equal(str, @val.to_s) assert_yaml_dump str.to_path, @ref Index: lib/core_ex/yaml.rb --- lib/core_ex/yaml.rb (revision 382) +++ lib/core_ex/yaml.rb (working copy) @@ -62,6 +62,19 @@ alias_method :old_to_yaml, :to_yaml + if HAVE_YAML_TAGURI + def to_yaml ( opts={} ) + inline = nil + if not opts.is_a?(YAML::Syck::Emitter) and opts[:Inline] and not is_complex_yaml? + inline = :inline + end + YAML::quick_emit(object_id, opts) do |out| + out.seq( taguri, to_yaml_style || inline ) do |seq| + each { |x| seq.add x } + end + end + end + else def to_yaml ( opts={} ) em = (opts.is_a? YAML::Syck::Emitter)? opts : opts[:Emitter] if (opts[:Inline] or (em and em.options[:Inline])) and not is_complex_yaml? @@ -82,6 +95,7 @@ old_to_yaml(opts) end end + end suppress(NoMethodError, NameError) { undef_method :is_complex_yaml? } @@ -98,6 +112,19 @@ alias_method :old_to_yaml, :to_yaml + if HAVE_YAML_TAGURI + def to_yaml ( opts={} ) + inline = nil + if not opts.is_a?(YAML::Syck::Emitter) and opts[:Inline] and not is_complex_yaml? + inline = :inline + end + YAML::quick_emit(object_id, opts) do |out| + out.map(taguri, to_yaml_style || inline) do |map| + each { |k, v| map.add k, v } + end + end + end + else def to_yaml ( opts={} ) em = (opts.is_a? YAML::Syck::Emitter)? opts : opts[:Emitter] if (opts[:Inline] or (em and em.options[:Inline])) and not is_complex_yaml? @@ -120,6 +147,7 @@ old_to_yaml(opts) end end + end suppress(NoMethodError, NameError) { undef_method :is_complex_yaml? } @@ -132,7 +160,7 @@ -YAML.add_builtin_type('!ruby') do |type, val| +YAML.add_builtin_type('ruby') do |type, val| eval val.to_s end @@ -146,14 +174,14 @@ def test_regexp @re = /a.*[bc]$/ - assert_yaml_load '--- !re a.*[bc]$', Regexp, @re + assert_yaml_load '!re a.*[bc]$', Regexp, @re assert_match(@val, 'afffc') assert_no_match(@val, 'afffC') assert_no_match(@val, 'fffb') assert_no_match(@val, "af\nffb") assert_yaml_dump @re, @ref @re = /a.*[bc]$/mi - assert_yaml_load '--- !re ["a.*[bc]$", mi]', Regexp, @re + assert_yaml_load '!re ["a.*[bc]$", mi]', Regexp, @re assert_match(@val, 'afffc') assert_match(@val, 'afffC') assert_no_match(@val, 'fffb') @@ -161,55 +189,68 @@ end def test_range - assert_yaml_load "--- !range 0..10", Range, 0..10 + assert_yaml_load "!range 0..10", Range, 0..10 assert_yaml_dump @val, @ref - assert_yaml_load "--- !range 0...10", Range, 0...10 + assert_yaml_load "!range 0...10", Range, 0...10 assert_yaml_dump @val, @ref end def test_ruby - assert_yaml_load "--- !ruby 2 + 4", Integer, 6 - assert_yaml_load "--- !ruby '[2, 4]'", Array, [2, 4] + assert_yaml_load "!ruby 2 + 4", Integer, 6 + assert_yaml_load "!ruby '[2, 4]'", Array, [2, 4] + end + + class A < String + have YamlExtension, :core_ex_yaml_test_a + def is_complex_yaml? + true + end + def to_yaml_string + to_s + end + def self.yaml_load ( val ) + A.new(val) + end end def test_array opts = { :Inline => true } - assert_yaml_load '--- [2, "4"]', Array, [2, '4'] + assert_yaml_load '[2, "4"]', Array, [2, '4'] assert_yaml_dump @val, @ref, opts - assert_yaml_load '--- [2, "4"]', Array, [2, '4'] - assert_yaml_dump @val, "--- \n- 2\n- \"4\"" - assert_yaml_load "--- [2, [!range 1..4]]", Array, [2, [1..4]] - assert_yaml_dump @val, "--- \n- 2\n- \n - !range 1..4", opts + assert_yaml_load '[2, "4"]', Array, [2, '4'] + assert_yaml_dump @val, "- 2\n- \"4\"" + assert_yaml_load "[2, [!core_ex_yaml_test_a x]]", Array, [2, [A.new('x')]] + assert_yaml_dump @val, /- 2\n- (\n )?- !core_ex_yaml_test_a x/, opts arr = (0 .. 25).to_a str = arr.join(', ') str2 = arr.join("\n- ") - assert_yaml_load "--- [#{str}]", Array, arr - assert_yaml_dump @val, "--- \n- #{str2}", opts - assert_yaml_load '--- [2, {a: 4}]', Array, [2, {'a' => 4}] + assert_yaml_load "[#{str}]", Array, arr + assert_yaml_dump @val, "- #{str2}", opts + assert_yaml_load '[2, {a: 4}]', Array, [2, {'a' => 4}] assert_yaml_dump @val, @ref, opts end def test_hash opts = { :Inline => true } - assert_yaml_load '--- {a: "4"}', Hash, { 'a' => '4' } + assert_yaml_load '{a: "4"}', Hash, { 'a' => '4' } assert_yaml_dump @val, @ref, opts - assert_yaml_load '--- {a: "4"}', Hash, { 'a' => '4' } - assert_yaml_dump @val, "--- \na: \"4\"" - assert_yaml_load "--- {a: [4]}", Hash, { 'a' => [4] } + assert_yaml_load '{a: "4"}', Hash, { 'a' => '4' } + assert_yaml_dump @val, "a: \"4\"" + assert_yaml_load "{a: [4]}", Hash, { 'a' => [4] } assert_yaml_dump @val, @ref, opts hash = Hash[*(0 .. 23).to_a] arr = hash.map{|k,v| "#{k}: #{v}"}.sort str = arr.join(', ') str2 = arr.join('|') - assert_yaml_load "--- {#{str}}", Hash, hash - assert_yaml_dump @val, /\A--- \n(?:(?:#{str2})\n)*(?:#{str2})\Z/, opts + assert_yaml_load "{#{str}}", Hash, hash + assert_yaml_dump @val, /\A(?:(?:#{str2})\n)*(?:#{str2})\Z/, opts end def test_no_inline opts = { :Inline => false } hash = Hash[*(0 .. 3).to_a] tree = [hash.dup, hash.dup, hash.dup, hash.dup] - @no_inline = "--- \n- \n 0: 1\n 2: 3\n- \n 0: 1\n 2: 3\n- \n 0: 1\n 2: 3\n- \n 0: 1\n 2: 3" + @no_inline = /- (\n )?0: 1\n 2: 3\n- (\n )?0: 1\n 2: 3\n- (\n )?0: 1\n 2: 3\n- (\n )?0: 1\n 2: 3/ assert_yaml_dump tree, @no_inline, opts assert_yaml_dump tree, @no_inline end Index: lib/core_ex/proc.rb --- lib/core_ex/proc.rb (revision 382) +++ lib/core_ex/proc.rb (working copy) @@ -65,7 +65,7 @@ end def test_yaml - assert_yaml_load "--- !proc 3 + 7", Proc + assert_yaml_load "!proc 3 + 7", Proc assert_yaml_dump @val, @ref assert_equal(10, @val[]) end Index: lib/core_ex.rb --- lib/core_ex.rb (revision 382) +++ lib/core_ex.rb (working copy) @@ -16,23 +16,23 @@ core_ex_long = (CORE_EX_DIR + 'core_ex.rb').to_s $LOADED_FEATURES << core_ex_long unless $LOADED_FEATURES.include? core_ex_long - CORE_EX_VENDORS = [] unless defined? CORE_EX_VENDORS - CORE_EX_VENDORS << CORE_EX_DIR.parent + 'vendor' + $CORE_EX_VENDORS ||= [] + $CORE_EX_VENDORS << CORE_EX_DIR.parent + 'vendor' def core_ex_debug ( &block ) # STDERR.puts block[].inspect end - def core_ex_vendor_require ( dir_name, dir_version='*' ) - if CORE_EX_VENDORS.any? { |dir| dir.exist? } - dir = Pathname.glob("{#{CORE_EX_VENDORS.join(',')}}/#{dir_name}#{dir_version}/{lib,}").first + def core_ex_vendor_require ( dir_name, sub_dir='lib' ) + if $CORE_EX_VENDORS.any? { |dir| dir.exist? } + dir = Pathname.glob("{#{$CORE_EX_VENDORS.join(',')}}/#{dir_name}/{#{sub_dir},}").first if dir and dir.directory? if defined? CoreEx::Pathname and Pathname.include? CoreEx::Pathname dir.load_path! else $LOAD_PATH << dir.to_s end - core_ex_debug { [:vendor, dir_name, dir_version] } + core_ex_debug { [:vendor, dir_name, sub_dir] } else raise LoadError, "no vendor dir #{dir}" end @@ -42,7 +42,7 @@ end def core_ex_register_vendor ( dir ) - CORE_EX_VENDORS << dir unless CORE_EX_VENDORS.include? dir + $CORE_EX_VENDORS << dir unless $CORE_EX_VENDORS.include? dir end begin @@ -58,9 +58,9 @@ end end - def core_ex_require ( name, gem_name=name, dir_name=name, gem_version='> 0', dir_version='*' ) + def core_ex_require ( name, gem_name=name, dir_name=name, gem_version='> 0', sub_dir='lib' ) begin - core_ex_vendor_require(dir_name, dir_version) + core_ex_vendor_require(dir_name, sub_dir) rescue LoadError => ex begin core_ex_gem_require(gem_name, gem_version) @@ -72,7 +72,64 @@ verbose = $VERBOSE $VERBOSE = false - core_ex_require 'active_support', 'activesupport', 'activesupport', '~> 1.1.1', '-1.1.1' + + # <<< Dynamic fix: bug: Ruby 1.8.3 vs active_support 1.1.1 + require 'logger' + class Logger + Format = 42 unless defined? Format + end + # >>> + + core_ex_require 'active_support', 'activesupport', 'activesupport', '~> 1.1.1' + + # <<< Dynamic patch: Yaml warnings in ruby 1.8.3 + begin + silence_warnings { require 'yaml/tag' } + class Module + alias yaml_as_bugged yaml_as + def yaml_as( tag, sc = true ) + class_eval <<-"end;", __FILE__, __LINE__ + attr_writer :taguri + def taguri + if respond_to? :to_yaml_type + YAML::tagurize( to_yaml_type[1..-1] ) + else + return @taguri if defined? @taguri + tag = #{ tag.dump } + if self.class.yaml_tag_subclasses? and self.class != YAML::tagged_classes[tag] + tag = "\#{ tag }:\#{ self.class.yaml_tag_class_name }" + end + tag + end + end + def self.yaml_tag_subclasses?; #{ sc ? 'true' : 'false' }; end + end; + YAML::tag_class tag, self + end + end + silence_warnings { require 'yaml' } + module YAML + module Syck + class Parser + alias initialize_bugged initialize + def initialize ( *a, &b ) + @input = nil + initialize_bugged(*a, &b) + end + end + end + end + class Object + def is_complex_yaml? + false + end + end + HAVE_YAML_TAGURI = true + rescue LoadError => ex + HAVE_YAML_TAGURI = false + end + # >>> + # <<< little active_support patch module Inflector @@ -171,6 +228,7 @@ include CoreEx::Module::MixInWithArgs include CoreEx::Module::AttrOnce include CoreEx::Module::Import + include CoreEx::Module::InPlace end # class Module class Object -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051002/c4867c4b/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 2 12:55:18 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 2 Oct 2005 18:55:18 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 384: Improve rakefile_base.rf to support developper version of vendor. Message-ID: <20051002165518.30E531C003EC@mwinf0407.wanadoo.fr> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard Improve rakefile_base.rf to support developper version of vendor. * lib/core_ex/rakefile_base.rf: Add vendor_dev, revendor_dev, clobber_vendor_dev. Dependencies in SPEC.yml can now be hashes. * SPEC.yml: Update to the hash mode for dependencies. SPEC.yml | 4 +++- lib/core_ex/rakefile_base.rf | 43 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 39 insertions(+), 8 deletions(-) Index: lib/core_ex/rakefile_base.rf --- lib/core_ex/rakefile_base.rf (revision 383) +++ lib/core_ex/rakefile_base.rf (working copy) @@ -254,7 +254,11 @@ if SPEC.dependencies SPEC.dependencies.each do |name, version| - s.add_dependency(name, (version.is_a? Array)? version.first : version) + case version + when Array then version = version.first + when Hash then version = version['gem'] + end + s.add_dependency(name, version) end end @@ -563,23 +567,35 @@ end - task :vendor => [ :spec, :ruby_ex ] do + dev = $developpement_mode unless VENDOR.directory? - say "Creating the vendor directory..." + say "Creating the #{(dev)? 'developpement ' : ''}vendor directory..." VENDOR.mkpath require 'uri_ex' if SPEC.dependencies SPEC.dependencies.each do |name, version| - next unless version.is_a? Array - url = version.last + url = nil + case version + when Array then url = version.last + when Hash + if $developpement_mode and version['vcs'] + url = version['vcs'] + else + url = version['tarball'] + end + else next + end + next if url.nil? if url =~ /^\d+\/[^\/]+$/ url = "http://rubyforge.org/frs/download.php/#{url}" end url = URI.parse(url) - dest = VENDOR + url.pathname.basename.ext.to_s.sub(/\.tar$/, '').to_path + dest = VENDOR + name STDERR.puts "#{url} => #{dest}" - FileType.guess(url.checkout).extract.path.mv(dest) + out = FileType.guess(url.checkout.first) + out = out.extract if out.extractable? + out.path.mv(dest) end end end @@ -590,3 +606,16 @@ end task :revendor => [:clobber_vendor, :vendor] + + + +task :vendor_dev => [ :set_developpement_mode, :vendor ] + +clean_task :vendor_dev => [:clobber_vendor] + +task :revendor_dev => [:clobber_vendor_dev, :vendor_dev] + +$developpement_mode ||= false +task :set_developpement_mode do + $developpement_mode = true +end Index: SPEC.yml --- SPEC.yml (revision 383) +++ SPEC.yml (working copy) @@ -37,6 +37,8 @@ - '[A-Z]*' dependencies: - activesupport: [~> 1.1.1, 5161/activesupport-1.1.1.tgz] + activesupport: + gem: ~> 1.1.1 + tarball: 5161/activesupport-1.1.1.tgz ttk_version: ~> 0.3.0 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051002/d234b5b5/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 2 12:49:30 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 2 Oct 2005 18:49:30 +0200 Subject: [Uttk-Patches] [core_ex] 382: Two fixes in object extensions. In-Reply-To: <20051002164119.735BB1C00209@mwinf0512.wanadoo.fr> References: <20051002164119.735BB1C00209@mwinf0512.wanadoo.fr> Message-ID: <840b875c0510020949s261bcd7fkb07bf5ac31d2a858@mail.gmail.com> On 10/2/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk/core_ex > > Index: ChangeLog > from Nicolas Pouillard > > Two fixes in object extensions. > > * lib/core_ex/object/the_first_time.rb: Rename just_one_time to > just_once. > * lib/core_ex/object/singleton_class.rb: Adapt the test to the new > behavior of superclass in ruby 1.8.3. > [...] Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 2 12:56:10 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 2 Oct 2005 18:56:10 +0200 Subject: [Uttk-Patches] [ruby_ex] 376: Rename resources to fixtures. In-Reply-To: <20050929214637.AB0427C615@smtp.feydakins.org> References: <20050929214637.AB0427C615@smtp.feydakins.org> Message-ID: <840b875c0510020956x68d74c00w5d368db68672e069@mail.gmail.com> On 9/29/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk > > Index: ChangeLog > from Nicolas Pouillard > > Rename resources to fixtures. > > * test/functional: New. > * test/resources: Rename to ... > * test/fixtures: ... this. > * test/fixtures/my_diff.patch: New. > * lib/sym_tbl_gsub.rb, > * lib/md5sum.rb, > * lib/file_type.rb, > * lib/cache.rb, > * lib/module/autoload_tree.rb: Update. > [...] Ok, if you prefer... [...] > > Index: test/fixtures/my_diff.patch > --- test/fixtures/my_diff.patch (revision 0) > +++ test/fixtures/my_diff.patch (revision 0) What is that? [...] Reviewed. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 2 12:57:42 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 2 Oct 2005 18:57:42 +0200 Subject: [Uttk-Patches] [core_ex] 384: Improve rakefile_base.rf to support developper version of vendor. In-Reply-To: <20051002165518.30E531C003EC@mwinf0407.wanadoo.fr> References: <20051002165518.30E531C003EC@mwinf0407.wanadoo.fr> Message-ID: <840b875c0510020957n34963607lca5c446e39d9ff79@mail.gmail.com> On 10/2/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk/core_ex > > Index: ChangeLog > from Nicolas Pouillard > > Improve rakefile_base.rf to support developper version of vendor. > > * lib/core_ex/rakefile_base.rf: Add vendor_dev, revendor_dev, > clobber_vendor_dev. Dependencies in SPEC.yml can now be hashes. > * SPEC.yml: Update to the hash mode for dependencies. > [...] Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 2 12:51:01 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 2 Oct 2005 18:51:01 +0200 Subject: [Uttk-Patches] [core_ex] 383: CoreEx now support YAML in ruby 1.8.3. In-Reply-To: <20051002164845.042E71C0009B@mwinf1208.wanadoo.fr> References: <20051002164845.042E71C0009B@mwinf1208.wanadoo.fr> Message-ID: <840b875c0510020951g7e01625wc96131ef17bbb32@mail.gmail.com> On 10/2/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk/core_ex > > Index: ChangeLog > from Nicolas Pouillard > > CoreEx now support YAML in ruby 1.8.3. > > * lib/yaml_extension.rb, > * lib/core_ex/pathname.rb, > * lib/core_ex/yaml.rb, > * lib/core_ex/proc.rb, > * lib/core_ex.rb: Adapt to taguri and add some dynamic fixes. > Use a global variable for CORE_EX_VENDORS. > [...] Ok. Good ! Does it still support ruby 1.8.2? -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 2 13:11:21 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 2 Oct 2005 19:11:21 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 385: Upgrade RubyEx to ruby 1.8.3. Message-ID: <20051002171121.7812D1C003DD@mwinf0303.wanadoo.fr> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Upgrade RubyEx to ruby 1.8.3. * lib/uri/file.rb, lib/uri/ftp_ex.rb, lib/uri/http_ex.rb: Make checkout return an array. * lib/ruby_ex.rb: Update the CoreEx require. * lib/d_logger.rb: Update to Logger 1.2.6 in ruby 1.8.3. * lib/drb/insecure_protected_methods.rb: Update the unit test suite. * SPEC.yml: Use a hash for the CoreEx dependency. SPEC.yml | 5 ++++- lib/d_logger.rb | 10 ++++++++-- lib/drb/insecure_protected_methods.rb | 2 +- lib/ruby_ex.rb | 11 +++++++---- lib/uri/file.rb | 2 +- lib/uri/ftp_ex.rb | 2 +- lib/uri/http_ex.rb | 2 +- 7 files changed, 23 insertions(+), 11 deletions(-) Index: lib/uri/file.rb --- lib/uri/file.rb (revision 384) +++ lib/uri/file.rb (working copy) @@ -53,7 +53,7 @@ cmd = GZIP['-c', p] > out end cmd.run(self.runner) - out + [out, nil] end end # class File Index: lib/uri/ftp_ex.rb --- lib/uri/ftp_ex.rb (revision 384) +++ lib/uri/ftp_ex.rb (working copy) @@ -28,7 +28,7 @@ raise CheckoutError, "Cannot checkout #{to_s} (error: #{ex.short_pp})" end - tmp + [tmp, nil] end end # class FTP Index: lib/uri/http_ex.rb --- lib/uri/http_ex.rb (revision 384) +++ lib/uri/http_ex.rb (working copy) @@ -33,7 +33,7 @@ raise CheckoutError, "Cannot checkout #{to_s} (error: #{ex.short_pp})" end - tmp + [tmp, nil] end end # class HTTP Index: lib/ruby_ex.rb --- lib/ruby_ex.rb (revision 384) +++ lib/ruby_ex.rb (working copy) @@ -35,13 +35,16 @@ unless defined? CoreEx - file = Pathname.glob("#{dir}/../{core_ex/lib/core_ex,vendor/core_ex*/lib/core_ex}").first - if file.nil? + vendor = dir.parent + 'vendor' + $CORE_EX_VENDORS ||= [] + $CORE_EX_VENDORS << vendor + file = vendor + 'core_ex' + 'lib' + 'core_ex' + if file.exist? + require file.to_s + else require 'rubygems' require_gem 'core_ex' require 'core_ex' - else - require file end end suppress(LoadError) { core_ex_require 'highline' } Index: lib/d_logger.rb --- lib/d_logger.rb (revision 384) +++ lib/d_logger.rb (working copy) @@ -29,9 +29,15 @@ end Format = "%s, [%s#%d] %6s -- %s: %s\n" + if defined? Logger::VERSION and Logger::VERSION >= '1.2.6' + def format_message(severity, timestamp, progname, msg) + Format % [severity[0..0], timestamp, $$, severity, progname, msg] + end + else def format_message(severity, timestamp, msg, progname) Format % [severity[0..0], timestamp, $$, severity, progname, msg] end + end private :format_message end # class DLogger @@ -51,8 +57,8 @@ log.debug3 'You don\'t see me' log.debug2 'You see me' cout.rewind - ref = /D, \[\d+-\d+-\d+.\d+:\d+:\d+\.\d+ #\d+\] DEBUG -- : You see me -D, \[\d+-\d+-\d+.\d+:\d+:\d+\.\d+ #\d+\] DEBUG2 -- : You see me/ + ref = /D, \[[\d\w: -]+#\d+\] DEBUG -- : You see me +D, \[[\d\w: -]+#\d+\] DEBUG2 -- : You see me/ assert_match(ref, cout.readlines.join) end Index: lib/drb/insecure_protected_methods.rb --- lib/drb/insecure_protected_methods.rb (revision 384) +++ lib/drb/insecure_protected_methods.rb (working copy) @@ -79,7 +79,7 @@ # Test # def test_simple - assert_raises(NameError) { @drb_obj.send(:protected_resquest) } + assert_raises(NameError, NoMethodError) { @drb_obj.send(:protected_resquest) } assert_nothing_raised { @drb_obj.public_request } end Index: SPEC.yml --- SPEC.yml (revision 384) +++ SPEC.yml (working copy) @@ -30,7 +30,10 @@ - '[A-Z]*' dependencies: - core_ex: [~> 0.3.1, 6077/core_ex-0.3.1.tar.gz] + core_ex: + gem: ~> 0.3.1 + tarball: 6077/core_ex-0.3.1.tar.gz + vcs: svn://svn.feydakins.org/ruby_ex/trunk/core_ex highline: [~> 1.0.1, 5143/highline-1.0.1.tgz] ttk_version: ~> 0.3.0 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051002/492939ea/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 2 13:16:05 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 2 Oct 2005 19:16:05 +0200 Subject: [Uttk-Patches] [ruby_ex] 385: Upgrade RubyEx to ruby 1.8.3. In-Reply-To: <20051002171121.7812D1C003DD@mwinf0303.wanadoo.fr> References: <20051002171121.7812D1C003DD@mwinf0303.wanadoo.fr> Message-ID: <840b875c0510021016n18014f66ha9a0380630608bae@mail.gmail.com> On 10/2/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk > > Index: ChangeLog > from Nicolas Pouillard > > Upgrade RubyEx to ruby 1.8.3. > > * lib/uri/file.rb, lib/uri/ftp_ex.rb, lib/uri/http_ex.rb: Make checkout > return an array. > * lib/ruby_ex.rb: Update the CoreEx require. > * lib/d_logger.rb: Update to Logger 1.2.6 in ruby 1.8.3. > * lib/drb/insecure_protected_methods.rb: Update the unit test suite. > * SPEC.yml: Use a hash for the CoreEx dependency. > [...] Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 2 20:02:20 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Mon, 3 Oct 2005 02:02:20 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 386: Some fixes before the release. Message-ID: <20051003000220.70D977C7D4@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard Some fixes before the release. * lib/core_ex/rakefile_base.rf: Fix a missing uttk renaming. Make vendor_dev recursive for vcs based dependencies. * lib/core_ex.rb: Change a default value in core_ex_require. * SPEC.yml: Remove the 'commit_dir: ..'. SPEC.yml | 1 - lib/core_ex.rb | 2 +- lib/core_ex/rakefile_base.rf | 15 ++++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) Index: lib/core_ex/rakefile_base.rf --- lib/core_ex/rakefile_base.rf (revision 385) +++ lib/core_ex/rakefile_base.rf (working copy) @@ -80,6 +80,10 @@ task :ruby_ex => [ :spec ] do require_gem('ruby_ex', SPEC.ruby_ex_version || '~> 0.2.0') require 'ruby_ex' + Commands.import! + $runner = Commands::Runners::System.new + $runner.raise_on_failures + $runner.make_verbose end @@ -87,9 +91,8 @@ task :uttk => [ :spec, :ruby_ex ] do require_gem('uttk', SPEC.uttk_version || '~> 0.3.0') require 'uttk' - Commands.import! def uttk ( *a, &b ) - cmd = TTK.bin[*a] + cmd = Uttk.bin[*a] cmd.input = b[] if b cmd.output = STDOUT cmd.error = STDERR @@ -569,6 +572,7 @@ task :vendor => [ :spec, :ruby_ex ] do dev = $developpement_mode + $developpement_mode = false unless VENDOR.directory? say "Creating the #{(dev)? 'developpement ' : ''}vendor directory..." VENDOR.mkpath @@ -579,7 +583,7 @@ case version when Array then url = version.last when Hash - if $developpement_mode and version['vcs'] + if dev and version['vcs'] url = version['vcs'] else url = version['tarball'] @@ -596,6 +600,11 @@ out = FileType.guess(url.checkout.first) out = out.extract if out.extractable? out.path.mv(dest) + if dev and version['vcs'] and (dest + 'SPEC.yml').exist? + cmd = $0.to_cmd['vendor_dev'] > [STDOUT, STDERR] + cmd.dir = dest + data = cmd.run($runner) + end end end end Index: lib/core_ex.rb --- lib/core_ex.rb (revision 385) +++ lib/core_ex.rb (working copy) @@ -58,7 +58,7 @@ end end - def core_ex_require ( name, gem_name=name, dir_name=name, gem_version='> 0', sub_dir='lib' ) + def core_ex_require ( name, gem_name=name, dir_name=gem_name, gem_version='> 0', sub_dir='lib' ) begin core_ex_vendor_require(dir_name, sub_dir) rescue LoadError => ex Index: SPEC.yml --- SPEC.yml (revision 385) +++ SPEC.yml (working copy) @@ -23,7 +23,6 @@ tags_url: svn://svn.feydakins.org/ruby_ex/tags commit_command: rxci -commit_dir: .. rdoc_files: !filelist - README -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051003/b43529dc/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 2 20:16:38 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Mon, 3 Oct 2005 02:16:38 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 387: Bump to 0.4. Message-ID: <20051003001638.43A4D7C7B1@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard Bump to 0.4. * SPEC.dyn.yml: Update. * SPEC.yml: Just use ci. * NEWS: Add the 0.4 section. NEWS | 7 +++++++ SPEC.dyn.yml | 10 +++++----- SPEC.yml | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) Index: SPEC.dyn.yml --- SPEC.dyn.yml (revision 386) +++ SPEC.dyn.yml (working copy) @@ -1,10 +1,10 @@ --- !ruby/object:OpenStruct table: - :url: svn://svn.feydakins.org/ruby_ex/trunk/core_ex :version_id: '' + :date: "Mon, 03 Oct 2005" :version: !ruby/object:Version - build: 1 + build: 0 major: 0 - minor: 3 - revision: 356 - :date: "Fri, 16 Sep 2005" + minor: 4 + revision: 387 + :url: svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: SPEC.yml --- SPEC.yml (revision 386) +++ SPEC.yml (working copy) @@ -22,7 +22,7 @@ rdoc_dir: doc/html tags_url: svn://svn.feydakins.org/ruby_ex/tags -commit_command: rxci +commit_command: ci rdoc_files: !filelist - README Index: NEWS --- NEWS (revision 386) +++ NEWS (working copy) @@ -1,3 +1,10 @@ += New in 0.4, 2005-10-03: + + This release is mainly a bugfix release compatible with ruby 1.8.3! + + * CoreEx::Module::InPlace: + Add a module extension to ease the use of in place methods. + = New in 0.3, 2005-09-15: * Architecture: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051003/0b410a9b/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 2 20:46:22 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Mon, 3 Oct 2005 02:46:22 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 389: Little DLogger fix for ruby 1.8.2. Message-ID: <20051003004622.67FA77C864@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Little DLogger fix for ruby 1.8.2. * lib/d_logger.rb: Suppress a warning with ruby 1.8.2. Fix the test for ruby 1.8.2. d_logger.rb | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: lib/d_logger.rb --- lib/d_logger.rb (revision 388) +++ lib/d_logger.rb (working copy) @@ -29,7 +29,7 @@ end Format = "%s, [%s#%d] %6s -- %s: %s\n" - if defined? Logger::VERSION and Logger::VERSION >= '1.2.6' + if Logger.const_defined? :VERSION and Logger::VERSION >= '1.2.6' def format_message(severity, timestamp, progname, msg) Format % [severity[0..0], timestamp, $$, severity, progname, msg] end @@ -57,8 +57,8 @@ log.debug3 'You don\'t see me' log.debug2 'You see me' cout.rewind - ref = /D, \[[\d\w: -]+#\d+\] DEBUG -- : You see me -D, \[[\d\w: -]+#\d+\] DEBUG2 -- : You see me/ + ref = /D, \[[\d\w: .-]+#\d+\] DEBUG -- : You see me +D, \[[\d\w: .-]+#\d+\] DEBUG2 -- : You see me/ assert_match(ref, cout.readlines.join) end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051003/125708e3/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 2 22:21:54 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Mon, 3 Oct 2005 04:21:54 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 390: Bump RubyEx to 0.3. Message-ID: <20051003022154.4DF957C86A@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Bump RubyEx to 0.3. * SPEC.dyn.yml: Update. * SPEC.yml: Update CoreEx dependency to 0.4. * NEWS: Add an entry. NEWS | 11 +++++++++++ SPEC.dyn.yml | 6 +++--- SPEC.yml | 4 ++-- core_ex/lib/core_ex/rakefile_base.rf | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) Index: SPEC.dyn.yml --- SPEC.dyn.yml (revision 389) +++ SPEC.dyn.yml (working copy) @@ -1,10 +1,10 @@ --- !ruby/object:OpenStruct table: :version_id: '' - :url: svn://svn.feydakins.org/ruby_ex/trunk + :date: "Mon, 03 Oct 2005" :version: !ruby/object:Version build: 0 major: 0 minor: 2 - revision: 360 - :date: "Fri, 16 Sep 2005" + revision: 389 + :url: svn://svn.feydakins.org/ruby_ex/trunk Index: core_ex/lib/core_ex/rakefile_base.rf --- core_ex/lib/core_ex/rakefile_base.rf (revision 389) +++ core_ex/lib/core_ex/rakefile_base.rf (working copy) @@ -298,7 +298,7 @@ end -task :vcs do +task :vcs => [:spec] do require_gem('vcs', SPEC.vcs_version || '~> 0.3.0') end Index: SPEC.yml --- SPEC.yml (revision 389) +++ SPEC.yml (working copy) @@ -31,8 +31,8 @@ dependencies: core_ex: - gem: ~> 0.3.1 - tarball: 6077/core_ex-0.3.1.tar.gz + gem: ~> 0.4.0 + tarball: 6312/core_ex-0.4.0.tar.gz vcs: svn://svn.feydakins.org/ruby_ex/trunk/core_ex highline: [~> 1.0.1, 5143/highline-1.0.1.tgz] Index: NEWS --- NEWS (revision 389) +++ NEWS (working copy) @@ -1,3 +1,14 @@ += New in 0.3, 2005-10-03: + + This release make RubyEx compatible with ruby 1.8.3! + + * DiffTool: + Add DiffTool a module for the Diff manipulation. + * RegexList: + Add RegexList a class to handle sorting with regular expressions. + * Sendmail: + Add an header option to specify header fields on the fly. + = New in 0.2, 2005-09-16: * Remove many requires which are now useless; many are not yet -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051003/ff250ee6/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 2 22:24:28 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Mon, 3 Oct 2005 04:24:28 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 391: Fix the SPEC.dyn.yml. Message-ID: <20051003022428.3ECE27C876@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Fix the SPEC.dyn.yml. * SPEC.dyn.yml: Re-update. SPEC.dyn.yml | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: SPEC.dyn.yml --- SPEC.dyn.yml (revision 390) +++ SPEC.dyn.yml (working copy) @@ -5,6 +5,6 @@ :version: !ruby/object:Version build: 0 major: 0 - minor: 2 - revision: 389 + minor: 3 + revision: 390 :url: svn://svn.feydakins.org/ruby_ex/trunk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051003/3a2e3b94/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Mon Oct 3 04:52:10 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Mon, 3 Oct 2005 10:52:10 +0200 Subject: [Uttk-Patches] [core_ex] 386: Some fixes before the release. In-Reply-To: <20051003000220.70D977C7D4@smtp.feydakins.org> References: <20051003000220.70D977C7D4@smtp.feydakins.org> Message-ID: <840b875c0510030152k5edf4bdex19d14634b4832ef3@mail.gmail.com> On 10/3/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk/core_ex > > Index: ChangeLog > from Nicolas Pouillard > > Some fixes before the release. > > * lib/core_ex/rakefile_base.rf: Fix a missing uttk renaming. > Make vendor_dev recursive for vcs based dependencies. > * lib/core_ex.rb: Change a default value in core_ex_require. > * SPEC.yml: Remove the 'commit_dir: ..'. > [...] Reviewed. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Mon Oct 3 08:56:55 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Mon, 3 Oct 2005 14:56:55 +0200 Subject: [Uttk-Patches] [ruby_ex] 390: Bump RubyEx to 0.3. In-Reply-To: <20051003022154.4DF957C86A@smtp.feydakins.org> References: <20051003022154.4DF957C86A@smtp.feydakins.org> Message-ID: <840b875c0510030556t7d2d0c1by617bb7680e00fb16@mail.gmail.com> On 10/3/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk > > Index: ChangeLog > from Nicolas Pouillard > > Bump RubyEx to 0.3. > > * SPEC.dyn.yml: Update. > * SPEC.yml: Update CoreEx dependency to 0.4. > * NEWS: Add an entry. > [...] Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Mon Oct 3 08:57:10 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Mon, 3 Oct 2005 14:57:10 +0200 Subject: [Uttk-Patches] [ruby_ex] 391: Fix the SPEC.dyn.yml. In-Reply-To: <20051003022428.3ECE27C876@smtp.feydakins.org> References: <20051003022428.3ECE27C876@smtp.feydakins.org> Message-ID: <840b875c0510030557o25be9dfehb2b7e2928eb8d2c8@mail.gmail.com> On 10/3/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk > > Index: ChangeLog > from Nicolas Pouillard > > Fix the SPEC.dyn.yml. > > * SPEC.dyn.yml: Re-update. > [...] Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Mon Oct 3 08:55:53 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Mon, 3 Oct 2005 14:55:53 +0200 Subject: [Uttk-Patches] [ruby_ex] 389: Little DLogger fix for ruby 1.8.2. In-Reply-To: <20051003004622.67FA77C864@smtp.feydakins.org> References: <20051003004622.67FA77C864@smtp.feydakins.org> Message-ID: <840b875c0510030555l56fd88d9ie58d0a17d61c1b04@mail.gmail.com> On 10/3/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk > > Index: ChangeLog > from Nicolas Pouillard > > Little DLogger fix for ruby 1.8.2. > > * lib/d_logger.rb: Suppress a warning with ruby 1.8.2. > Fix the test for ruby 1.8.2. > [...] Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Mon Oct 3 08:55:32 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Mon, 3 Oct 2005 14:55:32 +0200 Subject: [Uttk-Patches] [core_ex] 387: Bump to 0.4. In-Reply-To: <20051003001638.43A4D7C7B1@smtp.feydakins.org> References: <20051003001638.43A4D7C7B1@smtp.feydakins.org> Message-ID: <840b875c0510030555l18b1968fj1b7951aa38d91db7@mail.gmail.com> On 10/3/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk/core_ex > > Index: ChangeLog > from Nicolas Pouillard > > Bump to 0.4. > > * SPEC.dyn.yml: Update. > * SPEC.yml: Just use ci. > * NEWS: Add the 0.4 section. > [...] Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Tue Oct 4 03:06:50 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Tue, 4 Oct 2005 09:06:50 +0200 (MEST) Subject: [Uttk-Patches] 733: Various bugs fixes. Message-ID: <20051004070650.E007626C91@pm-mx5.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/733 Index: ChangeLog from Nicolas Desprès Various bugs fixes. * test/minimal/wc.yml: Adapt to the real output. * test/fixtures/unit: Remove. * test/fixtures/unit/bad.rb: Remove. * test/fixtures/unit/good.rb: Remove. * test/fixtures/unit/error.rb: Remove. * test/fixtures/runit: New. Rename unit to runit to make runit.yml happy. * lib/uttk/logger.rb: Adapt to the real parameter name. lib/uttk/logger.rb | 2 +- test/minimal/wc.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: test/minimal/wc.yml --- test/minimal/wc.yml (revision 732) +++ test/minimal/wc.yml (working copy) @@ -23,4 +23,4 @@ - from file test: input: !path '<>/../fixtures/text/1.txt' - output: !re \s*244\n$ + output: !re \s*272\s Index: lib/uttk/logger.rb --- lib/uttk/logger.rb (revision 732) +++ lib/uttk/logger.rb (working copy) @@ -174,7 +174,7 @@ str = key.to_s if str =~ /^(.*)=$/ self[$1.to_sym] = a[0] - elsif block + elsif b begin args = make_log_arguments(str) args += a -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051004/dc422202/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 5 14:42:37 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 5 Oct 2005 20:42:37 +0200 (CEST) Subject: [Uttk-Patches] [UnifiedMatchers] 4: Initial checkin. Message-ID: <20051005184237.42EF87A63D@smtp.feydakins.org> svn://svn.feydakins.org/unified_matchers/trunk Index: ChangeLog from Nicolas Pouillard Initial checkin. * lib: New. * test: New. * test/unit: New. * test/pkg: New. * test/functional: New. * bin: New. * vcs: New. * vcs/unified_matchers_vcs.rb: New. * Rakefile: New. * AUTHORS: New. * SPEC.yml: New. * NEWS: New. * README: New. AUTHORS | 5 +++++ README | 0 Rakefile | 8 ++++++++ SPEC.yml | 39 +++++++++++++++++++++++++++++++++++++++ vcs/unified_matchers_vcs.rb | 16 ++++++++++++++++ 5 files changed, 68 insertions(+) Index: Rakefile --- Rakefile (revision 0) +++ Rakefile (revision 0) @@ -0,0 +1,8 @@ +# Author:: The TTK Team. -*- ruby -*- +# Copyright:: Copyright (c) 2005 TTK team. All rights reserved. +# License:: Ruby License +# Revision:: $Id$ + +require 'rubygems' +require_gem 'core_ex' +load 'core_ex/rakefile_base.rf' Index: AUTHORS --- AUTHORS (revision 0) +++ AUTHORS (revision 0) @@ -0,0 +1,5 @@ +--- +UnifiedMatchers was written by and with the assistance of: + + - Nicolas Pouillard : + - Initial design Index: SPEC.yml --- SPEC.yml (revision 0) +++ SPEC.yml (revision 0) @@ -0,0 +1,39 @@ +--- +Author: The TTK Team +License: Ruby License +Revision: '$Id$' + +name: unified_matchers + +title: UnifiedMatchers +summary: UnifiedMatchers +description: "" +homepage: http://api.feydakins.org/unified_matchers +rubyforge_project: ttk +rubyforge_sub_package_name: unified_matchers + +root_test_suite: test/check-pkg-unified_matchers.yml +rdoc_dir: doc/html +tags_url: svn://svn.feydakins.org/unified_matchers/tags + +commit_command: umci + +rdoc_files: !filelist + - README + - AUTHORS + - NEWS + - lib/**/*.rb + +pkg_files: !filelist + - lib/**/*.rb + - test/**/* + - bin/**/* + - '[A-Z]*' + +dependencies: + ruby_ex: + gem : ~> 0.3.0 + tarball: 6317/ruby_ex-0.3.0.tar.gz + vcs : svn://svn.feydakins.org/ruby_ex/trunk + +ttk_version: ~> 0.3.0 Index: vcs/unified_matchers_vcs.rb --- vcs/unified_matchers_vcs.rb (revision 0) +++ vcs/unified_matchers_vcs.rb (revision 0) @@ -0,0 +1,16 @@ +class Vcs + + # See http://rubyforge.org/projects/vcs + # and http://vcs.rubyforge.org + + protocol_version '0.1' + + def unified_matchers_commit! ( *args ) + common_commit!("[UnifiedMatchers] <%= rev %>: <%= title %>", *args) do |subject| + mail!(:to => %w[uttk-patches at lists.feydakins.org], :subject => subject) + end + end + alias_command :umci, :unified_matchers_commit + default_commit :unified_matchers_commit + +end # class Vcs Property changes on: vcs/unified_matchers_vcs.rb ___________________________________________________________________ Name: svn:keywords + Id Index: NEWS Index: README -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051005/0b6f9382/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Wed Oct 5 15:09:42 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Wed, 5 Oct 2005 21:09:42 +0200 Subject: [Uttk-Patches] [UnifiedMatchers] 4: Initial checkin. In-Reply-To: <20051005184237.42EF87A63D@smtp.feydakins.org> References: <20051005184237.42EF87A63D@smtp.feydakins.org> Message-ID: <840b875c0510051209l490f5f0ft9bd2bdf6f3fd6e38@mail.gmail.com> On 10/5/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/unified_matchers/trunk Unified fashion power :-) -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Wed Oct 5 15:54:18 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Wed, 5 Oct 2005 21:54:18 +0200 (MEST) Subject: [Uttk-Patches] 734: Update misc scripts. Message-ID: <20051005195418.7A9D1275E8@pm-mx5.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/734 Index: ChangeLog from Nicolas Desprès Update misc scripts. * misc/uttk-line-count.rb: Add -a which add glob pattern given on the command line to default glob pattern. If not provided and glob patterns are given on the command line, only those ones are used. * misc/uttk-grep.sh: Use /bin/sh instead of zsh and prefer xargs in order to see the filename for which the line matches. uttk-grep.sh | 5 +++-- uttk-line-count.rb | 25 +++++++++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) Index: misc/uttk-line-count.rb --- misc/uttk-line-count.rb (revision 733) +++ misc/uttk-line-count.rb (working copy) @@ -13,6 +13,7 @@ skip_empty_line = false skip_test = false verbose = true +append = false opts = OptionParser.new do |opts| opts.banner = "Usage: #{ME} [options]" @@ -50,6 +51,10 @@ verbose = false end + opts.on('-a', '--append', 'Append glob pattern to the search list') do + append = true + end + end opts.parse!(ARGV) @@ -62,16 +67,28 @@ end +GLOBDIRS = [ + 'bin/**/*.rb', + 'bin/uttk*', + 'lib/**/*.{rb,js,css}', + 'test/**/*.{rb,yml}', +] + + files = [] -if ARGV.empty? - Pathname.glob('{bin,lib,test}/**/*.{rb,yml,js,css}').each { |x| files << x } +globdirs = GLOBDIRS +if append and (not ARGV.empty?) + globdirs += ARGV else - files += ARGV.map { |x| Pathname.new(x) } + globdirs = ARGV end -Pathname.glob('bin/uttk*').each do |x| +globdirs.each do |glob| + Pathname.glob(glob).each do |x| next if x.to_s =~ /~$/ files << x end +end + if verbose puts "%7s %7s %7s %7s %7s %s" % Index: misc/uttk-grep.sh --- misc/uttk-grep.sh (revision 733) +++ misc/uttk-grep.sh (working copy) @@ -1,7 +1,8 @@ -#!/usr/bin/env zsh +#!/bin/sh find . \ \( -name '*.rb' -or \ -name 'uttk' -or \ -name 'uttk[dm]' \) \ - -exec grep "$@" {} \; + | xargs grep "$@" + -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051005/9b048f55/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Wed Oct 5 16:06:14 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Wed, 5 Oct 2005 22:06:14 +0200 (MEST) Subject: [Uttk-Patches] 735: Some little fixes. Message-ID: <20051005200614.9740227634@pm-mx5.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/735 Index: ChangeLog from Nicolas Desprès Some little fixes. * misc/uttk-line-count.rb: Make the usage more verbose. * NORM: Add rule about newline required at the end of line. NORM | 4 ++++ misc/uttk-line-count.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) Index: misc/uttk-line-count.rb --- misc/uttk-line-count.rb (revision 734) +++ misc/uttk-line-count.rb (working copy) @@ -16,7 +16,7 @@ append = false opts = OptionParser.new do |opts| - opts.banner = "Usage: #{ME} [options]" + opts.banner = "Usage: #{ME} [options] " opts.separator '' opts.on('-c', '--skip-comment', 'Skip comment') do Index: NORM --- NORM (revision 734) +++ NORM (working copy) @@ -131,3 +131,7 @@ ** No trailling whitespaces Do not let trailling whitespaces in your files !!! + +** Newline required at the end of file + + Do not let last line of file without a newline !!! -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051005/a3eaaf75/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 5 17:24:53 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 5 Oct 2005 23:24:53 +0200 (CEST) Subject: [Uttk-Patches] [Commands] 4: Initial checkin. Message-ID: <20051005212453.E746A7CA4F@smtp.feydakins.org> svn://svn.feydakins.org/commands/trunk Index: ChangeLog from Nicolas Pouillard Initial checkin. * test: New. * test/unit: New. * test/functional: New. * test/sanity: New. * test/fixtures: New. * Rakefile: New. * AUTHORS: New. * lib: New. * bin: New. * SPEC.yml: New. * vcs: New. * vcs/commands_vcs.rb: New. AUTHORS | 5 +++++ Rakefile | 8 ++++++++ SPEC.yml | 39 +++++++++++++++++++++++++++++++++++++++ vcs/commands_vcs.rb | 16 ++++++++++++++++ 4 files changed, 68 insertions(+) Index: Rakefile --- Rakefile (revision 0) +++ Rakefile (revision 0) @@ -0,0 +1,8 @@ +# Author:: The TTK Team. -*- ruby -*- +# Copyright:: Copyright (c) 2005 TTK team. All rights reserved. +# License:: Ruby License +# Revision:: $Id$ + +require 'rubygems' +require_gem 'core_ex' +load 'core_ex/rakefile_base.rf' Index: AUTHORS --- AUTHORS (revision 0) +++ AUTHORS (revision 0) @@ -0,0 +1,5 @@ +--- +Commands was written by and with the assistance of: + + - Nicolas Pouillard : + - Initial design Index: SPEC.yml --- SPEC.yml (revision 0) +++ SPEC.yml (revision 0) @@ -0,0 +1,39 @@ +--- +Author: The TTK Team +License: Ruby License +Revision: '$Id$' + +name: commands + +title: Commands +summary: Commands +description: "" +homepage: http://api.feydakins.org/commands +rubyforge_project: ttk +rubyforge_sub_package_name: commands + +root_test_suite: test/check-pkg-commands.yml +rdoc_dir: doc/html +tags_url: svn://svn.feydakins.org/commands/tags + +commit_command: cmdci + +rdoc_files: !filelist + - README + - AUTHORS + - NEWS + - lib/**/*.rb + +pkg_files: !filelist + - lib/**/*.rb + - test/**/* + - bin/**/* + - '[A-Z]*' + +dependencies: + ruby_ex: + gem : ~> 0.3.0 + tarball: 6317/ruby_ex-0.3.0.tar.gz + vcs : svn://svn.feydakins.org/ruby_ex/trunk + +ttk_version: ~> 0.3.0 Index: vcs/commands_vcs.rb --- vcs/commands_vcs.rb (revision 0) +++ vcs/commands_vcs.rb (revision 0) @@ -0,0 +1,16 @@ +class Vcs + + # See http://rubyforge.org/projects/vcs + # and http://vcs.rubyforge.org + + protocol_version '0.1' + + def commands_commit! ( *args ) + common_commit!("[Commands] <%= rev %>: <%= title %>", *args) do |subject| + mail!(:to => %w[uttk-patches at lists.feydakins.org], :subject => subject) + end + end + alias_command :cmdci, :commands_commit + default_commit :commands_commit + +end # class Vcs Property changes on: vcs/commands_vcs.rb ___________________________________________________________________ Name: svn:keywords + Id -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051005/e9585972/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 5 17:26:20 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 5 Oct 2005 23:26:20 +0200 (CEST) Subject: [Uttk-Patches] [StructuredLogger] 4: Initial checkin. Message-ID: <20051005212620.340D77CA4F@smtp.feydakins.org> svn://svn.feydakins.org/structured_logger/trunk Index: ChangeLog from Nicolas Pouillard Initial checkin. * test: New. * test/unit: New. * test/functional: New. * test/sanity: New. * test/fixtures: New. * Rakefile: New. * AUTHORS: New. * lib: New. * bin: New. * SPEC.yml: New. * vcs: New. * vcs/structured_logger_vcs.rb: New. AUTHORS | 5 +++++ Rakefile | 8 ++++++++ SPEC.yml | 39 +++++++++++++++++++++++++++++++++++++++ vcs/structured_logger_vcs.rb | 16 ++++++++++++++++ 4 files changed, 68 insertions(+) Index: Rakefile --- Rakefile (revision 0) +++ Rakefile (revision 0) @@ -0,0 +1,8 @@ +# Author:: The TTK Team. -*- ruby -*- +# Copyright:: Copyright (c) 2005 TTK team. All rights reserved. +# License:: Ruby License +# Revision:: $Id$ + +require 'rubygems' +require_gem 'core_ex' +load 'core_ex/rakefile_base.rf' Index: AUTHORS --- AUTHORS (revision 0) +++ AUTHORS (revision 0) @@ -0,0 +1,5 @@ +--- +StructuredLogger was written by and with the assistance of: + + - Nicolas Pouillard : + - Initial design Index: SPEC.yml --- SPEC.yml (revision 0) +++ SPEC.yml (revision 0) @@ -0,0 +1,39 @@ +--- +Author: The TTK Team +License: Ruby License +Revision: '$Id$' + +name: structured_logger + +title: StructuredLogger +summary: StructuredLogger +description: "" +homepage: http://api.feydakins.org/structured_logger +rubyforge_project: ttk +rubyforge_sub_package_name: structured_logger + +root_test_suite: test/check-pkg-structured_logger.yml +rdoc_dir: doc/html +tags_url: svn://svn.feydakins.org/structured_logger/tags + +commit_command: logci + +rdoc_files: !filelist + - README + - AUTHORS + - NEWS + - lib/**/*.rb + +pkg_files: !filelist + - lib/**/*.rb + - test/**/* + - bin/**/* + - '[A-Z]*' + +dependencies: + ruby_ex: + gem : ~> 0.3.0 + tarball: 6317/ruby_ex-0.3.0.tar.gz + vcs : svn://svn.feydakins.org/ruby_ex/trunk + +ttk_version: ~> 0.3.0 Index: vcs/structured_logger_vcs.rb --- vcs/structured_logger_vcs.rb (revision 0) +++ vcs/structured_logger_vcs.rb (revision 0) @@ -0,0 +1,16 @@ +class Vcs + + # See http://rubyforge.org/projects/vcs + # and http://vcs.rubyforge.org + + protocol_version '0.1' + + def structured_logger_commit! ( *args ) + common_commit!("[StructuredLogger] <%= rev %>: <%= title %>", *args) do |subject| + mail!(:to => %w[uttk-patches at lists.feydakins.org], :subject => subject) + end + end + alias_command :logci, :structured_logger_commit + default_commit :structured_logger_commit + +end # class Vcs Property changes on: vcs/structured_logger_vcs.rb ___________________________________________________________________ Name: svn:keywords + Id -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051005/2d0e00e5/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Wed Oct 5 17:28:31 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Wed, 5 Oct 2005 23:28:31 +0200 Subject: [Uttk-Patches] 734: Update misc scripts. In-Reply-To: References: <20051005195418.7A9D1275E8@pm-mx5.mx.noos.fr> Message-ID: <840b875c0510051428o11689141w8ad0ff5a579b459d@mail.gmail.com> On 10/5/05, Nicolas Pouillard wrote: > On 10/5/05, Nicolas Despr?s wrote: > > > > svn://svn.feydakins.org/ttk/trunk > > > > You can also view this changeset here: > > > > http://http://dev.uttk.org/repository/changesets/734 > > > > Index: ChangeLog > > from Nicolas Despr?s > > > > Update misc scripts. > > > > * misc/uttk-line-count.rb: Add -a which add glob pattern given on the > > command line to default glob pattern. If not provided and glob > > patterns are given on the command line, only those ones are used. > > * misc/uttk-grep.sh: Use /bin/sh instead of zsh and prefer xargs in > > order to see the filename for which the line matches. > > > > uttk-grep.sh | 5 +++-- > > uttk-line-count.rb | 25 +++++++++++++++++++++---- > > 2 files changed, 24 insertions(+), 6 deletions(-) > > > [...] > > > Index: misc/uttk-grep.sh > > --- misc/uttk-grep.sh (revision 733) > > +++ misc/uttk-grep.sh (working copy) > > @@ -1,7 +1,8 @@ > > -#!/usr/bin/env zsh > > +#!/bin/sh > > > > It will be great to not require a such shell but just ruby. > But it's not important for now. > If Ruby is installed, I think /bin/sh is too. So no problem for such a so short script. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Wed Oct 5 17:30:37 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Wed, 5 Oct 2005 23:30:37 +0200 Subject: [Uttk-Patches] 735: Some little fixes. In-Reply-To: References: <20051005200614.9740227634@pm-mx5.mx.noos.fr> Message-ID: <840b875c0510051430t7a1866a0yd22cded0d91101d3@mail.gmail.com> On 10/5/05, Nicolas Pouillard wrote: > > We need tests in sanity to check some of these trivial rules. > I was thinking about a vcs rules instead, to avoid to overload the distcheck process. After all, these rules are more a matter of patch reviewing than program checking. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 5 17:37:58 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 5 Oct 2005 23:37:58 +0200 (CEST) Subject: [Uttk-Patches] 736: Update requires and dependencies. Message-ID: <20051005213758.B26787CAB8@smtp.feydakins.org> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/736 Index: ChangeLog from Nicolas Pouillard Update requires and dependencies. * SPEC.yml: Update the ruby_ex dependency to 0.3. * lib/uttk/filters/Warrior.rb: Make it compliant with ruby 1.8.3. * lib/uttk.rb: Update requires. * bin/uttk: Remove to useless requires. SPEC.yml | 5 ++++- bin/uttk | 2 -- lib/uttk.rb | 19 +++++++++++-------- lib/uttk/filters/Warrior.rb | 6 +++--- 4 files changed, 18 insertions(+), 14 deletions(-) Index: SPEC.yml --- SPEC.yml (revision 735) +++ SPEC.yml (working copy) @@ -51,7 +51,10 @@ - '[A-Z]*' dependencies: - ruby_ex: [~> 0.2.0, 6087/ruby_ex-0.2.0.tar.gz] + ruby_ex: + gem : ~> 0.3.0 + tarball: 6317/ruby_ex-0.3.0.tar.gz + vcs : svn://svn.feydakins.org/ruby_ex/trunk actionpack: [~> 1.9.1, 5167/actionpack-1.9.1.tgz] # The version needed to test this uttk. Index: lib/uttk/filters/Warrior.rb --- lib/uttk/filters/Warrior.rb (revision 735) +++ lib/uttk/filters/Warrior.rb (working copy) @@ -12,9 +12,9 @@ def self.template ( str ) [ - '[Yaml: %s.yml', "Xml: %s.xml", - 'JustStatus: [Completer: [RemoveTypes: [ColorStatus: Yaml]]]', - 'Compact: [NodeCut: [!skip ^contents$, Html: %s.html]]]' + '[Yaml: [%s.yml]', "Xml: [%s.xml]", + 'JustStatus: [Completer: [RemoveTypes: [ColorStatus: [Yaml]]]]', + 'Compact: [NodeCut: [!skip ^contents$, Html: [%s.html]]]]' ].join(', ') % [str, str, str] end Index: lib/uttk.rb --- lib/uttk.rb (revision 735) +++ lib/uttk.rb (working copy) @@ -27,15 +27,16 @@ lib = Pathname.new(__FILE__).dirname vendor = lib.parent + 'vendor' - unless defined? CoreEx - CORE_EX_VENDORS = [vendor] - file = Pathname.glob("#{vendor}/core_ex*/core_ex").first - if file + unless defined? RubyEx + $CORE_EX_VENDORS ||= [] + $CORE_EX_VENDORS << vendor + file = vendor + 'ruby_ex' + 'lib' + 'ruby_ex.rb' + if file.exist? require file.to_s else require 'rubygems' - require_gem 'core_ex' - require 'core_ex' + require_gem 'ruby_ex' + require 'ruby_ex' end end lib.load_path! @@ -47,6 +48,7 @@ # Standard library requirements require 'stringio' + require 'ostruct' require 'tmpdir' require 'thread' require 'mutex_m' @@ -66,6 +68,7 @@ HashEval.import! RPath.import! Commands.import! + Version.import! # Mother exception of every exception thrown by Uttk. class UttkException < Exception @@ -302,8 +305,8 @@ # Return the default logger factory def self.default_log_factory ( options=default_options ) log_factory = LoggerFactory.new - if ENV.has_key?('Uttk_SEVERITY') - log_factory.severity_level = ENV['Uttk_SEVERITY'] + if ENV.has_key?('UTTK_SEVERITY') + log_factory.severity_level = ENV['UTTK_SEVERITY'] else log_factory.severity_level = options[:log_severity] end Index: bin/uttk --- bin/uttk (revision 735) +++ bin/uttk (working copy) @@ -6,7 +6,6 @@ begin require 'pathname' - require 'yaml' ME = Pathname.new($0).basename unless defined? ME ME_DIR = Pathname.new(__FILE__).dirname unless defined? ME_DIR @@ -17,7 +16,6 @@ Uttk_BIN = true - require 'ostruct' require Pathname.new(__FILE__).dirname.parent + 'lib/uttk' unless defined? Uttk module Uttk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051005/a642239e/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Wed Oct 5 17:48:28 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Wed, 5 Oct 2005 23:48:28 +0200 Subject: [Uttk-Patches] 736: Update requires and dependencies. In-Reply-To: <20051005213758.B26787CAB8@smtp.feydakins.org> References: <20051005213758.B26787CAB8@smtp.feydakins.org> Message-ID: <840b875c0510051448p20c87dbbhdf795f90a18bd91@mail.gmail.com> On 10/5/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ttk/trunk > > You can also view this changeset here: > > http://http://dev.uttk.org/repository/changesets/736 > > Index: ChangeLog > from Nicolas Pouillard > > Update requires and dependencies. > > * SPEC.yml: Update the ruby_ex dependency to 0.3. > * lib/uttk/filters/Warrior.rb: Make it compliant with ruby 1.8.3. > * lib/uttk.rb: Update requires. > * bin/uttk: Remove to useless requires. > Reviewed. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Wed Oct 5 17:41:06 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Wed, 5 Oct 2005 23:41:06 +0200 Subject: [Uttk-Patches] 734: Update misc scripts. In-Reply-To: References: <20051005195418.7A9D1275E8@pm-mx5.mx.noos.fr> <840b875c0510051428o11689141w8ad0ff5a579b459d@mail.gmail.com> Message-ID: <840b875c0510051441i2e588a46tcd9a8c28f7b12320@mail.gmail.com> On 10/5/05, Nicolas Pouillard wrote: > On 10/5/05, Nicolas Despr?s wrote: > > On 10/5/05, Nicolas Pouillard wrote: > > > On 10/5/05, Nicolas Despr?s wrote: > > > > > > > > svn://svn.feydakins.org/ttk/trunk > > > > > > > > You can also view this changeset here: > > > > > > > > http://http://dev.uttk.org/repository/changesets/734 > > > > > > > > Index: ChangeLog > > > > from Nicolas Despr?s > > > > > > > > Update misc scripts. > > > > > > > > * misc/uttk-line-count.rb: Add -a which add glob pattern given on the > > > > command line to default glob pattern. If not provided and glob > > > > patterns are given on the command line, only those ones are used. > > > > * misc/uttk-grep.sh: Use /bin/sh instead of zsh and prefer xargs in > > > > order to see the filename for which the line matches. > > > > > > > > uttk-grep.sh | 5 +++-- > > > > uttk-line-count.rb | 25 +++++++++++++++++++++---- > > > > 2 files changed, 24 insertions(+), 6 deletions(-) > > > > > > > [...] > > > > > > > Index: misc/uttk-grep.sh > > > > --- misc/uttk-grep.sh (revision 733) > > > > +++ misc/uttk-grep.sh (working copy) > > > > @@ -1,7 +1,8 @@ > > > > -#!/usr/bin/env zsh > > > > +#!/bin/sh > > > > > > > > > > It will be great to not require a such shell but just ruby. > > > But it's not important for now. > > > > > > > If Ruby is installed, I think /bin/sh is too. So no problem for such a > > so short script. > > > > But find ? > > On windows ? So Uttk needs to work on Windows to allow developpers to work on it, since only developpers use it. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Thu Oct 6 16:47:03 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Thu, 6 Oct 2005 22:47:03 +0200 (MEST) Subject: [Uttk-Patches] 737: Fixe a bug. Message-ID: <20051006204703.00702276FC@pm-mx5.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/737 Index: ChangeLog from Nicolas Desprès Fixe a bug. * misc/uttk-line-count.rb: Fix a bug in the append file condition. uttk-line-count.rb | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: misc/uttk-line-count.rb --- misc/uttk-line-count.rb (revision 736) +++ misc/uttk-line-count.rb (working copy) @@ -77,10 +77,10 @@ files = [] globdirs = GLOBDIRS -if append and (not ARGV.empty?) +if append globdirs += ARGV else - globdirs = ARGV + globdirs = ARGV unless ARGV.empty? end globdirs.each do |glob| Pathname.glob(glob).each do |x| -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051006/0ca760ca/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Fri Oct 7 16:47:19 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Fri, 7 Oct 2005 22:47:19 +0200 (CEST) Subject: [Uttk-Patches] 738: Add uttk-unit a unified command to run unit tests. Message-ID: <20051007204719.6B1397CB5B@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/738 Index: ChangeLog from Nicolas Pouillard Add uttk-unit a unified command to run unit tests. * bin/uttk-unit: New. It currently just supports ruby unit tests, and will be a replacment for all test_unit_setup files. * lib/uttk/strategies/RUnit.rb: Adapt to uttk-unit to use it if the user want it. * lib/uttk.rb: Add uttk-unit in the symtbl. bin/uttk-unit | 99 +++++++++++++++++++++++++++++++++++++++++++ lib/uttk.rb | 2 lib/uttk/strategies/RUnit.rb | 21 +++++++-- 3 files changed, 119 insertions(+), 3 deletions(-) Index: lib/uttk/strategies/RUnit.rb --- lib/uttk/strategies/RUnit.rb (revision 737) +++ lib/uttk/strategies/RUnit.rb (working copy) @@ -82,11 +82,22 @@ protected def prologue @command = '<> ' + unless @uttk_unit_options.nil? + @command += '-- <> ' + end @command += '-w ' if @verbose @load_path.each { |x| @command += "-I#{x} " } - @command += "%i " - @command += "--runner yaml " - @command += "-- %a" + @requires = [@requires] unless @requires.respond_to? :each + @requires.each { |x| @command += "-r #{x} " } + if @uttk_unit_options.nil? + @command += '%i --runner yaml -- ' + else + opts = @uttk_unit_options + opts = [opts] unless opts.respond_to? :each + opts.each { |x| @command += "#{x} " } + @command += '-- %i --runner yaml ' + end + @command += '%a' @quiet_print = true super end @@ -101,6 +112,7 @@ else @output.my.open { |io| result = YAML.load(io) } @log[:result] = result + skip PassStatus.new.weight if result['tests_number'] == 0 if result['failures_number'] != 0 or result['errors_number'] != 0 if result['failures_number'] == 0 fail('there are errors') @@ -120,6 +132,9 @@ attribute :load_path, 'directories to add to the $LOAD_PATH variable', :invisible do [] end + attribute :requires, 'features to require before load the input', + [Array, String, Pathname] + attribute :uttk_unit_options, 'options for uttk-unit', [Array, String] attribute :verbose, 'turn on/off the ruby verbose mode', false, :invisible Index: lib/uttk.rb --- lib/uttk.rb (revision 737) +++ lib/uttk.rb (working copy) @@ -288,6 +288,8 @@ symtbl = SymTbl.new(options) symtbl[:uttk] = Pathname.new($0).expand_path symtbl[:ruby] = Config::CONFIG['RUBY_INSTALL_PATH'] + symtbl[:'uttk-unit'] = symtbl[:uttk_unit] = + Uttk.dir.parent.parent/'bin'/'uttk-unit' symtbl[:core_ex] = CoreEx.dir symtbl[:symtbl_class] = symtbl.class symtbl[:pwd] = Pathname.pwd.expand_path Index: bin/uttk-unit --- bin/uttk-unit (revision 0) +++ bin/uttk-unit (revision 0) @@ -0,0 +1,99 @@ +#!/usr/bin/env ruby +# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + + +# FIXME add a configuration file +# conf: +# load_path: ../lib # relative to the place of the configuration file +# requires: +class UttkUnit + + def initialize ( argv ) + @argv = argv + end + + + def parse_options + @options = OpenStruct.new(:load_path => [], + :requires => [], + :core_ex => true, + :ruby_ex => true, + :uttk => true) + + OptionParser.new do |o| + o.on('-I', '--include DIR', 'Add this directory to $LOAD_PATH') do |dir| + @options.load_path << dir + end + o.on('-r', '--require FEATURE', 'Require this file') do |file| + @options.requires << file + end + o.on('-w', '--[no-]verbose', 'Turn on/off the verbose mode [default: on]') do |b| + $VERBOSE = b + end + o.on('--[no-]core_ex', 'Turn on/off the CoreEx require [default: on]') do |b| + @options.core_ex = b + end + o.on('--[no-]ruby_ex', 'Turn on/off the RubyEx require [default: on]') do |b| + @options.ruby_ex = b + end + o.on('--[no-]uttk', 'Turn on/off the Uttk require [default: on]') do |b| + @options.uttk = b + end + end.parse!(@argv) + end + + + def requires + require 'pathname' + require 'ostruct' + require 'optparse' + require 'rubygems' + end + + + def run + raise 'Do not load CoreEx before uttk-unit' if defined? CoreEx + raise 'Do not load RubyEx before uttk-unit' if defined? RubyEx + $VERBOSE = true + + requires + + parse_options + + path = Pathname.new(@argv.first).cleanpath + + Kernel.const_set(:EMBEDDED_TEST_MODE, Regexp.new(path.to_s)) + + @options.load_path.each { |dir| $LOAD_PATH << dir } + + require 'core_ex' if @options.core_ex + require 'ruby_ex' if @options.ruby_ex + require 'uttk' if @options.uttk + raise 'CoreEx not loaded' unless defined? CoreEx + + Test::Unit::UI::Yaml::TestRunner.import! + + @options.load_path.each { |dir| dir.to_path.load_path! } + + @options.requires.each { |r| require r } + +# FIXME try to fix this feature +# begin +# file = path.ext('').to_s # .sub(/^#{lib}\/*/, '') +# raise NameError if file =~ /\./ +# file.camelize.constantize unless file.empty? +# rescue NameError + require path +# end + + run_embedded_test_sections + end + + +end # class UttkUnit + + +UttkUnit.new(ARGV).run Property changes on: bin/uttk-unit ___________________________________________________________________ Name: svn:executable + * -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051007/2bbbf174/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Fri Oct 7 17:01:43 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Fri, 7 Oct 2005 23:01:43 +0200 (CEST) Subject: [Uttk-Patches] [UnifiedMatchers] 5: Commit the first contract. Message-ID: <20051007210143.C37327CA55@smtp.feydakins.org> svn://svn.feydakins.org/unified_matchers/trunk Index: ChangeLog from Nicolas Pouillard Commit the first contract. * test/unit.yml: New. * test/check.yml: New. * lib/unified_matchers: New. * lib/unified_matchers.rb: New. The main module. * lib/unified_matchers/unified_matcher.rb: New. Abstract matcher to fix. * lib/unified_matchers/strict_equality_based_matcher.rb: New. Matchers based on Object#equal?. * lib/unified_matchers/equality_based_matcher.rb: New. (==) * lib/unified_matchers/case_equality_based_matcher.rb: New. (===) * lib/unified_matchers/stream_matcher.rb: New. * lib/unified_matchers/diff_matcher.rb: New. Abstract. * lib/unified_matchers/gnu_diff_matcher.rb: New. Command based diff output. * lib/unified_matchers/lcs_diff_matcher.rb: New. Will be a LCS::Diff based diff output. * lib/unified_matchers/assertions.rb: New. lib/unified_matchers.rb | 31 +++++++++ lib/unified_matchers/assertions.rb | 19 +++++ lib/unified_matchers/case_equality_based_matcher.rb | 48 ++++++++++++++ lib/unified_matchers/diff_matcher.rb | 20 ++++++ lib/unified_matchers/equality_based_matcher.rb | 43 ++++++++++++ lib/unified_matchers/gnu_diff_matcher.rb | 60 ++++++++++++++++++ lib/unified_matchers/lcs_diff_matcher.rb | 32 +++++++++ lib/unified_matchers/stream_matcher.rb | 59 +++++++++++++++++ lib/unified_matchers/strict_equality_based_matcher.rb | 44 +++++++++++++ lib/unified_matchers/unified_matcher.rb | 52 +++++++++++++++ test/check.yml | 8 ++ test/unit.yml | 11 +++ 12 files changed, 427 insertions(+) Index: test/unit.yml --- test/unit.yml (revision 0) +++ test/unit.yml (revision 0) @@ -0,0 +1,11 @@ +--- + +Unit tests of UnifiedMatchers: !S::Iterate + over: !pathlist <>/{unit,../lib}/(**/*).rb + iter: [ it_file, it_name ] + test: + Unit test <>: !S::RUnit + load_path : <>/../lib + requires : unified_matchers + uttk_unit_options: --no-ruby_ex --no-uttk + input : !path <> Index: test/check.yml --- test/check.yml (revision 0) +++ test/check.yml (revision 0) @@ -0,0 +1,8 @@ +--- + +UnifiedMatchers test suite: !S::Iterate + over: !pathlist <>/({unit,functional,sanity}).yml + iter: [it_file, it_name] + test: + Run the <> test suite: !S::Import + import: !path <> Index: lib/unified_matchers/equality_based_matcher.rb --- lib/unified_matchers/equality_based_matcher.rb (revision 0) +++ lib/unified_matchers/equality_based_matcher.rb (revision 0) @@ -0,0 +1,43 @@ +# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + + +module UnifiedMatchers + + class EqualityBasedMatcher < UnifiedMatcher + make Concrete + + with(Object, Object) { |ref, my| ref == my } + + end # class EqualityBasedMatcher + + + + test_section __FILE__ do + + class TestExqualityBasedMatcher < ::Test::Unit::TestCase + include UnifiedMatchers::Assertions + + def setup + self.matcher = EqualityBasedMatcher.new + end + + def teardown + end + + def test_equality_based_matcher + assert_matcher 42, 42 + assert_matcher 42, 43, false + assert_matcher '42', '42' + assert_matcher 42, '42', false + assert_matcher '42', '43', false + end + + end # class TestExqualityBasedMatcher + + end + +end # module UnifiedMatchers + Property changes on: lib/unified_matchers/equality_based_matcher.rb ___________________________________________________________________ Name: svn:keywords + Id Index: lib/unified_matchers/stream_matcher.rb --- lib/unified_matchers/stream_matcher.rb (revision 0) +++ lib/unified_matchers/stream_matcher.rb (revision 0) @@ -0,0 +1,59 @@ +# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + + +module UnifiedMatchers + + class StreamMatcher < UnifiedMatcher + make Concrete + + with(Object) { to_s } + with(String, String) { |ref, my| ref == my } + with(Regexp, String) { |ref, my| ref.match my } + with(Pathname) { open } + with(IO) { rewind ; read } + + end # class StreamMatcher + + + + test_section __FILE__ do + + class TestStreamMatchers < ::Test::Unit::TestCase + include UnifiedMatchers::Assertions + + def setup + self.matcher = StreamMatcher.new + end + + def teardown + end + + def test_stream_matcher + assert_matcher 'a', 'b', false + assert_matcher(/a/, 'a') + assert_matcher 'a', 'a' + assert_matcher(/a/, /a/, false) + assert_matcher '/a/', /a/ + assert_matcher(/\d/, 4) + assert_matcher '42', 42, false + s = StringIO.new + s << 'foo' + assert_matcher 'foo', s + assert_matcher 'bar', s, false + assert_matcher 'foo', s + TempPath.new do |t| + t.open('w') { |f| f.print 'foo' } + assert_matcher 'foo', t + assert_matcher(/fo+/, t.open) + assert_matcher t, t + end + end + + end # class TestStreamMatchers + + end + +end # module UnifiedMatchers Property changes on: lib/unified_matchers/stream_matcher.rb ___________________________________________________________________ Name: svn:keywords + Id Index: lib/unified_matchers/gnu_diff_matcher.rb --- lib/unified_matchers/gnu_diff_matcher.rb (revision 0) +++ lib/unified_matchers/gnu_diff_matcher.rb (revision 0) @@ -0,0 +1,60 @@ +# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + +Commands.import! + +module UnifiedMatchers + + class GnuDiff < DiffMatcher + make Concrete + + cattr_accessor :runner, :diff + self.diff = 'diff'.to_cmd + self.runner = Commands::Runners::System.new.raise_on_failures + + with_my(Object) { to_path } + + with(String, Pathname) do |ref, my| + cmd = diff[my] + %w[ -u --label my --label ref - ] < ref + cmd.run(runner) + end + + end # class GnuDiff + + + + test_section __FILE__ do + + class TestGnuDiff < ::Test::Unit::TestCase + include UnifiedMatchers::Assertions + + def setup + @old_runner = GnuDiff.runner + @mock_runner = GnuDiff.runner = @old_runner.dup.make_mock {} + self.matcher = GnuDiff.new + @my = 'my.file'.to_path + end + + def teardown + GnuDiff.runner = @old_runner + end + + def test_diff + d = Commands::Datas::Data + assert_nothing_raised do + assert_kind_of d, matcher['foo', @my] + assert_equal true, matcher[/foo/, @my] + assert_kind_of d, matcher['foo', @my.to_s] + assert_kind_of d, matcher[@my.open, @my] + end + assert_equal ['CHECK THESE DIFF CALLS'], @mock_runner.log + end + + end # class TestGnuDiff + + end + +end # module UnifiedMatchers + Property changes on: lib/unified_matchers/gnu_diff_matcher.rb ___________________________________________________________________ Name: svn:keywords + Id Index: lib/unified_matchers/strict_equality_based_matcher.rb --- lib/unified_matchers/strict_equality_based_matcher.rb (revision 0) +++ lib/unified_matchers/strict_equality_based_matcher.rb (revision 0) @@ -0,0 +1,44 @@ +# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + + +module UnifiedMatchers + + class StrictEqualityBasedMatcher < UnifiedMatcher + make Concrete + + with(Object, Object) { |ref, my| ref.equal? my } + + end # class StrictEqualityBasedMatcher + + + + test_section __FILE__ do + + class TestStrictEqualityBasedMatcher < ::Test::Unit::TestCase + include UnifiedMatchers::Assertions + + def setup + self.matcher = StrictEqualityBasedMatcher.new + end + + def teardown + end + + def test_equality_based_matcher + assert_matcher 42, 42 + assert_matcher 42, 43, false + assert_matcher '42', '42', false + s = '42' + assert_matcher s, s + assert_matcher '42', 42, false + assert_matcher '42', '43', false + end + + end # class TestStrictEqualityBasedMatcher + + end + +end # module UnifiedMatchers Property changes on: lib/unified_matchers/strict_equality_based_matcher.rb ___________________________________________________________________ Name: svn:keywords + Id Index: lib/unified_matchers/unified_matcher.rb --- lib/unified_matchers/unified_matcher.rb (revision 0) +++ lib/unified_matchers/unified_matcher.rb (revision 0) @@ -0,0 +1,52 @@ +# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + +module UnifiedMatchers + + class UnifiedMatcher + make Abstract + + class << self + + def with ( ref_class, my_class=nil, &block ) + if ref_class.nil? + with_ref ref_class, &block + with_my ref_class, &block + else + with_my_ref ref_class, my_class, &block + end + end + + private + + def call ( anObject, &block ) + case block.arity + when -1 then anObject.instance_eval(&block) + when 1 then block[anObject] + else raise ArgumentError, "Bad block arity" + end + end + + def with_my ( my_class, &block ) + # FIXME ... anObject ... call(anObject, &block) ... + end + + def with_ref ( ref_class, &block ) + # FIXME ... anObject ... call(anObject, &block) ... + end + + def with_my_ref ( ref_class, my_class, &block ) + # FIXME + end + + end # class << self + + def [] ( ref, my ) + # FIXME + end + + end # class UnifiedMatcher + +end # module UnifiedMatchers Property changes on: lib/unified_matchers/unified_matcher.rb ___________________________________________________________________ Name: svn:keywords + Id Index: lib/unified_matchers/case_equality_based_matcher.rb --- lib/unified_matchers/case_equality_based_matcher.rb (revision 0) +++ lib/unified_matchers/case_equality_based_matcher.rb (revision 0) @@ -0,0 +1,48 @@ +# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + + +module UnifiedMatchers + + class CaseEqualityBasedMatcher < UnifiedMatcher + make Concrete + + with(Object, Object) { |ref, my| ref === my } + + end # class CaseEqualityBasedMatcher + + + + test_section __FILE__ do + + class TestCaseEqualityBasedMatcher < ::Test::Unit::TestCase + include UnifiedMatchers::Assertions + + def setup + self.matcher = CaseEqualityBasedMatcher.new + end + + def teardown + end + + def test_equality_based_matcher + assert_matcher 42, 42 + assert_matcher 43, 42, false + assert_matcher '42', '42' + assert_matcher 42, '42', false + assert_matcher '43', '42', false + assert_matcher Integer, 42.0 + assert_matcher Float, 42.0 + assert_matcher Float, 42, false + assert_matcher 42, Integer, false + assert_matcher(/42/, '42') + assert_matcher(/42/, 42, false) + end + + end # class TestCaseEqualityBasedMatcher + + end + +end # module UnifiedMatchers Property changes on: lib/unified_matchers/case_equality_based_matcher.rb ___________________________________________________________________ Name: svn:keywords + Id Index: lib/unified_matchers/assertions.rb --- lib/unified_matchers/assertions.rb (revision 0) +++ lib/unified_matchers/assertions.rb (revision 0) @@ -0,0 +1,19 @@ +# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + +module UnifiedMatchers + + module Assertions + + attr_accessor :matcher + + def assert_matcher ( ref, my, ref_ref=true ) + assert_nothing_raised { @matcher_result = matcher[ref, my] } + assert_equal ref_ref, @matcher_result + end + + end # module Assertions + +end # module UnifiedMatchers Property changes on: lib/unified_matchers/assertions.rb ___________________________________________________________________ Name: svn:keywords + Id Index: lib/unified_matchers/diff_matcher.rb --- lib/unified_matchers/diff_matcher.rb (revision 0) +++ lib/unified_matchers/diff_matcher.rb (revision 0) @@ -0,0 +1,20 @@ +# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + + +module UnifiedMatchers + + class DiffMatcher < StreamMatcher + # FIXME make Abstract + + end # class DiffMatcher + + + + test_section __FILE__ do + + end + +end # module UnifiedMatchers Property changes on: lib/unified_matchers/diff_matcher.rb ___________________________________________________________________ Name: svn:keywords + Id Index: lib/unified_matchers/lcs_diff_matcher.rb --- lib/unified_matchers/lcs_diff_matcher.rb (revision 0) +++ lib/unified_matchers/lcs_diff_matcher.rb (revision 0) @@ -0,0 +1,32 @@ +# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + + +module UnifiedMatchers + + class LcsDiff < DiffMatcher + make Concrete + + with(String, String) { |ref, my| LCS::Diff.new(ref, my) } + + end # class LcsDiff + + + test_section __FILE__ do + include UnifiedMatchers::Assertions + + class TestLcsDiff < ::Test::Unit::TestCase + + def setup + end + + def teardown + end + + end # class TestLcsDiff + + end + +end # module UnifiedMatchers Property changes on: lib/unified_matchers/lcs_diff_matcher.rb ___________________________________________________________________ Name: svn:keywords + Id Index: lib/unified_matchers.rb --- lib/unified_matchers.rb (revision 0) +++ lib/unified_matchers.rb (revision 0) @@ -0,0 +1,31 @@ +# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + +require 'pathname' + +lib = Pathname.new(__FILE__).dirname +vendor = lib.parent + 'vendor' +unless defined? RubyEx + $CORE_EX_VENDORS ||= [] + $CORE_EX_VENDORS << vendor + file = vendor + 'ruby_ex' + 'lib' + 'ruby_ex.rb' + if file.exist? + require file.to_s + else + require 'rubygems' + require_gem 'ruby_ex' + require 'ruby_ex' + end +end +lib.load_path! +RubyEx.import! +Controllers::UnifiedMatchers.import! +# module UnifiedMatchers +# +# +# mattr_accessor :dir +# self.dir = lib +# +# end # module UnifiedMatchers Property changes on: lib/unified_matchers.rb ___________________________________________________________________ Name: svn:keywords + Id -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051007/e3ad4c37/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Fri Oct 7 19:15:09 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sat, 8 Oct 2005 01:15:09 +0200 (CEST) Subject: [Uttk-Patches] [UnifiedMatchers] 6: More tests. Message-ID: <20051007231509.8CA8E7CBA6@smtp.feydakins.org> svn://svn.feydakins.org/unified_matchers/trunk Index: ChangeLog from Nicolas Pouillard More tests. * lib/unified_matchers/stream_matcher.rb: Add tests with a dynamically added class. stream_matcher.rb | 7 +++++++ 1 files changed, 7 insertions(+) Index: lib/unified_matchers/stream_matcher.rb --- lib/unified_matchers/stream_matcher.rb (revision 5) +++ lib/unified_matchers/stream_matcher.rb (working copy) @@ -52,6 +52,13 @@ end end + def test_with_a_new_class + c = Class.new + assert_matcher(/^#<#.*>$/, c.new) + StreamMatcher.with(c) { object_id } + assert_matcher(/^\d+$/, c.new) + end + end # class TestStreamMatchers end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051008/12764c77/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sat Oct 8 08:39:43 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sat, 8 Oct 2005 14:39:43 +0200 (CEST) Subject: [Uttk-Patches] [UnifiedMatchers] 7: Improve the contract. Message-ID: <20051008123943.30BC97CBCF@smtp.feydakins.org> svn://svn.feydakins.org/unified_matchers/trunk Index: ChangeLog from Nicolas Pouillard Improve the contract. * lib/unified_matchers/stream_matcher.rb: Returns a boolean, handles StringIO. * lib/unified_matchers/gnu_diff_matcher.rb: Makes it really pathname based and provides some conversions. * lib/unified_matchers/case_equality_based_matcher.rb: . * lib/unified_matchers/lcs_diff_matcher.rb: Fix an assertion. * lib/unified_matchers.rb: Requires 'diff/lcs' if available, add Unified_matchers.{dir,fixtures} class attributes. * test/fixtures/my.file: New. lib/unified_matchers.rb | 17 ++++--- lib/unified_matchers/case_equality_based_matcher.rb | 2 lib/unified_matchers/gnu_diff_matcher.rb | 43 ++++++++++++++------ lib/unified_matchers/lcs_diff_matcher.rb | 24 ++++++++++- lib/unified_matchers/stream_matcher.rb | 12 +++-- test/fixtures/my.file | 1 6 files changed, 72 insertions(+), 27 deletions(-) Index: test/fixtures/my.file --- test/fixtures/my.file (revision 0) +++ test/fixtures/my.file (revision 0) @@ -0,0 +1 @@ +foo/bar Index: lib/unified_matchers/stream_matcher.rb --- lib/unified_matchers/stream_matcher.rb (revision 6) +++ lib/unified_matchers/stream_matcher.rb (working copy) @@ -11,9 +11,10 @@ with(Object) { to_s } with(String, String) { |ref, my| ref == my } - with(Regexp, String) { |ref, my| ref.match my } + with(Regexp, String) { |ref, my| !! ref.match(my) } with(Pathname) { open } with(IO) { rewind ; read } + with(StringIO) { rewind ; read } end # class StreamMatcher @@ -33,12 +34,13 @@ def test_stream_matcher assert_matcher 'a', 'b', false - assert_matcher(/a/, 'a') + assert_matcher(/^a$/, 'a') assert_matcher 'a', 'a' - assert_matcher(/a/, /a/, false) - assert_matcher '/a/', /a/ + assert_matcher(/^a$/, /^a$/, false) + assert_matcher "(?-mix:^a$)", /^a$/ assert_matcher(/\d/, 4) - assert_matcher '42', 42, false + assert_matcher '42', 42 + assert_matcher 42, '42' s = StringIO.new s << 'foo' assert_matcher 'foo', s Index: lib/unified_matchers/gnu_diff_matcher.rb --- lib/unified_matchers/gnu_diff_matcher.rb (revision 6) +++ lib/unified_matchers/gnu_diff_matcher.rb (working copy) @@ -14,11 +14,20 @@ self.diff = 'diff'.to_cmd self.runner = Commands::Runners::System.new.raise_on_failures - with_my(Object) { to_path } + with(Object) do + (respond_to?(:to_path))? to_path : to_s + end + + with(String) do |s| + tmp = TempPath.new + tmp.open('w') { |f| f.print s } + tmp + end - with(String, Pathname) do |ref, my| - cmd = diff[my] + %w[ -u --label my --label ref - ] < ref - cmd.run(runner) + with(Pathname, Pathname) do |ref, my| + cmd = diff[ref, my] + %w[ -u --label ref --label my ] + data = cmd.run(runner) + (data.status.success?)? true : data end end # class GnuDiff @@ -29,12 +38,18 @@ class TestGnuDiff < ::Test::Unit::TestCase include UnifiedMatchers::Assertions + include Commands::Runners::Mockable + + # Will be useful just with this mocked diff command + def assert_kind_of_data ( *args ) + assert_kind_of Commands::Datas::Data, matcher[*args] + end def setup @old_runner = GnuDiff.runner - @mock_runner = GnuDiff.runner = @old_runner.dup.make_mock {} + @mock_runner = GnuDiff.runner = Commands::Runners::System.new.make_mock {} self.matcher = GnuDiff.new - @my = 'my.file'.to_path + @my = UnifiedMatchers.fixtures/'my.file' end def teardown @@ -42,14 +57,18 @@ end def test_diff - d = Commands::Datas::Data assert_nothing_raised do - assert_kind_of d, matcher['foo', @my] - assert_equal true, matcher[/foo/, @my] - assert_kind_of d, matcher['foo', @my.to_s] - assert_kind_of d, matcher[@my.open, @my] + assert_matcher "foo/bar\n", @my + assert_matcher 'foo', @my.to_s + assert_matcher(/foo/, @my) + assert_matcher @my.open, @my + end + re = /"diff" ".*" ".*" "-u" "--label" "ref" "--label" "my"/ + @mock_runner.log.each do |cmd| + assert_match re, cmd.to_sh end - assert_equal ['CHECK THESE DIFF CALLS'], @mock_runner.log + assert_match %r{/test/fixtures/my.file}, @mock_runner.log[0].to_sh + assert_equal 3, @mock_runner.log.size end end # class TestGnuDiff Index: lib/unified_matchers/case_equality_based_matcher.rb --- lib/unified_matchers/case_equality_based_matcher.rb (revision 6) +++ lib/unified_matchers/case_equality_based_matcher.rb (working copy) @@ -33,7 +33,7 @@ assert_matcher '42', '42' assert_matcher 42, '42', false assert_matcher '43', '42', false - assert_matcher Integer, 42.0 + assert_matcher Integer, 42 assert_matcher Float, 42.0 assert_matcher Float, 42, false assert_matcher 42, Integer, false Index: lib/unified_matchers/lcs_diff_matcher.rb --- lib/unified_matchers/lcs_diff_matcher.rb (revision 6) +++ lib/unified_matchers/lcs_diff_matcher.rb (working copy) @@ -9,22 +9,42 @@ class LcsDiff < DiffMatcher make Concrete - with(String, String) { |ref, my| LCS::Diff.new(ref, my) } + with(IO) { rewind ; readlines } + with(String) { to_a } + with(Array, Array) do |ref, my| + res = Diff::LCS.diff(ref, my) + (res.empty?)? true : res + end end # class LcsDiff test_section __FILE__ do - include UnifiedMatchers::Assertions class TestLcsDiff < ::Test::Unit::TestCase + include UnifiedMatchers::Assertions def setup + self.matcher = LcsDiff.new + @my = UnifiedMatchers.fixtures/'my.file' end def teardown end + if defined? Diff::LCS + def test_lcs_diff + assert_matcher 42, 42 + assert_matcher '42', '42' + assert_matcher @my, @my + assert_matcher "foo/bar\n", @my + assert_kind_of Array, matcher['foo', 'bar'] + assert_kind_of Array, matcher[%w[ a b c d e f ], %w[ a c d h e ]] + assert_matcher(/baz/, @my, false) + assert_matcher(/foo/, @my) + end + end + end # class TestLcsDiff end Index: lib/unified_matchers.rb --- lib/unified_matchers.rb (revision 6) +++ lib/unified_matchers.rb (working copy) @@ -22,10 +22,13 @@ lib.load_path! RubyEx.import! Controllers::UnifiedMatchers.import! -# module UnifiedMatchers -# -# -# mattr_accessor :dir -# self.dir = lib -# -# end # module UnifiedMatchers +suppress(LoadError) { require 'diff/lcs' } + +module UnifiedMatchers + + mattr_accessor :dir, :fixtures + +end # module UnifiedMatchers + +UnifiedMatchers.dir = lib +UnifiedMatchers.fixtures = lib.parent/'test'/'fixtures' -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051008/b1d5ad5a/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sat Oct 8 08:46:16 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sat, 8 Oct 2005 14:46:16 +0200 (CEST) Subject: [Uttk-Patches] 739: Fix the unit test suites. Message-ID: <20051008124616.3462E7CAEF@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/739 Index: ChangeLog from Nicolas Pouillard Fix the unit test suites. * lib/uttk/strategies/RUnit.rb: Better handling of uttk-unit. * lib/uttk.rb: More precise dumpable proc. * bin/uttk-unit: Honore the verbose option later in the execution. * bin/uttk: Update cache messages. * test/unit-suite.yml: Adapt to uttk-unit. * test/minimal/runit.yml: Rename to ... * test/minimal/r_unit.yml: ... this. And adapt. * test/fixtures/runit: Rename to ... * test/fixtures/unit: ... this. * test/minimal/uttk-minimal: Remove. Useless and empty. bin/uttk | 8 +++++--- bin/uttk-unit | 8 +++++--- lib/uttk.rb | 4 ++-- lib/uttk/strategies/RUnit.rb | 39 ++++++++++++++++++++------------------- test/minimal/r_unit.yml | 14 +++++++------- test/unit-suite.yml | 3 +-- 6 files changed, 40 insertions(+), 36 deletions(-) Index: test/minimal/r_unit.yml --- test/minimal/r_unit.yml (revision 738) +++ test/minimal/r_unit.yml (working copy) @@ -1,23 +1,23 @@ --- RUnit strategy test suite: !S::RMatch symbols: - unit_dir: <>/../fixtures/runit + unit_dir: <>/../fixtures/unit test: !S::Suite attributes: !S::RUnit - input: !path <>/../test-unit-setup.rb + uttk_unit_options: [--no-ruby_ex, --no-uttk] contents: - good: - args: <>/good.rb + input: !path <>/good.rb - bad: - args: <>/bad.rb + input: !path <>/bad.rb - error: - args: <>/error.rb + input: !path <>/error.rb - good directory: - args: fixtures/runit/good.rb + input: !path fixtures/unit/good.rb dir: <>/.. verbose: true - bad directory: - args: fixtures/runit/bad.rb + input: !path fixtures/unit/bad.rb dir: <>/.. match: - ///good/status/PASS Index: test/unit-suite.yml --- test/unit-suite.yml (revision 738) +++ test/unit-suite.yml (working copy) @@ -5,7 +5,6 @@ iter: [it_file, it_name] test: Unit test <>: !S::RUnit - input: !path <>/test-unit-setup.rb - args: <> + input: !path <> dir: <> verbose: true Index: lib/uttk/strategies/RUnit.rb --- lib/uttk/strategies/RUnit.rb (revision 738) +++ lib/uttk/strategies/RUnit.rb (working copy) @@ -81,23 +81,17 @@ protected def prologue - @command = '<> ' - unless @uttk_unit_options.nil? - @command += '-- <> ' - end + @command = '<> -- <> ' @command += '-w ' if @verbose @load_path.each { |x| @command += "-I #{x} " } @requires = [@requires] unless @requires.respond_to? :each @requires.each { |x| @command += "-r #{x} " } - if @uttk_unit_options.nil? - @command += '%i --runner yaml -- ' - else + unless @uttk_unit_options.empty? opts = @uttk_unit_options opts = [opts] unless opts.respond_to? :each opts.each { |x| @command += "#{x} " } - @command += '-- %i --runner yaml ' end - @command += '%a' + @command += '-- %i --runner yaml -- %a' @quiet_print = true super end @@ -110,16 +104,22 @@ skip('No result has been collected probably because no test ' + 'suite has been run') else - @output.my.open { |io| result = YAML.load(io) } + result = YAML.load(@output.my.read) + r = OpenStruct.new(result) @log[:result] = result - skip PassStatus.new.weight if result['tests_number'] == 0 - if result['failures_number'] != 0 or result['errors_number'] != 0 - if result['failures_number'] == 0 - fail('there are errors') - elsif result['errors_number'] == 0 - fail('there are failures') + if r.tests_number == 0 + skip PassStatus.new.weight, 'No test suite in this file' + end + if r.failures_number != 0 or r.errors_number != 0 + rpath = '/^failures$/^default_test/No tests were specified' + if r.failures_number == 1 and result.rpath_find :first, rpath + skip 'No tests were specified' + elsif r.failures_number.zero? + fail 'There are errors' + elsif r.errors_number.zero? + fail 'There are failures' else - fail('there are failures and errors') + fail 'There are failures and errors' end end pass @@ -133,8 +133,9 @@ attribute :load_path, 'directories to add to the $LOAD_PATH variable', :invisible do [] end attribute :requires, 'features to require before load the input', - [Array, String, Pathname] - attribute :uttk_unit_options, 'options for uttk-unit', [Array, String] + [Array, String, Pathname] do [] end + attribute :uttk_unit_options, 'options for uttk-unit', + [Array, String] do [] end attribute :verbose, 'turn on/off the ruby verbose mode', false, :invisible Index: lib/uttk.rb --- lib/uttk.rb (revision 738) +++ lib/uttk.rb (working copy) @@ -273,7 +273,7 @@ :dump_status => false, :cache_mode => false, :cache_proc => DumpableProc.new('|test, status| - status.pass? or status.is_a? Uttk::SkipStatus' + status.pass? or (status.is_a? Uttk::SkipStatus and status.weight.pass?)' ).freeze, }.freeze @@ -289,7 +289,7 @@ symtbl[:uttk] = Pathname.new($0).expand_path symtbl[:ruby] = Config::CONFIG['RUBY_INSTALL_PATH'] symtbl[:'uttk-unit'] = symtbl[:uttk_unit] = - Uttk.dir.parent.parent/'bin'/'uttk-unit' + (Uttk.dir.parent.parent/'bin'/'uttk-unit').expand_path.cleanpath symtbl[:core_ex] = CoreEx.dir symtbl[:symtbl_class] = symtbl.class symtbl[:pwd] = Pathname.pwd.expand_path Index: bin/uttk-unit --- bin/uttk-unit (revision 738) +++ bin/uttk-unit (working copy) @@ -21,7 +21,8 @@ :requires => [], :core_ex => true, :ruby_ex => true, - :uttk => true) + :uttk => true, + :verbose => true) OptionParser.new do |o| o.on('-I', '--include DIR', 'Add this directory to $LOAD_PATH') do |dir| @@ -31,7 +32,7 @@ @options.requires << file end o.on('-w', '--[no-]verbose', 'Turn on/off the verbose mode [default: on]') do |b| - $VERBOSE = b + @options.verbose = b end o.on('--[no-]core_ex', 'Turn on/off the CoreEx require [default: on]') do |b| @options.core_ex = b @@ -57,7 +58,6 @@ def run raise 'Do not load CoreEx before uttk-unit' if defined? CoreEx raise 'Do not load RubyEx before uttk-unit' if defined? RubyEx - $VERBOSE = true requires @@ -80,6 +80,8 @@ @options.requires.each { |r| require r } + $VERBOSE = @options.verbose + # FIXME try to fix this feature # begin # file = path.ext('').to_s # .sub(/^#{lib}\/*/, '') Index: bin/uttk --- bin/uttk (revision 738) +++ bin/uttk (working copy) @@ -104,14 +104,14 @@ raise 'HighLine is unavailable' unless defined? HighLine h = HighLine.new # Ask the user what to do. - if h.agree 'Would you relaunch the test suite now (use the cache)', true + if h.agree 'Would you relaunch the test suite now (use the cache) (y/n)', true pid = Kernel.fork do Kernel.exec Config::CONFIG['RUBY_INSTALL_PATH'], $0, *ARGV end Process.waitpid pid exit else - if h.agree 'Would you remove the temporary dir', true + if h.agree 'Would you remove the temporary dir (y/n)', true TempPath.auto_clean = true else TempPath.auto_clean = false @@ -132,12 +132,14 @@ |--- | | /------------------------------------------------------------------. - | | Uttk was running in cache mode to re-run the same test just type: | + | | Uttk was running in cache mode to re-run the same one just type: | | | #{relaunch.to_s.ljust(63)}| | `------------------------------------------------------------------/ |".head_cut! end end + else + TempPath.auto_clean = true end # Handle the --dump-status option. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051008/755bceb3/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sat Oct 8 09:33:05 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sat, 8 Oct 2005 15:33:05 +0200 Subject: [Uttk-Patches] [UnifiedMatchers] 7: Improve the contract. In-Reply-To: <20051008123943.30BC97CBCF@smtp.feydakins.org> References: <20051008123943.30BC97CBCF@smtp.feydakins.org> Message-ID: <840b875c0510080633h2a5597d8l938519f9d9ee8eb2@mail.gmail.com> On 10/8/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/unified_matchers/trunk > > Index: ChangeLog > from Nicolas Pouillard > > Improve the contract. > > * lib/unified_matchers/stream_matcher.rb: Returns a boolean, > handles StringIO. > * lib/unified_matchers/gnu_diff_matcher.rb: Makes it really pathname > based and provides some conversions. > * lib/unified_matchers/case_equality_based_matcher.rb: . > * lib/unified_matchers/lcs_diff_matcher.rb: Fix an assertion. > * lib/unified_matchers.rb: Requires 'diff/lcs' if available, add > Unified_matchers.{dir,fixtures} class attributes. > * test/fixtures/my.file: New. > Why don't you write code but only tests? XP says to write a test which break the current code, then to fix it and finally to commit. This way the second test is more accurate because you have a better overview of your program, and the program is always usable. Maybe the contract you are writing is not exactly the one you want and so part of this work is probably incorrect. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sat Oct 8 09:27:23 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sat, 8 Oct 2005 15:27:23 +0200 Subject: [Uttk-Patches] 738: Add uttk-unit a unified command to run unit tests. In-Reply-To: <20051007204719.6B1397CB5B@smtp.feydakins.org> References: <20051007204719.6B1397CB5B@smtp.feydakins.org> Message-ID: <840b875c0510080627n7733c94cs1325daf638b319e2@mail.gmail.com> On 10/7/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/uttk/trunk > > You can also view this changeset here: > > http://http://dev.uttk.org/repository/changesets/738 > > Index: ChangeLog > from Nicolas Pouillard > > Add uttk-unit a unified command to run unit tests. > > * bin/uttk-unit: New. It currently just supports ruby unit tests, and > will be a replacment for all test_unit_setup files. > * lib/uttk/strategies/RUnit.rb: Adapt to uttk-unit to use it if > the user want it. > * lib/uttk.rb: Add uttk-unit in the symtbl. > Reviewed. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sat Oct 8 14:32:54 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sat, 8 Oct 2005 20:32:54 +0200 (CEST) Subject: [Uttk-Patches] 740: Restore the main test suite. Message-ID: <20051008183254.476207CC14@smtp.feydakins.org> We get only 99% since weight.yml reveal three small bugs in the weight computation. svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/740 Index: ChangeLog from Nicolas Pouillard Restore the main test suite. * lib/uttk/status.rb: Merge Status and StatusWithMessage. Fix the bug with Status#to_yaml. * test/minimal/glob.yml: Use S::Iterate since Glob is no more available. * lib/uttk/strategies/Block.rb: Inherit from IOBased. * bin/uttk-unit: Require the uttk of uttk-unit. bin/uttk-unit | 12 +++++-- lib/uttk/status.rb | 71 +++++++++++++------------------------------ lib/uttk/strategies/Block.rb | 4 +- test/minimal/glob.yml | 8 ++-- 4 files changed, 38 insertions(+), 57 deletions(-) Index: test/minimal/glob.yml --- test/minimal/glob.yml (revision 739) +++ test/minimal/glob.yml (working copy) @@ -1,10 +1,10 @@ --- -Test a list of tarballs (glob.yml): !S::Glob - glob: '<>/../fixtures/ball/*.tar.bz2' - regexp: !re ([^/]*)\.tar\.bz2$ +Test a list of tarballs (glob.yml): !S::Iterate + over: !pathlist <>/../fixtures/ball/(*).tar.bz2 + iter: [ it_file, it_name ] test: - 'Useless test suite for <>': !S::Suite + Useless test suite for <>: !S::Suite contents: - Pass 1: !S::Pass {} - Fail 1: !S::Fail { weight: -1 } Index: lib/uttk/status.rb --- lib/uttk/status.rb (revision 739) +++ lib/uttk/status.rb (working copy) @@ -9,14 +9,6 @@ class Status < UttkException include Abstract - attr_accessor :weight - - class_inheritable_accessor :default_weight_value - - def initialize - @weight = self.class.default_weight_value - end - def self.default_weight ( aSymbol ) self.default_weight_value = Weights::Default.new(aSymbol) end @@ -29,6 +21,25 @@ (status_name.to_s.downcase + '_hook').to_sym end + + attr_accessor :weight, :reason + class_inheritable_accessor :default_weight_value + class_inheritable_accessor :default_reason + self.default_reason = nil + default_weight :FAIL + + + def initialize ( anObject=nil ) + super() + @reason = anObject || default_reason + @weight = self.class.default_weight_value + end + + def to_uttk_log ( log ) + log.status = self.to_s + log.reason = @reason unless @reason.nil? + end + def hook_name self.class.hook_name end @@ -41,10 +52,6 @@ res end - def to_uttk_log ( log ) - log.status = self.to_s - end - def pass? false end @@ -53,28 +60,6 @@ - class StatusWithMessage < Status - include Abstract - - attr_reader :message - class_inheritable_accessor :default_message - self.default_message = nil - default_weight :FAIL - - def initialize ( anObject=nil ) - super() - @message = anObject || default_message - end - - def to_uttk_log ( log ) - super - log.reason = @message unless @message.nil? - end - - end # class StatusWithMessage - - - class PassStatus < Status include Concrete default_weight :PASS @@ -85,7 +70,7 @@ - class SkipStatus < StatusWithMessage + class SkipStatus < Status include Concrete def initialize ( aWeight=nil, anObject=nil ) super(anObject) @@ -95,13 +80,13 @@ - class ErrorStatus < StatusWithMessage + class ErrorStatus < Status include Concrete end - class AbortStatus < StatusWithMessage + class AbortStatus < Status include Concrete end # class AbortStatus @@ -144,7 +129,7 @@ - class FailStatus < StatusWithMessage + class FailStatus < Status include Concrete def initialize ( aWeight=nil, anObject=nil ) @@ -156,16 +141,6 @@ :failed_hook end - # FIXME find the Yaml bug that force us to write it by hand - # problem: message is dumped twice. - have YamlExtension, 'Uttk::Status::Fail' - def to_yaml_string - { 'message' => @message, 'weight' => @weight }.to_yaml.sub(/---.*$/, '') - end - def self.yaml_load ( val ) - new(val['weight'], val['message']) - end - end # class FailStatus end # module Uttk Index: lib/uttk/strategies/Block.rb --- lib/uttk/strategies/Block.rb (revision 739) +++ lib/uttk/strategies/Block.rb (working copy) @@ -8,7 +8,7 @@ module Strategies - class Block < Strategy + class Block < IOBased include Concrete @@ -21,7 +21,7 @@ def test=(block1=nil, &block2) - if block + if block2 @test = block2 elsif not block1.nil? @test = block1 Index: bin/uttk-unit --- bin/uttk-unit (revision 739) +++ bin/uttk-unit (working copy) @@ -69,9 +69,15 @@ @options.load_path.each { |dir| $LOAD_PATH << dir } - require 'core_ex' if @options.core_ex - require 'ruby_ex' if @options.ruby_ex - require 'uttk' if @options.uttk + root = Pathname.new(__FILE__).dirname.parent + + if @options.uttk + require (root + 'lib' + 'uttk').to_s + elsif @options.ruby_ex + require 'ruby_ex' + elsif @options.core_ex + require 'core_ex' + end raise 'CoreEx not loaded' unless defined? CoreEx Test::Unit::UI::Yaml::TestRunner.import! -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051008/2aad97bf/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sat Oct 8 14:35:28 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sat, 8 Oct 2005 20:35:28 +0200 (CEST) Subject: [Uttk-Patches] [UnifiedMatchers] 8: A simple implementation. Message-ID: <20051008183528.597557CBFD@smtp.feydakins.org> svn://svn.feydakins.org/unified_matchers/trunk Index: ChangeLog from Nicolas Pouillard A simple implementation. * lib/unified_matchers/unified_matcher.rb: This implementation is not yet optimizied but respect the previous contract. unified_matcher.rb | 70 +++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 52 insertions(+), 18 deletions(-) Index: lib/unified_matchers/unified_matcher.rb --- lib/unified_matchers/unified_matcher.rb (revision 7) +++ lib/unified_matchers/unified_matcher.rb (working copy) @@ -8,44 +8,78 @@ class UnifiedMatcher make Abstract + class_inheritable_hash :my_triggers, :ref_triggers + self.my_triggers = {} + self.ref_triggers = {} + class << self def with ( ref_class, my_class=nil, &block ) - if ref_class.nil? + if my_class.nil? with_ref ref_class, &block with_my ref_class, &block else - with_my_ref ref_class, my_class, &block + with_ref ref_class, my_class, &block end end private - def call ( anObject, &block ) - case block.arity - when -1 then anObject.instance_eval(&block) - when 1 then block[anObject] - else raise ArgumentError, "Bad block arity" - end - end - def with_my ( my_class, &block ) - # FIXME ... anObject ... call(anObject, &block) ... + raise ArgumentError, 'Need a block' if block.nil? + my_triggers[my_class] = block end - def with_ref ( ref_class, &block ) - # FIXME ... anObject ... call(anObject, &block) ... - end - - def with_my_ref ( ref_class, my_class, &block ) - # FIXME + def with_ref ( ref_class, my_class=nil, &block ) + raise ArgumentError, 'Need a block' if block.nil? + ref_triggers[ref_class] = [my_class, block] end end # class << self + + def [] ( ref, my ) - # FIXME + my_target_class, ref_trigger, my_trigger = nil, nil, nil + loop do + ref_class = ref.class + ref_class.ancestors.each do |aModule| + if ref_triggers.has_key? aModule + my_target_class, ref_trigger = ref_triggers[aModule] + break + end + end + if my_target_class.nil? + ref = apply(ref, &ref_trigger) + next + else + until my.is_a? my_target_class + my.class.ancestors.each do |aModule| + if my_triggers.has_key? aModule + my_trigger = my_triggers[aModule] + break + end + end + if my_trigger.nil? + raise ArgumentError, 'No "my" trigger with this class #{my.class}' + end + my = apply(my, &my_trigger) + end + return ref_trigger[ref, my] + end + end + end + + + + def apply ( anObject, &block ) + case block.arity + when -1 then anObject.instance_eval(&block) + when 1 then block[anObject] + else raise ArgumentError, "Bad block arity: #{block.arity}" + end end + private :apply end # class UnifiedMatcher -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051008/91d98f61/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 05:37:41 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 11:37:41 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 393: Some minor fixes in the base Rakefile. Message-ID: <20051009093741.3F1DE79B5A@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard Some minor fixes in the base Rakefile. * lib/core_ex/rakefile_base.rf: Update the ruby_ex version to ~> 0.3.0. Improve error displaying in publish_package. Fix a bug with re?vendor_dev. rakefile_base.rf | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) Index: lib/core_ex/rakefile_base.rf --- lib/core_ex/rakefile_base.rf (revision 392) +++ lib/core_ex/rakefile_base.rf (working copy) @@ -78,7 +78,7 @@ task :ruby_ex => [ :spec ] do - require_gem('ruby_ex', SPEC.ruby_ex_version || '~> 0.2.0') + require_gem('ruby_ex', SPEC.ruby_ex_version || '~> 0.3.0') require 'ruby_ex' Commands.import! $runner = Commands::Runners::System.new @@ -469,7 +469,10 @@ end cookie = login_response['set-cookie'] - raise 'Login failed' unless cookie + unless cookie + STDERR.puts login_response.body + raise 'Login failed' + end headers = { 'Cookie' => cookie } release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}" @@ -480,7 +483,10 @@ package_name = SPEC.rubyforge_sub_package_name || SPEC.name package_id = names.zip(ids).find { |name, id| name == package_name }.last - raise "Couldn't get package id or package name" unless package_id + unless package_id + STDERR.puts release_data.body + raise "Couldn't get package id or package name" + end first_file = true release_id = '' @@ -556,7 +562,10 @@ if first_file then release_id = release_response.body[/release_id=(\d+)/, 1] - raise("Couldn't get release id") unless release_id + unless release_id + STDERR.puts release_response.body + raise "Couldn't get release id" + end end first_file = false @@ -579,12 +588,13 @@ require 'uri_ex' if SPEC.dependencies SPEC.dependencies.each do |name, version| - url = nil + url, vcs = nil, false case version when Array then url = version.last when Hash if dev and version['vcs'] url = version['vcs'] + vcs = true else url = version['tarball'] end @@ -600,8 +610,8 @@ out = FileType.guess(url.checkout.first) out = out.extract if out.extractable? out.path.mv(dest) - if dev and version['vcs'] and (dest + 'SPEC.yml').exist? - cmd = $0.to_cmd['vendor_dev'] > [STDOUT, STDERR] + if dev and vcs and (dest + 'SPEC.yml').exist? + cmd = $0.to_cmd['revendor_dev'] > [STDOUT, STDERR] cmd.dir = dest data = cmd.run($runner) end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/9c070175/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 05:46:22 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 11:46:22 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 394: Update unit tests. Message-ID: <20051009094622.5BC317B2D9@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard Update unit tests. * test/unit-suite.yml: Use uttk-unit. * lib/core_ex/pathname.rb: Renaming. * lib/d_time.rb, lib/core_ex.rb, * lib/path_list.rb: Update the Yaml extension. * test/resources: Rename to ... * test/fixtures: ... this. * test/test-unit-setup.rb: Remove useless since uttk-unit provides the same service. lib/core_ex.rb | 6 ------ lib/core_ex/pathname.rb | 4 ++-- lib/d_time.rb | 10 +++++----- lib/path_list.rb | 4 ++-- test/unit-suite.yml | 9 +++++---- 5 files changed, 14 insertions(+), 19 deletions(-) Index: test/unit-suite.yml --- test/unit-suite.yml (revision 393) +++ test/unit-suite.yml (working copy) @@ -2,12 +2,13 @@ CoreEx Unit Test Suite: !S::Iterate - over : !pathlist <>/../lib/(**/*).rb - iter : [it_file, it_name] + over : !pathlist <>/../lib/((**/*).rb) + iter : [it_file, it_short_path, it_name ] test: Unit test <>: !S::RUnit - input: !path <>/test-unit-setup.rb - args: <> + input: !path <> + requires: <>/../lib/core_ex + uttk_unit_options: --uttk no --import dir: <> verbose: true Index: lib/d_time.rb --- lib/d_time.rb (revision 393) +++ lib/d_time.rb (working copy) @@ -7,7 +7,7 @@ class DTime - have YamlExtension + have YamlExtension, :dtime, :d_time def initialize(delta) @delta = delta.to_f.abs @@ -137,13 +137,13 @@ def test_to_yaml d = DTime.new(265678.42000) - assert_yaml_dump(d, '--- !dtime 3 days 1 hours 47 mins 58.4199999999837 secs') + assert_yaml_dump(d, '!dtime 3 days 1 hours 47 mins 58.4199999999837 secs') d = DTime.new(5678.42000) - assert_yaml_dump(d, '--- !dtime 1 hours 34 mins 38.4200000000001 secs') + assert_yaml_dump(d, '!dtime 1 hours 34 mins 38.4200000000001 secs') d = DTime.new(158.42000) - assert_yaml_dump(d, '--- !dtime 2 mins 38.42 secs') + assert_yaml_dump(d, '!dtime 2 mins 38.42 secs') d = DTime.new(58.42000) - assert_yaml_dump(d, '--- !dtime 58.42 secs') + assert_yaml_dump(d, '!dtime 58.42 secs') end def test_diff Index: lib/core_ex/pathname.rb --- lib/core_ex/pathname.rb (revision 393) +++ lib/core_ex/pathname.rb (working copy) @@ -226,8 +226,8 @@ def setup @test = __FILE__.to_path.dirname.parent.parent + 'test' - @res = @test + 'resources' - @req = @res + 'require' + @fixtures = @test + 'fixtures' + @req = @fixtures + 'require' @s = 'test_require' @s_dne = 'test_require_dne' @s_so = 'test_require_so.so' Index: lib/core_ex.rb --- lib/core_ex.rb (revision 393) +++ lib/core_ex.rb (working copy) @@ -136,12 +136,6 @@ def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '/').gsub(/([A-Z])/,'_\1').gsub(/(^|\/)_/, '\1').downcase end - def constantize(camel_cased_word, start=Object) - camel_cased_word.split("::").inject(start) do |final_type, part| - return nil unless final_type.const_defined? part - final_type.const_get(part) - end - end end # module Inflector module Dependencies class LoadingModule Index: lib/path_list.rb --- lib/path_list.rb (revision 393) +++ lib/path_list.rb (working copy) @@ -518,8 +518,8 @@ def test_pathlist ls = __FILE__.to_path.dirname + '*.rb' - assert_yaml_load "--- !filelist #{ls}", PathList, PathList[ls] - assert_yaml_dump @val, @val.to_a.to_yaml + assert_yaml_load "!filelist #{ls}", PathList, PathList[ls] + assert_yaml_dump @val, @val.to_a.to_yaml.sub(/^---\s*/, '') end end # class PathListTest -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/a34a3826/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 06:31:11 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 12:31:11 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 395: Add URI::Rsync and fix some others URI::*. Message-ID: <20051009103111.32BE57B332@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Add URI::Rsync and fix some others URI::*. * lib/uri_ex.rb: Use URI.decode in mk_custom_opts. * lib/uri/rsync.rb: New. Just supports rsync.ssh. * lib/uri/ssh.rb, lib/uri/file.rb, lib/uri/mysql.rb, lib/uri/pgsql.rb, lib/uri/svn.rb: Fix returned values of checkout and save. * lib/commands/datas/data.rb: Suppress errors in to_yaml_string. commands/datas/data.rb | 4 +-- uri/file.rb | 2 - uri/mysql.rb | 3 -- uri/pgsql.rb | 3 -- uri/rsync.rb | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ uri/ssh.rb | 17 ++------------ uri/svn.rb | 2 - uri_ex.rb | 3 +- 8 files changed, 69 insertions(+), 23 deletions(-) Index: lib/uri_ex.rb --- lib/uri_ex.rb (revision 394) +++ lib/uri_ex.rb (working copy) @@ -69,12 +69,13 @@ return opts if @query.nil? @query.split(/,/).map do |x| k, v = x.split(/=/) + k = URI.decode(k) if k.size == 1 opts << "-#{k}" else opts << "--#{k}" end - opts << v unless v.nil? + opts << URI.decode(v) unless v.nil? end opts end Index: lib/commands/datas/data.rb --- lib/commands/datas/data.rb (revision 394) +++ lib/commands/datas/data.rb (working copy) @@ -108,8 +108,8 @@ have YamlExtension, :'commands::data' def to_yaml_string - out = output.read - err = error.read + suppress(IOError) { out = output.read } + suppress(IOError) { err = error.read } out ||= '' err ||= '' Index: lib/uri/ssh.rb --- lib/uri/ssh.rb (revision 394) +++ lib/uri/ssh.rb (working copy) @@ -29,20 +29,9 @@ end def mk_opts - opts = [] - opts << '-q' + opts = ['-q'] opts << '-P' << @port if @port != DEFAULT_PORT - return opts if @query.nil? - @query.split(/,/).map do |x| - k, v = x.split(/=/) - if k.size == 1 - opts << "-#{k}" - else - opts << "--#{k}" - end - opts << v unless v.nil? - end - opts + opts + mk_custom_opts end def mk_arg @@ -55,7 +44,7 @@ end def save - checkout.save + checkout.first.save end def commit ( aPath ) Index: lib/uri/rsync.rb --- lib/uri/rsync.rb (revision 0) +++ lib/uri/rsync.rb (revision 0) @@ -0,0 +1,58 @@ +# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved. +# Author:: Nicolas Pouillard . +# License:: Gnu General Public License. +# Revision:: $Id$ + +require 'uri_ex' + +module URI + + class Rsync < Generic + + SCHEMES = ['rsync.ssh'.freeze] + DEFAULT_HOST = 'localhost'.freeze + DEFAULT_QUERY = ''.freeze + cattr_accessor :rsync + self.rsync ||= 'rsync'.to_cmd.freeze + + COMPONENT = [ + :scheme, + :userinfo, + :host, + :path, + :query + ].freeze + + def self.build ( args ) + tmp = Util::make_components_hash(self, args) + return super(tmp) + end + + def mk_opts + ['-Pa'] + mk_custom_opts + end + + def mk_arg + "#@user@#@host:#{@path.gsub(/^\//, '')}" + end + + # def checkout + # out = TempPath.new('checkout', pathname.basename.to_s) + # [out, SCP[mk_opts, mk_arg, out].run(self.runner)] + # end + + # def save + # checkout.first.save + # end + + def commit ( aPath ) + rsync[mk_opts, aPath, mk_arg].run(runner) + end + + end # class Rsync + + Rsync::SCHEMES.each do |scheme| + @@schemes[scheme.upcase] = Rsync + end + +end # module URI Property changes on: lib/uri/rsync.rb ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + Id Index: lib/uri/file.rb --- lib/uri/file.rb (revision 394) +++ lib/uri/file.rb (working copy) @@ -35,7 +35,7 @@ def checkout p = self.pathname raise CheckoutError, to_s unless p.exist? - p + [p, nil] end def commit ( aPath ) Index: lib/uri/mysql.rb --- lib/uri/mysql.rb (revision 394) +++ lib/uri/mysql.rb (working copy) @@ -60,8 +60,7 @@ def save out = TempPath.new('dump', pathname.basename.to_s) cmd = DUMP + mk_connection_opts + mk_dump_opts(out) + mk_custom_opts - cmd.run(self.runner) - out + [out, cmd.run(runner)] end end # class MySQL Index: lib/uri/pgsql.rb --- lib/uri/pgsql.rb (revision 394) +++ lib/uri/pgsql.rb (working copy) @@ -59,8 +59,7 @@ def save out = TempPath.new('dump', pathname.basename.to_s) cmd = DUMP + mk_connection_opts + mk_dump_opts(out) + mk_custom_opts - cmd.run(self.runner) - out + [out, cmd.run(runner)] end end # class PgSQL Index: lib/uri/svn.rb --- lib/uri/svn.rb (revision 394) +++ lib/uri/svn.rb (working copy) @@ -41,7 +41,7 @@ raise SaveError unless (repos + 'format').exist? out = TempPath.new('save', "#{repos.basename}.svndump") cmd = SVNADMIN['dump', repos, '--incremental', '--quiet'] > out - cmd.run(self.runner) + [out, cmd.run(runner)] end end # class Svn -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/e15dddc0/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 9 06:34:33 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 9 Oct 2005 12:34:33 +0200 Subject: [Uttk-Patches] 740: Restore the main test suite. In-Reply-To: <20051008183254.476207CC14@smtp.feydakins.org> References: <20051008183254.476207CC14@smtp.feydakins.org> Message-ID: <840b875c0510090334s43ef8f5m1b1da3fd683a1f7@mail.gmail.com> On 10/8/05, Nicolas Pouillard wrote: > > We get only 99% since weight.yml reveal three small bugs > in the weight computation. > > svn://svn.feydakins.org/uttk/trunk > > You can also view this changeset here: > > http://http://dev.uttk.org/repository/changesets/740 > > Index: ChangeLog > from Nicolas Pouillard > > Restore the main test suite. > > * lib/uttk/status.rb: Merge Status and StatusWithMessage. Fix the bug > with Status#to_yaml. > > * test/minimal/glob.yml: Use S::Iterate since Glob is no more available. > * lib/uttk/strategies/Block.rb: Inherit from IOBased. > * bin/uttk-unit: Require the uttk of uttk-unit. > Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 9 06:53:34 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 9 Oct 2005 12:53:34 +0200 Subject: [Uttk-Patches] [core_ex] 394: Update unit tests. In-Reply-To: <20051009094622.5BC317B2D9@smtp.feydakins.org> References: <20051009094622.5BC317B2D9@smtp.feydakins.org> Message-ID: <840b875c0510090353g5f5e5311l8e1019436cf767bd@mail.gmail.com> On 10/9/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk/core_ex > > Index: ChangeLog > from Nicolas Pouillard > > Update unit tests. > > * test/unit-suite.yml: Use uttk-unit. > * lib/core_ex/pathname.rb: Renaming. > * lib/d_time.rb, lib/core_ex.rb, > * lib/path_list.rb: Update the Yaml extension. > > * test/resources: Rename to ... > * test/fixtures: ... this. > * test/test-unit-setup.rb: Remove useless since uttk-unit provides the > same service. > Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 06:57:16 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 12:57:16 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 396: Add tests for URI::Rsync. Message-ID: <20051009105716.2E73E380A3@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Add tests for URI::Rsync. * lib/uri/rsync.rb: Check the option generation. * lib/uri/ssh.rb, lib/uri/file.rb, lib/uri/druby.rb, * lib/uri/ftp_ex.rb, lib/uri/mysql.rb, lib/uri/pgsql.rb, * lib/uri/svn.rb, lib/uri/http_ex.rb: Imports instead of requires. druby.rb | 3 +-- file.rb | 3 ++- ftp_ex.rb | 2 +- http_ex.rb | 2 +- mysql.rb | 2 +- pgsql.rb | 2 +- rsync.rb | 28 +++++++++++++++++++++++++++- ssh.rb | 2 +- svn.rb | 2 +- 9 files changed, 36 insertions(+), 10 deletions(-) Index: lib/uri/ssh.rb --- lib/uri/ssh.rb (revision 395) +++ lib/uri/ssh.rb (working copy) @@ -3,7 +3,7 @@ # License:: Gnu General Public License. # Revision:: $Id$ -require 'uri_ex' +UriEx.import! module URI Index: lib/uri/rsync.rb --- lib/uri/rsync.rb (revision 395) +++ lib/uri/rsync.rb (working copy) @@ -3,7 +3,7 @@ # License:: Gnu General Public License. # Revision:: $Id$ -require 'uri_ex' +UriEx.import! module URI @@ -55,4 +55,30 @@ @@schemes[scheme.upcase] = Rsync end + test_section __FILE__ do + + class RsyncTest < Test::Unit::TestCase + + def test_mk_opts + assert_nothing_raised { @uri = URI.parse('rsync.ssh://foo at bar') } + assert_equal(['-Pa'], @uri.mk_opts) + end + + def test_mk_opts_with_query + assert_nothing_raised do + @uri = URI.parse('rsync.ssh://foo at bar/baz?rsh=ssh%20-i%20foo,boo,bee=42') + end + ref = ['-Pa', '--rsh', 'ssh -i foo', '--boo', '--bee', '42'] + assert_equal(ref, @uri.mk_opts) + end + + def test_mk_arg + assert_nothing_raised { @uri = URI.parse('rsync.ssh://foo at bar/path') } + assert_equal('foo at bar:path', @uri.mk_arg) + end + + end # class RsyncTest + + end + end # module URI Index: lib/uri/file.rb --- lib/uri/file.rb (revision 395) +++ lib/uri/file.rb (working copy) @@ -5,7 +5,8 @@ # $LastChangedBy$ # $Id$ -require 'uri_ex' + +UriEx.import! module URI Index: lib/uri/druby.rb --- lib/uri/druby.rb (revision 395) +++ lib/uri/druby.rb (working copy) @@ -5,8 +5,7 @@ # $LastChangedBy$ # $Id$ -require 'uri_ex' - +UriEx.import! module URI Index: lib/uri/ftp_ex.rb --- lib/uri/ftp_ex.rb (revision 395) +++ lib/uri/ftp_ex.rb (working copy) @@ -5,7 +5,7 @@ # $LastChangedBy$ # $Id$ -require 'uri_ex' +UriEx.import! require 'uri/ftp' require 'net/ftp' Index: lib/uri/mysql.rb --- lib/uri/mysql.rb (revision 395) +++ lib/uri/mysql.rb (working copy) @@ -3,7 +3,7 @@ # License:: Gnu General Public License. # Revision:: $Id$ -require 'uri_ex' +UriEx.import! module URI Index: lib/uri/pgsql.rb --- lib/uri/pgsql.rb (revision 395) +++ lib/uri/pgsql.rb (working copy) @@ -3,7 +3,7 @@ # License:: Gnu General Public License. # Revision:: $Id$ -require 'uri_ex' +UriEx.import! module URI Index: lib/uri/svn.rb --- lib/uri/svn.rb (revision 395) +++ lib/uri/svn.rb (working copy) @@ -5,7 +5,7 @@ # $LastChangedBy$ # $Id$ -require 'uri_ex' +UriEx.import! module URI Index: lib/uri/http_ex.rb --- lib/uri/http_ex.rb (revision 395) +++ lib/uri/http_ex.rb (working copy) @@ -5,7 +5,7 @@ # $LastChangedBy$ # $Id$ -require 'uri_ex' +UriEx.import! require 'uri/http' require 'net/http' -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/f87da606/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 9 06:59:03 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Sun, 9 Oct 2005 12:59:03 +0200 (MEST) Subject: [Uttk-Patches] 741: Fix the weight test suite. Message-ID: <20051009105903.6256A268F0@pm-mx5.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/741 Index: ChangeLog from Nicolas Desprès Fix the weight test suite. * test/minimal/weight.yml: Fix the expected output of some test. weight.yml | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: test/minimal/weight.yml --- test/minimal/weight.yml (revision 740) +++ test/minimal/weight.yml (working copy) @@ -13,7 +13,7 @@ - ///1/status/PASS$ - ///2/status/PASS$ - ///3/status/FAIL$ - - //status/FAIL$ + - //status/FAIL\(0%\)$ - All or nothing (100%): !S::RMatch test: !S::Suite @@ -64,7 +64,7 @@ - ///15/status/PASS$ - //status/PASS$ - - Fatal fail (50%): !S::RMatch + - Fatal fail: !S::RMatch test: !S::Suite contents: - Suppose to FAIL 16: !S::Fail @@ -72,7 +72,7 @@ - Suppose to be not tested 17: !S::Pass {} match: - ///16/status/FAIL$ - - //status/FAIL\(50%\)$ + - //status/FAIL$ dont_match: - ///17 @@ -113,7 +113,7 @@ - Suppose to be not tested 25: {} match: - ///23/status/FAIL$ - - //status/PASS$ + - //status/FAIL$ dont_match: - ///24 - ///25 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/f843e342/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 07:12:42 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 13:12:42 +0200 (CEST) Subject: [Uttk-Patches] 742: Fix some bugs. Message-ID: <20051009111242.0B6B851251@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/742 Index: ChangeLog from Nicolas Pouillard Fix some bugs. * test/minimal/weight.yml: More precise. * test/minimal/r_unit.yml: Update options. * test/test-unit-setup.rb: Remove. * lib/uttk/status.rb: Simplify. * lib/uttk/weights/Weight.rb: Fix Weight#==. * lib/uttk/strategies/Composite.rb: Fix the weight computation when fatal. * lib/uttk/strategies/RUnit.rb: Update the verbose option. * lib/uttk.rb: Move the $LOADED_FEATURES use after the CoreEx loading for ruby-1.8.1 compatibility. lib/uttk.rb | 3 +-- lib/uttk/status.rb | 4 ++-- lib/uttk/strategies/Composite.rb | 7 ++++++- lib/uttk/strategies/RUnit.rb | 6 +++++- lib/uttk/weights/Weight.rb | 2 +- test/minimal/r_unit.yml | 2 +- test/minimal/weight.yml | 11 ++++++++--- 7 files changed, 24 insertions(+), 11 deletions(-) Index: test/minimal/weight.yml --- test/minimal/weight.yml (revision 741) +++ test/minimal/weight.yml (working copy) @@ -64,15 +64,20 @@ - ///15/status/PASS$ - //status/PASS$ - - Fatal fail: !S::RMatch + - Fatal fail (20%): !S::RMatch test: !S::Suite contents: + - Suppose to PASS 15.5: !S::Pass + fatal: true - Suppose to FAIL 16: !S::Fail fatal: true - Suppose to be not tested 17: !S::Pass {} + - Suppose to be not tested 17.5: !S::Fail + weight: 2 match: + - ///15.5/status/PASS$ - ///16/status/FAIL$ - - //status/FAIL$ + - //status/FAIL\(20%\)$ dont_match: - ///17 @@ -102,7 +107,7 @@ - ///22/status/PASS$ - //status/PASS$ - - Fatal fail but no weight (100%): !S::RMatch + - Fatal fail but no weight (0%): !S::RMatch test: !S::Suite attributes: !S::Pass {} contents: Index: test/minimal/r_unit.yml --- test/minimal/r_unit.yml (revision 741) +++ test/minimal/r_unit.yml (working copy) @@ -4,7 +4,7 @@ unit_dir: <>/../fixtures/unit test: !S::Suite attributes: !S::RUnit - uttk_unit_options: [--no-ruby_ex, --no-uttk] + uttk_unit_options: --uttk no contents: - good: input: !path <>/good.rb Index: lib/uttk/status.rb --- lib/uttk/status.rb (revision 741) +++ lib/uttk/status.rb (working copy) @@ -32,7 +32,7 @@ def initialize ( anObject=nil ) super() @reason = anObject || default_reason - @weight = self.class.default_weight_value + @weight = default_weight_value end def to_uttk_log ( log ) @@ -46,7 +46,7 @@ def to_s res = self.class.status_name.to_s - if @weight != self.class.default_weight_value + if @weight != default_weight_value res += "(#{@weight.get})" end res Index: lib/uttk/weights/Weight.rb --- lib/uttk/weights/Weight.rb (revision 741) +++ lib/uttk/weights/Weight.rb (working copy) @@ -88,7 +88,7 @@ end def == ( rhs ) - rhs.class <= self.class and + rhs.class <= Weight and @min == rhs.min and @val == rhs.val and @max == rhs.max Index: lib/uttk/strategies/Composite.rb --- lib/uttk/strategies/Composite.rb (revision 741) +++ lib/uttk/strategies/Composite.rb (working copy) @@ -151,8 +151,13 @@ def run_composite @log.new_node :contents, :ordered => true do @contents.each do |t| + if defined? @fatal_failure + st = FailStatus.new + st.weight *= t.weight + @status_list << st + else run_test(t, @log) - break if defined? @fatal_failure + end end end end Index: lib/uttk/strategies/RUnit.rb --- lib/uttk/strategies/RUnit.rb (revision 741) +++ lib/uttk/strategies/RUnit.rb (working copy) @@ -82,7 +82,11 @@ protected def prologue @command = '<> -- <> ' - @command += '-w ' if @verbose + if @verbose + @command += '--verbose ' + else + @command += '--no-verbose ' + end @load_path.each { |x| @command += "-I #{x} " } @requires = [@requires] unless @requires.respond_to? :each @requires.each { |x| @command += "-r #{x} " } Index: lib/uttk.rb --- lib/uttk.rb (revision 741) +++ lib/uttk.rb (working copy) @@ -23,8 +23,6 @@ require 'pathname' - $LOADED_FEATURES << 'uttk.rb' - lib = Pathname.new(__FILE__).dirname vendor = lib.parent + 'vendor' unless defined? RubyEx @@ -39,6 +37,7 @@ require 'ruby_ex' end end + $LOADED_FEATURES << 'uttk.rb' lib.load_path! RubyEx.import! mattr_accessor :dir -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/654bf155/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 07:15:09 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 13:15:09 +0200 (CEST) Subject: [Uttk-Patches] 743: Improve uttk-unit. Message-ID: <20051009111509.B82385125F@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/743 Index: ChangeLog from Nicolas Pouillard Improve uttk-unit. * bin/uttk-unit: Order between imports, requires and load_paths are now respected, the 'mode' option allow to import loading mode. uttk-unit | 70 +++++++++++++++++++++++++++++++------------------------------- 1 files changed, 36 insertions(+), 34 deletions(-) Index: bin/uttk-unit --- bin/uttk-unit (revision 742) +++ bin/uttk-unit (working copy) @@ -18,30 +18,31 @@ def parse_options @options = OpenStruct.new(:load_path => [], - :requires => [], - :core_ex => true, - :ruby_ex => true, - :uttk => true, - :verbose => true) + :actions => [], + :uttk => nil, + :verbose => true, + :mode => :require) OptionParser.new do |o| o.on('-I', '--include DIR', 'Add this directory to $LOAD_PATH') do |dir| @options.load_path << dir + @options.actions << proc { dir.to_path.load_path! } end o.on('-r', '--require FEATURE', 'Require this file') do |file| - @options.requires << file + @options.actions << proc { require file } end - o.on('-w', '--[no-]verbose', 'Turn on/off the verbose mode [default: on]') do |b| - @options.verbose = b + o.on('--import NAME', 'Import this constant') do |const| + @options.actions << proc { const.constantize.import! } end - o.on('--[no-]core_ex', 'Turn on/off the CoreEx require [default: on]') do |b| - @options.core_ex = b + o.on('--mode import|require', [:import, :require], + 'Set the loading mode for unit tests [default: require]') do |mode| + @options.mode = mode end - o.on('--[no-]ruby_ex', 'Turn on/off the RubyEx require [default: on]') do |b| - @options.ruby_ex = b + o.on('-w', '--[no-]verbose', 'Turn on/off the verbose mode [default: on]') do |b| + @options.verbose = b end - o.on('--[no-]uttk', 'Turn on/off the Uttk require [default: on]') do |b| - @options.uttk = b + o.on('--uttk FILE', 'Require this Uttk (`no\' to disable)') do |file| + @options.uttk = file end end.parse!(@argv) end @@ -57,45 +58,46 @@ def run raise 'Do not load CoreEx before uttk-unit' if defined? CoreEx - raise 'Do not load RubyEx before uttk-unit' if defined? RubyEx requires parse_options - path = Pathname.new(@argv.first).cleanpath + quoted_paths = @argv.map { |s| Regexp.quote(s) } + re_paths = Regexp.new("(#{quoted_paths.join '|'})") - Kernel.const_set(:EMBEDDED_TEST_MODE, Regexp.new(path.to_s)) + Kernel.const_set(:EMBEDDED_TEST_MODE, re_paths) @options.load_path.each { |dir| $LOAD_PATH << dir } root = Pathname.new(__FILE__).dirname.parent - if @options.uttk - require (root + 'lib' + 'uttk').to_s - elsif @options.ruby_ex - require 'ruby_ex' - elsif @options.core_ex - require 'core_ex' + if @options.uttk.nil? + require((root + 'lib' + 'uttk').to_s) + elsif @options.uttk != 'no' + require @options.uttk end - raise 'CoreEx not loaded' unless defined? CoreEx - Test::Unit::UI::Yaml::TestRunner.import! + @options.actions.each { |block| block[] } - @options.load_path.each { |dir| dir.to_path.load_path! } + raise 'CoreEx not loaded' unless defined? CoreEx - @options.requires.each { |r| require r } + Test::Unit::UI::Yaml::TestRunner.import! $VERBOSE = @options.verbose -# FIXME try to fix this feature -# begin -# file = path.ext('').to_s # .sub(/^#{lib}\/*/, '') -# raise NameError if file =~ /\./ -# file.camelize.constantize unless file.empty? -# rescue NameError + @argv.each do |arg| + path = Pathname.new(arg).cleanpath.ext.to_s + + case @options.mode + when :import + path = path.camelize if path !~ /[A-Z]/ or path =~ /[.\/]/ + path.constantize.import! + when :require require path -# end + else raise "Bad loading mode: #{@options.mode}" + end + end run_embedded_test_sections end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/107734c7/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 9 07:22:44 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 9 Oct 2005 13:22:44 +0200 Subject: [Uttk-Patches] 742: Fix some bugs. In-Reply-To: <20051009111242.0B6B851251@smtp.feydakins.org> References: <20051009111242.0B6B851251@smtp.feydakins.org> Message-ID: <840b875c0510090422p4e0b7f6eqa9deb0eee5e70283@mail.gmail.com> On 10/9/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/uttk/trunk > > You can also view this changeset here: > > http://http://dev.uttk.org/repository/changesets/742 > > Index: ChangeLog > from Nicolas Pouillard > > Fix some bugs. > > * test/minimal/weight.yml: More precise. As you should have noticed, I was working on this issue. It could have been nice to tell me that you'll fix the bug in your previous review in order to avoid conflict and waste of my time. Moreover, you fixed the bug but you didn't fix the test suite ! I fix it. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 9 07:23:57 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Sun, 9 Oct 2005 13:23:57 +0200 (MEST) Subject: [Uttk-Patches] 744: Fix the weight test suite. Message-ID: <20051009112357.D7D7326F72@pm-mx5.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/744 Index: ChangeLog from Nicolas Desprès Fix the weight test suite. * test/minimal/weight.yml: Do not print `0%' for FAIL status. weight.yml | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: test/minimal/weight.yml --- test/minimal/weight.yml (revision 743) +++ test/minimal/weight.yml (working copy) @@ -13,7 +13,7 @@ - ///1/status/PASS$ - ///2/status/PASS$ - ///3/status/FAIL$ - - //status/FAIL\(0%\)$ + - //status/FAIL$ - All or nothing (100%): !S::RMatch test: !S::Suite -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/b5716e8f/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 9 07:29:04 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 9 Oct 2005 13:29:04 +0200 Subject: [Uttk-Patches] 744: Fix the weight test suite. In-Reply-To: References: <20051009112357.D7D7326F72@pm-mx5.mx.noos.fr> Message-ID: <840b875c0510090429r27287110g18fe17da7e3b46f@mail.gmail.com> On 10/9/05, Nicolas Pouillard wrote: > On 10/9/05, Nicolas Despr?s wrote: > > > > svn://svn.feydakins.org/ttk/trunk > > > > You can also view this changeset here: > > > > http://http://dev.uttk.org/repository/changesets/744 > > > > Index: ChangeLog > > from Nicolas Despr?s > > > > Fix the weight test suite. > > > > * test/minimal/weight.yml: Do not print `0%' for FAIL status. > > > > weight.yml | 2 +- > > 1 files changed, 1 insertion(+), 1 deletion(-) > > > > No !!!!!!!!!!!!! > > This is wrong ! > Two patch before you told me the opposite !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 9 07:35:01 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 9 Oct 2005 13:35:01 +0200 Subject: [Uttk-Patches] 742: Fix some bugs. In-Reply-To: References: <20051009111242.0B6B851251@smtp.feydakins.org> <840b875c0510090422p4e0b7f6eqa9deb0eee5e70283@mail.gmail.com> Message-ID: <840b875c0510090435i44d20cf8q191eb2f6d7968821@mail.gmail.com> On 10/9/05, Nicolas Pouillard wrote: > On 10/9/05, Nicolas Despr?s wrote: > > On 10/9/05, Nicolas Pouillard wrote: > > > > > > svn://svn.feydakins.org/uttk/trunk > > > > > > You can also view this changeset here: > > > > > > http://http://dev.uttk.org/repository/changesets/742 > > > > > > Index: ChangeLog > > > from Nicolas Pouillard > > > > > > Fix some bugs. > > > > > > * test/minimal/weight.yml: More precise. > > > > As you should have noticed, I was working on this issue. It could have > > been nice to tell me that you'll fix the bug in your previous review > > in order to avoid conflict and waste of my time. > > > I would say to you the same because I work on it since yesterday and I > obtained 100% to > uttk-check.yml > This is the problem when someone keep non commited work on its working copy and do not communicate with the other. How could I have known? I'm sorry but the test suite were broken for a while, so it pisses me off and I decided to fix it. I saw that you were also working on UnifiedMatcher, Command and full of other thing. I could not know that you were fixing this old problem. I see only one solution: when you start a task close it before starting to work on another one and do not keep non commited work on your working copy. Finaly, don't blame me because I fix your bugs !!! > > Moreover, you fixed the bug but you didn't fix the test suite ! I fix it. > > > > No please wait > Too late it's already done. Don't forget: you are not the only one who work on this repository. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 08:21:22 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 14:21:22 +0200 (CEST) Subject: [Uttk-Patches] 745: Fix the option handling in uttk-unit. Message-ID: <20051009122122.D092F51251@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/745 Index: ChangeLog from Nicolas Pouillard Fix the option handling in uttk-unit. * test/minimal/r_unit.yml: No more uttk_unit_options. Make output checking more precise. * lib/uttk/strategies/RUnit.rb: Add another `--' separator. * bin/uttk-unit: Split option with `--'. bin/uttk-unit | 22 +++++++++++++++++++--- lib/uttk/strategies/RUnit.rb | 2 +- test/minimal/r_unit.yml | 6 +++--- 3 files changed, 23 insertions(+), 7 deletions(-) Index: test/minimal/r_unit.yml --- test/minimal/r_unit.yml (revision 744) +++ test/minimal/r_unit.yml (working copy) @@ -3,8 +3,7 @@ symbols: unit_dir: <>/../fixtures/unit test: !S::Suite - attributes: !S::RUnit - uttk_unit_options: --uttk no + attributes: !S::RUnit {} contents: - good: input: !path <>/good.rb @@ -21,5 +20,6 @@ dir: <>/.. match: - ///good/status/PASS - - ///bad/status/FAIL + - ///^bad$/status/FAIL + - ///^bad directory$/status/FAIL - ///error/status/ERROR Index: lib/uttk/strategies/RUnit.rb --- lib/uttk/strategies/RUnit.rb (revision 744) +++ lib/uttk/strategies/RUnit.rb (working copy) @@ -95,7 +95,7 @@ opts = [opts] unless opts.respond_to? :each opts.each { |x| @command += "#{x} " } end - @command += '-- %i --runner yaml -- %a' + @command += '-- %i -- --runner yaml -- %a' @quiet_print = true super end Index: bin/uttk-unit --- bin/uttk-unit (revision 744) +++ bin/uttk-unit (working copy) @@ -63,7 +63,23 @@ parse_options - quoted_paths = @argv.map { |s| Regexp.quote(s) } + files = [] + options = false + argv = ARGV.dup + ARGV.replace([]) + argv.each do |arg| + if options + ARGV << arg + next + end + if arg == '--' + options = true + else + files << Pathname.new(arg).cleanpath + end + end + + quoted_paths = files.map { |s| Regexp.quote(s) } re_paths = Regexp.new("(#{quoted_paths.join '|'})") Kernel.const_set(:EMBEDDED_TEST_MODE, re_paths) @@ -86,8 +102,8 @@ $VERBOSE = @options.verbose - @argv.each do |arg| - path = Pathname.new(arg).cleanpath.ext.to_s + files.each do |arg| + path = Pathname.new(arg).ext.to_s case @options.mode when :import -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/576d2810/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 9 09:51:15 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Sun, 9 Oct 2005 15:51:15 +0200 (MEST) Subject: [Uttk-Patches] 746: Fix the ruby suite. Message-ID: <20051009135115.62A0727118@pm-mx6.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/746 Index: ChangeLog from Nicolas Desprès Fix the ruby suite. * test/ruby/wc.rb: Adapt to the new size of the text file. * test/minimal/import.yml: Add test that emphasis a bug with the pwd management. * test/ruby-suite.rb: Build the suite "manually" since Iterate do not support the Ruby loader. * lib/uttk/strategies/Iterate.rb: Leave a FIXME. * lib/uttk/strategies/Import.rb: Save and restore the :pwd. lib/uttk/strategies/Import.rb | 8 ++++++++ lib/uttk/strategies/Iterate.rb | 2 ++ test/minimal/import.yml | 13 +++++++++++++ test/ruby-suite.rb | 15 +++++++++++---- test/ruby/wc.rb | 2 +- 5 files changed, 35 insertions(+), 5 deletions(-) Index: test/ruby/wc.rb --- test/ruby/wc.rb (revision 745) +++ test/ruby/wc.rb (working copy) @@ -31,7 +31,7 @@ name 'from file test' do input Pathname.new('<>/../fixtures/text/1.txt') - output(/\s*244\n$/) + output(/\s*272\n$/) end end Index: test/minimal/import.yml --- test/minimal/import.yml (revision 745) +++ test/minimal/import.yml (working copy) @@ -23,3 +23,16 @@ - Clean: !S::Block fatal: true test: '@symtbl[:tmp].unlink' + + - Bad pwd handling: !S::Suite + + contents: + + - Basic 1: !S::Import + loader: Ruby + import: '<>/../ruby/wc.rb' + + - Basic 2: !S::Import + import: '<>/wc.yml' + + Index: test/ruby-suite.rb --- test/ruby-suite.rb (revision 745) +++ test/ruby-suite.rb (working copy) @@ -1,10 +1,17 @@ include Strategies -Glob.new('Uttk Ruby loader minimal test suite') do - glob '<>/uttk-ruby/*.rb' - regexp(/\/([^\/]+.rb)/) - test Import.new('Test <>') { import '<>' } +# We create the suite using PathList because Iterate do not support the Ruby +# loader. +Suite.new('Uttk Ruby loader minimal test suite') do |t| + + # We use a local variable because 't.contents <<' do not call 't.contents='. + tests = [] + PathList.new(symtbl[:pwd] + 'ruby/*.rb').each do |path| + tests << Import.new("Test #{path.basename}") { import path } + end + t.contents = tests + end Index: lib/uttk/strategies/Iterate.rb --- lib/uttk/strategies/Iterate.rb (revision 745) +++ lib/uttk/strategies/Iterate.rb (working copy) @@ -50,6 +50,8 @@ def prologue super + #FIXME: Do not work with the Ruby loader. Others Collection do not + # require this critera. unless @test.is_a? Hash and @test.size == 1 raise ArgumentError, 'Test must be a hash with one key for name of the test' Index: lib/uttk/strategies/Import.rb --- lib/uttk/strategies/Import.rb (revision 745) +++ lib/uttk/strategies/Import.rb (working copy) @@ -20,11 +20,19 @@ save_loader = @symtbl[:loader] @symtbl[:loader] = @loader end + @old_pwd = @symtbl[:pwd] create(@import) do |t| t.symtbl[:loader] = @symtbl[:loader] end @symtbl[:loader] = save_loader unless @loader.nil? end + protected :prologue + + def epilogue + @symtbl[:pwd] = @old_pwd + super + end + protected :epilogue def import= ( aPath ) @import = aPath -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/51b47eac/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 9 10:35:41 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Sun, 9 Oct 2005 16:35:41 +0200 (MEST) Subject: [Uttk-Patches] 747: Add the ruby suite to the check suite. Message-ID: <20051009143541.C8F5E26D9D@pm-mx6.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/747 Index: ChangeLog from Nicolas Desprès Add the ruby suite to the check suite. * test/uttk-check.yml: Add the ruby suite. * test/ruby-suite.yml: New. A Yaml proxy to the ruby suite. * lib/uttk/strategies/Import.rb: Accept instance of loader or a string for the loader attribute. Restore the original loader at epilogue time since Import is a proxy it shares the same symtbl as its sub test. lib/uttk/strategies/Import.rb | 8 ++++++-- test/ruby-suite.yml | 5 +++++ test/uttk-check.yml | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) Index: test/uttk-check.yml --- test/uttk-check.yml (revision 746) +++ test/uttk-check.yml (working copy) @@ -1,7 +1,7 @@ --- Run all test suites: !S::Iterate - over: !pathlist <>/({pkg,minimal,unit})-suite.yml # FIXME dist,pool + over: !pathlist <>/({unit,minimal,ruby,pkg})-suite.yml # FIXME dist,pool iter: [it_file, it_name] test: Run the <> suite: !S::Import Index: test/ruby-suite.yml --- test/ruby-suite.yml (revision 0) +++ test/ruby-suite.yml (revision 0) @@ -0,0 +1,5 @@ +--- + +Yaml proxy for the ruby-suite: !S::Import + loader: Ruby + import: '<>/ruby-suite.rb' Index: lib/uttk/strategies/Import.rb --- lib/uttk/strategies/Import.rb (revision 746) +++ lib/uttk/strategies/Import.rb (working copy) @@ -17,18 +17,18 @@ raise ArgumentError, "the import file must exits (#@import)" end unless @loader.nil? - save_loader = @symtbl[:loader] + @save_loader = @symtbl[:loader] @symtbl[:loader] = @loader end @old_pwd = @symtbl[:pwd] create(@import) do |t| t.symtbl[:loader] = @symtbl[:loader] end - @symtbl[:loader] = save_loader unless @loader.nil? end protected :prologue def epilogue + @symtbl[:loader] = @save_loader unless @loader.nil? @symtbl[:pwd] = @old_pwd super end @@ -40,8 +40,12 @@ end def loader= ( aLoader ) + if aLoader.is_a? Loaders::Loader + @loader = aLoader + else @loader = Loaders.const_get(aLoader).new end + end attribute :import, 'the file to import', :mandatory attribute :loader, 'loader to use for the imported file' -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/6c46c707/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 12:47:25 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 18:47:25 +0200 (CEST) Subject: [Uttk-Patches] 748: Fix the bug with Collection contents. Message-ID: <20051009164725.C09AB51692@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/748 Index: ChangeLog from Nicolas Pouillard Fix the bug with Collection contents. * test/ruby-suite.rb: Removes the local variable. * lib/uttk/strategies/Composite.rb: Splits Composite#contents adding Composite#internal_contents. * lib/uttk/strategies/Collection.rb: Provides a default value for @internal_contents, and make a protected attribute reader. * test/minimal/import.yml: Make a test more robust. * bin/uttk-unit: Do not require rubygems. * test/ruby/wc.rb: Typo. * test/ruby/uttk-ruby: Remove. Because useless and empty. bin/uttk-unit | 1 - lib/uttk/strategies/Collection.rb | 3 +++ lib/uttk/strategies/Composite.rb | 8 +++++++- test/minimal/import.yml | 7 +++++-- test/ruby-suite.rb | 5 +---- test/ruby/wc.rb | 2 +- 6 files changed, 17 insertions(+), 9 deletions(-) Index: test/ruby/wc.rb --- test/ruby/wc.rb (revision 747) +++ test/ruby/wc.rb (working copy) @@ -1,5 +1,5 @@ -S::Suite.new 'Test the wc command (wc.rc)' do +S::Suite.new 'Test the wc command (wc.rb)' do attributes do strategy S::Cmd Index: test/minimal/import.yml --- test/minimal/import.yml (revision 747) +++ test/minimal/import.yml (working copy) @@ -16,9 +16,12 @@ tmp << '--- A bad test: !S::Fail {}' end - - Test the generated test: !S::Import - weight: -1 + - Test the generated test: !S::RMatch + test: !S::Import import: '<>' + match: + - //A bad test/status/FAIL + - //status/FAIL - Clean: !S::Block fatal: true Index: test/ruby-suite.rb --- test/ruby-suite.rb (revision 747) +++ test/ruby-suite.rb (working copy) @@ -5,12 +5,9 @@ # loader. Suite.new('Uttk Ruby loader minimal test suite') do |t| - # We use a local variable because 't.contents <<' do not call 't.contents='. - tests = [] PathList.new(symtbl[:pwd] + 'ruby/*.rb').each do |path| - tests << Import.new("Test #{path.basename}") { import path } + t.contents << Import.new("Test #{path.basename}") { import path } end - t.contents = tests end Index: lib/uttk/strategies/Composite.rb --- lib/uttk/strategies/Composite.rb (revision 747) +++ lib/uttk/strategies/Composite.rb (working copy) @@ -57,7 +57,7 @@ def contents(other=nil, &block) if other.nil? if block.nil? - @contents + internal_contents else self.contents = ContentsEval.new(&block).contents end @@ -67,6 +67,12 @@ end + def internal_contents + @contents + end + protected :internal_contents + + def prologue begin super Index: lib/uttk/strategies/Collection.rb --- lib/uttk/strategies/Collection.rb (revision 747) +++ lib/uttk/strategies/Collection.rb (working copy) @@ -11,9 +11,12 @@ class Collection < Composite include Abstract + attr_reader :internal_contents + protected :internal_contents def initialize ( *a, &b ) @attributes = OHash.new + @internal_contents = [] super end Index: bin/uttk-unit --- bin/uttk-unit (revision 747) +++ bin/uttk-unit (working copy) @@ -52,7 +52,6 @@ require 'pathname' require 'ostruct' require 'optparse' - require 'rubygems' end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/47b6cbbc/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 9 12:59:01 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 9 Oct 2005 18:59:01 +0200 Subject: [Uttk-Patches] 748: Fix the bug with Collection contents. In-Reply-To: <20051009164725.C09AB51692@smtp.feydakins.org> References: <20051009164725.C09AB51692@smtp.feydakins.org> Message-ID: <840b875c0510090959l797c3f60j2db0ffb5d3988c30@mail.gmail.com> On 10/9/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/uttk/trunk > > You can also view this changeset here: > > http://http://dev.uttk.org/repository/changesets/748 > > Index: ChangeLog > from Nicolas Pouillard > > Fix the bug with Collection contents. > > * test/ruby-suite.rb: Removes the local variable. > * lib/uttk/strategies/Composite.rb: Splits Composite#contents adding > Composite#internal_contents. > * lib/uttk/strategies/Collection.rb: Provides a default value for > @internal_contents, and make a protected attribute reader. > * test/minimal/import.yml: Make a test more robust. > * bin/uttk-unit: Do not require rubygems. > * test/ruby/wc.rb: Typo. > * test/ruby/uttk-ruby: Remove. Because useless and empty. > Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 13:08:33 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 19:08:33 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 397: Add a runner which do not run the command. Message-ID: <20051009170833.9585A51265@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Add a runner which do not run the command. * lib/commands/runners/no_run.rb: New. This trivial runner can be useful to catch the command that will be ran, and run it with after with some modifications. * lib/commands/datas/data.rb: Fix to_yaml. datas/data.rb | 10 +++------- runners/no_run.rb | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 7 deletions(-) Index: lib/commands/datas/data.rb --- lib/commands/datas/data.rb (revision 396) +++ lib/commands/datas/data.rb (working copy) @@ -115,19 +115,15 @@ msg = [] msg << "exit: #{status.exitstatus}" unless status.nil? - if out.empty? - msg << 'output: ""' - else + unless out.empty? out.gsub!(/^/, ' ') msg << "output: |\n #{out}" end - if err.empty? - msg << 'error: ""' - else + unless err.empty? err.gsub!(/^/, ' ') msg << "error: |\n #{err}" end - msg.join("\n") + "\n" + msg.join("\n") end def kill ( sig='KILL' ) Index: lib/commands/runners/no_run.rb --- lib/commands/runners/no_run.rb (revision 0) +++ lib/commands/runners/no_run.rb (revision 0) @@ -0,0 +1,46 @@ +# Author:: Nicolas Pouillard . +# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved. +# License:: GNU General Public License (GPL). +# Revision:: $Id$ + +require 'commands' + +module Commands + + module Runners + + # This very particular runner returns it's command instead of running it. + class NoRun < Runner + include Concrete + + def run ( aCommand ) + aCommand + end + + end # class NoRun + + + + test_section __FILE__ do + + class NoRunTest < Test::Unit::TestCase + + def setup + assert_nothing_raised { @runner = NoRun.new } + end + + def test_0_initialize + end + + def test_simple + cmd = 'sleep'.to_cmd[10] + assert_kind_of Command, cmd.run(@runner) + end + + end # class NoRunTest + + end + + end # module Runners + +end # module Commands Property changes on: lib/commands/runners/no_run.rb ___________________________________________________________________ Name: svn:keywords + Id -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/2f86961c/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 13:23:55 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 19:23:55 +0200 (CEST) Subject: [Uttk-Patches] 749: Rename minimal to functional. Message-ID: <20051009172355.748CC380A2@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/749 Index: ChangeLog from Nicolas Pouillard Rename minimal to functional. * test/minimal: Rename to ... * test/functional: ... this. * test/minimal-suite.yml: Rename to ... * test/functional-suite.yml: ... this. * lib/uttk/generators/generator.rb, lib/uttk/generators/strategy_generator.rb, * lib/uttk/strategies/RUnit.rb, test/uttk-check.yml, test/ruby-suite.rb: Apply renaming. lib/uttk/generators/generator.rb | 4 ++-- lib/uttk/generators/strategy_generator.rb | 2 +- lib/uttk/strategies/RUnit.rb | 4 ++-- test/functional-suite.yml | 4 ++-- test/ruby-suite.rb | 2 +- test/uttk-check.yml | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) Index: test/functional-suite.yml --- test/functional-suite.yml (revision 748) +++ test/functional-suite.yml (working copy) @@ -2,8 +2,8 @@ # an inconsistent result and so dumpers may raise an exception! --- -Uttk minimal test suite: !S::Iterate - over: !pathlist <>/minimal/(*).yml +Uttk functional test suite: !S::Iterate + over: !pathlist <>/functional/(*).yml iter: [it_file, it_name] test: Test <>: !S::Import Index: test/uttk-check.yml --- test/uttk-check.yml (revision 748) +++ test/uttk-check.yml (working copy) @@ -1,7 +1,7 @@ --- Run all test suites: !S::Iterate - over: !pathlist <>/({unit,minimal,ruby,pkg})-suite.yml # FIXME dist,pool + over: !pathlist <>/({unit,functional,ruby,pkg})-suite.yml # FIXME dist,pool iter: [it_file, it_name] test: Run the <> suite: !S::Import Index: test/ruby-suite.rb --- test/ruby-suite.rb (revision 748) +++ test/ruby-suite.rb (working copy) @@ -3,7 +3,7 @@ # We create the suite using PathList because Iterate do not support the Ruby # loader. -Suite.new('Uttk Ruby loader minimal test suite') do |t| +Suite.new('Uttk Ruby loader functional test suite') do |t| PathList.new(symtbl[:pwd] + 'ruby/*.rb').each do |path| t.contents << Import.new("Test #{path.basename}") { import path } Index: lib/uttk/generators/generator.rb --- lib/uttk/generators/generator.rb (revision 748) +++ lib/uttk/generators/generator.rb (working copy) @@ -39,8 +39,8 @@ define_method(name) { name } end - def minimal - 'minimal' + def functional + 'functional' end attr_reader :root, :fullname, :email, :year Index: lib/uttk/generators/strategy_generator.rb --- lib/uttk/generators/strategy_generator.rb (revision 748) +++ lib/uttk/generators/strategy_generator.rb (working copy) @@ -17,7 +17,7 @@ # Source and test templates. m.template 'strategy.rb', root/lib/uttk/strategies/"#{class_name}.rb" - m.template 'strategy.yml', root/test/minimal/"#{file_name}.yml" + m.template 'strategy.yml', root/test/functional/"#{file_name}.yml" end end Index: lib/uttk/strategies/RUnit.rb --- lib/uttk/strategies/RUnit.rb (revision 748) +++ lib/uttk/strategies/RUnit.rb (working copy) @@ -68,8 +68,8 @@ # load_path: ../lib # verbose: true # - # This file is extracted from the Uttk's minimal test suite - # (test/minimal/unit_test.yml). The strategy upon it is based (Glob) + # This file is extracted from the Uttk's functional test suite + # (test/functional/unit_test.yml). The strategy upon it is based (Glob) # looks for every file ending by `_test.rb' in a particular directory # relative to the place the Uttk YAML input file is located (<>). All # these files are loaded as RUnit strategy with a verbose mode on, the Uttk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/f4634767/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 13:28:23 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 19:28:23 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 398: Update uttk-unit options. Message-ID: <20051009172823.50B7B516A8@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard Update uttk-unit options. * test/unit-suite.yml: Use --mode. unit-suite.yml | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: test/unit-suite.yml --- test/unit-suite.yml (revision 397) +++ test/unit-suite.yml (working copy) @@ -9,6 +9,6 @@ Unit test <>: !S::RUnit input: !path <> requires: <>/../lib/core_ex - uttk_unit_options: --uttk no --import + uttk_unit_options: --uttk no --mode import dir: <> verbose: true -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/3d41c5ad/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 9 13:39:35 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 9 Oct 2005 19:39:35 +0200 Subject: [Uttk-Patches] 749: Rename minimal to functional. In-Reply-To: <20051009172355.748CC380A2@smtp.feydakins.org> References: <20051009172355.748CC380A2@smtp.feydakins.org> Message-ID: <840b875c0510091039w5bd86e70lce2eda4e780b40a8@mail.gmail.com> On 10/9/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/uttk/trunk > > You can also view this changeset here: > > http://http://dev.uttk.org/repository/changesets/749 > > Index: ChangeLog > from Nicolas Pouillard > > Rename minimal to functional. > > * test/minimal: Rename to ... > * test/functional: ... this. > * test/minimal-suite.yml: Rename to ... > * test/functional-suite.yml: ... this. > * lib/uttk/generators/generator.rb, lib/uttk/generators/strategy_generator.rb, > * lib/uttk/strategies/RUnit.rb, test/uttk-check.yml, test/ruby-suite.rb: > Apply renaming. > Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sun Oct 9 13:39:59 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sun, 9 Oct 2005 19:39:59 +0200 Subject: [Uttk-Patches] [core_ex] 398: Update uttk-unit options. In-Reply-To: <20051009172823.50B7B516A8@smtp.feydakins.org> References: <20051009172823.50B7B516A8@smtp.feydakins.org> Message-ID: <840b875c0510091039g6c3b4a06l433607221527efd1@mail.gmail.com> On 10/9/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk/core_ex > > Index: ChangeLog > from Nicolas Pouillard > > Update uttk-unit options. > > * test/unit-suite.yml: Use --mode. > Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 15:51:36 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 21:51:36 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 399: Fix 2 unit tests. Message-ID: <20051009195136.AFFB23F4A2@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard Fix 2 unit tests. * lib/temp_path.rb: Adapt tests because object_id can be negative. * lib/path_list.rb: Adapt to yaml of ruby 1.8.3. path_list.rb | 3 ++- temp_path.rb | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) Index: lib/temp_path.rb --- lib/temp_path.rb (revision 398) +++ lib/temp_path.rb (working copy) @@ -184,8 +184,8 @@ end def test_interface - assert_match(/\.#{$$}\/foo\.\d+$/, @foo.to_s) - assert_match(/\.#{$$}\/foo\.\d+\.bar$/, @foobar.to_s) + assert_match(/\.#{$$}\/foo\.-?\d+$/, @foo.to_s) + assert_match(/\.#{$$}\/foo\.-?\d+\.bar$/, @foobar.to_s) assert_nothing_raised { @foo.open('w') { |f| f.puts 'FooFoo' } } end Index: lib/path_list.rb --- lib/path_list.rb (revision 398) +++ lib/path_list.rb (working copy) @@ -519,7 +519,8 @@ def test_pathlist ls = __FILE__.to_path.dirname + '*.rb' assert_yaml_load "!filelist #{ls}", PathList, PathList[ls] - assert_yaml_dump @val, @val.to_a.to_yaml.sub(/^---\s*/, '') + assert_yaml_dump @val.to_a, /.*/ + assert_yaml_dump @val, @str end end # class PathListTest -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/f814aef5/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sun Oct 9 17:04:40 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 9 Oct 2005 23:04:40 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 400: Fix Range#to_yaml_string. Message-ID: <20051009210440.AC6BC5122C@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard Fix Range#to_yaml_string. * lib/core_ex/yaml.rb: Use inspect instead of to_s. yaml.rb | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: lib/core_ex/yaml.rb --- lib/core_ex/yaml.rb (revision 399) +++ lib/core_ex/yaml.rb (working copy) @@ -45,7 +45,7 @@ have YamlExtension def to_yaml_string - to_s + inspect end def self.yaml_load ( val ) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051009/0ec38786/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Mon Oct 10 01:56:59 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Mon, 10 Oct 2005 07:56:59 +0200 Subject: [Uttk-Patches] 746: Fix the ruby suite. In-Reply-To: References: <20051009135115.62A0727118@pm-mx6.mx.noos.fr> Message-ID: <840b875c0510092256q7a2234d0nfb43b44bae3a85c1@mail.gmail.com> On 10/9/05, Nicolas Pouillard wrote: > On 10/9/05, Nicolas Despr?s wrote: > > > > + #FIXME: Do not work with the Ruby loader. Others Collection do not > > + # require this critera. > > unless @test.is_a? Hash and @test.size == 1 > > raise ArgumentError, > > 'Test must be a hash with one key for name of the test' > > The aim of this test is to verify that the test have a real name. > I think that you can extend it. > Actually, the problem is not only this test. In its prologue, Iterate assumes that the test is provided by means of a Hash which is a wrong assumption since other kinds of object may be testified. Cheers, -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Mon Oct 10 08:57:11 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Mon, 10 Oct 2005 14:57:11 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 401: Fix Range#to_yaml_string again. Message-ID: <20051010125711.1E0445130C@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard Fix Range#to_yaml_string again. * lib/core_ex/yaml.rb: Dump the given string. yaml.rb | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: lib/core_ex/yaml.rb --- lib/core_ex/yaml.rb (revision 400) +++ lib/core_ex/yaml.rb (working copy) @@ -45,7 +45,7 @@ have YamlExtension def to_yaml_string - inspect + inspect.dump end def self.yaml_load ( val ) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051010/dafc983a/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Mon Oct 10 09:07:41 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Mon, 10 Oct 2005 15:07:41 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 402: URI::Svn#save now makes smaller files. Message-ID: <20051010130741.821E4512DB@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard URI::Svn#save now makes smaller files. * lib/uri/svn.rb: Add the --deltas option to svnadmin dump. svn.rb | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: lib/uri/svn.rb --- lib/uri/svn.rb (revision 401) +++ lib/uri/svn.rb (working copy) @@ -40,7 +40,7 @@ repos = pathname raise SaveError unless (repos + 'format').exist? out = TempPath.new('save', "#{repos.basename}.svndump") - cmd = SVNADMIN['dump', repos, '--incremental', '--quiet'] > out + cmd = SVNADMIN['dump', repos, '--incremental', '--quiet', '--deltas'] > out [out, cmd.run(runner)] end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051010/2dcdb4d9/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Mon Oct 10 16:41:59 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Mon, 10 Oct 2005 22:41:59 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 403: Add options to running methods of C::Commands. Message-ID: <20051010204159.95CA72BF76@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Add options to running methods of C::Commands. * lib/commands/command.rb: Add run_with_options and adapt system, fork, popen, sys, exec, and run. * lib/commands/pipe.rb: Adapt run. * lib/commands/helpers.rb: Leave a fixme. * lib/commands/factory.rb, lib/commands/seq.rb, * lib/commands/datas/composite.rb, lib/commands/datas/data.rb, * lib/commands/runners/mockable.rb, lib/commands/runners/no_run.rb, * lib/commands/runners/fork.rb, lib/commands/runners/exec.rb, * lib/commands/runners/system.rb, lib/commands/runners/runner.rb, * lib/commands/runners.rb: Prefer import! instead of require. command.rb | 56 ++++++++++++++++++++++++++++++++-------------------- datas/composite.rb | 2 - datas/data.rb | 2 - factory.rb | 2 - helpers.rb | 3 +- pipe.rb | 8 +++---- runners.rb | 2 - runners/exec.rb | 4 +-- runners/fork.rb | 4 +-- runners/mockable.rb | 2 - runners/no_run.rb | 2 - runners/runner.rb | 2 - runners/system.rb | 2 - seq.rb | 2 - 14 files changed, 54 insertions(+), 39 deletions(-) Index: lib/commands/pipe.rb --- lib/commands/pipe.rb (revision 402) +++ lib/commands/pipe.rb (working copy) @@ -3,7 +3,7 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! class IO @@ -13,7 +13,7 @@ class << self - alias_method :pipe_without_pipe?, :pipe + alias_method :pipe_without_pipe?, :pipe unless method_defined? :pipe_without_pipe? def pipe ios = pipe_without_pipe? @@ -35,7 +35,7 @@ @cmds = cmds.flatten.map { |x| x.dup } end - def run ( runner=@runner ) + def run ( runner=@runner, *a ) datas = Datas::Composite.new runner = runner.dup runner.hook_trigger :display_command, self @@ -53,7 +53,7 @@ wr.close end runner = runner.dup - datas << @cmds.last.run(runner) + datas << @cmds.last.run(runner, *a) datas.waitpid if runner.is_a? Runners::System datas end Index: lib/commands/command.rb --- lib/commands/command.rb (revision 402) +++ lib/commands/command.rb (working copy) @@ -3,7 +3,7 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! module Commands @@ -41,30 +41,47 @@ # Running methods. # - # Simulate Kernel#system() to run the command (No shell expansion). - def system - unless defined? @@system_runner - @@system_runner = Runners::System.new + @@default_runners = {} + @@running_options = + { + :verbose => :make_verbose, + :v => :make_verbose, + :raise => :raise_on_failures, + :r => :raise_on_failures, + :debug => :make_debug, + :d => :make_debug, + :mock => :make_mock, + :m => :make_mock, + } + def run_with_options ( runner_class, options ) + if options.empty? + runner = @@default_runners[runner_class] ||= runner_class.new + else + runner = runner_class.new + options.each do |k| + runner.send(@@running_options[k]) + end end - run(@@system_runner) + run(runner) end + protected :run_with_options - # Use the ExecRunner. - def exec - unless defined? @@exec_runner - @@exec_runner = Runners::Exec.new + # Simulate Kernel#system() to run the command (No shell expansion). + def system ( options=[] ) + run_with_options(Runners::System, options) end - run(@@exec_runner) + + + # Use the ExecRunner. + def exec ( options=[] ) + run_with_options(Runners::Exec, options) end # FIXME test me - def sys - unless defined? @@sys_runner - @@sys_runner = Runners::System.new.make_verbose.raise_on_failures - end - run(@@sys_runner) + def sys ( options=[] ) + run_with_options(Runners::System, [:v, :r] + options) end @@ -89,11 +106,8 @@ end - def popen - unless defined? @@fork_runner - @@fork_runner = Runners::Fork.new - end - run(@@fork_runner) + def popen ( options=[] ) + run_with_options(Runners::Fork, options) end alias :fork :popen Index: lib/commands/helpers.rb --- lib/commands/helpers.rb (revision 402) +++ lib/commands/helpers.rb (working copy) @@ -3,7 +3,7 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! module Commands @@ -25,6 +25,7 @@ # Split your command when no quotations are used. # # Do not touch the String and give as one argument. + # FIXME use shell words def to_cmd if self =~ /['"`]/ Command.new(self) Index: lib/commands/factory.rb --- lib/commands/factory.rb (revision 402) +++ lib/commands/factory.rb (working copy) @@ -3,7 +3,7 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! module Commands Index: lib/commands/seq.rb --- lib/commands/seq.rb (revision 402) +++ lib/commands/seq.rb (working copy) @@ -3,7 +3,7 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! module Commands Index: lib/commands/datas/composite.rb --- lib/commands/datas/composite.rb (revision 402) +++ lib/commands/datas/composite.rb (working copy) @@ -3,7 +3,7 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands::Datas.import! module Commands Index: lib/commands/datas/data.rb --- lib/commands/datas/data.rb (revision 402) +++ lib/commands/datas/data.rb (working copy) @@ -3,7 +3,7 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! module Commands Index: lib/commands/runners/mockable.rb --- lib/commands/runners/mockable.rb (revision 402) +++ lib/commands/runners/mockable.rb (working copy) @@ -3,7 +3,7 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! module Commands Index: lib/commands/runners/no_run.rb --- lib/commands/runners/no_run.rb (revision 402) +++ lib/commands/runners/no_run.rb (working copy) @@ -3,7 +3,7 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! module Commands Index: lib/commands/runners/fork.rb --- lib/commands/runners/fork.rb (revision 402) +++ lib/commands/runners/fork.rb (working copy) @@ -3,14 +3,14 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! module Commands module Runners class Fork < Exec - concrete + include Concrete # # Hooks declaration Index: lib/commands/runners/exec.rb --- lib/commands/runners/exec.rb (revision 402) +++ lib/commands/runners/exec.rb (working copy) @@ -3,14 +3,14 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! module Commands module Runners class Exec < Runner - concrete + include Concrete def exec ( aCommand, data ) Kernel.exec(*aCommand.to_a) Index: lib/commands/runners/system.rb --- lib/commands/runners/system.rb (revision 402) +++ lib/commands/runners/system.rb (working copy) @@ -3,7 +3,7 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! module Commands Index: lib/commands/runners/runner.rb --- lib/commands/runners/runner.rb (revision 402) +++ lib/commands/runners/runner.rb (working copy) @@ -3,7 +3,7 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! module Commands Index: lib/commands/runners.rb --- lib/commands/runners.rb (revision 402) +++ lib/commands/runners.rb (working copy) @@ -3,7 +3,7 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ -require 'commands' +Commands.import! module Commands -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051010/7665a0f6/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Mon Oct 10 17:21:38 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Mon, 10 Oct 2005 23:21:38 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 404: Add fingerprint and clean up URIs. Message-ID: <20051010212138.1F1E73F467@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Add fingerprint and clean up URIs. * lib/uri/ssh.rb, * lib/uri/rsync.rb, * lib/uri/mysql.rb, * lib/uri/pgsql.rb: Less class constants, more cattr_reader. Remove the useless build singleton method. * lib/uri/file.rb: Likewise and add fingerprint. * lib/uri/svn.rb: Likewise, add fingerprint, and remove the useless scheme handling. * lib/uri_ex.rb: Use a simple class accessor for runner. uri/file.rb | 38 ++++++++++++++++++-------- uri/mysql.rb | 11 ++----- uri/pgsql.rb | 11 ++----- uri/rsync.rb | 9 +----- uri/ssh.rb | 12 ++------ uri/svn.rb | 84 +++++++++-------------------------------------------------- uri_ex.rb | 5 +-- 7 files changed, 54 insertions(+), 116 deletions(-) Index: lib/uri/ssh.rb --- lib/uri/ssh.rb (revision 403) +++ lib/uri/ssh.rb (working copy) @@ -13,7 +13,8 @@ DEFAULT_HOST = 'localhost'.freeze DEFAULT_PORT = 22 DEFAULT_QUERY = ''.freeze - SCP = 'scp'.to_cmd.freeze + cattr_reader :scp + @@scp = 'scp'.to_cmd.freeze COMPONENT = [ :scheme, @@ -23,11 +24,6 @@ :query ].freeze - def self.build ( args ) - tmp = Util::make_components_hash(self, args) - return super(tmp) - end - def mk_opts opts = ['-q'] opts << '-P' << @port if @port != DEFAULT_PORT @@ -40,7 +36,7 @@ def checkout out = TempPath.new('checkout', pathname.basename.to_s) - [out, SCP[mk_opts, mk_arg, out].run(self.runner)] + [out, scp[mk_opts, mk_arg, out].run(runner)] end def save @@ -48,7 +44,7 @@ end def commit ( aPath ) - SCP[mk_opts, aPath, mk_arg].run(self.runner) + scp[mk_opts, aPath, mk_arg].run(runner) end end # class Ssh Index: lib/uri/rsync.rb --- lib/uri/rsync.rb (revision 403) +++ lib/uri/rsync.rb (working copy) @@ -12,8 +12,8 @@ SCHEMES = ['rsync.ssh'.freeze] DEFAULT_HOST = 'localhost'.freeze DEFAULT_QUERY = ''.freeze - cattr_accessor :rsync - self.rsync ||= 'rsync'.to_cmd.freeze + cattr_reader :rsync + @@rsync ||= 'rsync'.to_cmd.freeze COMPONENT = [ :scheme, @@ -23,11 +23,6 @@ :query ].freeze - def self.build ( args ) - tmp = Util::make_components_hash(self, args) - return super(tmp) - end - def mk_opts ['-Pa'] + mk_custom_opts end Index: lib/uri/file.rb --- lib/uri/file.rb (revision 403) +++ lib/uri/file.rb (working copy) @@ -7,6 +7,7 @@ UriEx.import! +require 'md5' module URI @@ -16,8 +17,9 @@ :scheme, :path ].freeze - TAR = 'tar'.to_cmd.freeze - GZIP = 'gzip'.to_cmd.freeze + cattr_reader :tar, :gzip + @@tar = 'tar'.to_cmd.freeze + @@gzip = 'gzip'.to_cmd.freeze def initialize ( *args ) @@ -28,13 +30,8 @@ end end - def self.build ( args ) - tmp = Util::make_components_hash(self, args) - return super(tmp) - end - def checkout - p = self.pathname + p = pathname raise CheckoutError, to_s unless p.exist? [p, nil] end @@ -44,19 +41,36 @@ end def save - p = self.pathname + p = pathname raise SaveError, to_s unless p.exist? if p.directory? out = TempPath.new('save', "#{p.basename}.tar.gz") - cmd = TAR['czf', out, p] + cmd = tar['czf', out, p] else out = TempPath.new('save', "#{p.basename}.gz") - cmd = GZIP['-c', p] > out + cmd = gzip['-c', p] > out end - cmd.run(self.runner) + cmd.run(runner) [out, nil] end + def fingerprint + digest = Digest::MD5.new + if pathname.directory? + pathname.find do |path| + next if path.directory? + digest << path.read + end + else + digest << pathname.read + end + digest.to_s + end + + def to_s + super.sub(/^(file:\/)([^\/])/, '\1//\2') + end + end # class File @@schemes['FILE'] = File Index: lib/uri/mysql.rb --- lib/uri/mysql.rb (revision 403) +++ lib/uri/mysql.rb (working copy) @@ -13,7 +13,8 @@ DEFAULT_HOST = 'localhost'.freeze DEFAULT_PORT = 3306 DEFAULT_QUERY = ''.freeze - DUMP = 'mysqldump'.to_cmd.freeze + cattr_reader :mysqldump + @@mysqldump = 'mysqldump'.to_cmd.freeze COMPONENT = [ :scheme, @@ -24,12 +25,6 @@ ].freeze - def self.build ( args ) - tmp = Util::make_components_hash(self, args) - return super(tmp) - end - - def mk_connection_opts opts = [] opts << '-h' << @host @@ -59,7 +54,7 @@ def save out = TempPath.new('dump', pathname.basename.to_s) - cmd = DUMP + mk_connection_opts + mk_dump_opts(out) + mk_custom_opts + cmd = mysqldump + mk_connection_opts + mk_dump_opts(out) + mk_custom_opts [out, cmd.run(runner)] end Index: lib/uri/pgsql.rb --- lib/uri/pgsql.rb (revision 403) +++ lib/uri/pgsql.rb (working copy) @@ -13,7 +13,8 @@ DEFAULT_HOST = 'localhost'.freeze DEFAULT_PORT = 5432 DEFAULT_QUERY = ''.freeze - DUMP = 'pg_dump'.to_cmd.freeze + cattr_reader :pg_dump + @@pg_dump = 'pg_dump'.to_cmd.freeze COMPONENT = [ :scheme, @@ -24,12 +25,6 @@ ].freeze - def self.build ( args ) - tmp = Util::make_components_hash(self, args) - return super(tmp) - end - - def mk_connection_opts opts = [] opts << '-h' << @host @@ -58,7 +53,7 @@ def save out = TempPath.new('dump', pathname.basename.to_s) - cmd = DUMP + mk_connection_opts + mk_dump_opts(out) + mk_custom_opts + cmd = pg_dump + mk_connection_opts + mk_dump_opts(out) + mk_custom_opts [out, cmd.run(runner)] end Index: lib/uri/svn.rb --- lib/uri/svn.rb (revision 403) +++ lib/uri/svn.rb (working copy) @@ -16,23 +16,26 @@ :host, :path ].freeze - SVN = 'svn'.to_cmd.freeze - SVNADMIN = 'svnadmin'.to_cmd.freeze + cattr_reader :svn, :svnadmin - def self.build ( args ) - tmp = Util::make_components_hash(self, args) - return super(tmp) + @@svn = 'svn'.to_cmd.freeze + @@svnadmin = 'svnadmin'.to_cmd.freeze + + + def svn_uri_string + to_s.sub(/^svn\./, '') + end + + def fingerprint + svn['info', svn_uri_string].system(:r).output.read[/Revision: (\d+)/, 1] end def checkout - # klass = SvnSchemes.guess(scheme) - # klass.new tmp = TempPath.new('svn-checkout') tmp.mkpath - target = to_s.sub(/^svn\./, '') tmp += pathname.basename - [tmp, SVN['checkout', target, tmp].run(self.runner)] + [tmp, svn['checkout', svn_uri_string, tmp].run(runner)] end def save @@ -40,72 +43,13 @@ repos = pathname raise SaveError unless (repos + 'format').exist? out = TempPath.new('save', "#{repos.basename}.svndump") - cmd = SVNADMIN['dump', repos, '--incremental', '--quiet', '--deltas'] > out + cmd = svnadmin['dump', repos, '--incremental', '--quiet', '--deltas'] > out [out, cmd.run(runner)] end end # class Svn - module SvnSchemes - - def self.guess ( aScheme ) - init - @@svn_schemes[aScheme] - end - - def self.init - return if defined? @@svn_schemes - @@svn_schemes = {} - constants.each do |const| - klass = const_get(const) - next if klass.abstract? - @@svn_schemes[klass.scheme] = klass - end - @@svn_schemes.freeze - end - - def self.svn_schemes - init - @@svn_schemes - end - - class AbstractSvnScheme - include Abstract - - def self.scheme - const_get(:SCHEME) - end - - end - - class SvnScheme < AbstractSvnScheme - include Concrete - SCHEME = 'SVN' - end - - class SvnSshScheme < AbstractSvnScheme - include Concrete - SCHEME = 'SVN+SSH' - end - - class SvnHttpScheme < AbstractSvnScheme - include Concrete - SCHEME = 'SVN.HTTP' - end - - class SvnHttpsScheme < AbstractSvnScheme - include Concrete - SCHEME = 'SVN.HTTPS' - end - - class SvnFileScheme < AbstractSvnScheme - include Concrete - SCHEME = 'SVN.FILE' - end - - end - - SvnSchemes.svn_schemes.each_key do |name| + ['SVN', 'SVN+SSH', 'SVN.HTTP', 'SVN.HTTPS', 'SVN.FILE'].each do |name| @@schemes[name] = Svn end Index: lib/uri_ex.rb --- lib/uri_ex.rb (revision 403) +++ lib/uri_ex.rb (working copy) @@ -26,7 +26,7 @@ # To make all uris command verbose you can change or modify the global # command runner: URI::Generic.runner.make_verbose! # - class_inheritable_accessor :runner + cattr_accessor :runner self.runner = Commands::Runners::System.new.raise_on_failures self.runner.command_data_factory.command_data_class = Commands::Datas::Temp @@ -81,8 +81,7 @@ end - end # module Generic - + end # class Generic test_section __FILE__ do -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051010/75cdf141/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Mon Oct 10 17:23:39 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Mon, 10 Oct 2005 23:23:39 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 405: More imports. Message-ID: <20051010212339.5065B3D4D5@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard More imports. * lib/commands.rb, lib/kill_all.rb: Use import. commands.rb | 14 +++++++------- kill_all.rb | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) Index: lib/commands.rb --- lib/commands.rb (revision 404) +++ lib/commands.rb (working copy) @@ -3,14 +3,14 @@ # License:: GNU General Public License (GPL). # Revision:: $Id$ +Controllers::Commands.import! AutoloadTree.import! -require 'abstract' -require 'hookable' -require 'hooker' -require 'commands/helpers' -require 'commands/datas' -require 'commands/runners' - +Abstract.import! +Hookable.import! +Hooker.import! +Commands::Runners.import! +Commands::Datas.import! +Commands::Helpers.import! # Provides an object oriented way to manage, combine and run your commands. # Index: lib/kill_all.rb --- lib/kill_all.rb (revision 404) +++ lib/kill_all.rb (working copy) @@ -3,7 +3,7 @@ # License:: LGPL # $Id$ -require 'commands' +Commands.import! class KillAll -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051010/f2c29b22/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Mon Oct 10 17:25:21 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Mon, 10 Oct 2005 23:25:21 +0200 Subject: [Uttk-Patches] [ruby_ex] 404: Add fingerprint and clean up URIs. In-Reply-To: <20051010212138.1F1E73F467@smtp.feydakins.org> References: <20051010212138.1F1E73F467@smtp.feydakins.org> Message-ID: <840b875c0510101425p65153763q985e608d7f7b203b@mail.gmail.com> On 10/10/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/ruby_ex/trunk > > Index: ChangeLog > from Nicolas Pouillard > > Add fingerprint and clean up URIs. > > * lib/uri/ssh.rb, > * lib/uri/rsync.rb, > * lib/uri/mysql.rb, > * lib/uri/pgsql.rb: Less class constants, more cattr_reader. > Remove the useless build singleton method. > > * lib/uri/file.rb: Likewise and add fingerprint. > * lib/uri/svn.rb: Likewise, add fingerprint, and remove the useless > scheme handling. > * lib/uri_ex.rb: Use a simple class accessor for runner. > Do you think, it's a good will to remove the self.build method used by the basis of URIs? -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Mon Oct 10 20:01:57 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Tue, 11 Oct 2005 02:01:57 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 406: Commands: Shellwords and user friendly options. Message-ID: <20051011000157.266C2404E5@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Commands: Shellwords and user friendly options. * lib/commands/helpers.rb: Use the Shellwords module to split a string. * lib/commands/command.rb: Make options more user friendly. * lib/commands/runners/fork.rb: Move the FailureHooker ... * lib/commands/runners/runner.rb: ... here. * lib/uri/svn.rb: Fix a bug on to_s with svn.file scheme. commands/command.rb | 24 +++++++++++++++--------- commands/helpers.rb | 13 ++++--------- commands/runners/fork.rb | 17 +---------------- commands/runners/runner.rb | 23 +++++++++++++++++++++++ uri/svn.rb | 4 ++++ 5 files changed, 47 insertions(+), 34 deletions(-) Index: lib/commands/command.rb --- lib/commands/command.rb (revision 405) +++ lib/commands/command.rb (working copy) @@ -64,24 +64,23 @@ end run(runner) end - protected :run_with_options # Simulate Kernel#system() to run the command (No shell expansion). - def system ( options=[] ) - run_with_options(Runners::System, options) + def system ( *options ) + run_with_options(Runners::System, options.flatten) end # Use the ExecRunner. - def exec ( options=[] ) - run_with_options(Runners::Exec, options) + def exec ( *options ) + run_with_options(Runners::Exec, options.flatten) end # FIXME test me - def sys ( options=[] ) - run_with_options(Runners::System, [:v, :r] + options) + def sys ( *options ) + run_with_options(Runners::System, [:v, :r] + options.flatten) end @@ -106,8 +105,8 @@ end - def popen ( options=[] ) - run_with_options(Runners::Fork, options) + def popen ( *options ) + run_with_options(Runners::Fork, options.flatten) end alias :fork :popen @@ -314,6 +313,13 @@ assert(@tmp.exist?) end + def test_system_raise_on_failures + assert_raise(Runners::Runner::FailureHooker::Error) do + 'false'.to_cmd.system(:r) + end + assert_not_equal(0, $?) + end + def test_sh_and_pipe ((@cat | @wc) < @file > @tmp).sh assert_equal(0, $?) Index: lib/commands/helpers.rb --- lib/commands/helpers.rb (revision 405) +++ lib/commands/helpers.rb (working copy) @@ -4,6 +4,7 @@ # Revision:: $Id$ Commands.import! +require 'shellwords' module Commands @@ -22,16 +23,10 @@ # # Make a command from a String. # - # Split your command when no quotations are used. + # Split your command using the Shellwords module. # - # Do not touch the String and give as one argument. - # FIXME use shell words def to_cmd - if self =~ /['"`]/ - Command.new(self) - else - Command.new(*split(/\s+/)) - end + Shellwords.shellwords(self).to_cmd end def to_io_for_commands @@ -67,7 +62,7 @@ "foo b/ar \t \n qu44x32".to_cmd.to_a) s = "foo 'b/ar \t' \n qu44x32" - assert_equal([s], s.to_cmd.to_a) + assert_equal(["foo", "b/ar \t", "qu44x32"], s.to_cmd.to_a) end def test_array_to_cmd Index: lib/commands/runners/fork.rb --- lib/commands/runners/fork.rb (revision 405) +++ lib/commands/runners/fork.rb (working copy) @@ -19,7 +19,6 @@ hook_declare :exception_raised_during_exec hook_declare :already_killed hook_declare :waitpid - hook_declare :failure hook_declare :son hook_declare :kill @@ -39,7 +38,7 @@ end hook_trigger :waitpid, data if data.status.nil? or not data.status.exitstatus.zero? - hook_trigger :failure, data + hook_trigger :failure, aCommand, data end end @@ -69,11 +68,6 @@ end - def raise_on_failures - hooker_subscribe FailureHooker.new - self - end - def before_exec ( command, data ) TempPath.clean end @@ -81,15 +75,6 @@ end # class Fork - class FailureHooker - class Error < Exception - end - def failure ( data ) - raise Error, { 'Command failed' => data }.to_yaml - end - end - - test_section __FILE__ do class ForkTest < Test::Unit::TestCase Index: lib/commands/runners/runner.rb --- lib/commands/runners/runner.rb (revision 405) +++ lib/commands/runners/runner.rb (working copy) @@ -33,6 +33,7 @@ hook_declare :before_chdir hook_declare :before_exec hook_declare :exec + hook_declare :failure # @@ -107,6 +108,13 @@ self end + + def raise_on_failures + hooker_subscribe FailureHooker.new + self + end + + # # Hookers # @@ -134,6 +142,21 @@ end # class VerboseHooker + class FailureHooker + include Hooker + + class Error < Exception + end + + def failure ( aCommand, data ) + raise Error, { 'reason' => 'Command failed', + 'command' => aCommand.to_s, + 'data' => data }.to_yaml + end + + end # class FailureHooker + + end # class Runner Index: lib/uri/svn.rb --- lib/uri/svn.rb (revision 405) +++ lib/uri/svn.rb (working copy) @@ -27,6 +27,10 @@ to_s.sub(/^svn\./, '') end + def to_s + super.sub(/^(svn\.file:\/)([^\/])/, '\1//\2') + end + def fingerprint svn['info', svn_uri_string].system(:r).output.read[/Revision: (\d+)/, 1] end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051011/d34032bd/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Mon Oct 10 21:58:50 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Tue, 11 Oct 2005 03:58:50 +0200 (CEST) Subject: [Uttk-Patches] 750: Make Uttk works with Yaml of ruby 1.8.3. Message-ID: <20051011015850.30C99512DB@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/750 Index: ChangeLog from Nicolas Pouillard Make Uttk works with Yaml of ruby 1.8.3. * lib/uttk/dumpers/Yaml.rb: Print the type without to_yaml_type. Chomp the value returned by Yaml. * lib/uttk/loaders/Yaml.rb: Adapt key_transform and uttk_loader_yaml_transform to this new version. * test/unit/strategies/suite_test.rb: Adapt the test suite. lib/uttk/dumpers/Yaml.rb | 6 ++++++ lib/uttk/loaders/Yaml.rb | 15 +++++++++++---- test/unit/strategies/suite_test.rb | 22 ++++++++++++++++++---- 3 files changed, 35 insertions(+), 8 deletions(-) Index: test/unit/strategies/suite_test.rb --- test/unit/strategies/suite_test.rb (revision 749) +++ test/unit/strategies/suite_test.rb (working copy) @@ -37,26 +37,37 @@ | command: 'false' | status: PASS | status: PASS + |}.head_cut! + + output_ref2 = %q{ |A set of tests: !S::Suite | attributes: | strategy: Uttk::Strategies::Cmd | exit: 0 | contents: | - I'm suppose to pass 4: !S::Cmd - | command: true + | command: 'true' | status: PASS | - I'm suppose to fail 5: !S::Cmd | weight: -1 - | command: false + | command: 'false' | my_exit: 1 | status: FAIL | reason: wrong exit value | - I'm suppose to pass 6: !S::Cmd - | command: false + | command: 'false' | status: PASS | status: PASS |}.head_cut! + # Dynamically fix the reference output for ruby 1.8.2 since there is a + # strange bug with Yaml and/or Dumpers::Yaml + # But it's ok with ruby 1.8.3 + unless HAVE_YAML_TAGURI + output_ref.gsub!(/'(true|false)'/, '\1') + output_ref2.gsub!(/'(true|false)'/, '\1') + end + TempPath.new do |tmp| log = Logger.new(Dumpers::Yaml.new(tmp.open('w'))) log.severity_level = Logger::Severity::INFO @@ -82,6 +93,9 @@ } aSuite = aDoc.testify(:loader => loader) aSuite.run + # mini_diff(output_ref, tmp.read) + assert_nothing_raised { @my = YAML::load(tmp.read) } + assert_equal(YAML::load(output_ref), @my) aSuite = Strategies::Suite.new aSuite.name = 'A set of tests' @@ -108,7 +122,7 @@ aSuite.run # mini_diff(output_ref, tmp.read) assert_nothing_raised { @my = YAML::load(tmp.read) } - assert_equal(YAML::load(output_ref), @my) + assert_equal(YAML::load(output_ref2), @my) end end Index: lib/uttk/dumpers/Yaml.rb --- lib/uttk/dumpers/Yaml.rb (revision 749) +++ lib/uttk/dumpers/Yaml.rb (working copy) @@ -69,8 +69,13 @@ end @io << clean_to_yaml(node) << ':' if cur_options and type = cur_options[:type] + # FIXME handle this better + if HAVE_YAML_TAGURI + @io << ' !' << type.taguri.sub(/^tag:.*?:/, '') + else @io << ' ' << type.to_yaml_type end + end @endl = false end protected :new_node @@ -107,6 +112,7 @@ def clean_to_yaml ( val ) val = val.to_yaml(@opts) val.sub!(/^--- /, '') + val.chomp! val.gsub!(/(^\s*)- \n\s+([^\s-])/, '\1- \2') val = '""' if val == "''" val Index: lib/uttk/loaders/Yaml.rb --- lib/uttk/loaders/Yaml.rb (revision 749) +++ lib/uttk/loaders/Yaml.rb (working copy) @@ -39,18 +39,19 @@ CLASS_KEY_LIST = [:strategy, :wclass, :symtbl_class] def key_transform ( t, k, v ) + k = k.uttk_loader_yaml_transform if k.is_a? BaseNode case k when Symbol when Integer when /^:(.*)/ then k = $1.to_sym - when Syck::Scalar - k = k.value.to_s.to_sym else k = k.to_s.to_sym end if CLASS_KEY_LIST.include?(k) and (val = v.value) =~ /^[A-Z]/ t[k] = Uttk::Loaders.get_class(val) - else + elsif v.is_a? BaseNode t[k] = v.uttk_loader_yaml_transform + else + t[k] = v end end private :key_transform @@ -60,9 +61,15 @@ t = nil if @value.is_a? Hash t = Hash.new + if HAVE_YAML_TAGURI + @value.each do |k, v| + key_transform(t, k, v) + end + else children_with_index.each do |v, k| key_transform(t, k, v) end + end elsif @value.is_a? Array if not @value.empty? and @value.all? { |x| x.is_a? Hash and x.size == 1 } t = OHash.new @@ -80,7 +87,7 @@ @type_id = nil t = $1.to_sym else - t = @value + return transform end YAML.transfer(@type_id, t) end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051011/2652c067/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Mon Oct 10 22:13:16 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Tue, 11 Oct 2005 04:13:16 +0200 (CEST) Subject: [Uttk-Patches] 751: Add another loading mode to uttk-unit: nothing. Message-ID: <20051011021316.BE95E51338@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/751 Index: ChangeLog from Nicolas Pouillard Add another loading mode to uttk-unit: nothing. * bin/uttk-unit: This mode does nothing, but the path is used during the matching part which activate (or not) embbeded tests. uttk-unit | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: bin/uttk-unit --- bin/uttk-unit (revision 750) +++ bin/uttk-unit (working copy) @@ -34,7 +34,7 @@ o.on('--import NAME', 'Import this constant') do |const| @options.actions << proc { const.constantize.import! } end - o.on('--mode import|require', [:import, :require], + o.on('--mode import|require|nothing', [:import, :require, :nothing], 'Set the loading mode for unit tests [default: require]') do |mode| @options.mode = mode end @@ -110,6 +110,7 @@ path.constantize.import! when :require require path + when :nothing else raise "Bad loading mode: #{@options.mode}" end end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051011/9fb270e7/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Mon Oct 10 22:23:09 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Tue, 11 Oct 2005 04:23:09 +0200 (CEST) Subject: [Uttk-Patches] 752: Partially fix Iterate for the Ruby loader. Message-ID: <20051011022309.3C11451380@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/752 Index: ChangeLog from Nicolas Pouillard Partially fix Iterate for the Ruby loader. * test/ruby-suite.rb: Use iterate but leave a fixme for the import. * lib/uttk/strategies/Iterate.rb: Move the iterators initialization into iter=. Make iterators a protected attribute. Handle tests given as hash and already initialized strategies separatly. lib/uttk/strategies/Iterate.rb | 39 +++++++++++++++++++++------------------ test/ruby-suite.rb | 23 +++++++++++------------ 2 files changed, 32 insertions(+), 30 deletions(-) Index: test/ruby-suite.rb --- test/ruby-suite.rb (revision 751) +++ test/ruby-suite.rb (working copy) @@ -1,14 +1,13 @@ -include Strategies - -# We create the suite using PathList because Iterate do not support the Ruby -# loader. -Suite.new('Uttk Ruby loader functional test suite') do |t| - - PathList.new(symtbl[:pwd] + 'ruby/*.rb').each do |path| - t.contents << Import.new("Test #{path.basename}") { import path } - end - +S::Iterate.new 'Uttk Ruby loader functional test suite' do + over PathList['<>/ruby/(*.rb)'] + iter ['path', 'basename'] + # FIXME make the non hash version works + # test do + # S::Import.new("Test <>") { import '<>' } + # end + test "Test <>" => { + :strategy => S::Import, + :import => '<>' + } end - - Index: lib/uttk/strategies/Iterate.rb --- lib/uttk/strategies/Iterate.rb (revision 751) +++ lib/uttk/strategies/Iterate.rb (working copy) @@ -39,8 +39,8 @@ include Composite::Ordered alias_method :make_new_symtbl, :new_symtbl - attr_reader :new_symtbl - protected :new_symtbl + attr_reader :new_symtbl, :iterators + protected :new_symtbl, :iterators # @@ -50,23 +50,13 @@ def prologue super - #FIXME: Do not work with the Ruby loader. Others Collection do not - # require this critera. - unless @test.is_a? Hash and @test.size == 1 - raise ArgumentError, - 'Test must be a hash with one key for name of the test' - end + if @test.is_a? Hash and @test.size == 1 name, @attributes = @test.to_a.first - iterators = case @iter - when Array then @iter.flatten - when /^\[.*\]$/ then eval @iter - when /,/ then @iter.split(/\s*,\s*/) - else [@iter] - end - unless iterators.all? { |it| it.is_a? String } - raise ArgumentError, 'The iterator name or list of names ' + - "must be strings not (#{iterators.inspect})" + @attributes[:name] = name + else + name = @test.name end + iter1 = iterators.first iteri = "#{iter1}:i" iterstar = "*#{iter1}" @@ -76,7 +66,6 @@ 'iterating with this name all your tests will have the same ' + "name, to avoid this you can add <<#{iteri}>> to your name" end - @attributes[:name] = name # Iterate over the object `@over' with the method `@with'. @@ -98,6 +87,20 @@ protected :prologue + def iter= ( iter ) + @iter = iter + @iterators = case @iter + when Array then @iter.flatten + when /^\[.*\]$/ then eval @iter + when /,/ then @iter.split(/\s*,\s*/) + else [@iter] + end + unless iterators.all? { |it| it.is_a? String } + raise ArgumentError, 'The iterator name or list of names ' + + "must be strings not (#{iterators.inspect})" + end + end + # # Attributes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051011/20327492/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Tue Oct 11 04:47:37 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Tue, 11 Oct 2005 10:47:37 +0200 Subject: [Uttk-Patches] 752: Partially fix Iterate for the Ruby loader. In-Reply-To: <20051011022309.3C11451380@smtp.feydakins.org> References: <20051011022309.3C11451380@smtp.feydakins.org> Message-ID: <840b875c0510110147n5ba542afy987ccd89054fdc10@mail.gmail.com> On 10/11/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/uttk/trunk > > You can also view this changeset here: > > http://http://dev.uttk.org/repository/changesets/752 > > Index: ChangeLog > from Nicolas Pouillard > > Partially fix Iterate for the Ruby loader. > > * test/ruby-suite.rb: Use iterate but leave a fixme for the import. > * lib/uttk/strategies/Iterate.rb: Move the iterators initialization > into iter=. Make iterators a protected attribute. Handle tests given as > hash and already initialized strategies separatly. > [...] > +S::Iterate.new 'Uttk Ruby loader functional test suite' do > + over PathList['<>/ruby/(*.rb)'] > + iter ['path', 'basename'] > + # FIXME make the non hash version works > + # test do > + # S::Import.new("Test <>") { import '<>' } > + # end > + test "Test <>" => { > + :strategy => S::Import, > + :import => '<>' > + } > end Ok, but it doesn't solve anything. > - > - > Index: lib/uttk/strategies/Iterate.rb > --- lib/uttk/strategies/Iterate.rb (revision 751) > +++ lib/uttk/strategies/Iterate.rb (working copy) > @@ -39,8 +39,8 @@ > include Composite::Ordered > > alias_method :make_new_symtbl, :new_symtbl > - attr_reader :new_symtbl > - protected :new_symtbl > + attr_reader :new_symtbl, :iterators > + protected :new_symtbl, :iterators > Question: Why does Iterate use yet another new_symtbl scheme? Question: Why do these two attributes protected? I think private is what we need? [...] Ok, thanks for the iter= method. But the real shit of uttk behind this problem is still there :-( -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Tue Oct 11 05:24:46 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Tue, 11 Oct 2005 11:24:46 +0200 Subject: [Uttk-Patches] 752: Partially fix Iterate for the Ruby loader. In-Reply-To: References: <20051011022309.3C11451380@smtp.feydakins.org> <840b875c0510110147n5ba542afy987ccd89054fdc10@mail.gmail.com> Message-ID: <840b875c0510110224r29b18f32yeb313f5d928086b@mail.gmail.com> On 10/11/05, Nicolas Pouillard wrote: > On 10/11/05, Nicolas Despr?s wrote: > > On 10/11/05, Nicolas Pouillard wrote: > > > > > > svn://svn.feydakins.org/uttk/trunk > > > > > > You can also view this changeset here: > > > > > > http://http://dev.uttk.org/repository/changesets/752 > > > > > > Index: ChangeLog > > > from Nicolas Pouillard > > > > > > Partially fix Iterate for the Ruby loader. > > > > > > * test/ruby-suite.rb: Use iterate but leave a fixme for the import. > > > * lib/uttk/strategies/Iterate.rb: Move the iterators initialization > > > into iter=. Make iterators a protected attribute. Handle tests given as > > > hash and already initialized strategies separatly. > > > > > > > [...] > > > > > +S::Iterate.new 'Uttk Ruby loader functional test suite' do > > > + over PathList['<>/ruby/(*.rb)'] > > > + iter ['path', 'basename'] > > > + # FIXME make the non hash version works > > > + # test do > > > + # S::Import.new("Test <>") { import '<>' } > > > + # end > > > + test "Test <>" => { > > > + :strategy => S::Import, > > > + :import => '<>' > > > + } > > > end > > > > Ok, but it doesn't solve anything. > > > > Yes but when you think about this: > > ... > test do > S::Import.new("Test <>") { import '<>' } > end > ... > > It's quite complex in fact because test is supposed to be an > uninstanciated template of test. > But here it's a completly well initialized test, not yet instanciated > but it's no more a document. > It doesn't solve the real problem. > > > - > > > - > > > Index: lib/uttk/strategies/Iterate.rb > > > --- lib/uttk/strategies/Iterate.rb (revision 751) > > > +++ lib/uttk/strategies/Iterate.rb (working copy) > > > @@ -39,8 +39,8 @@ > > > include Composite::Ordered > > > > > > alias_method :make_new_symtbl, :new_symtbl > > > - attr_reader :new_symtbl > > > - protected :new_symtbl > > > + attr_reader :new_symtbl, :iterators > > > + protected :new_symtbl, :iterators > > > > > > > Question: Why does Iterate use yet another new_symtbl scheme? > > Just because the new symtbl must contains the current iterator value. > A symtbl is a context so when you implement a loop you must change > this context to > give the value a each turn. Here it's the same thing. > So it's not a Collection since it behaves differently. > > Question: Why do these two attributes protected? I think private is > > what we need? > > I have not the solution since no one subclass Iterate. > So private is enough by now. > > > > [...] > > > > Ok, thanks for the iter= method. But the real shit of uttk behind this > > problem is still there :-( > > > > Yes but it's also a step forward. > And it's better to make many little steps forward than make a big one > and fall in a hole :) > You know that this problem comes from the bases of Uttk. Because they are not well tested/defined and not strong enough. When a card is missing in the base of your castle card it will bring down, and you will have to restart from the beginning any way. Moreover, working on Uttk is more and more painfull and specially debugging it. I'm completly fed up to see many many new features and still the problem. We are working on an unstable base ! -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Tue Oct 11 07:22:53 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Tue, 11 Oct 2005 13:22:53 +0200 (CEST) Subject: [Uttk-Patches] 753: Optimize Html to simplify the browser job. Message-ID: <20051011112253.3FA40512FD@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/753 Index: ChangeLog from Nicolas Pouillard Optimize Html to simplify the browser job. * lib/uttk/dumpers/Html.rb: The Html computation is now almost done during the dumping step. * lib/uttk/filters/Compact.rb: Compact also attributes. * lib/www: New. * lib/js/uttk.js: Rename to ... * lib/www/javascripts/uttk.js: ... this and simplify. * lib/js/css: Rename to ... * lib/www/stylesheets: ... this. * lib/js/img: Rename to ... * lib/www/images: ... this. uttk/dumpers/Html.rb | 126 ++++++++++++++++++++++++++++++------------------ uttk/filters/Compact.rb | 3 + www/javascripts/uttk.js | 54 +++++++------------- 3 files changed, 104 insertions(+), 79 deletions(-) Index: lib/www/javascripts/uttk.js --- lib/www/javascripts/uttk.js (revision 0) +++ lib/www/javascripts/uttk.js (working copy) @@ -6,12 +6,12 @@ var uttk_nodes = new Array(); var uttk_leaves = new Array(); var CLASS = 0; -var NAME = 1; -var STATUS = 2; +var ID = 1; +var FATHER = 2; var STATE = 3; -var FATHER = 4; -var ID = 5; -var CONTENTS = 6; +var CONTENTS1 = 4; +var CONTENTS2 = 5; +var CONTENTS3 = 6; // Main function @@ -28,15 +28,15 @@ // Add a leaf to "father" -function uttk_add_leaf ( name, status, state, father_id, id, contents ) +function uttk_add_leaf ( id, father_id, state, c1, c2, c3 ) { var father = uttk_hash[father_id]; if (father == null) name += "(FATHER[" + father_id + "] == null)"; - var leaf = new Array("leaf", name, status, state, father, id, contents); + var leaf = new Array("leaf", id, father, state, c1, c2 || '', c3 || ''); if (father != null) - father[CONTENTS].push(leaf); + father[CONTENTS3].push(leaf); uttk_hash[id] = leaf; uttk_leaves.push(leaf); @@ -44,15 +44,15 @@ // Add a node to "father" -function uttk_add_node ( name, status, state, father_id, id ) +function uttk_add_node ( id, father_id, state, c1, c2 ) { var father = uttk_hash[father_id]; - var node = new Array("node", name, status, state, father, id, new Array()); + var node = new Array("node", id, father, state, c1, c2, new Array()); if (father == null) uttk_root.push(node); else - father[CONTENTS].push(node); + father[CONTENTS3].push(node); uttk_hash[id] = node; uttk_nodes.push(node); @@ -74,36 +74,18 @@ // Generate html common part function uttk_node_or_leaf ( data ) { - var source = ""; - - source += '
' - source += ' ' - source += ' ' - - if (data[STATE] != 2) - { - source += ' ' - } - source += ' '; - source += ' '; - source += ' ' - source += '
'; switch (data[STATE]) { case 0: - source += ' '; break; case 1: - source += ' '; - break; + return data[CONTENTS1] + 'open' + data[CONTENTS2]; case 2: - break; + return data[CONTENTS1]; default: alert('Unknown state: ' + data[STATE]); } - source += ' ' + data[NAME] + '' + data[STATUS] + '
'; - - return source; + return data[CONTENTS1] + data[CONTENTS2]; } @@ -113,7 +95,7 @@ if (node[STATE] == 0) return ""; else - return uttk_display(node[CONTENTS]); + return uttk_display(node[CONTENTS3]); } @@ -123,7 +105,7 @@ if (leaf[STATE] == 0) return ""; else - return leaf[CONTENTS]; + return leaf[CONTENTS3]; } @@ -165,16 +147,20 @@ { case null: for (i = 0; i < uttk_nodes.length; ++i) + if (uttk_nodes[i][STATE] != 2) uttk_nodes[i][STATE] = state; for (i = 0; i < uttk_leaves.length; ++i) + if (uttk_leaves[i][STATE] != 2) uttk_leaves[i][STATE] = state; break; case "node": for (i = 0; i < uttk_nodes.length; ++i) + if (uttk_nodes[i][STATE] != 2) uttk_nodes[i][STATE] = state; break; case "leaf": for (i = 0; i < uttk_leaves.length; ++i) + if (uttk_leaves[i][STATE] != 2) uttk_leaves[i][STATE] = state; break; default: Index: lib/uttk/filters/Compact.rb --- lib/uttk/filters/Compact.rb (revision 752) +++ lib/uttk/filters/Compact.rb (working copy) @@ -33,6 +33,9 @@ @record[path.to_s] = Buffer.new end end + if node.to_s == 'attributes' + @record[path.to_s] = Buffer.new + end end protected :new_node Index: lib/uttk/dumpers/Html.rb --- lib/uttk/dumpers/Html.rb (revision 752) +++ lib/uttk/dumpers/Html.rb (working copy) @@ -15,6 +15,11 @@ # class Html < Dumper include Concrete + cattr_reader :base_url + @@base_url = 'http://api.uttk.org/' + + # Use this one when you have made changes in lib/www + # @@base_url = "file://#{Uttk.dir.parent.expand_path}/www/" class XmlMarkup < Builder::XmlMarkup def initialize ( *a, &b ) @@ -47,34 +52,94 @@ end class BaseNode - attr_reader :father, :name, :status, :id + attr_reader :father, :name, :status, :id, :contents, :state + + @@template_images = Html.base_url + 'images/%%%IMAGE_SPLIT%%%triangle.gif' def initialize ( h ) @father, @status, @id = h[:father], h[:status], h[:id] - @name, @state = h[:name], h[:state] + @name, @contents, @state = h[:name], h[:contents], h[:state] + end + + def unquote ( s ) + s.gsub('"', '') + end + + def html + @status ||= '' + x = XmlMarkup.new(:indent => 2) + x.div :class => self.class.name.demodulize.underscore do + x.table :class => 'title', :id => unquote(status).sub(/\(.+\)/, '') do + x.tr do + if state == 2 + x.td { x.text!(name.to_s) } + x.td { x.pre clean_yaml_str(contents), + :class => 'attribute_alone' } + else + x.td :width => '11px', + :onClick => "uttk_toggle_state(#{id.gsub('"', "'")})" do + x.img :src => @@template_images + end + x.td { x.text!(name.to_s) } + x.td(:width => '20px') { x.text!(unquote(status)) } + end + end + end + end + result = x.target! + raise unless result =~ /<\/div>\Z/ + result.sub!(/<\/div>\Z/, '') + result.split('%%%IMAGE_SPLIT%%%').map do |x| + x.dump + end.join(', ') + end + + require 'stringio' + def clean_yaml_str ( anObject ) + str = '' + io = StringIO.new str + log = Logger.new(Dumpers::Yaml.new(io)) + log << anObject + log.close + io.close + str.sub!(/^---\s*/, '') + str.chomp! + str end + private :clean_yaml_str end class Node < BaseNode def to_html_uttk_js ( status_h ) - "uttk_add_node(#@name, #{status_h[@status]}, #@state, #@father, #@id);" + @status = status_h[@status] + "uttk_add_node(#@id, #@father, #@state, #{html});" end end class Leaf < BaseNode - attr_reader :contents - def initialize ( h ) - super - @contents = h[:contents] - end def to_html_uttk_js ( status_h ) - "uttk_add_leaf(#@name, '#@status', #@state, #@father, #@id, #@contents);" + "uttk_add_leaf(#@id, #@father, #@state, #{html}, #{html_contents});" + end + def html_contents + return '""' if state == 2 + x = XmlMarkup.new(:indent => 2) + x.table :class => 'attribute' do + contents.each do |k, v| + x.tr do + x.td "#{k}:", :class => 'key' + x.td :class => 'value' do + x.pre clean_yaml_str(v), :class => 'attribute' + end + end + end + end + x.target!.dump end end def initialize ( *a, &b ) - @uttk_js = 'http://api.uttk.org/js/uttk.js' - @uttk_css = 'http://api.uttk.org/js/css/uttk.css' + @uttk_js = base_url + 'javascripts/uttk.js' + @uttk_css = base_url + 'stylesheets/uttk.css' super reset end @@ -95,7 +160,7 @@ id = id_of :node, path, node status = id_of :status, path + [node, :status] @elts << Node.new(:father => father, - :name => clean_js_str(node), + :name => node, :id => id, :status => status, :state => 1) @@ -106,48 +171,33 @@ def new_leaf ( path, node ) super if path.last == :status - @status[id_of(:status, path)] = clean_js_str(node) + @status[id_of(:status, path)] = node @elts.pop else father = id_of :node, path id = id_of :leaf, path, node if node.is_a? Hash and node.size == 1 node, contents = node.to_a.first - node = clean_js_str(node) else contents = node n = @elts.pop father, node, id, status = n.father, n.name, n.id, n.status end - state, status = 1, '' - x = XmlMarkup.new(:indent => 2) + state, status = 0, '' if contents.is_a? Hash status = contents[:status] [:status].each do |k| contents.delete k if contents.has_key? k end - unless contents.empty? - x.table :class => 'attribute' do - contents.each do |k, v| - x.tr do - x.td "#{k}:", :class => 'key' - x.td :class => 'value' do - x.pre clean_yaml_str(v), :class => 'attribute' - end - end - end - end - end else state = 2 - x.pre clean_yaml_str(contents), :class => 'attribute_alone' end @elts << Leaf.new(:father => father, :id => id, :name => node, :status => status, :state => state, - :contents => x.target!.dump) + :contents => contents) end end protected :new_leaf @@ -205,26 +255,12 @@ end protected :new_id - require 'stringio' - def clean_yaml_str ( anObject ) - str = '' - io = StringIO.new str - log = Logger.new(Dumpers::Yaml.new(io)) - log << anObject - log.close - io.close - str.sub!(/^---\s*/, '') - str - end - private :clean_yaml_str - - def clean_js_str ( str ) + def self.clean_js_str ( str ) res = str.to_s.html_encode.dump res.gsub!(/([^\\])\\n/, '\1
\n') res end - private :clean_js_str end # class Html -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051011/2f90a771/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Tue Oct 11 07:24:21 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Tue, 11 Oct 2005 13:24:21 +0200 (CEST) Subject: [Uttk-Patches] 754: Fix a bug in uttk-unit. Message-ID: <20051011112421.BB949512FD@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/754 Index: ChangeLog from Nicolas Pouillard Fix a bug in uttk-unit. * bin/uttk-unit: Use load_path! only if CoreEx is available. uttk-unit | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: bin/uttk-unit --- bin/uttk-unit (revision 753) +++ bin/uttk-unit (working copy) @@ -26,7 +26,7 @@ OptionParser.new do |o| o.on('-I', '--include DIR', 'Add this directory to $LOAD_PATH') do |dir| @options.load_path << dir - @options.actions << proc { dir.to_path.load_path! } + @options.actions << proc { dir.to_path.load_path! if defined? CoreEx } end o.on('-r', '--require FEATURE', 'Require this file') do |file| @options.actions << proc { require file } -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051011/76465e1b/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Tue Oct 11 07:29:19 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Tue, 11 Oct 2005 13:29:19 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 407: Change options for rsync. Message-ID: <20051011112919.1A6B551FAE@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Change options for rsync. * lib/uri/rsync.rb: Use -v not -P. rsync.rb | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: lib/uri/rsync.rb --- lib/uri/rsync.rb (revision 406) +++ lib/uri/rsync.rb (working copy) @@ -24,7 +24,7 @@ ].freeze def mk_opts - ['-Pa'] + mk_custom_opts + ['-va'] + mk_custom_opts end def mk_arg @@ -56,14 +56,14 @@ def test_mk_opts assert_nothing_raised { @uri = URI.parse('rsync.ssh://foo at bar') } - assert_equal(['-Pa'], @uri.mk_opts) + assert_equal(['-va'], @uri.mk_opts) end def test_mk_opts_with_query assert_nothing_raised do @uri = URI.parse('rsync.ssh://foo at bar/baz?rsh=ssh%20-i%20foo,boo,bee=42') end - ref = ['-Pa', '--rsh', 'ssh -i foo', '--boo', '--bee', '42'] + ref = ['-va', '--rsh', 'ssh -i foo', '--boo', '--bee', '42'] assert_equal(ref, @uri.mk_opts) end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051011/d1d9cf4e/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Tue Oct 11 07:30:20 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Tue, 11 Oct 2005 13:30:20 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 408: Adapt the unit suite to uttk-unit. Message-ID: <20051011113020.C7B4851B5B@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Adapt the unit suite to uttk-unit. * test/unit-suite.yml: Update. unit-suite.yml | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: test/unit-suite.yml --- test/unit-suite.yml (revision 407) +++ test/unit-suite.yml (working copy) @@ -8,6 +8,7 @@ test: <>: !S::RUnit load_path: <>/../lib - input: !path test/test-unit-setup.rb - args: <> + requires: ruby_ex + input: !path <> + uttk_unit_options: --uttk no verbose: true -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051011/730ec592/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 12 04:41:57 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 12 Oct 2005 10:41:57 +0200 (CEST) Subject: [Uttk-Patches] 755: Reveal an iterate bug with the Ruby loader. Message-ID: <20051012084157.217B151B64@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/755 Index: ChangeLog from Nicolas Pouillard Reveal an iterate bug with the Ruby loader. * lib/uttk/strategies/Iterate.rb: It now accepts more inputs than just a hash. * test/ruby/iterate.rb: New. This test reveal a bug. * test/ruby-suite.rb: Leave another fixme. lib/uttk/strategies/Iterate.rb | 14 ++++++++------ test/ruby-suite.rb | 2 ++ test/ruby/iterate.rb | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) Index: test/ruby/iterate.rb --- test/ruby/iterate.rb (revision 0) +++ test/ruby/iterate.rb (revision 0) @@ -0,0 +1,15 @@ +S::Suite.new 'Test the Iterate strategy (Ruby Loader)' do + contents [ + S::Iterate.new('Iterate over a range') { + over 0...4 + with :each + iter :it + test(S::Assert.new('Test on turn <>') { + test(" + assert_equal('<>', '<>') + assert_equal('<>', '<>') + ") + }) + } + ] +end Property changes on: test/ruby/iterate.rb ___________________________________________________________________ Name: svn:keywords + Id Index: test/ruby-suite.rb --- test/ruby-suite.rb (revision 754) +++ test/ruby-suite.rb (working copy) @@ -6,6 +6,8 @@ # test do # S::Import.new("Test <>") { import '<>' } # end + # FIXME This one should works too + # test(S::Import.new("Test <>") { import '<>' }) test "Test <>" => { :strategy => S::Import, :import => '<>' Index: lib/uttk/strategies/Iterate.rb --- lib/uttk/strategies/Iterate.rb (revision 754) +++ lib/uttk/strategies/Iterate.rb (working copy) @@ -53,6 +53,7 @@ if @test.is_a? Hash and @test.size == 1 name, @attributes = @test.to_a.first @attributes[:name] = name + @test = {} else name = @test.name end @@ -79,7 +80,7 @@ symtbl["#{iterators[i]}"] = arg if i < iterators.size end @new_symtbl = symtbl - create + create @test turn += 1 end @@ -89,11 +90,12 @@ def iter= ( iter ) @iter = iter - @iterators = case @iter - when Array then @iter.flatten - when /^\[.*\]$/ then eval @iter - when /,/ then @iter.split(/\s*,\s*/) - else [@iter] + iter = iter.to_s if iter.is_a? Symbol + @iterators = case iter + when Array then iter.flatten + when /^\[.*\]$/ then eval iter + when /,/ then iter.split(/\s*,\s*/) + else [iter] end unless iterators.all? { |it| it.is_a? String } raise ArgumentError, 'The iterator name or list of names ' + -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051012/df0ca2fe/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 12 04:43:22 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 12 Oct 2005 10:43:22 +0200 (CEST) Subject: [Uttk-Patches] 756: A strategy instance cannot be run twice. Message-ID: <20051012084322.EEE41512DE@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/756 Index: ChangeLog from Nicolas Pouillard A strategy instance cannot be run twice. * lib/uttk/strategies/Strategy.rb: Raise an error if the test was already run. Strategy.rb | 3 +++ 1 files changed, 3 insertions(+) Index: lib/uttk/strategies/Strategy.rb --- lib/uttk/strategies/Strategy.rb (revision 755) +++ lib/uttk/strategies/Strategy.rb (working copy) @@ -92,6 +92,9 @@ # - check_post_assertion # - epilogue def run ( log=@symtbl[:log] ) + unless @status.is_a? StartStatus + raise_error("This test was already run (#{self} : #{self.class})") + end @log = log @benchmark = [] initialize_flow_factory if @symtbl[:flow_factory].nil? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051012/8c38d1b5/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 12 04:51:02 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 12 Oct 2005 10:51:02 +0200 (CEST) Subject: [Uttk-Patches] 757: Add a simpler test. Message-ID: <20051012085102.22474512DE@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/757 Index: ChangeLog from Nicolas Pouillard Add a simpler test. * test/ruby/iterate.rb: Add an iteration over Pass strategies. iterate.rb | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: test/ruby/iterate.rb --- test/ruby/iterate.rb (revision 756) +++ test/ruby/iterate.rb (working copy) @@ -1,6 +1,12 @@ S::Suite.new 'Test the Iterate strategy (Ruby Loader)' do contents [ - S::Iterate.new('Iterate over a range') { + S::Iterate.new('Iterate over a range of S::Pass') { + over 0...4 + with :each + iter :it + test S::Pass.new('<>') + }, + S::Iterate.new('Iterate over a range of S::Assert') { over 0...4 with :each iter :it -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051012/3b97be42/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 12 05:08:59 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 12 Oct 2005 11:08:59 +0200 (CEST) Subject: [Uttk-Patches] 758: Strategy#testify now dup itself. Message-ID: <20051012090859.CBBF8400E8@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/758 Index: ChangeLog from Nicolas Pouillard Strategy#testify now dup itself. * lib/uttk/strategies/Strategy.rb: This partially fix the problem which ran twice the same test, now the testification of a test duplicate it. Strategy.rb | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: lib/uttk/strategies/Strategy.rb --- lib/uttk/strategies/Strategy.rb (revision 757) +++ lib/uttk/strategies/Strategy.rb (working copy) @@ -544,9 +544,10 @@ # def testify ( symtbl, &block ) - @symtbl ||= symtbl - block[self] if block - self + test = dup + test.symtbl ||= symtbl + block[test] if block + test end def to_s -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051012/50df8da7/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 12 06:37:52 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 12 Oct 2005 12:37:52 +0200 (CEST) Subject: [Uttk-Patches] 759: Make S::Iterate works with the Ruby loader. Message-ID: <20051012103752.08F4E527BF@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/759 Index: ChangeLog from Nicolas Pouillard Make S::Iterate works with the Ruby loader. * test/ruby-suite.rb: Use iterate without a hash. * lib/uttk/strategies/Block.rb: Move the symtbl_gsub of @test in the prologue like the others. * lib/uttk/strategies/Composite.rb: Add an . lib/uttk/strategies/Block.rb | 9 +++++---- lib/uttk/strategies/Composite.rb | 6 ++++++ test/ruby-suite.rb | 7 +------ 3 files changed, 12 insertions(+), 10 deletions(-) Index: test/ruby-suite.rb --- test/ruby-suite.rb (revision 758) +++ test/ruby-suite.rb (working copy) @@ -6,10 +6,5 @@ # test do # S::Import.new("Test <>") { import '<>' } # end - # FIXME This one should works too - # test(S::Import.new("Test <>") { import '<>' }) - test "Test <>" => { - :strategy => S::Import, - :import => '<>' - } + test(S::Import.new("Test <>") { import '<>' }) end Index: lib/uttk/strategies/Block.rb --- lib/uttk/strategies/Block.rb (revision 758) +++ lib/uttk/strategies/Block.rb (working copy) @@ -28,16 +28,17 @@ else raise ArgumentError, 'no block given' end + end + + + def prologue + super if @test.is_a?(String) str = @test.dup @test = lambda { eval str.do_symtbl_gsub(@symtbl) } end - end - - def prologue - super @result, @raised_exception = nil, nil end protected :prologue Index: lib/uttk/strategies/Composite.rb --- lib/uttk/strategies/Composite.rb (revision 758) +++ lib/uttk/strategies/Composite.rb (working copy) @@ -20,6 +20,12 @@ end + def initialize_copy ( aTest ) + super + aTest.contents = @contents.dup + end + + def initialize_test ( aTest ) aTest.wclass = @wclass end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051012/7147471b/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Wed Oct 12 09:33:28 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Wed, 12 Oct 2005 15:33:28 +0200 Subject: [Uttk-Patches] 758: Strategy#testify now dup itself. In-Reply-To: <20051012090859.CBBF8400E8@smtp.feydakins.org> References: <20051012090859.CBBF8400E8@smtp.feydakins.org> Message-ID: <840b875c0510120633jf639d43t16fa98e9322775b8@mail.gmail.com> On 10/12/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/uttk/trunk > > You can also view this changeset here: > > http://http://dev.uttk.org/repository/changesets/758 > > Index: ChangeLog > from Nicolas Pouillard > > Strategy#testify now dup itself. > > * lib/uttk/strategies/Strategy.rb: This partially fix the problem which > ran twice the same test, now the testification of a test duplicate it. > Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Wed Oct 12 09:30:52 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Wed, 12 Oct 2005 15:30:52 +0200 Subject: [Uttk-Patches] 756: A strategy instance cannot be run twice. In-Reply-To: <20051012084322.EEE41512DE@smtp.feydakins.org> References: <20051012084322.EEE41512DE@smtp.feydakins.org> Message-ID: <840b875c0510120630pd9aecd1g2f3db6153ea30db7@mail.gmail.com> On 10/12/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/uttk/trunk > > You can also view this changeset here: > > http://http://dev.uttk.org/repository/changesets/756 > > Index: ChangeLog > from Nicolas Pouillard > > A strategy instance cannot be run twice. > > * lib/uttk/strategies/Strategy.rb: Raise an error if the test was > already run. > Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sat Oct 15 05:59:43 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sat, 15 Oct 2005 11:59:43 +0200 (CEST) Subject: [Uttk-Patches] 761: Fix D::Basic*. Message-ID: <20051015095943.03CAA5DDF4@smtp1-g19.free.fr> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/761 Index: ChangeLog from Nicolas Pouillard Fix D::Basic*. * lib/uttk/dumpers/Basic.rb: Use b not block. * lib/uttk/dumpers/BasicColor.rb: Likewise, and use a more robust method for coloring. Basic.rb | 2 +- BasicColor.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) Index: lib/uttk/dumpers/Basic.rb --- lib/uttk/dumpers/Basic.rb (revision 760) +++ lib/uttk/dumpers/Basic.rb (working copy) @@ -13,7 +13,7 @@ def update ( *a, &b ) super - @io.puts "NOTIFICATION: #{a.inspect} block_given: #{not block.nil?}" + @io.puts "NOTIFICATION: #{a.inspect} block_given: #{not b.nil?}" end end # class Basic Index: lib/uttk/dumpers/BasicColor.rb --- lib/uttk/dumpers/BasicColor.rb (revision 760) +++ lib/uttk/dumpers/BasicColor.rb (working copy) @@ -21,11 +21,11 @@ super msg, path, node, options = a path = Logger::Path.new(path) unless path.nil? - @h.say "<%=color '#{msg.inspect.ljust(10)}', :red %> " + - "<%=color '#{path}', :green %> " + - "<%=color '#{node.inspect}', :magenta %> " + - "<%=color '#{options.inspect}', :yellow %> " + - "<%=color 'block_given: #{not block.nil?}', :cyan %>" + @h.say "#{@h.color msg.inspect.ljust(10), :red} " + + "#{@h.color path, :green} " + + "#{@h.color node.inspect, :magenta} " + + "#{@h.color options.inspect, :yellow} " + + "<%=color 'block_given: #{not b.nil?}', :cyan %>" end end # class BasicColor -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051015/d38eb967/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sat Oct 15 06:09:43 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sat, 15 Oct 2005 12:09:43 +0200 (CEST) Subject: [Uttk-Patches] 762: Minor fixes. Message-ID: <20051015100943.4DED25221A@smtp2-g19.free.fr> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://http://dev.uttk.org/repository/changesets/762 Index: ChangeLog from Nicolas Pouillard Minor fixes. * lib/uttk/generators/templates/strategy.yml: Remove the useless x name. * lib/uttk.rb: Import uri_ex. * bin/uttk: Simplify. bin/uttk | 7 ++----- lib/uttk.rb | 1 + lib/uttk/generators/templates/strategy.yml | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-) Index: lib/uttk/generators/templates/strategy.yml --- lib/uttk/generators/templates/strategy.yml (revision 761) +++ lib/uttk/generators/templates/strategy.yml (working copy) @@ -2,8 +2,7 @@ Test the <%= class_name %> strategy: !S::Suite contents: - good test 1: !S::RMatch - test: - x: !S::<%= class_name %> + test: !S::<%= class_name %> # ... match: - // # ... @@ -15,8 +14,7 @@ - // - bad test 1: !S::RMatch - test: - x: !S::<%= class_name %> + test: !S::<%= class_name %> # ... match: - // # ... Index: lib/uttk.rb --- lib/uttk.rb (revision 761) +++ lib/uttk.rb (working copy) @@ -68,6 +68,7 @@ RPath.import! Commands.import! Version.import! + UriEx.import! # Mother exception of every exception thrown by Uttk. class UttkException < Exception Index: bin/uttk --- bin/uttk (revision 761) +++ bin/uttk (working copy) @@ -43,11 +43,8 @@ opts[:cache_mode] ||= true end - log_factory = Uttk.default_log_factory(opts) - log = Uttk.default_log(opts, log_factory) - - symtbl = Uttk.default_symtbl(opts, log_factory, log).new_child - symtbl.update(opts.merge(:loader => opts[:loader].new)) + symtbl = Uttk.default_symtbl(opts).new_child + log = symtbl[:log] if opts[:input].nil? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051015/19cc6d7f/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sat Oct 15 06:05:43 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sat, 15 Oct 2005 12:05:43 +0200 Subject: [Uttk-Patches] 761: Fix D::Basic*. In-Reply-To: <20051015095943.03CAA5DDF4@smtp1-g19.free.fr> References: <20051015095943.03CAA5DDF4@smtp1-g19.free.fr> Message-ID: <840b875c0510150305h3a6679ackdd80400790f0900c@mail.gmail.com> On 10/15/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/uttk/trunk > > You can also view this changeset here: > > http://http://dev.uttk.org/repository/changesets/761 > > Index: ChangeLog > from Nicolas Pouillard > > Fix D::Basic*. > > * lib/uttk/dumpers/Basic.rb: Use b not block. > * lib/uttk/dumpers/BasicColor.rb: Likewise, and use a more robust > method for coloring. Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sat Oct 15 07:13:33 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sat, 15 Oct 2005 13:13:33 +0200 Subject: [Uttk-Patches] 762: Minor fixes. In-Reply-To: <20051015100943.4DED25221A@smtp2-g19.free.fr> References: <20051015100943.4DED25221A@smtp2-g19.free.fr> Message-ID: <840b875c0510150413t77afa3a7l5cf292d694dbfbac@mail.gmail.com> On 10/15/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/uttk/trunk > > You can also view this changeset here: > > http://http://dev.uttk.org/repository/changesets/762 > > Index: ChangeLog > from Nicolas Pouillard > > Minor fixes. > > * lib/uttk/generators/templates/strategy.yml: Remove the useless x name. > * lib/uttk.rb: Import uri_ex. > * bin/uttk: Simplify. > Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sat Oct 22 20:18:09 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 23 Oct 2005 02:18:09 +0200 (CEST) Subject: [Uttk-Patches] [UttkOnRails]: 6: Setup the environement. Message-ID: <20051023001809.8E9BE93F09@smtp.feydakins.org> svn://svn.feydakins.org/uttk_on_rails/trunk Index: ChangeLog from Nicolas Pouillard Setup the environement. * config/environment.rb: Add the Uttk require. * app/controllers/application.rb, config/routes.rb, * public/dispatch.cgi, public/dispatch.rb, public/dispatch.fcgi: Minor updates. app/controllers/application.rb | 7 +++ config/environment.rb | 80 +++++++++++++++++++++++++++++++++++++++++ config/routes.rb | 6 --- public/dispatch.cgi | 2 - public/dispatch.fcgi | 2 - public/dispatch.rb | 5 -- 6 files changed, 90 insertions(+), 12 deletions(-) Index: app/controllers/application.rb --- app/controllers/application.rb (revision 5) +++ app/controllers/application.rb (working copy) @@ -1,4 +1,9 @@ +require 'user_system' # Filters added to this controller will be run for all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base -end \ No newline at end of file + include UserSystem + helper :user + model :user + before_filter :login_required +end # class ApplicationController Index: config/routes.rb --- config/routes.rb (revision 5) +++ config/routes.rb (working copy) @@ -1,19 +1,15 @@ ActionController::Routing::Routes.draw do |map| # Add your own custom routes here. # The priority is based upon order of creation: first created -> highest priority. - # Here's a sample route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action - # You can have the root of your site routed by hooking up '' # -- just remember to delete public/index.html. - # map.connect '', :controller => "welcome" - + map.connect '', :controller => "admin" # Allow downloading Web Service WSDL as a file with an extension # instead of a file named 'wsdl' map.connect ':controller/service.wsdl', :action => 'wsdl' - # Install the default route as the lowest priority. map.connect ':controller/:action/:id' end Index: config/environment.rb --- config/environment.rb (revision 5) +++ config/environment.rb (working copy) @@ -4,6 +4,23 @@ # (Use only when you can't set environment variables through your web/app server) # ENV['RAILS_ENV'] = 'production' +require 'pathname' +config = Pathname.new(__FILE__).dirname.parent +vendor = config.parent + 'vendor' +unless defined? Uttk + $CORE_EX_VENDORS ||= [] + $CORE_EX_VENDORS << vendor + file = vendor + 'uttk' + 'lib' + 'uttk.rb' + if file.exist? + require file.to_s + else + require 'rubygems' + require_gem 'uttk' + require 'uttk' + end +end +Uttk.import! + # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') @@ -49,3 +66,66 @@ # end # Include your application configuration below \ No newline at end of file + +Dependencies.mechanism = :require +ActionMailer::Base.server_settings = { + :address => "smtp.feydakins.org", + :port => 25, + :domain => "feydakins.org", + # :user_name => "", + # :password => "", + # :authentication => :login +} +PathList[RAILS_ROOT.to_path + '{app/controllers,components}'].load_path! +# Include your app's configuration here: +require 'environments/user_environment' +# class << URI +# alias parse2 parse +# def parse(*args) + # p "URI.parse" + # p args + # begin + # result = parse2(*args) + # p result + # result + # rescue Exception => ex + # p "ERROR #{ex}" + # raise ex + # end + # # raise args.inspect + # # breakpoint +# end +# end +# p URI.parse('/admin') +# Object.const_set :URI, VerboseObject.new(URI) +class XHtml < TTK::Dumpers::Html::XmlMarkup + class Helpers + include ActionView::Helpers::TagHelper + include ActionView::Helpers::UrlHelper + include ActionView::Helpers::FormHelper + include ActionView::Helpers::FormTagHelper + def initialize ( controller ) + @controller = controller + end + end + def initialize ( opts ) + opts[:indent] ||= 2 + @helpers = Helpers.new(opts[:controller]) + super(opts) + end + def form_tag ( *a, &b ) + start_form_tag(*a) + _nested_structures(b) unless b.nil? + end_form_tag + end + def method_missing ( m, *a, &b ) + if @helpers.respond_to? m + ihtml! @helpers.send(m, *a, &b) + else + super + end + end +end +# TTK::Strategies::Cmd.to_form(XHtml.new(:target => STDERR, :controller => AutoObject.new)) +# STDERR.puts +# exit Index: public/dispatch.cgi --- public/dispatch.cgi (revision 5) +++ public/dispatch.cgi (working copy) @@ -1,4 +1,4 @@ -#!/usr/bin/ruby18 +#!/usr/bin/env ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) Index: public/dispatch.rb --- public/dispatch.rb (revision 5) +++ public/dispatch.rb (working copy) @@ -1,10 +1,7 @@ -#!/usr/bin/ruby18 - +#!/usr/bin/env ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) - # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired require "dispatcher" - ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun) Dispatcher.dispatch \ No newline at end of file Index: public/dispatch.fcgi --- public/dispatch.fcgi (revision 5) +++ public/dispatch.fcgi (working copy) @@ -1,4 +1,4 @@ -#!/usr/bin/ruby18 +#!/usr/bin/env ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051023/905233e3/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sat Oct 22 22:57:59 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sun, 23 Oct 2005 04:57:59 +0200 (CEST) Subject: [Uttk-Patches] [UttkOnRails]: 8: Add a new admin controller. Message-ID: <20051023025759.748A89421F@smtp.feydakins.org> svn://svn.feydakins.org/uttk_on_rails/trunk Index: ChangeLog from Nicolas Pouillard Add a new admin controller. * app/controllers/admin_controller.rb: New. * test/functional/admin_controller_test.rb: New. * app/helpers/admin_helper.rb: New. * app/views/admin/index.rhtml: New. * config/environment.rb: Activate Uttk. * log/test.log: Remove. * log/development.log: Remove. * log/production.log: Remove. * log/server.log: Remove. app/controllers/admin_controller.rb | 119 +++++++++++++++++++++++++++++++ app/helpers/admin_helper.rb | 2 app/views/admin/index.rhtml | 3 config/environment.rb | 93 +++++++++++------------- test/functional/admin_controller_test.rb | 18 ++++ 5 files changed, 187 insertions(+), 48 deletions(-) Index: test/functional/admin_controller_test.rb --- test/functional/admin_controller_test.rb (revision 0) +++ test/functional/admin_controller_test.rb (revision 0) @@ -0,0 +1,18 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'admin_controller' + +# Re-raise errors caught by the controller. +class AdminController; def rescue_action(e) raise e end; end + +class AdminControllerTest < Test::Unit::TestCase + def setup + @controller = AdminController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + # Replace this with your real tests. + def test_truth + assert true + end +end Property changes on: test/functional/admin_controller_test.rb ___________________________________________________________________ Name: svn:keywords + Id Index: app/helpers/admin_helper.rb --- app/helpers/admin_helper.rb (revision 0) +++ app/helpers/admin_helper.rb (revision 0) @@ -0,0 +1,2 @@ +module AdminHelper +end Property changes on: app/helpers/admin_helper.rb ___________________________________________________________________ Name: svn:keywords + Id Index: app/controllers/admin_controller.rb --- app/controllers/admin_controller.rb (revision 0) +++ app/controllers/admin_controller.rb (revision 0) @@ -0,0 +1,119 @@ +class Object + def default_instance ( *args, &block ) + if block + raise "Too many arguments" unless args.empty? + @default_instance = block + nil + elsif args.size == 1 + value = args.first + @default_instance = proc { value.try_dup } + nil + elsif args.size.zero? + (@default_instance.is_a? Proc)? @default_instance[] : @default_instance + else + raise "Too many arguments" + end + end + def to_gfx_element + GfxElements::None.new + end +end +class String + default_instance '' + def to_gfx_element + GfxElements::TextField.new(:default => self) + end +end +class Array + default_instance [] + def to_gfx_element + GfxElements::Select.new(:choices => map { |x| x.to_s }) + end +end +class Module + default_instance Kernel + def to_gfx_element + GfxElements::Select.new(:choices => constants.map { |x| x.to_s }) + end +end +class Class + default_instance Object + def to_gfx_element + mod = name.sub(/::[^:]*$/, '').constantize + subclasses = mod.constants.find_all do |x| + "#{mod}::#{x}".constantize.ancestors.include? self + end + GfxElements::Select.new :choices => subclasses + end +end +class TrueClass + default_instance true + def to_gfx_element + GfxElements::CheckBox.new(:checked => true) + end +end # class TrueClass +class FalseClass + default_instance false + def to_gfx_element + GfxElements::CheckBox.new(:checked => false) + end +end # class TrueClass +# module ActionView +# +# module Helpers + class TagBuilder < ActionView::Helpers::InstanceTag + def initialize ( value, gfx ) + @value = value + super(gfx.object, gfx.attribute.name, gfx.builder) + end + attr_reader :value + alias_method :value_before_type_cast, :value + end # class TagBuilder +# end # module Helpers +# +# end # module ActionView +module GfxElements + class Gfx + attr_accessor :builder, :attribute, :object + def initialize ( opts=nil ) + return if opts.nil? + opts.each do |k, v| + next unless respond_to? "#{k}=" + send("#{k}=", v) + end + end + def to_form ( str ) + @builder.ihtml! str + end + end # class Gfx + class None < Gfx + def to_form + @builder.bold { @builder.itext! 'GfxElements::None: ' + @attribute.inspect } + end + end # class None + class TextField < Gfx + def to_form + super TagBuilder.new(@default, self).to_input_field_tag('text') + end + end # class TextField + class CheckBox < Gfx + attr_accessor :checked + def to_form + super TagBuilder.new(@checked, self).to_check_box_tag({}, "1", "0") + end + end # class CheckBox + class Select < Gfx + attr_accessor :choices + def to_form + super TagBuilder.new(@choices.first, self).to_select_tag(@choices, {}, {}) + end + end # class Select +end # module GfxElements +class AdminController < ApplicationController + def index + @test = AutoObject.new + @result = '' + Uttk::Strategies::Cmd.to_form(XHtml.new(:target => @result, :controller => AutoObject.new)) + logger.info { @result } + end +end Property changes on: app/controllers/admin_controller.rb ___________________________________________________________________ Name: svn:keywords + Id Index: app/views/admin/index.rhtml --- app/views/admin/index.rhtml (revision 0) +++ app/views/admin/index.rhtml (revision 0) @@ -0,0 +1,3 @@ + + <%= @result %> + Index: config/database.yml Index: config/environment.rb --- config/environment.rb (revision 7) +++ config/environment.rb (working copy) @@ -4,22 +4,22 @@ # (Use only when you can't set environment variables through your web/app server) # ENV['RAILS_ENV'] = 'production' -# require 'pathname' -# config = Pathname.new(__FILE__).dirname.parent -# vendor = config.parent + 'vendor' -# unless defined? Uttk - # $CORE_EX_VENDORS ||= [] - # $CORE_EX_VENDORS << vendor - # file = vendor + 'uttk' + 'lib' + 'uttk.rb' - # if file.exist? - # require file.to_s - # else - # require 'rubygems' - # require_gem 'uttk' - # require 'uttk' - # end -# end -# Uttk.import! +require 'pathname' +config = Pathname.new(__FILE__).dirname.parent +vendor = config.parent + 'vendor' +unless defined? Uttk + $CORE_EX_VENDORS ||= [] + $CORE_EX_VENDORS << vendor + file = vendor + 'uttk' + 'lib' + 'uttk.rb' + if file.exist? + require file.to_s + else + require 'rubygems' + require_gem 'uttk' + require 'uttk' + end +end +Uttk.import! # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') @@ -67,7 +67,7 @@ # Include your application configuration below -Dependencies.mechanism = :require +# Dependencies.mechanism = :require ActionMailer::Base.server_settings = { :address => "smtp.feydakins.org", :port => 25, @@ -98,34 +98,31 @@ # end # p URI.parse('/admin') # Object.const_set :URI, VerboseObject.new(URI) -# class XHtml < TTK::Dumpers::Html::XmlMarkup - # class Helpers - # include ActionView::Helpers::TagHelper - # include ActionView::Helpers::UrlHelper - # include ActionView::Helpers::FormHelper - # include ActionView::Helpers::FormTagHelper - # def initialize ( controller ) - # @controller = controller - # end - # end - # def initialize ( opts ) - # opts[:indent] ||= 2 - # @helpers = Helpers.new(opts[:controller]) - # super(opts) - # end - # def form_tag ( *a, &b ) - # start_form_tag(*a) - # _nested_structures(b) unless b.nil? - # end_form_tag - # end - # def method_missing ( m, *a, &b ) - # if @helpers.respond_to? m - # ihtml! @helpers.send(m, *a, &b) - # else - # super - # end - # end -# end -# TTK::Strategies::Cmd.to_form(XHtml.new(:target => STDERR, :controller => AutoObject.new)) -# STDERR.puts -# exit +class XHtml < Uttk::Dumpers::Html::XmlMarkup + class Helpers + include ActionView::Helpers::TagHelper + include ActionView::Helpers::UrlHelper + include ActionView::Helpers::FormHelper + include ActionView::Helpers::FormTagHelper + def initialize ( controller ) + @controller = controller + end + end + def initialize ( opts ) + opts[:indent] ||= 2 + @helpers = Helpers.new(opts[:controller]) + super(opts) + end + def form_tag ( *a, &b ) + start_form_tag(*a) + _nested_structures(b) unless b.nil? + end_form_tag + end + def method_missing ( m, *a, &b ) + if @helpers.respond_to? m + ihtml! @helpers.send(m, *a, &b) + else + super + end + end +end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051023/6c92987d/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Tue Oct 25 20:05:57 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 26 Oct 2005 02:05:57 +0200 (CEST) Subject: [Uttk-Patches] 763: Update generators. Message-ID: <20051026000557.3B50858C19@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://dev.uttk.org/repository/changesets/763 Index: ChangeLog from Nicolas Pouillard * lib/uttk/generators/dumper_generator.rb, * lib/uttk/generators/generator.rb, * lib/uttk/generators/strategy_generator.rb, * lib/uttk/generators/filter_generator.rb, * lib/uttk/generators/templates/generator.rb, * lib/uttk/generators/loader_generator.rb, * lib/uttk/generators/templates/filter.rb: Rename runit to unit. * lib/uttk/generators/templates/dumper.rb: Likewise. emove the update method for these templates. dumper_generator.rb | 4 ++-- filter_generator.rb | 4 ++-- generator.rb | 6 +----- loader_generator.rb | 4 ++-- strategy_generator.rb | 2 +- templates/dumper.rb | 7 ------- templates/filter.rb | 7 ------- templates/generator.rb | 4 ++-- 8 files changed, 10 insertions(+), 28 deletions(-) Index: lib/uttk/generators/dumper_generator.rb --- lib/uttk/generators/dumper_generator.rb (revision 762) +++ lib/uttk/generators/dumper_generator.rb (working copy) @@ -13,11 +13,11 @@ # Source and test directories. m.directory root/lib/uttk/dumpers - m.directory root/test/runit/dumpers + m.directory root/test/unit/dumpers # Source and test templates. m.template 'dumper.rb', root/lib/uttk/dumpers/"#{class_name}.rb" - m.template 'unit_test.rb', root/test/runit/dumpers/"#{file_name}_test.rb" + m.template 'unit_test.rb', root/test/unit/dumpers/"#{file_name}_test.rb" end end Index: lib/uttk/generators/generator.rb --- lib/uttk/generators/generator.rb (revision 762) +++ lib/uttk/generators/generator.rb (working copy) @@ -34,15 +34,11 @@ @root = '.'.to_path end - %w[ lib uttk test runit + %w[ lib uttk test unit functional strategies loaders filters dumpers generators ].each do |name| define_method(name) { name } end - def functional - 'functional' - end - attr_reader :root, :fullname, :email, :year def dir_name Index: lib/uttk/generators/strategy_generator.rb --- lib/uttk/generators/strategy_generator.rb (revision 762) +++ lib/uttk/generators/strategy_generator.rb (working copy) @@ -13,7 +13,7 @@ # Source and test directories. m.directory root/lib/uttk/strategies - m.directory root/test/runit/strategies + m.directory root/test/unit/strategies # Source and test templates. m.template 'strategy.rb', root/lib/uttk/strategies/"#{class_name}.rb" Index: lib/uttk/generators/filter_generator.rb --- lib/uttk/generators/filter_generator.rb (revision 762) +++ lib/uttk/generators/filter_generator.rb (working copy) @@ -13,11 +13,11 @@ # Source and test directories. m.directory root/lib/uttk/filters - m.directory root/test/runit/filters + m.directory root/test/unit/filters # Source and test templates. m.template 'filter.rb', root/lib/uttk/filters/"#{class_name}.rb" - m.template 'unit_test.rb', root/test/runit/filters/"#{file_name}_test.rb" + m.template 'unit_test.rb', root/test/unit/filters/"#{file_name}_test.rb" end end Index: lib/uttk/generators/templates/filter.rb --- lib/uttk/generators/templates/filter.rb (revision 762) +++ lib/uttk/generators/templates/filter.rb (working copy) @@ -43,13 +43,6 @@ end protected :close - - def update ( *a, &b ) - # ... - super - # ... - end - end # class <%= class_name %> end # module Filters Index: lib/uttk/generators/templates/generator.rb --- lib/uttk/generators/templates/generator.rb (revision 762) +++ lib/uttk/generators/templates/generator.rb (working copy) @@ -13,11 +13,11 @@ # Source and test directories. m.directory root/lib/uttk/<%= dir_name %> - m.directory root/test/runit/<%= dir_name %> + m.directory root/test/unit/<%= dir_name %> # Source and test templates. m.template '<%= file_name %>.rb', root/lib/uttk/<%= dir_name %>/"#{class_name}.rb" - m.template 'unit_test.rb', root/test/runit/<%= dir_name %>/"#{file_name}_test.rb" + m.template 'unit_test.rb', root/test/unit/<%= dir_name %>/"#{file_name}_test.rb" end end Index: lib/uttk/generators/templates/dumper.rb --- lib/uttk/generators/templates/dumper.rb (revision 762) +++ lib/uttk/generators/templates/dumper.rb (working copy) @@ -43,13 +43,6 @@ end protected :close - - def update ( *a, &b ) - # ... - super - # ... - end - end # class <%= class_name %> end # module Dumpers Index: lib/uttk/generators/loader_generator.rb --- lib/uttk/generators/loader_generator.rb (revision 762) +++ lib/uttk/generators/loader_generator.rb (working copy) @@ -13,11 +13,11 @@ # Source and test directories. m.directory root/lib/uttk/loaders - m.directory root/test/runit/loaders + m.directory root/test/unit/loaders # Source and test templates. m.template 'loader.rb', root/lib/uttk/loaders/"#{class_name}.rb" - m.template 'unit_test.rb', root/test/runit/loaders/"#{file_name}_test.rb" + m.template 'unit_test.rb', root/test/unit/loaders/"#{file_name}_test.rb" end end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051026/77074e0c/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Tue Oct 25 20:39:00 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 26 Oct 2005 02:39:00 +0200 (CEST) Subject: [Uttk-Patches] 764: Improve the --include (-I) behavior. Message-ID: <20051026003900.DE043948C4@smtp.feydakins.org> svn://svn.feydakins.org/uttk/trunk You can also view this changeset here: http://dev.uttk.org/repository/changesets/764 Index: ChangeLog from Nicolas Pouillard * bin/getopts/uttk.rb: With -I you now specify another root for Uttk with modules directories (strategies, filters, dumpers...). * lib/uttk.rb: Adapt uttk_module. * lib/js, lib/uttk/uttk: Remove. Empty and useless. * vcs/uttk.rb: Fix the COLLABOA constant. bin/getopts/uttk.rb | 20 ++++++++------------ lib/uttk.rb | 18 ++++++++++++------ vcs/uttk.rb | 2 +- 3 files changed, 21 insertions(+), 19 deletions(-) Index: bin/getopts/uttk.rb --- bin/getopts/uttk.rb (revision 763) +++ bin/getopts/uttk.rb (working copy) @@ -71,23 +71,19 @@ end end + optparser.on('-I', + '--include PATH', + 'Add PATH to root path (PATH/strategies, ' + + 'PATH/filters...)') do |aPath| + ::Uttk.load_path += aPath.split(':').map { |x| x.to_path } + ::Uttk::Strategies.setup_autoload + end + ### Strategy options optparser.separator '' optparser.separator 'Strategy options:' - optparser.on('-I', - '--include PATH', - 'Set PATH for test strategy classes') do |aPath| - Strategies.module_eval do - aPath.split(':').each do |aPath| - autoload_tree(aPath, false) do |p| - ::Uttk.pathname_to_class(p) - end - end - end - end - optparser.on('--strategy-list', 'List all test strategy classes') do pp_class_hierarchy('Strategies::Strategy') exit Index: lib/uttk.rb --- lib/uttk.rb (revision 763) +++ lib/uttk.rb (working copy) @@ -40,8 +40,9 @@ $LOADED_FEATURES << 'uttk.rb' lib.load_path! RubyEx.import! - mattr_accessor :dir + mattr_accessor :dir, :load_path self.dir = lib + 'uttk' + self.load_path = [dir] suppress(LoadError) { silence_warnings { core_ex_require 'action_view', 'actionpack' } } @@ -96,18 +97,23 @@ class ::Module def uttk_module module_eval do - def self.module_dir - @@module_dir ||= {} - @@module_dir[self] ||= Uttk.dir + name.split(/::/).last.downcase + def self.module_dirs + mod = name.demodulize.underscore + Uttk.load_path.map { |path| path/mod } end + def self.setup_autoload + module_dirs.each do |module_dir| autoload_tree(module_dir, false) do |p| Uttk.pathname_to_class(p) end + end + end + setup_autoload def self.each_module_name ( &block ) - Pathname.glob(module_dir + '**/*.rb') do |path| - block[path.basename.extsplit.first.to_s.to_sym] + Pathname.glob('{' + module_dirs.join(',') + '}/**/*.rb') do |path| + block[path.basename.ext.to_s.to_sym] end end Index: vcs/uttk.rb --- vcs/uttk.rb (revision 763) +++ vcs/uttk.rb (working copy) @@ -3,7 +3,7 @@ # See http://rubyforge.org/projects/vcs # and http://vcs.rubyforge.org - COLLABOA = 'http://dev.uttk.org' + COLLABOA = 'dev.uttk.org' protocol_version '0.1' -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051026/30aebc85/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Wed Oct 26 02:15:02 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Wed, 26 Oct 2005 08:15:02 +0200 Subject: [Uttk-Patches] 763: Update generators. In-Reply-To: <20051026000557.3B50858C19@smtp.feydakins.org> References: <20051026000557.3B50858C19@smtp.feydakins.org> Message-ID: <840b875c0510252315o37185919kc88f6a4b564c5ec8@mail.gmail.com> On 10/26/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/uttk/trunk > > You can also view this changeset here: > > http://dev.uttk.org/repository/changesets/763 > > Index: ChangeLog > from Nicolas Pouillard > > * lib/uttk/generators/dumper_generator.rb, > * lib/uttk/generators/generator.rb, > * lib/uttk/generators/strategy_generator.rb, > * lib/uttk/generators/filter_generator.rb, > * lib/uttk/generators/templates/generator.rb, > * lib/uttk/generators/loader_generator.rb, > * lib/uttk/generators/templates/filter.rb: Rename runit to unit. > > * lib/uttk/generators/templates/dumper.rb: Likewise. > emove the update method for these templates. > Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Wed Oct 26 02:16:05 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Wed, 26 Oct 2005 08:16:05 +0200 Subject: [Uttk-Patches] 764: Improve the --include (-I) behavior. In-Reply-To: <20051026003900.DE043948C4@smtp.feydakins.org> References: <20051026003900.DE043948C4@smtp.feydakins.org> Message-ID: <840b875c0510252316x4ce03741ha552e1745b0dabdd@mail.gmail.com> On 10/26/05, Nicolas Pouillard wrote: > > svn://svn.feydakins.org/uttk/trunk > > You can also view this changeset here: > > http://dev.uttk.org/repository/changesets/764 > > Index: ChangeLog > from Nicolas Pouillard > > * bin/getopts/uttk.rb: With -I you now specify another root for Uttk > with modules directories (strategies, filters, dumpers...). > * lib/uttk.rb: Adapt uttk_module. > * lib/js, lib/uttk/uttk: Remove. Empty and useless. > * vcs/uttk.rb: Fix the COLLABOA constant. > Ok. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 26 08:35:45 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 26 Oct 2005 14:35:45 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 409: Add Proc#instance_call. Message-ID: <20051026123545.BE01252293@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard * lib/core_ex/proc.rb: Add instance_call, a magic version of call that use instance_eval(_with_args) when arguments are ok for this. Add a bunch of unit tests. * lib/dumpable_proc.rb: Remove this silly, because unefficient and wrong verification. * lib/core_ex/string.rb: Add to_proc, and to_uri. core_ex/proc.rb | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ core_ex/string.rb | 9 ++++++ dumpable_proc.rb | 9 ------ 3 files changed, 88 insertions(+), 9 deletions(-) Index: lib/dumpable_proc.rb --- lib/dumpable_proc.rb (revision 408) +++ lib/dumpable_proc.rb (working copy) @@ -7,15 +7,6 @@ class DumpableProc < Proc def self.new ( str ) - # FIXME imporve prevent from ruby injections - if str =~ /[{}]/ - str = str.gsub(/[^{}]/, '') - while str.gsub!(/\{\}/, '') - end - unless str.empty? - raise ArgumentError, "Bad block: bad `{' `}' equilibration" - end - end pr = super(&eval("proc { #{str} }")) pr.instance_eval { @str = str.freeze } pr Index: lib/core_ex/proc.rb --- lib/core_ex/proc.rb (revision 408) +++ lib/core_ex/proc.rb (working copy) @@ -8,6 +8,12 @@ module Proc + class ArityError < ArgumentError + def initialize + super("Bad number of arguments") + end + end # class ArityError + setup do have YamlExtension end @@ -28,6 +34,27 @@ to_s end + def to_proc + self + end + + def instance_call ( anObject, *args, &block ) + argc = args.size + case arity + when 1 + argc + call(anObject, *args, &block) + when argc, -1 + raise ArgumentError, "No block needed" if block + anObject.instance_eval_with_args(*args, &self) + else + if arity < 0 and argc >= arity.abs - 2 + call(anObject, *args, &block) + else + raise ArityError + end + end + end + module ClassMethods def yaml_load ( val ) DumpableProc.new(val.to_s) @@ -47,6 +74,15 @@ method(:teardown).to_proc => __LINE__, TestProc.instance_method(:setup).bind(self).to_proc => __LINE__ } + mock_args = @mock_args = [] + @m_ = proc { mock_args << [:_, object_id] } + @m_0 = proc { || mock_args << [:'0', object_id] } + @m_as = proc { |*a| mock_args << [:as, a, object_id] } + @m_a_bs = proc { |a, *b| mock_args << [:a_bs, a, b, object_id] } + @m_a = proc { |a| mock_args << [:a, a, object_id] } + @m_a_b = proc { |a, b| mock_args << [:a_b, a, b, object_id] } + @m_a_b_c = proc { |a, b, c| mock_args << [:a_b_c, a, b, c, object_id] } + @m_procs = [@m_, @m_0, @m_as, @m_a_bs, @m_a, @m_a_b, @m_a_b_c] end def teardown @@ -70,6 +106,49 @@ assert_equal(10, @val[]) end + def assert_instance_call ( ref, proc, args ) + assert_nothing_raised do + begin + proc.instance_call(*args) + rescue Proc::ArityError => ex + assert_equal :ArityError, ref + assert_equal [], @mock_args + return + end + end + assert_equal ref, @mock_args.shift + assert_equal [], @mock_args + end + + def test_instance_call + a, b, c = 'a', 'b', 'c' + ai, bi, ci, si = a.object_id, b.object_id, c.object_id, object_id + + assert_instance_call [:_, ai], @m_, [a] + assert_instance_call [:'0', ai], @m_0, [a] + assert_instance_call [:as, [], ai], @m_as, [a] + assert_instance_call [:a_bs, a, [], si], @m_a_bs, [a] + assert_instance_call [:a, a, si], @m_a, [a] + assert_instance_call :ArityError, @m_a_b, [a] + assert_instance_call :ArityError, @m_a_b_c, [a] + + assert_instance_call [:_, ai], @m_, [a, b] + assert_instance_call :ArityError, @m_0, [a, b] + assert_instance_call [:as, [b], ai], @m_as, [a, b] + assert_instance_call [:a_bs, a, [b], si], @m_a_bs, [a, b] + assert_instance_call [:a, b, ai], @m_a, [a, b] + assert_instance_call [:a_b, a, b, si], @m_a_b, [a, b] + assert_instance_call :ArityError, @m_a_b_c, [a, b] + + assert_instance_call [:_, ai], @m_, [a, b, c] + assert_instance_call :ArityError, @m_0, [a, b, c] + assert_instance_call [:as, [b, c], ai], @m_as, [a, b, c] + assert_instance_call [:a_bs, a, [b, c], si], @m_a_bs, [a, b, c] + assert_instance_call :ArityError, @m_a, [a, b, c] + assert_instance_call [:a_b, b, c, ai], @m_a_b, [a, b, c] + assert_instance_call [:a_b_c, a, b, c, si], @m_a_b_c, [a, b, c] + end + end # class TestProc end Index: lib/core_ex/string.rb --- lib/core_ex/string.rb (revision 408) +++ lib/core_ex/string.rb (working copy) @@ -34,6 +34,15 @@ ::Pathname.new(self) end + def to_uri + URI.parse(self) + end + alias_method :to_url, :to_uri + + def to_proc + DumpableProc.new(self) + end + def rec_fold ( init, &block ) if include? "\n" super -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051026/43630d88/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 26 14:10:26 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 26 Oct 2005 20:10:26 +0200 (CEST) Subject: [Uttk-Patches] [core_ex] 410: Add YAML.load_from_io a stream based YAML loader. Message-ID: <20051026181026.C49B1952DE@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk/core_ex Index: ChangeLog from Nicolas Pouillard * lib/core_ex/yaml.rb: It reads the IO with each_line and call the block with each document. yaml.rb | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+) Index: lib/core_ex/yaml.rb --- lib/core_ex/yaml.rb (revision 409) +++ lib/core_ex/yaml.rb (working copy) @@ -11,6 +11,26 @@ end # module CoreEx + +module YAML + + module_function + + def load_from_io ( io, &block ) + buffer = '' + io.each_line do |line| + if not buffer.empty? and line =~ /^---/ + block[YAML.load(buffer)] + buffer = '' + else + buffer += line + end + end + end + +end # module YAML + + class Regexp have YamlExtension, :re -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051026/2eb044ac/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 26 14:58:04 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Wed, 26 Oct 2005 20:58:04 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 411: Add triggers to Symbol Tables. Message-ID: <20051026185804.2635294238@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard * lib/sym_tbl.rb: You can now but trigger block in the symtbl, when corresponding key will be access it will class the trigger. sym_tbl.rb | 6 ++++++ 1 files changed, 6 insertions(+) Index: lib/sym_tbl.rb --- lib/sym_tbl.rb (revision 410) +++ lib/sym_tbl.rb (working copy) @@ -31,6 +31,7 @@ def [] ( aKey ) return nil if aKey == '' aKey = key_convert(aKey) + result = if @local.has_key? aKey @local[aKey] elsif @father.nil? @@ -38,6 +39,8 @@ else @father[aKey] end + result = result[] if result.is_a? Trigger + result end def []= ( aKey, aValue ) @@ -110,6 +113,9 @@ self.class.new(self) end + class Trigger < Proc + end # class Trigger + end # class SymTbl -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051026/92ce3acc/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Wed Oct 26 19:01:37 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Thu, 27 Oct 2005 01:01:37 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 412: Check the argument of do_symtbl_gsub. Message-ID: <20051026230137.304DF954BC@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard * lib/sym_tbl_gsub.rb: Update. sym_tbl_gsub.rb | 3 +++ 1 files changed, 3 insertions(+) Index: lib/sym_tbl_gsub.rb --- lib/sym_tbl_gsub.rb (revision 411) +++ lib/sym_tbl_gsub.rb (working copy) @@ -12,6 +12,9 @@ end def do_symtbl_gsub ( symtbl ) + unless symtbl.is_a? SymTbl + raise ArgumentError, "need a SymTbl not: #{symtbl.inspect}" + end result = symtbl_gsub(symtbl) return (result.nil?)? self : result end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051027/af88aad8/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Thu Oct 27 10:33:13 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Thu, 27 Oct 2005 16:33:13 +0200 (MEST) Subject: [Uttk-Patches] 765: Fix a bug with -S. Message-ID: <20051027143313.C81F2268B0@pm-mx2.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://dev.uttk.org/repository/changesets/765 Index: ChangeLog from Nicolas Desprès Fix a bug with -S. * bin/getopts/uttk.rb: Do not use a Uttk loader to load attributes and symbols since they are not strategies. * test/pkg/cmdline.yml: Test this issue. bin/getopts/uttk.rb | 4 ++-- test/pkg/cmdline.yml | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) Index: bin/getopts/uttk.rb --- bin/getopts/uttk.rb (revision 764) +++ bin/getopts/uttk.rb (working copy) @@ -253,14 +253,14 @@ optparser.on('-S', '--symbols symbols', 'Add a hash of symbols to the root test suite') do |str| - opts[:symbols] = opts[:loader].new.load(str) + opts[:symbols] = YAML.load(str) end optparser.on('-A', '--attributes attributes', 'Add a hash of attributes to ' + 'the root test suite') do |aString| - opts[:attributes] = opts[:loader].new.load(aString) + opts[:attributes] = YAML.load(aString) end optparser.on('-C', '--[no-]cache', 'Keep the test in cache') do |c| Index: test/pkg/cmdline.yml --- test/pkg/cmdline.yml (revision 764) +++ test/pkg/cmdline.yml (working copy) @@ -60,3 +60,21 @@ output: !re | ^Uttk::Filters classes hierarchy: /Filter/ + + - Symbol option: + args: | + -L Ruby -F Yaml -S '{ foo: bar }' + input: | + S::Stub.new("stub") do + returned_value({ :foo => "<>" }) + end + output: | + --- + root: !S::Suite + symbols: + foo: bar + contents: + - stub: !S::Stub + foo: bar + status: PASS + status: PASS -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051027/c821d174/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sat Oct 29 14:09:34 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sat, 29 Oct 2005 20:09:34 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex] 413: Generalize the header system. Message-ID: <20051029180934.C8ACE955FB@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Generalize the header system. * lib/sendmail.rb: All headers given as argument are now merged. Fields like To, From, Subject, etc. are now picked from the header table. This allow a more customizable mail generation. sendmail.rb | 28 ++++++++++++++++------------ 1 files changed, 16 insertions(+), 12 deletions(-) Index: lib/sendmail.rb --- lib/sendmail.rb (revision 412) +++ lib/sendmail.rb (working copy) @@ -19,18 +19,24 @@ full_name = (defined? FULLNAME)? FULLNAME : ENV['FULLNAME'] full_email = (defined? FULL_EMAIL)? FULL_EMAIL : "#{full_name} <#{email}>" options = OpenStruct.new( - :from_name => full_email, :from => email, :to => [], :server => ENV['SMTPSERVER'] || 'localhost:25', - :header => {}, + :header => { :From => full_email }, :body => STDIN ) string_args, hash_args = args.partition { |x| x.is_a?(String) } hash_args.each do |hash| raise ArgumentError, "Bad argument #{hash}" unless hash.is_a?(Hash) + hash[:header] = YAML.load(hash[:header]) if hash[:header].is_a? String + options.header[:Subject] = hash[:subject] if hash[:subject] hash.each do |k,v| - options.send("#{k}=", v) + x = options.send(k) + case x + when Hash then x.merge! v + when Array then x.concat v + else options.send("#{k}=", v) + end end end OptionParser.new do |opts| @@ -46,7 +52,7 @@ options.port ||= 25 end opts.on('-S', '--subject NAME', 'Choose your mail subject') do |aString| - options.subject = aString.sub(/\.?$/, '.') + options.header[:Subject] = aString.sub(/\.?$/, '.') end opts.on('--[no-]sign', 'Sign the message with gpg') do |signed| options.signed = signed @@ -61,7 +67,7 @@ options.comment = aComment end opts.on('--header STRING', 'Add some header fields (Yaml syntax)') do |s| - options.header = YAML.load(s) + options.header.merge! YAML.load(s) end opts.on('-m', '--[no-]mime', 'Choose the mime protocole') do |mime| options.mime = mime @@ -71,6 +77,7 @@ exit end end.parse!(string_args) + options.header[:To] = options.to.join(', ') check_mail_options(options) options end @@ -79,7 +86,7 @@ def check_mail_options ( options ) raise ArgumentError, 'No recipents' if options.to.empty? raise ArgumentError, 'No mail server' if options.server.nil? - raise ArgumentError, 'No mail subject' if options.subject.nil? + raise ArgumentError, 'No mail subject' if options.header[:Subject].nil? end # @@ -108,9 +115,9 @@ if opts.confirm raise 'HighLine is unavailable' unless defined? HighLine question = %Q[ - |Send a mail, with this subject: #{opts.subject} - | to #{opts.to.join(', ')} - | from #{opts.from_name} + |Send a mail, with this subject: #{opts.header[:Subject]} + | to #{opts.header[:To]} + | from #{opts.header[:From]} | #{(opts.signed)? 'signed by ' + opts.from : 'not signed !'} |Are you sure? (y/n)].head_cut! raise 'Aborting' unless HighLine.new.agree question, true @@ -119,9 +126,6 @@ require 'net/smtp' Net::SMTP.start(server, port) do |smtp| smtp.open_message_stream(opts.from, opts.to) do |f| - f.print %Q[From: #{opts.from_name} - |Subject: #{opts.subject} - |To: #{opts.to.join(', ')}\n].head_cut! opts.header.each do |k, v| f.puts "#{k}: #{v}" end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051029/88ba316f/signature-0001.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From ertai at lrde.epita.fr Sat Oct 29 14:15:14 2005 From: ertai at lrde.epita.fr (Nicolas Pouillard) Date: Sat, 29 Oct 2005 20:15:14 +0200 (CEST) Subject: [Uttk-Patches] [ruby_ex][SimulatedAnnealing] 414: Add argmin. Message-ID: <20051029181514.145AE955FB@smtp.feydakins.org> svn://svn.feydakins.org/ruby_ex/trunk Index: ChangeLog from Nicolas Pouillard Add argmin. * lib/algorithms/simulated_annealing.rb: This add a nice way to catch the better argmin at any time. simulated_annealing.rb | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+) Index: lib/algorithms/simulated_annealing.rb --- lib/algorithms/simulated_annealing.rb (revision 413) +++ lib/algorithms/simulated_annealing.rb (working copy) @@ -9,6 +9,12 @@ class SimulatedAnnealing + attr_reader :support, :global_thresold, :step_multiplicator, + :initial_temperature, :initial_cost, :output, + :iteration_modulus, :step_modulus, :generator, + :diff_cost, :iteration, :probability_threshold, :argmin + alias_method :best, :argmin + # Example: # # obj = MySimulatedAnnealingObject.new @@ -37,6 +43,8 @@ @diff_cost = 0 @iteration = 0 @probability_threshold = 0 + @argmin = nil + @min = @cur_cost end @@zeros = [0.0] * 8 @@ -89,6 +97,10 @@ @support.apply_transition(@transition) @cur_cost += @diff_cost + if @cur_cost < @min + @min = @cur_cost + @argmin = @support.copy_of_the_current_solution + end end end @@ -152,6 +164,14 @@ raise NotImplementedError end + # + # This method should return the copy of the current solution + # it will be called to save the best solution (argmin). + # + def copy_of_the_current_solution + raise NotImplementedError + end + end end -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 186 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051029/470d771f/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sat Oct 29 14:18:47 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Sat, 29 Oct 2005 20:18:47 +0200 (MEST) Subject: [Uttk-Patches] 766: Cmd do not handle sigsegv properly. Message-ID: <20051029181847.A254C27B49@pm-mx5.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://dev.uttk.org/repository/changesets/766 Index: ChangeLog from Nicolas Desprès Cmd do not handle sigsegv properly. * test/functional/cmd.yml: New. Show off the bug. * test/fixtures/binaries, test/fixtures/binaries/segv, * test/fixtures/binaries/segv.c, test/fixtures/binaries/segv.rb, * test/fixtures/binaries/segv, test/fixtures/binaries/segv.c, * test/fixtures/binaries/segv.rb: New. Fixtured a prog which auto-segv. Ruby segfault status is different than a c program. fixtures/binaries/segv | 10 ++++++++++ fixtures/binaries/segv.rb | 2 ++ functional/cmd.yml | 15 +++++++++++++++ 3 files changed, 27 insertions(+) Index: test/functional/cmd.yml --- test/functional/cmd.yml (revision 0) +++ test/functional/cmd.yml (revision 0) @@ -0,0 +1,15 @@ +--- + +Test suite for the Cmd strategy: !S::Suite + + contents: + + - segfault ruby: !S::Cmd + command: ruby + args: <>/../fixtures/binaries/segv.rb + exit: 134 + + - segfault C: !S::Cmd + command: ruby + args: <>/../fixtures/binaries/segv + exit: 139 Index: test/fixtures/binaries/segv Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: test/fixtures/binaries/segv ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Index: test/fixtures/binaries/segv.c --- test/fixtures/binaries/segv.c (revision 0) +++ test/fixtures/binaries/segv.c (revision 0) @@ -0,0 +1,10 @@ + +#include +#include +#include + +int main(void) +{ + kill(getpid(), SIGSEGV); + return 0; +} Index: test/fixtures/binaries/segv.rb --- test/fixtures/binaries/segv.rb (revision 0) +++ test/fixtures/binaries/segv.rb (revision 0) @@ -0,0 +1,2 @@ +Process.kill("SEGV", $$) + -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051029/d86b91f0/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sat Oct 29 14:20:40 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Sat, 29 Oct 2005 20:20:40 +0200 Subject: [Uttk-Patches] 766: Cmd do not handle sigsegv properly. In-Reply-To: <20051029181847.A254C27B49@pm-mx5.mx.noos.fr> References: <20051029181847.A254C27B49@pm-mx5.mx.noos.fr> Message-ID: <840b875c0510291120g583a7327yc825d8794451e428@mail.gmail.com> On 10/29/05, Nicolas Despr?s wrote: > + > + - segfault C: !S::Cmd > + command: ruby > + args: <>/../fixtures/binaries/segv > + exit: 139 That's a mistake. I fix it right now. [...] Sorry, but I don't have time now to address this bug. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sat Oct 29 14:22:01 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Sat, 29 Oct 2005 20:22:01 +0200 (MEST) Subject: [Uttk-Patches] 767: Fix mistakes from previous patch. Message-ID: <20051029182201.A77EF27195@pm-mx5.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://dev.uttk.org/repository/changesets/767 Index: ChangeLog from Nicolas Desprès Fix mistakes from previous patch. * test/functional/cmd.yml: Do not run ruby on a binary file. cmd.yml | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: test/functional/cmd.yml --- test/functional/cmd.yml (revision 766) +++ test/functional/cmd.yml (working copy) @@ -10,6 +10,5 @@ exit: 134 - segfault C: !S::Cmd - command: ruby - args: <>/../fixtures/binaries/segv + command: <>/../fixtures/binaries/segv exit: 139 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051029/32dbd105/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Sat Oct 29 17:20:49 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Sat, 29 Oct 2005 23:20:49 +0200 (MEST) Subject: [Uttk-Patches] 768: Remove useless directory. Message-ID: <20051029212049.7315827FC6@pm-mx6.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://dev.uttk.org/repository/changesets/768 Index: ChangeLog from Nicolas Desprès Remove useless directory. * lib/uttk/strategies/Cmd: Remove because it is empty. 0 files changed -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051029/93c55865/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Mon Oct 31 11:05:31 2005 From: nicolas.despres at gmail.com (Nicolas Desprès) Date: Mon, 31 Oct 2005 17:05:31 +0100 (MET) Subject: [Uttk-Patches] 769: A Diff with hexdump -C. Message-ID: <20051031160531.6FE5026D38@pm-mx5.mx.noos.fr> svn://svn.feydakins.org/ttk/trunk You can also view this changeset here: http://dev.uttk.org/repository/changesets/769 Index: ChangeLog from Nicolas Desprès A Diff with hexdump -C. * test/functional/hexa-diff.yml: New. Tests it. * lib/uttk/streams/HexaDiff.rb: New. Implements it. lib/uttk/streams/HexaDiff.rb | 35 +++++++++++++++++++++++++++++++++++ test/functional/hexa-diff.yml | 25 +++++++++++++++++++++++++ 2 files changed, 60 insertions(+) Index: test/functional/hexa-diff.yml --- test/functional/hexa-diff.yml (revision 0) +++ test/functional/hexa-diff.yml (revision 0) @@ -0,0 +1,25 @@ +--- + +Test Cmd with StreamHexaDiff: !S::Suite + attributes: !S::Cmd + stream_class: HexaDiff + command: cat + contents: + + - simple valid: + input: | + foo + bar bar + fuu + output: | + foo + bar bar + fuu + + - simple invalid: + weight: -1 + input: | + foo + bar bar + fuu + output: !path <>/../fixtures/text/1.txt Property changes on: test/functional/hexa-diff.yml ___________________________________________________________________ Name: sv:keywords + Id Index: lib/uttk/streams/HexaDiff.rb --- lib/uttk/streams/HexaDiff.rb (revision 0) +++ lib/uttk/streams/HexaDiff.rb (revision 0) @@ -0,0 +1,35 @@ +# Author:: Nicolas Desprès . +# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved. +# License:: LGPL +# $Id: Diff.rb 720 2005-09-26 04:34:48Z ertai $ + + +module Uttk + + module Streams + + class HexaDiff < Diff + + #FIXME: manage only !path :-( + def to_uttk_log ( log ) + if @name == "output" + if @ref.can_diff? + TempPath.new('hexa-diff-output') do |hexa_my| + system "hexdump -C #@my > #{hexa_my}" + TempPath.new('hexa-diff-output') do |hexa_ref| + system "hexdump -C #@ref > #{hexa_ref}" + log["hexa_diff_#@name"] = hexa_ref.to_diff_for_uttk_log(hexa_my) + end + end + end + else + super + end + end + + end # HexaDiff + + end # module Streams + +end # module Uttk + Property changes on: lib/uttk/streams/HexaDiff.rb ___________________________________________________________________ Name: sv:keywords + Id -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://rubyforge.org/pipermail/ttk-patches/attachments/20051031/2857d05c/signature.bin -------------- next part -------------- _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches From nicolas.despres at gmail.com Mon Oct 31 13:14:09 2005 From: nicolas.despres at gmail.com (=?ISO-8859-1?Q?Nicolas_Despr=E8s?=) Date: Mon, 31 Oct 2005 19:14:09 +0100 Subject: [Uttk-Patches] 769: A Diff with hexdump -C. In-Reply-To: References: <20051031160531.6FE5026D38@pm-mx5.mx.noos.fr> Message-ID: <840b875c0510311014s7f134140m4836112a0aba4d94@mail.gmail.com> On 10/31/05, Nicolas Pouillard wrote: > On 10/31/05, Nicolas Despr?s wrote: > > > > svn://svn.feydakins.org/ttk/trunk > > > > You can also view this changeset here: > > > > http://dev.uttk.org/repository/changesets/769 > > > > Index: ChangeLog > > from Nicolas Despr?s > > > > A Diff with hexdump -C. > > > > * test/functional/hexa-diff.yml: New. Tests it. > > * lib/uttk/streams/HexaDiff.rb: New. Implements it. > > > > lib/uttk/streams/HexaDiff.rb | 35 +++++++++++++++++++++++++++++++++++ > > test/functional/hexa-diff.yml | 25 +++++++++++++++++++++++++ > > 2 files changed, 60 insertions(+) > > > > [...] > > > + > > + #FIXME: manage only !path :-( > > To manage them you just can convert anything to a string and strings > to a temporary file. > > But it would be simpler with Commands. > > hexadump = 'hexadump'.to_cmd > hexadump['-C'] < 'a string' > OR > hexadump['-C'] < 'a-file'.to_path > That's what I thought and that's why I left it like that since it is usable as is. -- Nicolas Despr?s _______________________________________________ Uttk-Patches mailing list Uttk-Patches at lists.feydakins.org http://mailman.feydakins.org/mailman/listinfo/uttk-patches