licensee 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da987b46bd2ebeb6b8e471f3ed51eb7ffd90879f
4
- data.tar.gz: b554305bc92b5d90e55332a4df72d621dc48ab1a
3
+ metadata.gz: e51f3ebe2e7040fca35eebf4e9bdcfd4628136e1
4
+ data.tar.gz: bc32c352668ac443569bcfef2ee5e471e4bd7dbb
5
5
  SHA512:
6
- metadata.gz: 847fa7da0debf9e7e22de770a8297b1c6a0649a53c3fdbf3a83dfd07c606f3bce1ae30c1580d28d8cf57a718bcf3503f764bebb654e1ee08e701a68126ae3f90
7
- data.tar.gz: 240e989c5bd228121872d5ac3272173a545109a0c3eee490e42d52b9c19274da4d57647a688543adefb2e0301db7b63982decb0f0636c59af429eda7b4d87a2f
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
+ [![Build Status](https://travis-ci.org/benbalter/licensee.svg)](https://travis-ci.org/benbalter/licensee) [![Gem Version](https://badge.fury.io/rb/licensee.svg)](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 File.directory?(base_path)
25
- file = self::FILENAMES.find { |file| File.exists? File.expand_path(file, base_path) }
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
@@ -1,3 +1,3 @@
1
1
  class Licensee
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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: []