lib/ronin/license.rb in ronin-0.2.4 vs lib/ronin/license.rb in ronin-0.3.0
- old
+ new
@@ -1,9 +1,7 @@
#
-#--
-# Ronin - A Ruby platform designed for information security and data
-# exploration tasks.
+# Ronin - A Ruby platform for exploit development and security research.
#
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,11 +14,10 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#++
#
require 'ronin/model'
require 'dm-predefined'
@@ -46,73 +43,83 @@
# Validations
validates_present :name, :description
validates_is_unique :name
#
- # Returns the name of the license as a String.
+ # Converts the license to a String.
#
+ # @return [String]
+ # The name of the license.
+ #
def to_s
- @name.to_s
+ self.name.to_s
end
- #
- # Defines a new builtin License object of the specified _name_ and the
- # given _opts_. If block is given, it will be passed the newly created
- # License object.
- #
- # _options_ may contain the following keys:
- # <tt>:description</tt>:: The description of the license.
- # <tt>:url</tt>:: The URL to the license.
- #
- def self.define(name,options={})
- super(name.downcase.gsub(/[\s_\-]+/,'_'),options.merge(:name => name))
- end
+ # Creative Commons By-Attribution License
+ predefine :cc_by,
+ :name => 'CC by',
+ :description => 'Creative Commons Attribution v3.0 License',
+ :url => 'http://creativecommons.org/licenses/by/3.0/'
- # Creative Commons Licenses
- define 'CC by',
- :description => 'Creative Commons Attribution v3.0 License',
- :url => 'http://creativecommons.org/licenses/by/3.0/'
+ # Creative Commons By-Attribution Share-Alike License
+ predefine :cc_by_sa,
+ :name => 'CC by-sa',
+ :description => 'Creative Commons Attribution-Share Alike v3.0 License',
+ :url => 'http://creativecommons.org/licenses/by-sa/3.0/'
- define 'CC by-sa',
- :description => 'Creative Commons Attribution-Share Alike v3.0 License',
- :url => 'http://creativecommons.org/licenses/by-sa/3.0/'
+ # Creative Commons By-Attribution No-Derivative Works License
+ predefine :cc_by_nd,
+ :name => 'CC by-nd',
+ :description => 'Creative Commons Attribution-No Derivative Works v3.0 License',
+ :url => 'http://creativecommons.org/licenses/by-nd/3.0/'
- define 'CC by-nd',
- :description => 'Creative Commons Attribution-No Derivative Works v3.0 License',
- :url => 'http://creativecommons.org/licenses/by-nd/3.0/'
+ # Creative Commons By-Attribution Non-Commercial License
+ predefine :cc_by_nc,
+ :name => 'CC by-nc',
+ :description => 'Creative Commons Attribution-Noncommercial v3.0 License',
+ :url => 'http://creativecommons.org/licenses/by-nc/3.0/'
- define 'CC by-nc',
- :description => 'Creative Commons Attribution-Noncommercial v3.0 License',
- :url => 'http://creativecommons.org/licenses/by-nc/3.0/'
+ # Creative Commons By-Attribution Non-Commercial Share-Alike License
+ predefine :cc_by_nc_sa,
+ :name => 'CC by-nc-sa',
+ :description => 'Creative Commons Attribution-Noncommercial-Share Alike v3.0 License',
+ :url => 'http://creativecommons.org/licenses/by-nc-sa/3.0/'
- define 'CC by-nc-sa',
- :description => 'Creative Commons Attribution-Noncommercial-Share Alike v3.0 License',
- :url => 'http://creativecommons.org/licenses/by-nc-sa/3.0/'
+ # Creative Commons By-Attribution Non-Commercial No-Derivative Works
+ # License
+ predefine :cc_by_nc_nd,
+ :name => 'CC by-nc-nd',
+ :description => 'Creative Commons Attribution-Noncommercial-No Derivative Works v3.0 License',
+ :url => 'http://creativecommons.org/licenses/by-nc-nd/3.0/'
- define 'CC by-nc-nd',
- :description => 'Creative Commons Attribution-Noncommercial-No Derivative Works v3.0 License',
- :url => 'http://creativecommons.org/licenses/by-nc-nd/3.0/'
+ # Creative Commons Zero License
+ predefine :cc0,
+ :name => 'CC0',
+ :description => 'Creative Commons Zero License',
+ :url => 'http://creativecommons.org/licenses/zero/1.0/'
- define 'CC0',
- :description => 'Creative Commons Zero License',
- :url => 'http://creativecommons.org/licenses/zero/1.0/'
+ # General Public License, version 2
+ predefine :gpl2,
+ :name => 'GPL-2',
+ :description => 'GNU Public License v2.0',
+ :url => 'http://www.gnu.org/licenses/gpl-2.0.txt'
- # GNU Public Licenses
- define 'GPL-2',
- :description => 'GNU Public License v2.0',
- :url => 'http://www.gnu.org/licenses/gpl-2.0.txt'
+ # General Public License, version 3
+ predefine :gpl3,
+ :name => 'GPL-3',
+ :description => 'GNU Public License v3.0',
+ :url => 'http://www.gnu.org/licenses/gpl-3.0.txt'
- define 'GPL-3',
- :description => 'GNU Public License v3.0',
- :url => 'http://www.gnu.org/licenses/gpl-3.0.txt'
+ # Lesser General Public License, version 3
+ predefine :lgpl3,
+ :name => 'LGPL-3',
+ :description => 'GNU Lesser General Public License v3.0',
+ :url => 'http://www.gnu.org/licenses/lgpl-3.0.txt'
- define 'LGPL-3',
- :description => 'GNU Lesser General Public License v3.0',
- :url => 'http://www.gnu.org/licenses/lgpl-3.0.txt'
-
- # The MIT Licence
- define 'MIT',
- :description => 'The MIT Licence',
- :url => 'http://www.opensource.org/licenses/mit-license.php'
+ # The MIT "as-is" Licence
+ predefine :mit,
+ :name => 'MIT',
+ :description => 'The MIT Licence',
+ :url => 'http://www.opensource.org/licenses/mit-license.php'
end
end