1 class PublicationsController < ApplicationController
4 # before_filter :authorize, :only => [:issues]
7 @publications = Publication.all
10 format.xml { render :xml => @publications }
11 format.json { render :json => @publications }
18 regexp = Regexp.new(Setting.plugin_redmine_publications[:pattern])
19 Publication.delete_all()
20 repos = Repository.all
25 repo.entries.each do |entry|
26 match = entry.path.match(regexp)
28 Publication.find_or_create_by_name(:name => match[1],
29 :source_file => entry.path, :repository_id => repo.id)
30 repo_status += [{:path => entry.path, :match => match[1], :matched => true}]
32 repo_status += [{:path => entry.path, :match =>nil, :matched => false}]
35 @match_status += [{:repo => repo, :status => repo_status}]
39 respond_to do |format|
41 format.xml { render :xml => @match_status}
42 format.json { render :json => @match_status }
48 @publication = Publication.find_by_name(params[:pub])
50 joins = "JOIN issue_publications ON (issues.id = issue_publications.issue_id)"
51 conditions = ['issue_publications.publication_id = ? ', @publication.id ]
52 @issues = Issue.all(:joins => joins, :conditions => conditions)
55 fmt.json { render :json => @issues, :callback => params[:callback] }
62 @project = Project.find(params[:project_id])