Changeset 6388

Show
Ignore:
Timestamp:
02/08/08 21:53:51 (5 years ago)
Author:
cho45
Message:

websites/coderepos.org/scripts/commit-ping-to-irc/commig-ping-tiarra_spec.rb,
websites/coderepos.org/scripts/commit-ping-to-irc/commig-ping-tiarra.rb:

テスト書いた。

Location:
websites/coderepos.org/scripts/commit-ping-to-irc
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • websites/coderepos.org/scripts/commit-ping-to-irc/commig-ping-tiarra.rb

    r6387 r6388  
    2121                yaml = YAML.load(yaml) if yaml.kind_of?(String) 
    2222 
    23                 info = OpenStruct.new(yaml) 
     23                info = make_info(yaml) 
     24                text = info.instance_eval(@opts.format) 
     25 
     26                notify_tiarra(:channel => @opts.channel, :text => text) 
     27        end 
     28 
     29        def make_info(hash) 
     30                info = OpenStruct.new(hash) 
    2431                info.comment = NKF.nkf("-w", info.comment.gsub(/\?\\(\d+)/) {|i| 
    2532                        $1.to_i.chr 
    26                 }) 
     33                }).chomp 
    2734 
    2835                # remove svk prefix 
     
    3340 
    3441                # remove lines but first 
    35                 if info.comment.sub!(/[\r\n].*/, "") 
     42                if info.comment.sub!(/[\r\n].*/m, "") 
    3643                        info.comment << "..." 
    3744                end 
     
    6572                info.platform = info.platform.uniq.join(", ") 
    6673                info.path     = info.path.uniq.join(", ") 
    67  
    68                 text = info.instance_eval(@opts.format) 
    69  
    70                 notify_tiarra(:channel => @opts.channel, :text => text) 
     74                info 
    7175        end 
    7276 
     
    96100        end 
    97101end 
     102 
    98103 
    99104config = File.open("commig-ping-tiarra.yaml") {|f| YAML.load(f) } 
     
    166171        warn e.inspect 
    167172        warn e.backtrace.join("\n\t") 
    168 end 
     173end if __FILE__ == $0 
    169174 
    170175__END__