licensee 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/licensee/license_file.rb +12 -3
- data/lib/licensee/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e51f3ebe2e7040fca35eebf4e9bdcfd4628136e1
|
4
|
+
data.tar.gz: bc32c352668ac443569bcfef2ee5e471e4bd7dbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35a72332d434e26b0e1d29d82b2e75444a611c8f5d4774d767a46962ca21166eb51a334e29acfbe11b586baf57c981fb826eae3a86cdccdc04b9409178e83bf6
|
7
|
+
data.tar.gz: 985802167181e32a4796dbeeab879dc779c43b662b86a402f1bd89ceebad44932c3aec82790ce0b2c34709b2e3f61261d1c8dc8a498605ec9f19e2af756ea601
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
*A Ruby Gem to detect under what license a project is distributed.*
|
4
4
|
|
5
|
+
[](https://travis-ci.org/benbalter/licensee) [](http://badge.fury.io/rb/licensee)
|
6
|
+
|
5
7
|
## The problem
|
6
8
|
|
7
9
|
* You've got an open source project. How do you know what you can and can't do with the software?
|
@@ -9,8 +9,9 @@ class Licensee
|
|
9
9
|
]
|
10
10
|
|
11
11
|
attr_reader :path
|
12
|
+
attr_accessor :contents
|
12
13
|
|
13
|
-
def initialize(path)
|
14
|
+
def initialize(path=nil)
|
14
15
|
@path = File.expand_path(path)
|
15
16
|
end
|
16
17
|
|
@@ -21,11 +22,19 @@ class Licensee
|
|
21
22
|
alias_method :content, :contents
|
22
23
|
|
23
24
|
def self.find(base_path)
|
24
|
-
raise "Invalid directory" unless
|
25
|
-
file = self::FILENAMES.find { |file|
|
25
|
+
raise "Invalid directory" unless directory_exists? base_path
|
26
|
+
file = self::FILENAMES.find { |file| file_exists?(file, base_path) }
|
26
27
|
new(File.expand_path(file, base_path)) if file
|
27
28
|
end
|
28
29
|
|
30
|
+
def self.directory_exists?(base_path)
|
31
|
+
File.directory?(base_path)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.file_exists?(file, base_path)
|
35
|
+
File.exists? File.expand_path(file, base_path)
|
36
|
+
end
|
37
|
+
|
29
38
|
def length
|
30
39
|
@length ||= content.length
|
31
40
|
end
|
data/lib/licensee/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: licensee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
@@ -110,7 +110,8 @@ files:
|
|
110
110
|
- test/test_licensee_licenses.rb
|
111
111
|
- test/test_licensee_project.rb
|
112
112
|
homepage: http://github.com/benbalter/licensee
|
113
|
-
licenses:
|
113
|
+
licenses:
|
114
|
+
- MIT
|
114
115
|
metadata: {}
|
115
116
|
post_install_message:
|
116
117
|
rdoc_options: []
|