license_auto 0.1.1.1
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 +7 -0
- data/.gitignore +47 -0
- data/.travis.yml +9 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile +27 -0
- data/Gemfile.lock +103 -0
- data/LICENSE +23 -0
- data/README.md +136 -0
- data/Rakefile +20 -0
- data/examples/get_license_files_of_bundler.rb +12 -0
- data/lib/api.rb +60 -0
- data/lib/api/bitbucket.rb +142 -0
- data/lib/api/code_google_com.rb +66 -0
- data/lib/api/excel_export.rb +189 -0
- data/lib/api/gem_data.rb +30 -0
- data/lib/api/git_kernel_org.rb +59 -0
- data/lib/api/github.rb +376 -0
- data/lib/api/go_pkg_in.rb +41 -0
- data/lib/api/golang_org.rb +63 -0
- data/lib/api/google_source_com.rb +68 -0
- data/lib/api/gradle2.rb +41 -0
- data/lib/api/helper.rb +26 -0
- data/lib/api/j_center.rb +23 -0
- data/lib/api/maven_central_repository.rb +192 -0
- data/lib/api/mq.rb +30 -0
- data/lib/api/npm_registry.rb +169 -0
- data/lib/api/pattern.rb +33 -0
- data/lib/api/remote_source_package.rb +319 -0
- data/lib/api/spider.rb +47 -0
- data/lib/cloner.rb +154 -0
- data/lib/db.rb +267 -0
- data/lib/license_auto.rb +20 -0
- data/lib/license_auto/config/config.rb +52 -0
- data/lib/license_auto/errors.rb +0 -0
- data/lib/license_auto/license/frequency.rb +30 -0
- data/lib/license_auto/license/similarity.rb +247 -0
- data/lib/license_auto/license/templates/AFL2.0.txt +43 -0
- data/lib/license_auto/license/templates/AFL2.1.txt +47 -0
- data/lib/license_auto/license/templates/AFL3.0.txt +45 -0
- data/lib/license_auto/license/templates/AGPL3.0.txt +236 -0
- data/lib/license_auto/license/templates/APSL 2.0.txt +100 -0
- data/lib/license_auto/license/templates/Apache1.0.txt +18 -0
- data/lib/license_auto/license/templates/Apache1.1.txt +18 -0
- data/lib/license_auto/license/templates/Apache2.0.txt +201 -0
- data/lib/license_auto/license/templates/Artistic1.0.txt +45 -0
- data/lib/license_auto/license/templates/Artistic2.0.txt +70 -0
- data/lib/license_auto/license/templates/BSD.txt +29 -0
- data/lib/license_auto/license/templates/CDDL1.0.txt +1 -0
- data/lib/license_auto/license/templates/CDDL1.1.txt +209 -0
- data/lib/license_auto/license/templates/CPL1.0.txt +211 -0
- data/lib/license_auto/license/templates/CPOL 1.02.txt +41 -0
- data/lib/license_auto/license/templates/ClarifiedArtistic.txt +140 -0
- data/lib/license_auto/license/templates/Creative Commons1.0.txt +28 -0
- data/lib/license_auto/license/templates/EPL1.0.txt +70 -0
- data/lib/license_auto/license/templates/ERLANG1.1.txt +286 -0
- data/lib/license_auto/license/templates/GFDL1.1.txt +101 -0
- data/lib/license_auto/license/templates/GFDL1.2.txt +108 -0
- data/lib/license_auto/license/templates/GFDL1.3.txt +116 -0
- data/lib/license_auto/license/templates/GPL1.0.txt +105 -0
- data/lib/license_auto/license/templates/GPL2.0.txt +340 -0
- data/lib/license_auto/license/templates/GPL3.0.txt +220 -0
- data/lib/license_auto/license/templates/H2.txt +118 -0
- data/lib/license_auto/license/templates/IBMPublic1.0.txt +58 -0
- data/lib/license_auto/license/templates/LGPL2.0.txt +481 -0
- data/lib/license_auto/license/templates/LGPL2.1.txt +166 -0
- data/lib/license_auto/license/templates/LGPL3.0.txt +56 -0
- data/lib/license_auto/license/templates/Lucent Public License 1.02.txt +244 -0
- data/lib/license_auto/license/templates/MIT.txt +21 -0
- data/lib/license_auto/license/templates/MIT2.0.txt +11 -0
- data/lib/license_auto/license/templates/MPL 2.0.txt +373 -0
- data/lib/license_auto/license/templates/MPL1.1.txt +470 -0
- data/lib/license_auto/license/templates/MS-LPL.txt +22 -0
- data/lib/license_auto/license/templates/MS-PL.txt +20 -0
- data/lib/license_auto/license/templates/MS-RL.txt +19 -0
- data/lib/license_auto/license/templates/NPL1.0.txt +138 -0
- data/lib/license_auto/license/templates/OpenSSL.txt +127 -0
- data/lib/license_auto/license/templates/Oracle license.txt +69 -0
- data/lib/license_auto/license/templates/PublicDomain.txt +7 -0
- data/lib/license_auto/license/templates/Python.txt +15 -0
- data/lib/license_auto/license/templates/QPL1.0.txt +45 -0
- data/lib/license_auto/license/templates/RubyClause-6.txt +56 -0
- data/lib/license_auto/license/templates/SQLite Copyright.txt +33 -0
- data/lib/license_auto/license/templates/Sleepycat.txt +133 -0
- data/lib/license_auto/license/templates/SunPublic1.0.txt +183 -0
- data/lib/license_auto/license/templates/WTFPL license.txt +13 -0
- data/lib/license_auto/license_info.rb +12 -0
- data/lib/license_auto/matcher.rb +100 -0
- data/lib/license_auto/package.rb +73 -0
- data/lib/license_auto/parser/gemfile.rb +0 -0
- data/lib/license_auto/parser/golang.rb +0 -0
- data/lib/license_auto/parser/gradle.rb +0 -0
- data/lib/license_auto/version.rb +20 -0
- data/lib/license_auto/website.rb +11 -0
- data/lib/license_auto/website/github.rb +49 -0
- data/lib/license_auto/website/ruby_gems_org.rb +79 -0
- data/lib/license_auto/website/ruby_gems_org_db.rb +52 -0
- data/lib/license_auto/website/rubydoc_info.rb +12 -0
- data/lib/message.rb +5 -0
- data/lib/misc.rb +131 -0
- data/lib/parser/enums.rb +161 -0
- data/lib/parser/gemfile_parser.rb +221 -0
- data/lib/parser/golang_parser.rb +104 -0
- data/lib/parser/gradle_parser.rb +141 -0
- data/lib/parser/manifest_parser.rb +66 -0
- data/lib/parser/maven_parser.rb +91 -0
- data/lib/parser/npm_parser.rb +82 -0
- data/lib/parser/pip_parser.rb +1 -0
- data/lib/parser/rebar_parser.rb +61 -0
- data/lib/recorder.rb +184 -0
- data/lib/script/apt-get.deps.sh +37 -0
- data/lib/script/debian_dpkg_list.sh +2 -0
- data/lib/script/rubygems.org.importdb.sh +22 -0
- data/license_auto.gemspec +44 -0
- data/remove/license_auto +4 -0
- data/remove/mq_pack.rb +219 -0
- data/remove/mq_repo.rb +106 -0
- metadata +249 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 747f9a52d3563de65831f07b6c660faa9ca8e8d0
|
|
4
|
+
data.tar.gz: 4ec2029e39d2e9d3feb61b75cc2c4c600f6c9370
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 613dabbee06bf1dea2b4e0a6112dfc7be60ae95a457331a133f1c1cb46b9d5f28d300a99532a1c3e48d57dece5af3bcff272960bc00be10069e0131b3efa5577
|
|
7
|
+
data.tar.gz: 1821e4f525816a51713b6986a814df7e892d2b78f51bb0ecf44bea848a02b3b65310f2758a6862c3f136a11937dbcbb4b483c6f800df2603555c2b382e6df541
|
data/.gitignore
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
foo.rb
|
|
2
|
+
*.patch
|
|
3
|
+
*.diff
|
|
4
|
+
node_modules/
|
|
5
|
+
auto.log
|
|
6
|
+
*~
|
|
7
|
+
*.log
|
|
8
|
+
foo/
|
|
9
|
+
bar/
|
|
10
|
+
.key
|
|
11
|
+
*rsa
|
|
12
|
+
.idea/
|
|
13
|
+
*.gem
|
|
14
|
+
*.rbc
|
|
15
|
+
/.config
|
|
16
|
+
/coverage/
|
|
17
|
+
/InstalledFiles
|
|
18
|
+
/pkg/
|
|
19
|
+
/spec/reports/
|
|
20
|
+
/test/tmp/
|
|
21
|
+
/test/version_tmp/
|
|
22
|
+
/tmp/
|
|
23
|
+
|
|
24
|
+
## Specific to RubyMotion:
|
|
25
|
+
.dat*
|
|
26
|
+
.repl_history
|
|
27
|
+
build/
|
|
28
|
+
|
|
29
|
+
## Documentation cache and generated files:
|
|
30
|
+
/.yardoc/
|
|
31
|
+
/_yardoc/
|
|
32
|
+
/doc/
|
|
33
|
+
/rdoc/
|
|
34
|
+
|
|
35
|
+
## Environment normalisation:
|
|
36
|
+
/.bundle/
|
|
37
|
+
/vendor/bundle
|
|
38
|
+
/lib/bundler/man/
|
|
39
|
+
|
|
40
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
41
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
42
|
+
# Gemfile.lock
|
|
43
|
+
# .ruby-version
|
|
44
|
+
# .ruby-gemset
|
|
45
|
+
|
|
46
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
47
|
+
.rvmrc
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. This
|
|
4
|
+
project adheres to [Semantic Versioning 2.0.0][semver]. Any violations of this
|
|
5
|
+
scheme are considered to be bugs.
|
|
6
|
+
|
|
7
|
+
[semver]: http://semver.org/spec/v2.0.0.html
|
|
8
|
+
|
|
9
|
+
## [Unreleased][unreleased]
|
|
10
|
+
|
|
11
|
+
[unreleased]: https://github.com/intridea/hashie/compare/v0.1.0.beta...master
|
|
12
|
+
|
|
13
|
+
## [0.1.0.beta] - 2016-03-07
|
|
14
|
+
|
|
15
|
+
### Initialized
|
|
16
|
+
|
|
17
|
+
* Initialized project by the history code base [v0.1.0.beta](https://github.com/mineworks/license_auto/releases/tag/v0.1.0.beta)
|
data/Gemfile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
|
|
3
|
+
group :default do
|
|
4
|
+
gem "hashie"
|
|
5
|
+
gem "json"
|
|
6
|
+
gem "gems"
|
|
7
|
+
gem "github_api"
|
|
8
|
+
|
|
9
|
+
gem "git"
|
|
10
|
+
gem "log4r"
|
|
11
|
+
# gem "license_finder"
|
|
12
|
+
gem "httparty"
|
|
13
|
+
gem "nokogiri"
|
|
14
|
+
gem "anemone"
|
|
15
|
+
gem 'rest-client'
|
|
16
|
+
# This package should install by bundler as bellow:
|
|
17
|
+
# gem 'bzip2-ruby', :git => 'https://github.com/chewi/bzip2-ruby.git'
|
|
18
|
+
gem "ruby-xz"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
group :test do
|
|
22
|
+
gem "json"
|
|
23
|
+
gem "rspec"
|
|
24
|
+
gem 'webmock'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
addressable (2.4.0)
|
|
5
|
+
anemone (0.7.2)
|
|
6
|
+
nokogiri (>= 1.3.0)
|
|
7
|
+
robotex (>= 1.0.0)
|
|
8
|
+
crack (0.4.3)
|
|
9
|
+
safe_yaml (~> 1.0.0)
|
|
10
|
+
descendants_tracker (0.0.4)
|
|
11
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
|
12
|
+
diff-lcs (1.2.5)
|
|
13
|
+
domain_name (0.5.20160216)
|
|
14
|
+
unf (>= 0.0.5, < 1.0.0)
|
|
15
|
+
faraday (0.9.2)
|
|
16
|
+
multipart-post (>= 1.2, < 3)
|
|
17
|
+
ffi (1.9.10)
|
|
18
|
+
gems (0.8.3)
|
|
19
|
+
git (1.3.0)
|
|
20
|
+
github_api (0.13.1)
|
|
21
|
+
addressable (~> 2.4.0)
|
|
22
|
+
descendants_tracker (~> 0.0.4)
|
|
23
|
+
faraday (~> 0.8, < 0.10)
|
|
24
|
+
hashie (>= 3.4)
|
|
25
|
+
multi_json (>= 1.7.5, < 2.0)
|
|
26
|
+
oauth2
|
|
27
|
+
hashdiff (0.3.0)
|
|
28
|
+
hashie (3.4.3)
|
|
29
|
+
http-cookie (1.0.2)
|
|
30
|
+
domain_name (~> 0.5)
|
|
31
|
+
httparty (0.13.7)
|
|
32
|
+
json (~> 1.8)
|
|
33
|
+
multi_xml (>= 0.5.2)
|
|
34
|
+
io-like (0.3.0)
|
|
35
|
+
json (1.8.3)
|
|
36
|
+
jwt (1.5.1)
|
|
37
|
+
log4r (1.1.10)
|
|
38
|
+
mime-types (2.99.1)
|
|
39
|
+
mini_portile2 (2.0.0)
|
|
40
|
+
multi_json (1.11.2)
|
|
41
|
+
multi_xml (0.5.5)
|
|
42
|
+
multipart-post (2.0.0)
|
|
43
|
+
netrc (0.11.0)
|
|
44
|
+
nokogiri (1.6.7.2)
|
|
45
|
+
mini_portile2 (~> 2.0.0.rc2)
|
|
46
|
+
oauth2 (1.1.0)
|
|
47
|
+
faraday (>= 0.8, < 0.10)
|
|
48
|
+
jwt (~> 1.0, < 1.5.2)
|
|
49
|
+
multi_json (~> 1.3)
|
|
50
|
+
multi_xml (~> 0.5)
|
|
51
|
+
rack (>= 1.2, < 3)
|
|
52
|
+
rack (1.6.4)
|
|
53
|
+
rest-client (1.8.0)
|
|
54
|
+
http-cookie (>= 1.0.2, < 2.0)
|
|
55
|
+
mime-types (>= 1.16, < 3.0)
|
|
56
|
+
netrc (~> 0.7)
|
|
57
|
+
robotex (1.0.0)
|
|
58
|
+
rspec (3.4.0)
|
|
59
|
+
rspec-core (~> 3.4.0)
|
|
60
|
+
rspec-expectations (~> 3.4.0)
|
|
61
|
+
rspec-mocks (~> 3.4.0)
|
|
62
|
+
rspec-core (3.4.3)
|
|
63
|
+
rspec-support (~> 3.4.0)
|
|
64
|
+
rspec-expectations (3.4.0)
|
|
65
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
66
|
+
rspec-support (~> 3.4.0)
|
|
67
|
+
rspec-mocks (3.4.1)
|
|
68
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
69
|
+
rspec-support (~> 3.4.0)
|
|
70
|
+
rspec-support (3.4.1)
|
|
71
|
+
ruby-xz (0.2.3)
|
|
72
|
+
ffi (~> 1.9)
|
|
73
|
+
io-like (~> 0.3)
|
|
74
|
+
safe_yaml (1.0.4)
|
|
75
|
+
thread_safe (0.3.5)
|
|
76
|
+
unf (0.1.4)
|
|
77
|
+
unf_ext
|
|
78
|
+
unf_ext (0.0.7.2)
|
|
79
|
+
webmock (1.24.2)
|
|
80
|
+
addressable (>= 2.3.6)
|
|
81
|
+
crack (>= 0.3.2)
|
|
82
|
+
hashdiff
|
|
83
|
+
|
|
84
|
+
PLATFORMS
|
|
85
|
+
ruby
|
|
86
|
+
|
|
87
|
+
DEPENDENCIES
|
|
88
|
+
anemone
|
|
89
|
+
gems
|
|
90
|
+
git
|
|
91
|
+
github_api
|
|
92
|
+
hashie
|
|
93
|
+
httparty
|
|
94
|
+
json
|
|
95
|
+
log4r
|
|
96
|
+
nokogiri
|
|
97
|
+
rest-client
|
|
98
|
+
rspec
|
|
99
|
+
ruby-xz
|
|
100
|
+
webmock
|
|
101
|
+
|
|
102
|
+
BUNDLED WITH
|
|
103
|
+
1.10.6
|
data/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 MineWorks
|
|
4
|
+
Copyright (c) 2015 Michael Fan
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
|
data/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# license_auto(v0.1.0.beta)
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
[](https://codeclimate.com/github/mineworks/license_auto)
|
|
5
|
+
[](https://travis-ci.org/mineworks/license_auto)
|
|
6
|
+
|
|
7
|
+
[license_auto](https://github.com/mineworks/license_auto) is a Ruby Gem for Open Source License collection job inspired by [LicenseFinder](https://github.com/pivotal/LicenseFinder)
|
|
8
|
+
|
|
9
|
+
### Dependencies Management Detecting Implement Details
|
|
10
|
+
<table>
|
|
11
|
+
<tr>
|
|
12
|
+
<th>Language</th>
|
|
13
|
+
<th>DepsMgmt Program</th>
|
|
14
|
+
<th>Dependencies file</th>
|
|
15
|
+
<th>Default project servers</th>
|
|
16
|
+
<th>Progress(%)</th>
|
|
17
|
+
</tr>
|
|
18
|
+
<tr>
|
|
19
|
+
<td>Ruby</td>
|
|
20
|
+
<td>bundler</td>
|
|
21
|
+
<td>Gemfile(.lock)</td>
|
|
22
|
+
<td>https://rubygems.org/</td>
|
|
23
|
+
<!-- <td> https://rubygems.org/pages/data</td> -->
|
|
24
|
+
<td>1</td>
|
|
25
|
+
</tr>
|
|
26
|
+
<tr>
|
|
27
|
+
<td>Java</td>
|
|
28
|
+
<td>Gradle, Maven</td>
|
|
29
|
+
<td>build.gradle, pom.xml</td>
|
|
30
|
+
<td>https://repo1.maven.org/maven2</td>
|
|
31
|
+
<td>0</td>
|
|
32
|
+
</tr>
|
|
33
|
+
<tr>
|
|
34
|
+
<td>NodeJS</td>
|
|
35
|
+
<td>npm</td>
|
|
36
|
+
<td>package.json</td>
|
|
37
|
+
<td>http://registry.npmjs.org</td>
|
|
38
|
+
<td>0</td>
|
|
39
|
+
</tr>
|
|
40
|
+
<tr>
|
|
41
|
+
<td>Debian</td>
|
|
42
|
+
<td>dpkg -l</td>
|
|
43
|
+
<td></td>
|
|
44
|
+
<td>https://launchpad.net/</td>
|
|
45
|
+
<td>0</td>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<td>Golang</td>
|
|
49
|
+
<td>go list -json ./...</td>
|
|
50
|
+
<td></td>
|
|
51
|
+
<td></td>
|
|
52
|
+
<td>0</td>
|
|
53
|
+
</tr>
|
|
54
|
+
<tr>
|
|
55
|
+
<td>Python</td>
|
|
56
|
+
<td>pip</td>
|
|
57
|
+
<td>requirements.txt</td>
|
|
58
|
+
<td>https://pypi.python.org/pypi</td>
|
|
59
|
+
<td>0</td>
|
|
60
|
+
</tr>
|
|
61
|
+
<tr>
|
|
62
|
+
<td>Erlang</td>
|
|
63
|
+
<td>rebar</td>
|
|
64
|
+
<td>rebar.config</td>
|
|
65
|
+
<td></td>
|
|
66
|
+
<td>0</td>
|
|
67
|
+
</tr>
|
|
68
|
+
</table>
|
|
69
|
+
|
|
70
|
+
## Requirements
|
|
71
|
+
* HTTP Network(WiFi on)
|
|
72
|
+
* HTTP proxy to Google.com is a plus
|
|
73
|
+
* Ruby v2.2.x
|
|
74
|
+
* bundler v1.10.x
|
|
75
|
+
* Gradle v2.9
|
|
76
|
+
* Maven v3.x
|
|
77
|
+
* Rebar v2.6.1
|
|
78
|
+
* npm v3.3.12
|
|
79
|
+
* Python pip v1.5.6
|
|
80
|
+
* go v1.4.2
|
|
81
|
+
|
|
82
|
+
## Install
|
|
83
|
+
``` bash
|
|
84
|
+
gem install license_auto
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Examples
|
|
88
|
+
|
|
89
|
+
* Optional: Config Github Auth
|
|
90
|
+
``` ruby
|
|
91
|
+
require 'license_auto'
|
|
92
|
+
params = {
|
|
93
|
+
github_username: 'Alice'
|
|
94
|
+
github_password: '123456',
|
|
95
|
+
http_proxy: 'http://proxyuser:proxypwd@proxy.server.com:8080'
|
|
96
|
+
}
|
|
97
|
+
LicenseAuto::Base.config(params)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
* Get dependencies of a repository
|
|
101
|
+
``` ruby
|
|
102
|
+
require 'license_auto'
|
|
103
|
+
my_repo = {
|
|
104
|
+
repo_url: 'https://github.com/mineworks/license_auto.git'
|
|
105
|
+
}
|
|
106
|
+
repo = LicenseAuto::Package.new(my_repo)
|
|
107
|
+
dependencies = repo.get_dependencies()
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
* Get License Info of a package
|
|
111
|
+
``` ruby
|
|
112
|
+
require 'license_auto'
|
|
113
|
+
my_pack = {
|
|
114
|
+
language: 'Ruby', # Ruby|Golang|Java|NodeJS|Erlang|Python|
|
|
115
|
+
name: 'bundler',
|
|
116
|
+
group: 'com.google.http-client', # Optional: Assign nil if your package is not a Java
|
|
117
|
+
version: '1.11.2', # Optional: Assign nil if check the latest
|
|
118
|
+
project_server: 'rubygems.org' # Optional: github.com|rubygems.org|pypi.python.org/pypi|registry.npmjs.org
|
|
119
|
+
}
|
|
120
|
+
package = LicenseAuto::Package.new(my_pack)
|
|
121
|
+
license_info = package.get_license_info()
|
|
122
|
+
puts license_info.licenses
|
|
123
|
+
# => #<Hashie::Mash _links=#<Hashie::Mash git="https://api.github.com/repos/bundler/bundler/git/blobs/e356f59f949264bff1600af3476d5e37147957cc" html="https://github.com/bundler/bundler/blob/v1.11.2/LICENSE.md" self="https://api.github.com/repos/bundler/bundler/contents/LICENSE.md?ref=v1.11.2"> download_url="https://raw.githubusercontent.com/bundler/bundler/v1.11.2/LICENSE.md" git_url="https://api.github.com/repos/bundler/bundler/git/blobs/e356f59f949264bff1600af3476d5e37147957cc" html_url="https://github.com/bundler/bundler/blob/v1.11.2/LICENSE.md" name="LICENSE.md" path="LICENSE.md" sha="e356f59f949264bff1600af3476d5e37147957cc" size=1118 type="file" url="https://api.github.com/repos/bundler/bundler/contents/LICENSE.md?ref=v1.11.2">
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Test
|
|
127
|
+
``` bash
|
|
128
|
+
rake spec
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## TODO
|
|
132
|
+
* Check My `Gemfile` licensing for legal issues safe
|
|
133
|
+
* Speed up License name recognizing.
|
|
134
|
+
* Groovy gradle
|
|
135
|
+
* CMake
|
|
136
|
+
* Fork Github official licenses text sample
|
data/Rakefile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# require 'rubygems'
|
|
2
|
+
require 'bundler'
|
|
3
|
+
|
|
4
|
+
require 'rake'
|
|
5
|
+
|
|
6
|
+
require 'rspec/core'
|
|
7
|
+
require 'rspec/core/rake_task'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Bundler::GemHelper.install_tasks
|
|
11
|
+
|
|
12
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
13
|
+
# do not run integration tests, doesn't work on TravisCI
|
|
14
|
+
spec.pattern = FileList['spec/license_auto/*_spec.rb']
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
require 'rubocop/rake_task'
|
|
18
|
+
RuboCop::RakeTask.new(:rubocop)
|
|
19
|
+
|
|
20
|
+
task default: [:rubocop, :spec]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'license_auto'
|
|
2
|
+
my_pack = {
|
|
3
|
+
language: 'Ruby', # Ruby|Golang|Java|NodeJS|Erlang|Python|
|
|
4
|
+
name: 'bundler',
|
|
5
|
+
group: 'com.google.http-client', # Optional: Assign nil if your package is not a Java
|
|
6
|
+
version: '1.11.2', # Optional: Assign nil if check the latest
|
|
7
|
+
project_server: 'rubygems.org' # Optional: github.com|rubygems.org|pypi.python.org/pypi|registry.npmjs.org
|
|
8
|
+
}
|
|
9
|
+
package = LicenseAuto::Package.new(my_pack)
|
|
10
|
+
license_info = package.get_license_info()
|
|
11
|
+
puts license_info.licenses
|
|
12
|
+
# => #<Hashie::Mash _links=#<Hashie::Mash git="https://api.github.com/repos/bundler/bundler/git/blobs/e356f59f949264bff1600af3476d5e37147957cc" html="https://github.com/bundler/bundler/blob/v1.11.2/LICENSE.md" self="https://api.github.com/repos/bundler/bundler/contents/LICENSE.md?ref=v1.11.2"> download_url="https://raw.githubusercontent.com/bundler/bundler/v1.11.2/LICENSE.md" git_url="https://api.github.com/repos/bundler/bundler/git/blobs/e356f59f949264bff1600af3476d5e37147957cc" html_url="https://github.com/bundler/bundler/blob/v1.11.2/LICENSE.md" name="LICENSE.md" path="LICENSE.md" sha="e356f59f949264bff1600af3476d5e37147957cc" size=1118 type="file" url="https://api.github.com/repos/bundler/bundler/contents/LICENSE.md?ref=v1.11.2">
|
data/lib/api.rb
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
require_relative 'api/github'
|
|
2
|
+
require_relative 'api/git_kernel_org'
|
|
3
|
+
require_relative 'api/google_source_com'
|
|
4
|
+
require_relative 'api/code_google_com'
|
|
5
|
+
require_relative 'api/go_pkg_in'
|
|
6
|
+
require_relative 'api/golang_org'
|
|
7
|
+
require_relative 'api/excel_export'
|
|
8
|
+
require_relative 'api/bitbucket'
|
|
9
|
+
require_relative 'api/mq'
|
|
10
|
+
require_relative 'api/spider'
|
|
11
|
+
require_relative 'api/remote_source_package'
|
|
12
|
+
require_relative 'api/npm_registry'
|
|
13
|
+
require_relative 'api/maven_central_repository'
|
|
14
|
+
|
|
15
|
+
module API
|
|
16
|
+
class RemoteSourceVCS
|
|
17
|
+
attr_reader :vcs, :url
|
|
18
|
+
def initialize(url)
|
|
19
|
+
@url = url
|
|
20
|
+
|
|
21
|
+
if url =~ API::SOURCE_URL_PATTERN[:golang_org]
|
|
22
|
+
url = API::GolangOrg.new(url).repo_url
|
|
23
|
+
end
|
|
24
|
+
@vcs = if url =~ API::SOURCE_URL_PATTERN[:github]
|
|
25
|
+
API::Github.new(url)
|
|
26
|
+
elsif url =~ API::SOURCE_URL_PATTERN[:git_kernel_org]
|
|
27
|
+
API::GitKernelOrg.new(url)
|
|
28
|
+
elsif url =~ API::SOURCE_URL_PATTERN[:bitbucket]
|
|
29
|
+
API::Bitbucket.new(url)
|
|
30
|
+
elsif url =~ API::SOURCE_URL_PATTERN[:google_source_com]
|
|
31
|
+
API::GoogleSourceCom.new(url)
|
|
32
|
+
elsif url =~ API::SOURCE_URL_PATTERN[:code_google_com]
|
|
33
|
+
API::CodeGoogleCom.new(url)
|
|
34
|
+
elsif url =~ API::SOURCE_URL_PATTERN[:go_pkg_in]
|
|
35
|
+
API::GoPkgIn.new(url)
|
|
36
|
+
else
|
|
37
|
+
nil
|
|
38
|
+
# raise "Unknown repostory: #{url}"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def get_last_commit
|
|
43
|
+
@vcs.last_commits
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def get_homepage
|
|
47
|
+
homepage = nil
|
|
48
|
+
if @vcs.class == API::GoPkgIn
|
|
49
|
+
homepage = @url
|
|
50
|
+
end
|
|
51
|
+
homepage
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
if __FILE__ == $0
|
|
57
|
+
url = 'https://google.golang.org/cloud/compute'
|
|
58
|
+
r = API::RemoteSourceVCS.new(url)
|
|
59
|
+
p r.get_last_commit
|
|
60
|
+
end
|