You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2005/12/19 03:13:08 UTC

svn commit: r357613 - in /maven/sandbox/issue/rissue: issue.rb issue.rb.org

Author: jvanzyl
Date: Sun Dec 18 18:13:03 2005
New Revision: 357613

URL: http://svn.apache.org/viewcvs?rev=357613&view=rev
Log:
remove the correct file

Added:
    maven/sandbox/issue/rissue/issue.rb   (with props)
Removed:
    maven/sandbox/issue/rissue/issue.rb.org

Added: maven/sandbox/issue/rissue/issue.rb
URL: http://svn.apache.org/viewcvs/maven/sandbox/issue/rissue/issue.rb?rev=357613&view=auto
==============================================================================
--- maven/sandbox/issue/rissue/issue.rb (added)
+++ maven/sandbox/issue/rissue/issue.rb Sun Dec 18 18:13:03 2005
@@ -0,0 +1,149 @@
+#!/usr/bin/ruby
+
+require 'defaultDriver'
+require 'yaml'
+require 'yaml/store'
+require 'rexml/document'
+require 'net/http'
+require 'uri'
+require 'cgi'
+
+include REXML
+
+class IssueManager
+
+  def initialize
+    if ENV['JIRA_CONF_DIR'] != nil
+      @conf_dir = ENV['JIRA_CONF_DIR']
+    else
+      @conf_dir = `pwd`.chomp
+    end
+    @filters = YAML::load( File.open( File.join( @conf_dir, 'filters.yaml' ) ) )
+    @jira = YAML::load( File.open( File.join( @conf_dir, 'mappings.yaml' ) ) )
+    @server = getServer()
+    @issueLast = nil
+  end
+
+  def getServer
+    if @server == nil
+      @config = YAML::load( File.open( File.join( ENV['HOME'], 'jira.yaml' ) ) )
+      user = @config['user']
+      password = @config['password']
+      @url = @config['server-soap']
+      @server = JiraSoapService.new( @url )
+      @token = @server.login( user, password )
+    end
+    return @server
+  end
+
+  # The issue is a struct with all the issue information
+  def closeIssue( issue, assignee )
+    id = issue.id
+    query = "#{@config['server']}/secure/CommentAssignIssue.jspa?resolution=1&action=2&id=#{id}&assignee=#{assignee}&Close%20Issue=Close%20Issue&os_username=#{@config['user']}&os_password=#{@config['password']}"    
+    url = URI.parse(query)
+    res = Net::HTTP.get(url)
+    puts res
+  end
+
+  # The issue is a struct with all the issue information
+  def assignPermissionScheme( project, notificationSchemeId )
+    projectId = project['id']
+    query = "#{@config['server']}/secure/project/SelectProjectPermissionScheme.jspa?schemeIds=#{notificationSchemeId}&projectId=#{projectId}&Associate=Associate&os_username=#{@config['user']}&os_password=#{@config['password']}"
+    url = URI.parse(query)
+    res = Net::HTTP.get(url)
+    puts res
+  end  
+  
+  # The issue is a struct with all the issue information
+  def assignNotificationScheme( project, notificationSchemeId )
+    projectId = project['id']
+    query = "#{@config['server']}/secure/project/SelectProjectScheme.jspa?schemeIds=#{notificationSchemeId}&projectId=#{projectId}&Associate=Associate&os_username=#{@config['user']}&os_password=#{@config['password']}"
+    url = URI.parse(query)
+    res = Net::HTTP.get(url)
+    puts res
+  end  
+
+  # Delegate calls to the underlying server where possible
+  def method_missing(method_name, *args)
+    return getServer().send( method_name, *([@token] + args) )
+  end    
+
+  def issueUrl( issue )
+    return @config['server'] + '/browse/' + issue.key
+  end
+
+  def issuesByFilter( filterName )
+    return getIssuesFromFilter( @filters[filterName]['id'] )
+  end
+
+  def generateXdoc( filterName )
+    document = REXML::Element.new( "document" )
+    properties = REXML::Element.new( "properties" )
+    properties.add_element( "title" ).add_text( "JIRA Issues" )
+    properties.add_element( "author", { "email" => "jason@maven.org" } )
+    document.add_element( properties )
+    body = REXML::Element.new( "body" )
+    document.add_element( body )
+    section = REXML::Element.new( "section" )
+    section.attributes['name'] = "JIRA Issues"
+    body.add_element( section )
+    table = REXML::Element.new( "table" )        
+    section.add_element( table )
+    issues = issuesByFilter( 'patches' )
+    
+    for issue in issues
+      tr = REXML::Element.new( "tr" )
+      tr.add_element( "td" ).add_text( issue.summary )
+      a = REXML::Element.new( "a" ).add_text( issue.key )
+      a.attributes['href'] = issueUrl( issue )
+      tr.add_element( "td" ).add_element( a )
+      table.add_element( tr )
+    end
+
+    return document
+
+  end
+
+  def updateIssue( issueId, fields )
+    return getServer().updateIssue( issueId, fields )
+  end
+
+  def createIssue2( project, summary, description, type, assignee, priorityKey )
+    return createIssue( project, summary, description, type, assignee, priorityKey, nil )
+  end
+
+  def createIssue( project, summary, description, type, assignee, priorityKey, component )
+
+    issue = RemoteIssue.new()
+    issue.project = project
+    issue.summary = summary
+    issue.description = description 
+    issue.type = type
+    issue.assignee = assignee
+
+    priority = @jira['priority'][priorityKey]
+    issue.priority = priority
+    
+    if component != nil
+      issue.components = [ component ]
+    end
+ 
+    issue = getServer().createIssue( @token, issue )
+    puts issue.id
+    #eissue = EnhancedRemoteIssue.new( issue, assignee )
+    #puts eissue.id
+    return issue,assignee
+  end
+
+  # Create component mappings
+  # Create filter mappings
+  def setup( projectKey )
+    components = getServer().getComponents( projectKey )
+    puts components
+    y = YAML::Store.new( "components2.yaml", :Indent => 2 )
+    y.transaction do
+      y['components'] = components
+    end                
+  end
+
+end

Propchange: maven/sandbox/issue/rissue/issue.rb
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/issue/rissue/issue.rb
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"