Changeset 6415

Show
Ignore:
Timestamp:
02/09/08 13:07:12 (5 years ago)
Author:
cho45
Message:

lang/ruby/chokan/branches/citrus/plugins/system.rb,
lang/ruby/chokan/branches/citrus/lib/citrus/core.rb,
lang/ruby/chokan/branches/citrus/spec/core_spec.rb,
lang/ruby/chokan/branches/citrus/spec/spec_helper.rb:

最近 trunk にコミットしたやつをこっちにもとかいろいろ

Location:
lang/ruby/chokan/branches/citrus
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/chokan/branches/citrus/lib/citrus/core.rb

    r6401 r6415  
    136136                                if args[1] && args[1][0] == ?# # when channel 
    137137                                        channel  = args[1] 
    138                                         enabled  = @config.plugins[n]["enabled"] 
    139                                         disabled = @config.plugins[n]["disabled"] 
     138                                        config   = @config.plugins[n] || {} 
     139                                        enabled  = config["enabled"] 
     140                                        disabled = config["disabled"] 
    140141 
    141142                                        case 
  • lang/ruby/chokan/branches/citrus/plugins/system.rb

    r5931 r6415  
    3232                                notice channel, "Reloaded: " + reloaded 
    3333                        end 
     34 
     35                when /^chokan: join to (\S+)(?: (\S+))?/ 
     36                        chan, pass = Regexp.last_match.captures 
     37                        log "Joining to '#{chan}' with '#{pass}'" 
     38                        join(chan.to_s, pass.to_s) 
     39 
     40                when "chokan: part" 
     41                        part(channel, "lambda....") 
    3442 
    3543                when "operator?" 
     
    8189                end 
    8290 
     91                it "can operate join/part" do 
     92                        @socket.string = "" 
     93                        @plugin.on_privmsg(@prefixop, "#test", "chokan: part") 
     94                        @socket.string.should match(/^PART #test /) 
     95 
     96                        @socket.string = "" 
     97                        @plugin.on_privmsg(@prefixop, "#test", "chokan: join to #foobar") 
     98                        @socket.string.should match(/^JOIN #foobar /) 
     99 
     100                        @socket.string = "" 
     101                        @plugin.on_privmsg(@prefixop, "#test", "chokan: join to #foobar password") 
     102                        @socket.string.should match(/^JOIN #foobar password/) 
     103                end 
     104 
    83105                it "can Gem.clear_paths" do 
    84106                        @socket.string = "" 
  • lang/ruby/chokan/branches/citrus/spec/core_spec.rb

    r6407 r6415  
    154154                @core.plugins["Bar"].results[:on_privmsg].should_not == ["foo!bar@localhost", "#bar", "message"] 
    155155        end 
    156  
    157 #       @core = Core.new(YAML.load(<<-YAML.gsub(/^\t/, ""))) 
    158 #       --- 
    159 #       general: 
    160 #         server: charlotte 
    161 #         port: 6669 
    162 #         user: chokan 
    163 #         nick: chokan 
    164 #         real: chokan bot via tiarra 
    165 #         error: "#chokan@ircnet" 
    166 #         plugin_dir: plugins 
    167 #         charset: 
    168 #           default: iso-2022-jp 
    169 #           "#test": utf-8 
    170 #       plugins: 
    171 #         Core: 
    172 #           operator: "cho!cho45@localhost" 
    173 #         SimpleReply: 
    174 #           replies: 
    175 #             - words: 
    176 #                - "ping: chokan" 
    177 #               channels: [] 
    178 #               reply: "pong" 
    179 #             - words: 
    180 #                - Nice 
    181 #               channel: 
    182 #                - "#foo" 
    183 #                - "#bar" 
    184 #               reply: boat. 
    185 # 
    186 #       YAML 
    187156end 
    188157 
  • lang/ruby/chokan/branches/citrus/spec/spec_helper.rb

    r6407 r6415  
    4545                                "Foo"   => { "disabled" => ["#foo"], }, 
    4646                                "Bar"   => { "enabled" => ["#foo"], }, 
     47                                "Baz"   => nil, 
    4748                        } 
    4849                }.merge(config)