gem-licenses 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+
3
+ group :development do
4
+ gem 'rspec', '~> 2.5.0'
5
+ gem "jeweler", "~> 1.5.2"
6
+ end
7
+
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) Daniel Doubrovkine, 2011 by Artsy, Inc.
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,50 @@
1
+ Gem-Licenses
2
+ ============
3
+
4
+ Gem-licenses is an attempt to collect license information from project's gems. Similar to [3licenses](http://3licenses.codeplex.com/).
5
+
6
+ Motivation
7
+ ==========
8
+
9
+ The overwhelming majority of 3rd party licenses require the application that uses them to reproduce the license verbatim in an artifact that is installed with the application itself. For instance, the BSD license states the following.
10
+
11
+ “Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.”
12
+
13
+ Are you currently copying individual license.txt files "by hand" or are you including license text in your documentation with copy/paste? This project aims at improving this situation.
14
+
15
+ Usage
16
+ =====
17
+
18
+ Include in your project. To list licenses try the following Rake task.
19
+
20
+ task :licenses do
21
+ Gem.licenses.each do |license, gems|
22
+ puts "#{license}"
23
+ gems.each do |gem|
24
+ puts " #{gem.name} (#{gem.full_gem_path})"
25
+ end
26
+ end
27
+ end
28
+
29
+ Contributing
30
+ ============
31
+
32
+ * Fork the project.
33
+ * Make your feature addition or bug fix, write tests.
34
+ * Commit, do not mess with rakefile, version, or history.
35
+ * Make a pull request.
36
+
37
+ License
38
+ =======
39
+
40
+ This project is licenced under the MIT license.
41
+
42
+ Copyright
43
+ =========
44
+
45
+ Copyright (c) Daniel Doubrovkine, 2011 by Artsy, Inc.
46
+
47
+
48
+
49
+
50
+
@@ -0,0 +1,45 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+
4
+ begin
5
+ Bundler.setup(:default, :development)
6
+ rescue Bundler::BundlerError => e
7
+ $stderr.puts e.message
8
+ $stderr.puts "Run `bundle install` to install missing gems."
9
+ exit e.status_code
10
+ end
11
+
12
+ require 'rake'
13
+ require 'rspec/core/rake_task'
14
+
15
+ require 'jeweler'
16
+
17
+ Jeweler::Tasks.new do |gem|
18
+ gem.name = "gem-licenses"
19
+ gem.homepage = "http://github.com/dblock/gem-licenses"
20
+ gem.license = "MIT"
21
+ gem.summary = "List all gem licenses."
22
+ gem.description = "Attempts to figure out what licenses various gems use."
23
+ gem.email = "dblock@dblock.org"
24
+ gem.authors = [ "Daniel Doubrovkine" ]
25
+ end
26
+
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ RSpec::Core::RakeTask.new(:spec) do |spec|
30
+ spec.pattern = "spec/**/*_spec.rb"
31
+ end
32
+
33
+ task :default => :spec
34
+
35
+ require 'gem_licenses.rb'
36
+
37
+ task :licenses do
38
+ Gem.licenses.each do |license, gems|
39
+ puts "#{license}"
40
+ gems.each do |gem|
41
+ puts " #{gem.name} (#{gem.full_gem_path})"
42
+ end
43
+ end
44
+ end
45
+
data/VERSION ADDED
@@ -0,0 +1,2 @@
1
+ 0.1.0
2
+
@@ -0,0 +1,57 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{gem-licenses}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Daniel Doubrovkine"]
12
+ s.date = %q{2011-07-25}
13
+ s.description = %q{Attempts to figure out what licenses various gems use.}
14
+ s.email = %q{dblock@dblock.org}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".rspec",
21
+ "Gemfile",
22
+ "LICENSE",
23
+ "README.md",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "gem-licenses.gemspec",
27
+ "lib/gem_licenses.rb",
28
+ "lib/gem_specification.rb",
29
+ "spec/gem_licenses/gem_licenses_spec.rb",
30
+ "spec/spec_helper.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/dblock/gem-licenses}
33
+ s.licenses = ["MIT"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.6.2}
36
+ s.summary = %q{List all gem licenses.}
37
+ s.test_files = [
38
+ "spec/gem_licenses/gem_licenses_spec.rb",
39
+ "spec/spec_helper.rb"
40
+ ]
41
+
42
+ if s.respond_to? :specification_version then
43
+ s.specification_version = 3
44
+
45
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
+ s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
47
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
48
+ else
49
+ s.add_dependency(%q<rspec>, ["~> 2.5.0"])
50
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
51
+ end
52
+ else
53
+ s.add_dependency(%q<rspec>, ["~> 2.5.0"])
54
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
55
+ end
56
+ end
57
+
@@ -0,0 +1,20 @@
1
+ module Gem
2
+
3
+ require 'gem_specification'
4
+
5
+ class << self
6
+
7
+ def licenses
8
+ licenses = {}
9
+ Gem.loaded_specs.each do |key, spec|
10
+ # gemspec defines licenses
11
+ spec.licenses.each do |license|
12
+ licenses[license.to_sym] ||= []
13
+ licenses[license.to_sym] << spec
14
+ end
15
+ end
16
+ licenses
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,31 @@
1
+ class Gem::Specification
2
+ alias_method :__licenses, :licenses
3
+
4
+ def licenses
5
+ ary = __licenses || []
6
+ ary.length == 0 ? guess_licenses : ary
7
+ end
8
+
9
+ def guess_licenses
10
+ licenses = []
11
+ Dir.foreach(full_gem_path) do |filename|
12
+ filename_without_extension = File.basename(filename, File.extname(filename)).downcase
13
+ next unless filename_without_extension.include?("license")
14
+ parts = filename.split('-')
15
+ if (parts.length >= 2)
16
+ licenses << parts[0].upcase
17
+ else
18
+ license_file = File.join(full_gem_path, filename)
19
+ license_file_handle = File.new(license_file, "r")
20
+ while (line = license_file_handle.gets)
21
+ line = line.strip
22
+ licenses << "MIT" if line.include? "MIT License"
23
+ end
24
+ end
25
+ end
26
+ licenses << :unknown if licenses.length == 0
27
+ licenses
28
+ end
29
+
30
+ end
31
+
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gem do
4
+ it "collects 3rd party licenses" do
5
+ licenses = Gem.licenses
6
+ licenses.size.should == 2
7
+ licenses[:MIT].size.should == 7
8
+ licenses[:unknown].size.should == 2
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'rspec'
4
+
5
+ require File.expand_path("../../lib/gem_licenses", __FILE__)
6
+
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem-licenses
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Daniel Doubrovkine
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-07-25 00:00:00.000000000 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ requirement: &85711830 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 2.5.0
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: *85711830
26
+ - !ruby/object:Gem::Dependency
27
+ name: jeweler
28
+ requirement: &85711590 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.5.2
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *85711590
37
+ description: Attempts to figure out what licenses various gems use.
38
+ email: dblock@dblock.org
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.md
44
+ files:
45
+ - .rspec
46
+ - Gemfile
47
+ - LICENSE
48
+ - README.md
49
+ - Rakefile
50
+ - VERSION
51
+ - gem-licenses.gemspec
52
+ - lib/gem_licenses.rb
53
+ - lib/gem_specification.rb
54
+ - spec/gem_licenses/gem_licenses_spec.rb
55
+ - spec/spec_helper.rb
56
+ has_rdoc: true
57
+ homepage: http://github.com/dblock/gem-licenses
58
+ licenses:
59
+ - MIT
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ segments:
71
+ - 0
72
+ hash: -437104687
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 1.6.2
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: List all gem licenses.
85
+ test_files:
86
+ - spec/gem_licenses/gem_licenses_spec.rb
87
+ - spec/spec_helper.rb