- complete the Derby DDL file used for unit tests : sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl
*/
- public static final int LAST_VERSION = 202;
+ public static final int LAST_VERSION = 203;
public final static String TABLE_NAME = "schema_migrations";
#
def installed_plugins
respond_to do |format|
- format.json { render :json => jsonp(plugins_to_json(Plugin.user_plugins)) }
- format.xml { render :xml => plugins_to_xml(Plugin.user_plugins) }
+ format.json { render :json => jsonp(plugins_to_json(user_plugins())) }
+ format.xml { render :xml => plugins_to_xml(user_plugins()) }
format.text { render :text => text_not_supported }
end
end
+ private
+
def plugins_to_json(plugins=[])
json=[]
plugins.each do |p|
def plugin_to_json(plugin)
hash={}
- hash['key']=plugin.plugin_key
- hash['name']=plugin.name
- hash['version']=plugin.version || '-'
+ hash['key']=plugin.getKey()
+ hash['name']=plugin.getName()
+ hash['version']=plugin.getVersion() || '-'
hash
end
xml.plugins do
plugins.each do |plugin|
xml.plugin do
- xml.key(plugin.plugin_key)
- xml.name(plugin.name)
- xml.version(plugin.version || '-')
+ xml.key(plugin.getKey())
+ xml.name(plugin.getName())
+ xml.version(plugin.getVersion() || '-')
end
end
end
end
+
+ def user_plugins
+ java_facade.getPluginsMetadata().select{|plugin| !plugin.isCore()}.sort
+ end
end
@uninstalls=java_facade.getPluginUninstalls()
@downloads=java_facade.getPluginDownloads()
- @user_plugins=Plugin.user_plugins
- @core_plugins=Plugin.core_plugins
+ @user_plugins=user_plugins()
+ @core_plugins=core_plugins()
end
def updates
@user_plugins={}
@last_compatible={}
- Plugin.user_plugins.each do |plugin|
- @user_plugins[plugin.plugin_key]=plugin.version
+ user_plugins.each do |plugin|
+ @user_plugins[plugin.getKey()]=plugin.getVersion()
end
load_matrix()
redirect_to home_url
end
end
+
+ def user_plugins
+ java_facade.getPluginsMetadata().select{|plugin| !plugin.isCore()}.sort
+ end
+
+ def core_plugins
+ java_facade.getPluginsMetadata().select{|plugin| plugin.isCore()}.sort
+ end
end
+++ /dev/null
-#
-# Sonar, open source software quality management tool.
-# Copyright (C) 2008-2011 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# Sonar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
-#
-class Plugin < ActiveRecord::Base
-
- has_many :files, :class_name => 'PluginFile'
-
- def self.plugins
- find(:all, :order => 'name')
- end
-
- def self.user_plugins
- find(:all, :conditions => {:core => false}, :order => 'name')
- end
-
- def self.core_plugins
- find(:all, :conditions => {:core => true}, :order => 'name')
- end
-end
+++ /dev/null
-#
-# Sonar, open source software quality management tool.
-# Copyright (C) 2008-2011 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# Sonar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
-#
-class PluginFile < ActiveRecord::Base
- belongs_to :plugin
-end
<% @server.system_info.each do |data| %>
<%= render :partial => 'row', :locals => {:title => data[0], :value => data[1], :name => 'system' } %>
<% end %>
-</thead>
<tbody>
</table>
<% @server.sonar_info.each do |data| %>
<%= render :partial => 'row', :locals => {:title => data[0], :value => data[1], :name => 'sonar' } %>
<% end %>
-</thead>
<tbody>
</table>
<% @server.system_statistics.each do |data| %>
<%= render :partial => 'row', :locals => {:title => data[0], :value => data[1], :name => 'memory' } %>
<% end %>
-</thead>
<tbody>
</table>
</tr>
</thead>
<tbody>
- <% @server.sonar_plugins.each do |data| %>
- <%= render :partial => 'row', :locals => {:title => data[0], :value => data[1], :name => 'plugins' } %>
- <% end %>
-</thead>
+ <%
+ user_plugins=@server.sonar_plugins
+ if user_plugins.empty?
+ %>
+ <tr><td colspan="2" class="even">None</td></tr>
+ <% else %>
+ <% user_plugins.each do |data| %>
+ <%= render :partial => 'row', :locals => {:title => data[0], :value => data[1], :name => 'plugins' } %>
+ <% end %>
+ <% end %>
<tbody>
</table>
<% @server.system_properties.each do |data| %>
<%= render :partial => 'row', :locals => {:title => data[0], :value => data[1], :name => 'system_properties' } %>
<% end %>
-</thead>
<tbody>
</table>
<% else
@user_plugins.each do |plugin|
%>
- <tr class="select <%= cycle('even', 'odd', :name => 'user') -%>" id="select_<%= plugin.plugin_key -%>">
- <td width="1%" nowrap><b><a href="#plugin" onclick="showPlugin('<%= plugin.plugin_key -%>')"><%= h(plugin.name) -%></a></b></td>
- <td><%= plugin.version || '-' -%></td>
+ <tr class="select <%= cycle('even', 'odd', :name => 'user') -%>" id="select_<%= plugin.getKey() -%>">
+ <td width="1%" nowrap><b><a href="#plugin" onclick="showPlugin('<%= plugin.getKey() -%>')"><%= h(plugin.getName()) -%></a></b></td>
+ <td><%= plugin.getVersion() || '-' -%></td>
<td>
- <%= plugin.description -%>
+ <%= plugin.getDescription() -%>
- <div id="detail-<%= plugin.plugin_key -%>" style="display:none">
+ <div id="detail-<%= plugin.getKey() -%>" style="display:none">
<table class="spaced width100">
- <% if plugin.license %><tr><td class="thin nowrap"><b>License:</b> </td><td><%= plugin.license -%></td></tr><% end %>
- <% if plugin.organization %>
+ <% if plugin.getLicense() %><tr><td class="thin nowrap"><b>License:</b> </td><td><%= plugin.getLicense() -%></td></tr><% end %>
+ <% if plugin.getOrganization() %>
<tr><td class="thin nowrap"><b>Author:</b> </td>
- <td><%= link_to_if plugin.organization_url, plugin.organization, plugin.organization_url, :class=>'external' -%></td>
+ <td><%= link_to_if plugin.getOrganizationUrl(), plugin.getOrganization(), plugin.getOrganizationUrl(), :class=>'external' -%></td>
</tr>
<% end %>
- <% if plugin.homepage %>
+ <% if plugin.getHomepage() %>
<tr>
<td colspan="2">
- <%= link_to 'Homepage', plugin.homepage, :class => 'external' -%>
+ <%= link_to 'Homepage', plugin.getHomepage(), :class => 'external' -%>
</td>
</tr>
<% end %>
<tr>
<td colspan="2">
- <form method="post" action="<%= ApplicationController.root_context -%>/updatecenter/uninstall?key=<%= plugin.plugin_key -%>" style="display: inline-block">
+ <form method="post" action="<%= ApplicationController.root_context -%>/updatecenter/uninstall?key=<%= plugin.getKey() -%>" style="display: inline-block">
<input type="submit" value="Uninstall"></input>
</form>
</td>
<%
@core_plugins.each do |plugin|
%>
- <tr class="<%= cycle('even','odd', :name => 'core') -%>" id="<%= u plugin.plugin_key -%>">
- <td width="1%" nowrap><b><%= plugin.name -%></b></td>
- <td><%= plugin.description %></td>
+ <tr class="<%= cycle('even','odd', :name => 'core') -%>" id="<%= u plugin.getKey() -%>">
+ <td width="1%" nowrap><b><%= plugin.getName() -%></b></td>
+ <td><%= plugin.getDescription() -%></td>
</tr>
<% end %>
</tbody>
class AddPluginsChildFirstClassloaderColumn < ActiveRecord::Migration
def self.up
- add_column 'plugins', 'child_first_classloader', :boolean, :null => true
- Plugin.reset_column_information
- Plugin.update_all(Plugin.sanitize_sql_for_assignment({:child_first_classloader=>false}))
+ # this table has been removed in 2.9 (see migration 203)
+ #add_column 'plugins', 'child_first_classloader', :boolean, :null => true
+ #Plugin.reset_column_information
+ #Plugin.update_all(Plugin.sanitize_sql_for_assignment({:child_first_classloader=>false}))
end
end
class AddPluginBase < ActiveRecord::Migration
def self.up
- add_column 'plugins', 'base_plugin', :string, :limit => 100, :null => true
- Plugin.reset_column_information
+ # this table has been removed in 2.9 (see migration 203)
+ #add_column 'plugins', 'base_plugin', :string, :limit => 100, :null => true
+ #Plugin.reset_column_information
end
end
--- /dev/null
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2011 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+
+#
+# Sonar 2.9
+#
+class DropPluginTables < ActiveRecord::Migration
+
+ def self.up
+ drop_table('plugins')
+ drop_table('plugin_files')
+ end
+
+end
+++ /dev/null
-<dataset>
- <plugins id="1" name="Checkstyle" plugin_key="checkstyle" organization="[null]" organization_url="[null]" license="[null]" homepage="[null]"
- description="[null]" installation_date="[null]" plugin_class="[null]" core="true" version="2.2" />
-
- <plugin_files id="1" plugin_id="1" filename="checkstyle-plugin.jar"/>
-
-</dataset>
\ No newline at end of file
primary key (id)
);
-create table PLUGINS (
- ID INTEGER not null,
- PLUGIN_KEY VARCHAR(100),
- VERSION VARCHAR(100),
- NAME VARCHAR(100),
- DESCRIPTION VARCHAR(3000),
- ORGANIZATION VARCHAR(100),
- ORGANIZATION_URL VARCHAR(500),
- LICENSE VARCHAR(50),
- INSTALLATION_DATE TIMESTAMP,
- PLUGIN_CLASS VARCHAR(100),
- HOMEPAGE VARCHAR(500),
- CORE SMALLINT,
- CHILD_FIRST_CLASSLOADER SMALLINT,
- BASE_PLUGIN VARCHAR(100),
- primary key (id)
-);
-
-create table PLUGIN_FILES (
- ID INTEGER not null,
- PLUGIN_ID INTEGER,
- FILENAME VARCHAR(100),
- primary key (id)
-);
-
create table PROJECTS (
ID INTEGER not null,
NAME VARCHAR(256),