papers 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjJiMDlhOTlmYjAzNjcwNDE1N2QxN2IyOGU2MTllOGNhNjVlMDI3Yg==
4
+ YTA2ODg0ZGI3YWQ1MmY3ZTM5ZmI3NGU5ZWYyNDI2MmU3MzRjNDQzNA==
5
5
  data.tar.gz: !binary |-
6
- MDBlNGZjZTRmMGQ5NTQ2Mjg4YWNjYzM0Y2M1MzNlM2RiMWY2NTBiYw==
6
+ ODc3MzhmZmM0MjEwMjQxZmNkMDIwMGU3ZjNlYWQ2MDRiZGUxYTUwYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NGFhMTE2ZDg5MTg4ZDQ4NThhMDZjZTE3MzVkNDUwMDE4YzA0YzhhNDY3NWJk
10
- ZDYwNGQzM2ExZWM1ZGU3ZmJjODgzNGM2NzRlYzBjMjhlOWFkYjI5OGFmODI4
11
- NzQzZjI0ZWYxMzcyZDM1M2QyMmE3ZDgyOWFkMDQ3ZWUyNzg5NTU=
9
+ YTQ4ZTVjMGNiZmM2MjgzYjYyNTg3ZjE5OGUxYjg4MTE2NmNjMjQ4NmI0MDBl
10
+ MjE5YThjNWM3MjBjMGNjNjY4MTFjM2MyZWY4ZWE0OGY4NTk1YWNiMjA4NGYy
11
+ ZmZkZTRlZmE1MDM2ZWFlNTdjYmZjYTIyYzAyMTEzYzc2YzNlZmQ=
12
12
  data.tar.gz: !binary |-
13
- OWRkODEwYmFmNTRkZjE5OTg3OGUwZjU0MTJiNTVhNWVkZTgxMGIwNDc1MTEw
14
- YzU1ZGU0ZGIyODQ0ZDNjODllZjBkYWM2MjdhMDJlYmI5ZWNiNWU1MzQ5ZDZm
15
- YWUzZDBlM2Q0ZjBlNzA1YjE4YjRmNWMxMzgxYTI1ZDg3ZmQ4ZDY=
13
+ ZTdjMGVhZTQyOWM5YzA4NTZjMDdjNDA5NmJjMzc1MDUyOGExYWVmNmU5MDQ3
14
+ N2UxMzM5OWQ1NmQyODZmY2RmNjU5Yzc1Mzc4MDRhM2E2MDM5ZDhiZGE5M2Qw
15
+ ZmU3ODdhZmRhNGMxMDk3ODBiMzc4ZjZmYzE0ZGE3NDFjMmI2MTg=
data/.gitignore CHANGED
@@ -3,3 +3,4 @@ config/*
3
3
  Guardfile
4
4
  *.swp
5
5
  Gemfile.lock
6
+ *.gem
data/README.md CHANGED
@@ -6,7 +6,7 @@ Check that your Ruby/Rails project's dependencies are licensed with only the lic
6
6
 
7
7
  # Contents
8
8
  * [Usage](#usage)
9
- * [Validations](#validations)
9
+ * [Example Validations](#example-validations)
10
10
  * [Configuration](#configuration)
11
11
  * [Structure of Dependency Manifest](#dependency-manifest-structure)
12
12
  * [License](#license)
@@ -25,9 +25,10 @@ gem 'papers'
25
25
  ### 1. Generate Dependency Manifest from your bundled gems and JS
26
26
 
27
27
  ```
28
- $ papers
28
+ $ papers --generate
29
+ Created config/papers_manifest.yml!
29
30
  ```
30
- ### 2. Create [Validation Spec](#testing-with-rspec)
31
+ ### 2. Create a Validation Spec (or [use ours](#testing-with-rspec))
31
32
 
32
33
  ### 3. Run the specs
33
34
 
@@ -56,7 +57,7 @@ Finished in 0.01043 seconds
56
57
  ...
57
58
  ```
58
59
 
59
- # Validations
60
+ # Example Validations
60
61
 
61
62
  ## testing with RSpec
62
63
 
@@ -120,7 +121,7 @@ The default whitelist allows for permissive licensing for proprietary or commerc
120
121
 
121
122
  ## Available configuration options
122
123
 
123
- To configure the Papers gem, pass options to ```Papers.configure``` before initialization of LicenseValidator:
124
+ To configure the Papers gem, pass options to ```Papers.configure``` before initialization of LicenseValidator. Currently supported config options:
124
125
 
125
126
  ```
126
127
  Papers.configure do |c|
@@ -1,6 +1,7 @@
1
1
  require 'bundler'
2
2
  require 'yaml'
3
3
  require 'fileutils'
4
+ require 'uri'
4
5
 
5
6
  module Papers
6
7
 
@@ -52,10 +53,13 @@ module Papers
52
53
  name_and_version = "#{spec.name}-#{spec.version}"
53
54
  end
54
55
 
56
+ gem_license = blank?(spec.license) ? 'Unknown' : spec.license
57
+ gem_project_url = blank?(spec.homepage) ? nil : spec.homepage
58
+
55
59
  gems[name_and_version] = {
56
- 'license' => spec.license || 'Unknown',
60
+ 'license' => gem_license,
57
61
  'license_url' => nil,
58
- 'project_url' => spec.homepage || nil
62
+ 'project_url' => ensure_valid_url(gem_project_url)
59
63
  # TODO: add support for multiple licenses? some gemspecs have dual licensing
60
64
  }
61
65
  end
@@ -87,6 +91,19 @@ module Papers
87
91
  ].join("\n")
88
92
  end
89
93
 
94
+ def ensure_valid_url url_string
95
+ match_url = URI::regexp.match(url_string)
96
+ if match_url.nil?
97
+ nil
98
+ else
99
+ match_url[0]
100
+ end
101
+ end
102
+
103
+ def blank? str
104
+ str.respond_to?(:empty?) ? str.empty? : !str
105
+ end
106
+
90
107
  end
91
108
 
92
109
  end
@@ -1,7 +1,7 @@
1
1
  module Papers
2
2
  MAJOR = 1
3
3
  MINOR = 0
4
- PATCH = 1
4
+ PATCH = 2
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].join('.')
7
7
  end
data/papers.gemspec CHANGED
@@ -27,6 +27,6 @@ caught flat-footed by the GPL.
27
27
  s.require_paths = ['lib']
28
28
 
29
29
  # dependencies
30
- s.add_dependency 'rake', '~> 10.1'
30
+ s.add_development_dependency 'rake'
31
31
  s.add_development_dependency 'rspec', '~> 2.14'
32
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ralph Bodenner
@@ -11,22 +11,22 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-12-10 00:00:00.000000000 Z
14
+ date: 2013-12-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - ~>
20
+ - - ! '>='
21
21
  - !ruby/object:Gem::Version
22
- version: '10.1'
23
- type: :runtime
22
+ version: '0'
23
+ type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ~>
27
+ - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '10.1'
29
+ version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rspec
32
32
  requirement: !ruby/object:Gem::Requirement