[Rubygems-developers] Add a Gem::Specification#licenses attribute?

Daniel Berger djberg96 at gmail.com
Thu Jan 1 09:03:44 EST 2009


Hi,

Inspired by RF patch #11041, I've added a simple patch to allow 
license(s) to be specified in the gem spec.

--- specification.orig  2009-01-01 06:36:29.000000000 -0700
+++ specification.rb    2009-01-01 06:42:50.000000000 -0700
@@ -302,6 +302,7 @@
          @homepage,
          @has_rdoc,
          @new_platform,
+        @licenses,
        ]
      end

@@ -346,6 +347,7 @@
        spec.instance_variable_set :@has_rdoc,                  array[15]
        spec.instance_variable_set :@new_platform,              array[16]
        spec.instance_variable_set :@platform, 
array[16].to_s
+      spec.instance_variable_set :@license,                   array[17]
        spec.instance_variable_set :@loaded,                    false

        spec
@@ -1066,6 +1068,11 @@
      array_attribute :authors

      ##
+    # The license(s) for the the library
+
+    array_attribute :licenses
+
+    ##
      # Files included in this gem

      array_attribute :files
@@ -1122,6 +1129,10 @@
      attribute_alias_singular :author, :authors

      ##
+    # Singular accessor for licenses
+    attribute_alias_singular :license, :licenses
+
+    ##
      # Singular accessor for require_paths

      attribute_alias_singular :require_path, :require_paths

As you can see, it's a straightforward accessor that, like author(s), 
can be used in singular or plural form (in case you want to specify more 
than one license).

It does _not_ attempt to do any "license enforcement", nor do I even set 
a default license.

I know licensing issues are a touchy subject, but this simple accessor 
seems like a reasonable minimum to me.

What do you think?

Regards,

Dan

PS - I also added and updated a couple tests, and everything still passes.


More information about the Rubygems-developers mailing list