Diff
Modified: trunk/db/migrate/076_create_content_types.rb (2232 => 2233)
--- trunk/db/migrate/076_create_content_types.rb 2009-06-16 16:32:53 UTC (rev 2232)
+++ trunk/db/migrate/076_create_content_types.rb 2009-06-19 13:16:41 UTC (rev 2233)
@@ -22,11 +22,16 @@
# Create ContentType records for workflows with processors
u = User.find_by_username(Conf.admins.first)
+ if (u.blank?)
+ uid = 1
+ else
+ uid = u.id
+ end
- taverna_1 = ContentType.create(:title => 'Taverna 1', :mime_type => 'application/vnd.taverna.scufl+xml', :user => u)
- taverna_2 = ContentType.create(:title => 'Taverna 2 beta', :mime_type => 'application/vnd.taverna.t2flow+xml', :user => u)
- trident_x = ContentType.create(:title => 'Trident (XOML)', :mime_type => 'application/xaml+xml', :user => u)
- trident_p = ContentType.create(:title => 'Trident (Package)', :mime_type => 'application/octet-stream', :user => u)
+ taverna_1 = ContentType.create(:title => 'Taverna 1', :mime_type => 'application/vnd.taverna.scufl+xml', :user_id => uid)
+ taverna_2 = ContentType.create(:title => 'Taverna 2 beta', :mime_type => 'application/vnd.taverna.t2flow+xml', :user_id => uid)
+ trident_x = ContentType.create(:title => 'Trident (XOML)', :mime_type => 'application/xaml+xml', :user_id => uid)
+ trident_p = ContentType.create(:title => 'Trident (Package)', :mime_type => 'application/octet-stream', :user_id => uid)
# Create ContentType entries for the existing workflows
@@ -57,7 +62,7 @@
next
end
- ft = ContentType.create(:user_id => u.id, :title => entry, :mime_type => 'application/octet-stream')
+ ft = ContentType.create(:user_id => uid, :title => entry, :mime_type => 'application/octet-stream')
workflow_type_to_content_type_id[entry] = ft.id
end
@@ -69,7 +74,7 @@
Blob.find(:all).map do |b|
b.attributes["content_type"].strip end.uniq.each do |entry|
if !blob_type_to_content_type_id[entry]
- ft = ContentType.create(:user_id => u.id, :mime_type => entry, :title => entry)
+ ft = ContentType.create(:user_id => uid, :mime_type => entry, :title => entry)
blob_type_to_content_type_id[entry] = ft.id
end
Modified: trunk/db/migrate/077_create_licenses.rb (2232 => 2233)
--- trunk/db/migrate/077_create_licenses.rb 2009-06-16 16:32:53 UTC (rev 2232)
+++ trunk/db/migrate/077_create_licenses.rb 2009-06-19 13:16:41 UTC (rev 2233)
@@ -10,10 +10,15 @@
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
- u = User.find_by_username(Conf.admins.first)
+ u = User.find_by_username(Conf.admins.first)
+ if (u.blank?)
+ uid = 1
+ else
+ uid=u.id
+ end
#by-nd
- License.create(:user => u, :unique_name => 'by-nd', :title => 'Creative Commons Attribution-No Derivative Works 3.0 Unported License', :description => "<h4>You are free:</h4>
+ License.create(:user_id => uid, :unique_name => 'by-nd', :title => 'Creative Commons Attribution-No Derivative Works 3.0 Unported License', :description => "<h4>You are free:</h4>
<ul>
<li>to Share — to copy, distribute and transmit the work</li>
</ul>
@@ -36,7 +41,7 @@
</ul>", :url ="" 'http://creativecommons.org/licenses/by-nd/3.0/')
#by-sa
- License.create(:user => u, :unique_name => 'by-sa', :title => 'Creative Commons Attribution-Share Alike 3.0 Unported License', :description => "<h4>You are free:</h4>
+ License.create(:user_id => uid, :unique_name => 'by-sa', :title => 'Creative Commons Attribution-Share Alike 3.0 Unported License', :description => "<h4>You are free:</h4>
<ul>
<li>to Share — to copy, distribute and transmit the work</li>
<li>to Remix — to adapt the work</li>
@@ -61,7 +66,7 @@
</ul>", :url ="" 'http://creativecommons.org/licenses/by-sa/3.0/')
#by
- License.create(:user => u, :unique_name => 'by', :title => 'Creative Commons Attribution 3.0 Unported License', :description => "<h4>You are free:</h4>
+ License.create(:user_id => uid, :unique_name => 'by', :title => 'Creative Commons Attribution 3.0 Unported License', :description => "<h4>You are free:</h4>
<ul>
<li>to Share — to copy, distribute and transmit the work</li>
<li>to Remix — to adapt the work</li>
@@ -85,7 +90,7 @@
#by-nc-nd
- License.create(:user => u, :unique_name => 'by-nc-nd', :title => 'Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License', :description => "<h4>You are free:</h4>
+ License.create(:user_id => uid, :unique_name => 'by-nc-nd', :title => 'Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License', :description => "<h4>You are free:</h4>
<ul>
<li>to Share — to copy, distribute and transmit the work</li>
</ul>
@@ -109,7 +114,7 @@
</ul>", :url ="" 'http://creativecommons.org/licenses/by-nc-nd/3.0/')
#by-nc
- License.create(:user => u, :unique_name => 'by-nc', :title => 'Creative Commons Attribution-Noncommercial 3.0 Unported License', :description => "<h4>You are free:</h4>
+ License.create(:user_id => uid, :unique_name => 'by-nc', :title => 'Creative Commons Attribution-Noncommercial 3.0 Unported License', :description => "<h4>You are free:</h4>
<ul>
<li>to Share — to copy, distribute and transmit the work</li>
<li>to Remix — to adapt the work</li>
@@ -133,7 +138,7 @@
</ul>", :url ="" 'http://creativecommons.org/licenses/by-nc/3.0/')
#by-nc-sa
-License.create(:user => u, :unique_name => 'by-nc-sa', :title => 'Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License', :description => "<h4>You are free:</h4>
+License.create(:user_id => uid, :unique_name => 'by-nc-sa', :title => 'Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License', :description => "<h4>You are free:</h4>
<ul>
<li>to Share — to copy, distribute and transmit the work</li>
<li>to Remix — to adapt the work</li>
@@ -158,7 +163,7 @@
</ul>", :url ="" 'http://creativecommons.org/licenses/by-nc-sa/3.0/')
#MIT
-License.create(:user => u, :unique_name => 'MIT', :title => 'MIT License', :description => "<h4>You are free:</h4>
+License.create(:user_id => uid, :unique_name => 'MIT', :title => 'MIT License', :description => "<h4>You are free:</h4>
<ul>
<li>to Share — to copy, distribute and transmit the work</li>
<li>to Remix — to adapt the work</li>
@@ -170,7 +175,7 @@
</ul>", :url ="" 'http://creativecommons.org/licenses/MIT/')
#BSD
-License.create(:user => u, :unique_name => 'BSD', :title => 'BSD License', :description => "<h4>You are free:</h4>
+License.create(:user_id => uid, :unique_name => 'BSD', :title => 'BSD License', :description => "<h4>You are free:</h4>
<ul>
<li>to Share — to copy, distribute and transmit the work</li>
<li>to Remix — to adapt the work</li>
@@ -183,7 +188,7 @@
</ul>", :url ="" 'http://creativecommons.org/licenses/BSD/')
#GPL
-License.create(:user => u, :unique_name => 'GPL', :title => 'GNU General Public License (GPL) 2.0', :description => "<p>The GNU General Public License is a Free Software license. Like any Free Software license, it grants to you the four following freedoms:</p>
+License.create(:user_id => uid, :unique_name => 'GPL', :title => 'GNU General Public License (GPL) 2.0', :description => "<p>The GNU General Public License is a Free Software license. Like any Free Software license, it grants to you the four following freedoms:</p>
<ol>
<li>The freedom to run the program for any purpose.</li>
<li>The freedom to study how the program works and adapt it to your needs.</li>
@@ -199,7 +204,7 @@
<p>Any of the above conditions can be waived if you get permission from the copyright holder.</p>", :url ="" 'http://creativecommons.org/licenses/GPL/2.0/')
#LGPL
-License.create(:user => u, :unique_name => 'LGPL', :title => 'GNU Lesser General Public License (LGPL) 2.1', :description => "<p>The GNU Lesser General Public License is a Free Software license. Like any Free Software license, it grants to you the four following freedoms:</p>
+License.create(:user_id => uid, :unique_name => 'LGPL', :title => 'GNU Lesser General Public License (LGPL) 2.1', :description => "<p>The GNU Lesser General Public License is a Free Software license. Like any Free Software license, it grants to you the four following freedoms:</p>
<ol>
<li>The freedom to run the program for any purpose.</li>
<li>The freedom to study how the program works and adapt it to your needs.</li>
@@ -215,7 +220,7 @@
<p>Any of the above conditions can be waived if you get permission from the copyright holder.</p>", :url ="" 'http://creativecommons.org/licenses/LGPL/2.1/')
#Apache
- License.create(:user => u, :unique_name => 'Apache', :title => 'Apache License v2.0', :description => "<p>See <a href=''>http://www.apache.org/licenses/LICENSE-2.0</a></p>", :url ="" "http://www.apache.org/licenses/LICENSE-2.0")
+ License.create(:user_id => uid, :unique_name => 'Apache', :title => 'Apache License v2.0', :description => "<p>See <a href=''>http://www.apache.org/licenses/LICENSE-2.0</a></p>", :url ="" "http://www.apache.org/licenses/LICENSE-2.0")
end
def self.down
Modified: trunk/db/migrate/078_create_license_options.rb (2232 => 2233)
--- trunk/db/migrate/078_create_license_options.rb 2009-06-16 16:32:53 UTC (rev 2232)
+++ trunk/db/migrate/078_create_license_options.rb 2009-06-19 13:16:41 UTC (rev 2233)
@@ -11,19 +11,24 @@
t.column :updated_at, :datetime
end
u = User.find_by_username(Conf.admins.first)
+ if (u.blank?)
+ uid = 1
+ else
+ uid = u.id
+ end
- LicenseOption.create(:user => u, :title => 'Permits Reproduction', :description => 'Permits making multiple copies', :uri => 'http://creativecommons.org/ns#Reproduction', :predicate => 'permits')
- LicenseOption.create(:user => u, :title => 'Permits Distribution', :description => 'Permits distribution, public display, and publicly performance', :uri => 'http://creativecommons.org/ns#Distribution', :predicate => 'permits')
- LicenseOption.create(:user => u, :title => 'Permits Derivative Works', :description => 'Permits distribution of derivative works', :uri => 'http://creativecommons.org/ns#DerivativeWorks', :predicate => 'permits')
- LicenseOption.create(:user => u, :title => 'Permits High Income Nation Use', :description => 'Permits use in a non-developing country', :uri => 'http://creativecommons.org/ns#HighIncomeNationUse', :predicate => 'permits')
- LicenseOption.create(:user => u, :title => 'Permits Sharing', :description => 'Permits commercial derivatives, but only non-commercial distribution', :uri => 'http://creativecommons.org/ns#Sharing', :predicate => 'permits')
- LicenseOption.create(:user => u, :title => 'Requires Notice', :description => 'Requries copyright and license notices be kept intact', :uri => 'http://creativecommons.org/ns#Notice', :predicate => 'requires')
- LicenseOption.create(:user => u, :title => 'Requires Attribution', :description => 'Requires credit be given to copyright holder and/or author', :uri => 'http://creativecommons.org/ns#Attribution', :predicate => 'requires')
- LicenseOption.create(:user => u, :title => 'Requires Share Alike', :description => 'Requires derivative works be licensed under the same terms or compatible terms as the original work', :uri => 'http://creativecommons.org/ns#ShareAlike', :predicate => 'requires')
- LicenseOption.create(:user => u, :title => 'Requires Source Code', :description => 'Requires source code (the preferred form for making modifications) must be provided when exercising some rights granted by the license.', :uri => 'http://creativecommons.org/ns#SourceCode', :predicate => 'requires')
- LicenseOption.create(:user => u, :title => 'Requires Copyleft', :description => 'Requires derivative and combined works must be licensed under specified terms, similar to those on the original work', :uri => 'http://creativecommons.org/ns#Copyleft', :predicate => 'requires')
- LicenseOption.create(:user => u, :title => 'Requires Lesser Copyleft', :description => 'Requires derivative works must be licensed under specified terms, with at least the same conditions as the original work; combinations with the work may be licensed under different terms', :uri => 'http://creativecommons.org/ns#LesserCopyleft', :predicate => 'requires')
- LicenseOption.create(:user => u, :title => 'Prohibits Commercial User', :description => 'Prohibits exercising rights for commercial purposes', :uri => 'http://creativecommons.org/ns#CommercialUse', :predicate => 'prohibits')
+ LicenseOption.create(:user_id => uid, :title => 'Permits Reproduction', :description => 'Permits making multiple copies', :uri => 'http://creativecommons.org/ns#Reproduction', :predicate => 'permits')
+ LicenseOption.create(:user_id => uid, :title => 'Permits Distribution', :description => 'Permits distribution, public display, and publicly performance', :uri => 'http://creativecommons.org/ns#Distribution', :predicate => 'permits')
+ LicenseOption.create(:user_id => uid, :title => 'Permits Derivative Works', :description => 'Permits distribution of derivative works', :uri => 'http://creativecommons.org/ns#DerivativeWorks', :predicate => 'permits')
+ LicenseOption.create(:user_id => uid, :title => 'Permits High Income Nation Use', :description => 'Permits use in a non-developing country', :uri => 'http://creativecommons.org/ns#HighIncomeNationUse', :predicate => 'permits')
+ LicenseOption.create(:user_id => uid, :title => 'Permits Sharing', :description => 'Permits commercial derivatives, but only non-commercial distribution', :uri => 'http://creativecommons.org/ns#Sharing', :predicate => 'permits')
+ LicenseOption.create(:user_id => uid, :title => 'Requires Notice', :description => 'Requries copyright and license notices be kept intact', :uri => 'http://creativecommons.org/ns#Notice', :predicate => 'requires')
+ LicenseOption.create(:user_id => uid, :title => 'Requires Attribution', :description => 'Requires credit be given to copyright holder and/or author', :uri => 'http://creativecommons.org/ns#Attribution', :predicate => 'requires')
+ LicenseOption.create(:user_id => uid, :title => 'Requires Share Alike', :description => 'Requires derivative works be licensed under the same terms or compatible terms as the original work', :uri => 'http://creativecommons.org/ns#ShareAlike', :predicate => 'requires')
+ LicenseOption.create(:user_id => uid, :title => 'Requires Source Code', :description => 'Requires source code (the preferred form for making modifications) must be provided when exercising some rights granted by the license.', :uri => 'http://creativecommons.org/ns#SourceCode', :predicate => 'requires')
+ LicenseOption.create(:user_id => uid, :title => 'Requires Copyleft', :description => 'Requires derivative and combined works must be licensed under specified terms, similar to those on the original work', :uri => 'http://creativecommons.org/ns#Copyleft', :predicate => 'requires')
+ LicenseOption.create(:user_id => uid, :title => 'Requires Lesser Copyleft', :description => 'Requires derivative works must be licensed under specified terms, with at least the same conditions as the original work; combinations with the work may be licensed under different terms', :uri => 'http://creativecommons.org/ns#LesserCopyleft', :predicate => 'requires')
+ LicenseOption.create(:user_id => uid, :title => 'Prohibits Commercial User', :description => 'Prohibits exercising rights for commercial purposes', :uri => 'http://creativecommons.org/ns#CommercialUse', :predicate => 'prohibits')
end
def self.down
Modified: trunk/db/migrate/079_create_license_attributes.rb (2232 => 2233)
--- trunk/db/migrate/079_create_license_attributes.rb 2009-06-16 16:32:53 UTC (rev 2232)
+++ trunk/db/migrate/079_create_license_attributes.rb 2009-06-19 13:16:41 UTC (rev 2233)
@@ -31,7 +31,7 @@
LicenseAttribute.create(:license => lic, :license_option => derivs )
LicenseAttribute.create(:license => lic, :license_option => sharealike )
lic.save
-
+
#by
lic = License.find(:first,:conditions=>['unique_name = ?','by'])
LicenseAttribute.create(:license => lic, :license_option => reproduction )
@@ -49,7 +49,7 @@
LicenseAttribute.create(:license => lic, :license_option => attribution )
LicenseAttribute.create(:license => lic, :license_option => commercial )
lic.save
-
+
#by-nc
lic = License.find(:first,:conditions=>['unique_name = ?','by-nc'])
LicenseAttribute.create(:license => lic, :license_option => reproduction )
@@ -79,7 +79,7 @@
LicenseAttribute.create(:license => lic, :license_option => sourcecode )
LicenseAttribute.create(:license => lic, :license_option => derivs )
lic.save
-
+
#BSD
lic = License.find(:first,:conditions=>['unique_name = ?','BSD'])
LicenseAttribute.create(:license => lic, :license_option => reproduction )