Moved the redmine plugin to a seperate repositiory: http://github.com/fnp/redakcja_re...
authorŁukasz Rekucki <lrekucki@gmail.com>
Tue, 25 May 2010 11:46:03 +0000 (13:46 +0200)
committerŁukasz Rekucki <lrekucki@gmail.com>
Tue, 25 May 2010 11:46:03 +0000 (13:46 +0200)
27 files changed:
redmine/redmine_publications/README.rdoc [deleted file]
redmine/redmine_publications/app/controllers/publications_controller.rb [deleted file]
redmine/redmine_publications/app/helpers/publications_helper.rb [deleted file]
redmine/redmine_publications/app/models/issue_publication.rb [deleted file]
redmine/redmine_publications/app/models/publication.rb [deleted file]
redmine/redmine_publications/app/views/issues/_issue_form_pub.html.erb [deleted file]
redmine/redmine_publications/app/views/issues/_issue_view_pub.erb [deleted file]
redmine/redmine_publications/app/views/publications/index.html.erb [deleted file]
redmine/redmine_publications/app/views/publications/issues.html.erb [deleted file]
redmine/redmine_publications/app/views/publications/refresh.erb [deleted file]
redmine/redmine_publications/app/views/settings/_publications_settings.html.erb [deleted file]
redmine/redmine_publications/db/migrate/001_create_publications.rb [deleted file]
redmine/redmine_publications/db/migrate/002_create_issue_publications.rb [deleted file]
redmine/redmine_publications/db/migrate/003_publications_add_repo_id.rb [deleted file]
redmine/redmine_publications/db/migrate/004_publications_add_name.rb [deleted file]
redmine/redmine_publications/init.rb [deleted file]
redmine/redmine_publications/lang/en.yml [deleted file]
redmine/redmine_publications/lib/issue_publication_hook.rb [deleted file]
redmine/redmine_publications/lib/redmine_publications/change_patch.rb [deleted file]
redmine/redmine_publications/lib/redmine_publications/issue_patch.rb [deleted file]
redmine/redmine_publications/locales/en.yml [deleted file]
redmine/redmine_publications/locales/pl.yml [deleted file]
redmine/redmine_publications/routes.rb [deleted file]
redmine/redmine_publications/test/fixtures/publications.yml [deleted file]
redmine/redmine_publications/test/functional/publications_controller_test.rb [deleted file]
redmine/redmine_publications/test/test_helper.rb [deleted file]
redmine/redmine_publications/test/unit/publication_test.rb [deleted file]

diff --git a/redmine/redmine_publications/README.rdoc b/redmine/redmine_publications/README.rdoc
deleted file mode 100644 (file)
index 2bcee99..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-= publications
-
-Description goes here
diff --git a/redmine/redmine_publications/app/controllers/publications_controller.rb b/redmine/redmine_publications/app/controllers/publications_controller.rb
deleted file mode 100644 (file)
index c7a1194..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-class PublicationsController < ApplicationController
-  unloadable
-
-  #  before_filter :authorize, :only => [:issues]
-
-  def index
-       @publications = Publication.all
-    respond_to do |format|
-      format.html
-      format.xml { render :xml => @publications }
-      format.json { render :json => @publications }
-    end
-  end
-
-  def refresh
-    regexp = Regexp.new(Setting.plugin_redmine_publications[:pattern])
-    repo = Repository.find(:first, :conditions => ['project_id = ?', Setting.plugin_redmine_publications[:project]] )
-
-    Rails.logger.info('[INFO] Importing changes from ' << repo.url)
-    Rails.logger.info('[INFO] Change list: ' << repo.changes.find(:all).inspect )
-
-    @repo_status = []
-    repo.changes.find(:all).each do |change|
-        Rails.logger.info('[INFO] Importing change ' << change.path)
-        match = change.path.match(regexp)
-        if match
-            Publication.find_or_create_by_name(:name => match[1],
-                :source_file => change.path, :repository_id => repo.id)
-              @repo_status += [{:path => change.path, :match => match[1], :matched => true}]
-        else
-              @repo_status += [{:path => change.path, :match => nil, :matched => false}]
-        end
-    end
-       
-    respond_to do |format|
-        format.html
-        format.xml { render :xml => @repo_status}
-        format.json { render :json => @repo_status }
-    end
-  end
-
-  def issues
-    @publication = Publication.find_by_name(params[:pub])
-
-    joins = "JOIN issue_publications ON (issues.id = issue_publications.issue_id)"
-    conditions = ['issue_publications.publication_id = ? ', @publication.id ]
-    @issues = Issue.all(:joins => joins, :conditions =>  conditions)
-
-    respond_to do |fmt| 
-      fmt.json { render :json => @issues, :callback => params[:callback] }
-    end
-  end
-
-  private
-
-  def find_project
-    @project = Project.find(params[:project_id])
-  end
-
-end
diff --git a/redmine/redmine_publications/app/helpers/publications_helper.rb b/redmine/redmine_publications/app/helpers/publications_helper.rb
deleted file mode 100644 (file)
index 50f110e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-module PublicationsHelper
-end
diff --git a/redmine/redmine_publications/app/models/issue_publication.rb b/redmine/redmine_publications/app/models/issue_publication.rb
deleted file mode 100644 (file)
index ef7bf92..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-class IssuePublication < ActiveRecord::Base
-  belongs_to :publication
-  belongs_to :issue
-end    
diff --git a/redmine/redmine_publications/app/models/publication.rb b/redmine/redmine_publications/app/models/publication.rb
deleted file mode 100644 (file)
index 1544402..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-class Publication < ActiveRecord::Base
-  has_many :issues, :through => :issuepublications
-  belongs_to :repository
-end
diff --git a/redmine/redmine_publications/app/views/issues/_issue_form_pub.html.erb b/redmine/redmine_publications/app/views/issues/_issue_form_pub.html.erb
deleted file mode 100644 (file)
index ebb903c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<div>
-<p><label for="issue_source_files"><%= l(:field_publications) %>:</label>
-<input type='text' id='publications' name="publications" size="50"
-       value='<%= @issue.publication_names.join(', ') %>' />
-</div>
diff --git a/redmine/redmine_publications/app/views/issues/_issue_view_pub.erb b/redmine/redmine_publications/app/views/issues/_issue_view_pub.erb
deleted file mode 100644 (file)
index a22c78b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<tr>
-    <td><b><%= l(:field_publications) %>:</b></td>
-    <td>
-<% @issue.publication_names.each  do |pub| %>
-      <a href="<%= Setting.plugin_redmine_publications[:editorurl].sub(':pubid', pub) %>"><%= pub %></a><br />
-<% end %>
-    </td>
-</tr>
diff --git a/redmine/redmine_publications/app/views/publications/index.html.erb b/redmine/redmine_publications/app/views/publications/index.html.erb
deleted file mode 100644 (file)
index 3fa0299..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<h2>Publikacje</h2>
-<p><a href="/publications/refresh">Odśwież listę publikacji</a></p>
-<ol>
-<% @publications.each do |pub| %>
-       <li><a href="/publications/issues/<%= pub.name %>"><%= pub.name %></a></li>
-<% end %>
-</ol>
diff --git a/redmine/redmine_publications/app/views/publications/issues.html.erb b/redmine/redmine_publications/app/views/publications/issues.html.erb
deleted file mode 100644 (file)
index f36a875..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<h2>Issues for publication: <%= @publication.name %></h2>
-<% @issues.each do |issue| %>
-<p><%= issue.subject %></p>
-<% end %>
diff --git a/redmine/redmine_publications/app/views/publications/refresh.erb b/redmine/redmine_publications/app/views/publications/refresh.erb
deleted file mode 100644 (file)
index 311ed33..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<table>
-<tr><th>Ścieżka zasobu</th><th>Rozpoznano</th><th>ID zasobu</th></tr>
-<% @repo_status.each do |status| %>
-<tr>
-<td><%= status[:path] %></td>
-<td><%= (status[:matched] && 'Tak') || 'Nie' %></td>
-<td><%= status[:match] || '' %></td>
-</tr>
-<% end %>
-</table>
diff --git a/redmine/redmine_publications/app/views/settings/_publications_settings.html.erb b/redmine/redmine_publications/app/views/settings/_publications_settings.html.erb
deleted file mode 100644 (file)
index 255460e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<% @project = Project.find(:first, :conditions => ["id = ?", @settings[:project]]) %>
-<fieldset>
-<p>
-  <label for="settings[project]">Użyj w projektcie: </label>
-  <%= collection_select(:project, :id, Project.all, :id, :name, {}, {:name => "settings[project]"}) %>
-</p>
-
-<p>
-  <label for="settings[pattern]">Filtr publikacji: </label>
-  <%= text_field_tag 'settings[pattern]', @settings[:pattern] || '' %>
-</p>
-
-<p>
-  <label for="settings[editorurl]">Docelowy URL: </label>
-  <%= text_field_tag 'settings[editorurl]', @settings[:editorurl] || '' %>
-</p>
-
-</fieldset>
diff --git a/redmine/redmine_publications/db/migrate/001_create_publications.rb b/redmine/redmine_publications/db/migrate/001_create_publications.rb
deleted file mode 100644 (file)
index f9d93ef..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreatePublications < ActiveRecord::Migration
-  def self.up
-    create_table :publications do |t|
-      t.column :source_file, :string, :null => false
-    end
-  end
-
-  def self.down
-    drop_table :publications
-  end
-end
diff --git a/redmine/redmine_publications/db/migrate/002_create_issue_publications.rb b/redmine/redmine_publications/db/migrate/002_create_issue_publications.rb
deleted file mode 100644 (file)
index 07b64bd..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-class CreateIssuePublications < ActiveRecord::Migration
-  def self.up
-    create_table :issue_publications do |t| 
-       t.column :publication_id, :integer, :null => false
-        t.column :issue_id, :integer, :null => false
-    end
-  end
-
-  def self.down
-    drop_table :issue_publications
-  end
-end
diff --git a/redmine/redmine_publications/db/migrate/003_publications_add_repo_id.rb b/redmine/redmine_publications/db/migrate/003_publications_add_repo_id.rb
deleted file mode 100644 (file)
index 8f232c9..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-class PublicationsAddRepoId < ActiveRecord::Migration
-  def self.up
-    add_column :publications, :repository_id, :integer, :null => false, :default => 0
-  end
-
-  def self.down 
-  end
-end
diff --git a/redmine/redmine_publications/db/migrate/004_publications_add_name.rb b/redmine/redmine_publications/db/migrate/004_publications_add_name.rb
deleted file mode 100644 (file)
index 6b5bac6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-class PublicationsAddName < ActiveRecord::Migration
-  def self.up
-    add_column :publications, :name, :string
-  end
-
-  def self.down 
-  end
-end
diff --git a/redmine/redmine_publications/init.rb b/redmine/redmine_publications/init.rb
deleted file mode 100644 (file)
index 01afeab..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-require 'redmine'
-
-# Patches to the Redmine core.
-require 'dispatcher'
-
-Dispatcher.to_prepare :redmine_publications do
-  require_dependency 'issue'
-  
-  #Guards against including the module multiple time (like in tests)
-  # and registering multiple callbacks
-  unless Issue.included_modules.include? RedminePublications::IssuePatch
-    Issue.send(:include, RedminePublications::IssuePatch)
-  end
-
-  unless Change.included_modules.include? RedminePublications::ChangePatch
-    Change.send(:include, RedminePublications::ChangePatch)
-  end
-end
-
-require_dependency 'issue_publication_hook'
-
-Redmine::Plugin.register :redmine_publications do
-  name 'Publications managment plugin'
-  author 'Łukasz Rekucki'
-  description 'This plugn helps manage issues related to a publication.'
-  version '0.0.9'
-
-  # permission :view_issues_for_publication, :publications => :issues 
-
-  settings :partial => 'settings/publications_settings',
-      :default => { :project => '0', :pattern => '[^\$].xml', :editorurl => 'http://localhost/:pubid'}
-
-  menu :application_menu, :publications, { :controller => 'publications', :action => 'index' }, :caption => 'Publikacje'
-
-#  requires_redmine :version_or_higher => '0.8.0'       
-
-end
-
diff --git a/redmine/redmine_publications/lang/en.yml b/redmine/redmine_publications/lang/en.yml
deleted file mode 100644 (file)
index e338591..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# English strings go here
-my_label: "My label"
diff --git a/redmine/redmine_publications/lib/issue_publication_hook.rb b/redmine/redmine_publications/lib/issue_publication_hook.rb
deleted file mode 100644 (file)
index 788a72f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-# Provides a link to the document on the platform
-class IssuesPublicationHook < Redmine::Hook::ViewListener
-
-  def self.render_on(hook, options={})
-    define_method hook do |context|
-      if !options.include?(:if) || evaluate_if_option(options[:if], context)
-        context[:controller].send(:render_to_string, {:locals => context}.merge(options))
-      end
-    end
-  end
-
-  private
-
-  def evaluate_if_option(if_option, context)
-    case if_option
-    when Symbol
-      send(if_option, context)
-    when Method, Proc
-      if_option.call(context)
-    end
-  end
-
-  def is_pticket?(context)
-    context[:issue].project_id == Setting.plugin_redmine_publications[:project].to_i
-  end
-
-  public
-
-  render_on :view_issues_show_details_bottom, :partial => 'issue_view_pub', :if => :is_pticket?
-  render_on :view_issues_form_details_bottom, :partial => 'issue_form_pub', :if => :is_pticket?
-
-  #  names = context[:issue].publication_names {|name| "<span>" + name + "</span>"}
-  #  result << names.join(', ')
-
-  def controller_issues_edit_before_save(context)
-    if is_pticket?context
-      old_value = context[:issue].publication_names
-      new_value = context[:params][:publications].split(',').map { |n| n.strip }
-      context[:journal].details << JournalDetail.new(
-        :property => 'attr', :prop_key => "publications",
-        :old_value => old_value.join(', '),
-        :value => new_value.join(', ') ) unless new_value==old_value
-      context[:issue].publication_names = new_value
-    end
-  end
-
-
-  def controller_issues_new_after_save(context)
-    if is_pticket?context
-      value = context[:params][:publications].split(',').map { |n| n.strip }
-      context[:issue].publication_names = value
-      context[:issue].save
-    end
-  end
-end
diff --git a/redmine/redmine_publications/lib/redmine_publications/change_patch.rb b/redmine/redmine_publications/lib/redmine_publications/change_patch.rb
deleted file mode 100644 (file)
index b8e5c4b..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-module RedminePublications
-  # Patches Redmine's Issues dynamically. Adds a +after_save+ filter.
-
-  module ChangePatch
-    def self.included(base) # :nodoc:
-      base.extend(ClassMethods)
-
-      base.send(:include, InstanceMethods)
-
-      # Same as typing in the class
-      base.class_eval do
-        unloadable # Send unloadable so it will not be unloaded in development
-        after_save :update_publication
-      end
-
-    end
-
-    module ClassMethods
-    end
-
-    module InstanceMethods
-
-      def update_publication
-        if (self.action == 'A') and (self.changeset.repository.project_id == Setting.plugin_redmine_publications[:project].to_i)
-          regexp = Regexp.new(Setting.plugin_redmine_publications[:pattern])
-          match = self.path.match(regexp)
-          if match
-            Rails.logger.info('[INFO] Adding publication: "' << match[1])
-            Publication.find_or_create_by_name(:name => match[1],
-              :source_file => self.path, :repository_id => self.changeset.repository.id )
-          end
-        end      
-      end
-      
-    end
-    
-  end
-
-
-end
diff --git a/redmine/redmine_publications/lib/redmine_publications/issue_patch.rb b/redmine/redmine_publications/lib/redmine_publications/issue_patch.rb
deleted file mode 100644 (file)
index bd1f73e..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-module RedminePublications
-  # Patches Redmine's Issues dynamically. Adds a +after_save+ filter.
-
-  module IssuePatch
-    def self.included(base) # :nodoc:
-      base.extend(ClassMethods)
-      base.send(:include, InstanceMethods)
-      # Same as typing in the class
-      base.class_eval do
-        unloadable # Send unloadable so it will not be unloaded in development
-        validate :check_relations
-        after_save :update_relations
-      end
-    end
-    
-    module ClassMethods
-    end
-    
-    module InstanceMethods
-
-      def publication_names    
-        if not @pubnames
-          self.publications.map { |pub| pub.name }
-        else
-          @pubnames
-        end
-      end
-
-      def publication_names=(value)
-        @pubnames = value.sort!
-      end
-
-      def publications
-        Publication.all( 
-          :joins =>
-            "JOIN issue_publications ON (issue_publications.publication_id = publications.id)",
-          :conditions =>
-            ["issue_publications.issue_id = ? ", self.id] )
-      end
-
-      def check_relations
-        current_names = self.publication_names
-        non_existant = []
-
-        pubs =  Publication.find_all_by_name(current_names).map {|i| i.name}
-        missing = current_names.select {|name| not pubs.include?name }
-
-        if not missing.empty?
-          errors.add("publications", "Missing publication(s): " + missing.join(', '))
-        end
-      end
-
-      def update_relations
-        old = self.publications
-        current_names = self.publication_names
-        Rails.logger.info('[INFO] Updating relations: old= ' << old.inspect << ' current=' << current_names.inspect)
-
-        # delete unused relations
-        deleted = old.select { |v| not (current_names.include?(v.name)) }
-        deleted.each do |pub|
-          IssuePublication.delete_all(["issue_publications.issue_id = ? AND issue_publications.publication_id = ?", self.id, pub.id])
-        end
-
-        current_names.each do |name|
-          pub = Publication.find_by_name(name)
-          IssuePublication.find_or_create_by_publication_id_and_issue_id(pub.id, self.id)
-        end
-
-        return true
-      end
-
-    end
-  end
-end
diff --git a/redmine/redmine_publications/locales/en.yml b/redmine/redmine_publications/locales/en.yml
deleted file mode 100644 (file)
index 3932ef2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-## YAML Template.
-en:
-  field_publications: Publications
diff --git a/redmine/redmine_publications/locales/pl.yml b/redmine/redmine_publications/locales/pl.yml
deleted file mode 100644 (file)
index 2bf0783..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-## YAML Template.
-pl:
-  field_publications: Publikacje
diff --git a/redmine/redmine_publications/routes.rb b/redmine/redmine_publications/routes.rb
deleted file mode 100644 (file)
index 8752c69..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-connect 'publications/:action',
-       :controller => 'publications',
-       :format => 'html'
-
-connect 'publications/:action.:format',
-       :controller => 'publications' 
-
-connect 'publications/:action/:pub', 
-       :controller => 'publications', :format => 'json',
-     :pub => /[^\/?]+/
diff --git a/redmine/redmine_publications/test/fixtures/publications.yml b/redmine/redmine_publications/test/fixtures/publications.yml
deleted file mode 100644 (file)
index 9d7d113..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-one:
-  id: 1
-  source_file: One
-two:
-  id: 2
-  source_file: Two
diff --git a/redmine/redmine_publications/test/functional/publications_controller_test.rb b/redmine/redmine_publications/test/functional/publications_controller_test.rb
deleted file mode 100644 (file)
index 62b35f6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class MicrorestControllerTest < ActionController::TestCase
-  # Replace this with your real tests.
-  def test_truth
-    assert true
-  end
-end
diff --git a/redmine/redmine_publications/test/test_helper.rb b/redmine/redmine_publications/test/test_helper.rb
deleted file mode 100644 (file)
index bd1ed0c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# Load the normal Rails helper
-require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper')
-
-# Ensure that we are using the temporary fixture path
-Engines::Testing.set_fixture_path
diff --git a/redmine/redmine_publications/test/unit/publication_test.rb b/redmine/redmine_publications/test/unit/publication_test.rb
deleted file mode 100644 (file)
index ccf8aa4..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class PublicationTest < Test::Unit::TestCase
-  fixtures :publications
-
-  # Replace this with your real tests.
-  def test_truth
-    assert true
-  end
-end