|  | 
| 1 |  | -# floss-toolbox (version 2.6.0) | 
|  | 1 | +# floss-toolbox | 
| 2 | 2 | 
 | 
| 3 |  | -Toolbox to help developers and open source referents to have cleaner projects in GitHub organizations. | 
|  | 3 | +Toolbox to help developers and open source referents to have cleaner projects in _GitHub_ organizations, and more. | 
| 4 | 4 | 
 | 
| 5 |  | -Toolbox is mainly written in Shell because this language is very efficient for files processing and provides a strong and rich standard API with cool primitives. Contains also Ruby scripts. Ruby are shiny gems, I love them. | 
|  | 5 | +Toolbox is mainly written in _Shell_ because this language is very efficient for files processing and provides a strong and rich standard API with cool primitives. Contains also _Ruby_ scripts. _Ruby_ are shiny gems, I love them. _Python_ is also used. | 
| 6 | 6 | 
 | 
| 7 | 7 | # Environment | 
| 8 | 8 | 
 | 
| 9 | 9 | You must have a _BASH_ ready environment and also _Ruby_. | 
| 10 | 10 | Environment: | 
| 11 | 11 | - _Bash_ version **3.2.5** | 
| 12 | 12 | - _Ruby_ version **2.7.1** | 
| 13 |  | -- _Python_ version **3** | 
|  | 13 | +- _Python_ version **3.7** | 
| 14 | 14 | 
 | 
| 15 | 15 | # Project tree | 
| 16 | 16 | 
 | 
| @@ -490,4 +490,149 @@ brew install gitleaks | 
| 490 | 490 | You need to define in the _configuration.rb_ files the GitLab organisation ID at **GITLAB_ORGANIZATION_ID**. | 
| 491 | 491 | You have to also define the location to store clones at **REPOSITORIES_CLONE_LOCATION_PATH** and the access token at **GILAB_PERSONAL_ACCESS_TOKEN**. | 
| 492 | 492 | 
 | 
| 493 |  | -**You should also have your _git_ environment ready i.e. add your SSH private key if you clone by SSH for example. _gh_ must be installed, and _python3_ be ready. Obviously _gitleaks_ must be installed** | 
|  | 493 | +**You should also have your _git_ environment ready i.e. add your SSH private key if you clone by SSH for example. _gh_ must be installed, and _python3_ be ready. Obviously _gitleaks_ must be installed** | 
|  | 494 | + | 
|  | 495 | +# Licenses inventory | 
|  | 496 | + | 
|  | 497 | +_Keywords: #licenses #SPM #Gradle #Maven #NPMJS #package_ | 
|  | 498 | + | 
|  | 499 | +## Disclaimer | 
|  | 500 | + | 
|  | 501 | +*This is quite experimental feature, with results which must be verified by a human.* | 
|  | 502 | +*You must deal with platforms and APIs policies and fullfil them.* | 
|  | 503 | + | 
|  | 504 | +*This is software is distributed on "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* | 
|  | 505 | + | 
|  | 506 | +## Prerequisites | 
|  | 507 | + | 
|  | 508 | +- _Python_ version **3.7** | 
|  | 509 | +- _Python_ modules like _requests_, _xmltodict_ and _pytest-6.2.5_ | 
|  | 510 | + | 
|  | 511 | +```shell | 
|  | 512 | +pip install requests | 
|  | 513 | +pip install xmltodict | 
|  | 514 | +pip install pytest | 
|  | 515 | +``` | 
|  | 516 | + | 
|  | 517 | +## Fill the configuration file | 
|  | 518 | + | 
|  | 519 | +Before to use the tools, the file 'config.ini' is at the root of the project, you have to personalize this file. | 
|  | 520 | + | 
|  | 521 | +For example: | 
|  | 522 | +```text | 
|  | 523 | +[dependencies] | 
|  | 524 | +# Where to find the package manager file above | 
|  | 525 | +path to parse = /absolute/path/to/project_to_test | 
|  | 526 | +# The name of the package manager file to process store above | 
|  | 527 | +the filenames = go.mod | 
|  | 528 | +# For outputs | 
|  | 529 | +path to store the licenses = /absolute/path/to/project_to_test-licences | 
|  | 530 | +``` | 
|  | 531 | + | 
|  | 532 | +where: | 
|  | 533 | +- `path to parse` contains the dependencies manager files | 
|  | 534 | +- `the filenames` contains the names of the dependencies manager files to process | 
|  | 535 | +- `path to store the licenses` points to a folder containing the result files | 
|  | 536 | + | 
|  | 537 | +## Run the tool | 
|  | 538 | + | 
|  | 539 | +```shell | 
|  | 540 | +python3 sources/main.py | 
|  | 541 | +``` | 
|  | 542 | + | 
|  | 543 | +## Run the tests | 
|  | 544 | +  | 
|  | 545 | +To run integration tests: | 
|  | 546 | + | 
|  | 547 | +```shell | 
|  | 548 | + python3 -m pytest tests/integrationtests/test_search.py | 
|  | 549 | +``` | 
|  | 550 | + | 
|  | 551 | +To run unit tests: | 
|  | 552 | + | 
|  | 553 | +```shell | 
|  | 554 | + python3 -m pytest tests/unittests/test_config.py | 
|  | 555 | + python3 -m pytest tests/unittests/test_dependency.py | 
|  | 556 | + python3 -m pytest tests/unittests/test_files_check_the_directory.py | 
|  | 557 | + python3 -m pytest tests/unittests/test_files_get_the_filenames_by_name.py | 
|  | 558 | + python3 -m pytest tests/unittests/test_files_write_and_read.py | 
|  | 559 | + python3 -m pytest tests/unittests/test_filter.py | 
|  | 560 | + python3 -m pytest tests/unittests/test_parsing.py | 
|  | 561 | + python3 -m pytest tests/unittests/test_parsing_download.py | 
|  | 562 | +``` | 
|  | 563 | + | 
|  | 564 | +or just | 
|  | 565 | + | 
|  | 566 | +```shell | 
|  | 567 | + python3 -m pytest tests/unittests/*.py | 
|  | 568 | +``` | 
|  | 569 | + | 
|  | 570 | +## Managed platforms | 
|  | 571 | + | 
|  | 572 | +### Go language | 
|  | 573 | + | 
|  | 574 | +`go.mod` files are managed. | 
|  | 575 | +Depending to the `go.mod` definitions implementation, some cases can be applied: | 
|  | 576 | + | 
|  | 577 | +1. github.com will be requested if dependency starts by _github.com_ | 
|  | 578 | +2. pkg.go.dev will be requested for other cases | 
|  | 579 | + | 
|  | 580 | +For example: | 
|  | 581 | + | 
|  | 582 | +```text | 
|  | 583 | +module ... | 
|  | 584 | +
 | 
|  | 585 | +go 1.15 | 
|  | 586 | +
 | 
|  | 587 | +require ( | 
|  | 588 | +	emperror.dev/errors v0.4.2                                          // <--- Request pkg.go.dev | 
|  | 589 | +	github.com/antihax/optional v1.0.0                                  // <--- Request github.com | 
|  | 590 | +	golang.org/x/tools v0.0.0-20201014231627-1610a49f37af // indirect   // <--- Not managed | 
|  | 591 | +	k8s.io/api v0.20.2                                                  // <--- Request pkg.go.dev | 
|  | 592 | +	sigs.k8s.io/controller-runtime v0.7.2                               // <--- Request pkg.go.dev | 
|  | 593 | +) | 
|  | 594 | +``` | 
|  | 595 | + | 
|  | 596 | +### Gradle environment | 
|  | 597 | + | 
|  | 598 | +`build.gradle` and `build.gradle.kts` files are managed. | 
|  | 599 | +Some platforms are requests like _Maven Central_ (search.maven.org) and _GitHub_ (through api.github.com). | 
|  | 600 | + | 
|  | 601 | +**Warning: unstable feature with maybe _Maven Central_ troubles.* | 
|  | 602 | + | 
|  | 603 | +### Rust environment | 
|  | 604 | + | 
|  | 605 | +`Cargo.lock` files are also managed. | 
|  | 606 | +The _crates.io_ platform will be requested for each dependency found. | 
|  | 607 | + | 
|  | 608 | +### JavaScript/Node.js environment | 
|  | 609 | + | 
|  | 610 | +`package.json` files can be parsed too. | 
|  | 611 | +The platform _npmjs.org_ wll be requested for each dependency found. | 
|  | 612 | + | 
|  | 613 | +### Swift / SPM environment | 
|  | 614 | + | 
|  | 615 | +If you use _Swift Package Manager_, you can parse `Package.swift` file. | 
|  | 616 | +The tool will extract the dependency URLs and request some forges, e.g. _github.com_. | 
|  | 617 | + | 
|  | 618 | +### Dart / Flutter environment | 
|  | 619 | + | 
|  | 620 | +The `pubspec.yaml` files can also be processed. | 
|  | 621 | +For each dependency found, the _pub.dev_ platform will be requested. | 
|  | 622 | + | 
|  | 623 | +### Python | 
|  | 624 | + | 
|  | 625 | +_Coming soon_ | 
|  | 626 | + | 
|  | 627 | +### CocoaPods | 
|  | 628 | + | 
|  | 629 | +_Coming soon_ | 
|  | 630 | + | 
|  | 631 | +## Notes | 
|  | 632 | + | 
|  | 633 | +The tool downloads a file for each dependency it found in the dependency manager file. | 
|  | 634 | +These files containing the licenses are in directory like 'licenses/sub_folder', where 'sub_folder' is created for each platform: Gradle, Rust, etc. | 
|  | 635 | + | 
|  | 636 | +A file 'licenses.txt' is created in the folder 'licenses'.  | 
|  | 637 | +This file contains the list of the licenses for each dependency. | 
|  | 638 | +To personalize this folder, use 'config.ini'. | 
0 commit comments