lib/ronin/license.rb in ronin-0.1.2 vs lib/ronin/license.rb in ronin-0.1.3
- old
+ new
@@ -1,11 +1,11 @@
#
#--
# Ronin - A Ruby platform designed for information security and data
# exploration tasks.
#
-# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
+# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
@@ -22,15 +22,19 @@
#
require 'ronin/model'
require 'ronin/extensions/string'
+require 'dm-predefined'
+
module Ronin
class License
include Model
+ include DataMapper::Predefined
+ # Primary key
property :id, Serial
# License name
property :name, String
@@ -58,24 +62,12 @@
#
# _options_ may contain the following keys:
# <tt>:description</tt>:: The description of the license.
# <tt>:url</tt>:: The URL to the license.
#
- def License.define(name,options={})
- name = name.to_s
- description = options[:description].to_s
- url = options[:url].to_s
-
- meta_def(name.to_method_name) do
- License.first_or_create(
- :name => name,
- :description => description,
- :url => url
- )
- end
-
- return nil
+ def self.define(name,options={})
+ super(name.to_method_name,options.merge(:name => name))
end
# Creative Commons Licenses
define 'CC by', :description => 'Creative Commons Attribution v3.0 License', :url => 'http://creativecommons.org/licenses/by/3.0/'
define 'CC by-sa', :description => 'Creative Commons Attribution-Share Alike v3.0 License', :url => 'http://creativecommons.org/licenses/by-sa/3.0/'
@@ -86,8 +78,11 @@
# GNU Public Licenses
define 'GPL-2', :description => 'GNU Public License v2.0', :url => 'http://www.gnu.org/licenses/gpl-2.0.txt'
define 'GPL-3', :description => 'GNU Public License v3.0', :url => 'http://www.gnu.org/licenses/gpl-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'
end
end