Changeset 3

Show
Ignore:
Timestamp:
07/01/06 17:13:09 (3 years ago)
Author:
sandal
Message:
 
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • www-raa/lib/net/raa.rb

    r2 r3  
    77 
    88      class Entry 
    9          # Short description of project 
    10          attr_accessor :short_description 
    11  
    12          # Version of the project 
    13          attr_accessor :version 
    14  
    15          # Status of the project, e.g. 'stable', 'beta', etc. 
    16          attr_accessor :status 
    17  
    18          # Your email address 
    19          attr_accessor :email 
    20  
    21          # Category 
    22          attr_accessor :main_category 
    23           
    24          # Sub-category 
    25          attr_accessor :sub_category 
    26  
    27          # Home page (URL) 
    28          attr_accessor :home_page 
    29  
    30          # Download link (URL) 
    31          attr_accessor :download 
    32  
    33          # License, e.g. Ruby's, GPL, etc. 
    34          attr_accessor :license 
    35  
    36          # Long description 
    37          attr_accessor :long_description 
    38           
    39          # Long description format, e.g. plain, rdoc, etc. 
    40          attr_accessor :long_description_format 
    41  
    42          # Password 
    43          attr_accessor :password 
    44  
    45          # Project name 
    46          attr_accessor :project 
    47  
    48          # Minor edit? 
    49          attr_writer :minor_edit 
    50  
    51          def initialize(project) 
    52             @project = project 
    53             yield self if block_given? 
    54          end 
    559 
    5610         def minor_edit? 
    5711            @minor_edit 
    5812         end 
     13 
     14        def initialize(project) 
     15          @project = project 
     16          @mech = WWW::Mechanize.new 
     17          @mech.get("http://raa.ruby-lang.org/update.rhtml?name=#{project}") 
     18          @form = @mech.page.forms[1] 
     19          yield self if block_given? 
     20        end 
     21 
     22        def method_missing(id,*args) 
     23          if @form.field(id.to_s) 
     24            return @form.field(id.to_s).value if args.empty? 
     25            return @form.field(id.to_s).value = args[0] 
     26          end; super 
     27        end 
    5928 
    6029         # TODO: finish 
     
    6635   end 
    6736end 
     37 
     38a = WWW::RAA::Entry.new("dummy") { |e| e.email "a@a.com"; p e.email }