licensed 2.3.2 → 2.4.0

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: 56c8ff31beb8493afcf2d724011bd55765767d01
4
- data.tar.gz: 87146893755f09eedfa24d532eaae569d3f4cf9f
3
+ metadata.gz: 4578c64f9787f2894b6366165f1a1075f61ac7eb
4
+ data.tar.gz: 34ffddfaa1572948bce8bc116a5cfd093c685a13
5
5
  SHA512:
6
- metadata.gz: caa53e7f93ec83fa18c4b3264339035b9478e3dfb6ac0b3a50d3d52b06037f03d3c3c8446765fe52a330cb8d21fa48f580439000b6e1c8c024c68c940d6b3969
7
- data.tar.gz: 5894bef9cc7e7824a7adbe5a341bd244dcf45e7816a49c77aac49141a6b750c26d2fc160c7c36cc0439c3fb19603674e9ad3e0b71f0f2737dda3f8e4c9a72faf
6
+ metadata.gz: 0c9861f9d076050e389843122baeb96501f9a53e5252309576512e102fdef4f1dc7196593c66254e30a793c734a0127b53942215366a78e6f7444e04bffe9e27
7
+ data.tar.gz: 51880d49fca93099ee44997b2878c29d7ed25bc88d221439fcf73039a9728ee6079d0843fd90a615ffb21f6871ce9dadd310765c3a98799e13e81138630bf7fd
@@ -86,25 +86,33 @@ jobs:
86
86
  needs: [create_release]
87
87
 
88
88
  steps:
89
- - uses: actions/download-artifact@master
89
+ - name: Download linux package
90
+ uses: actions/download-artifact@master
90
91
  with:
91
92
  name: licensed-${{github.event.ref}}-linux-x64.tar.gz
92
- - uses: actions/download-artifact@master
93
+ - name: Download macOS package
94
+ uses: actions/download-artifact@master
93
95
  with:
94
96
  name: licensed-${{github.event.ref}}-darwin-x64.tar.gz
95
97
 
96
- - name: Publish to GitHub Release
98
+ - name: Publish packages to GitHub Release
97
99
  uses: Roang-zero1/github-upload-release-artifacts-action@v2.0.0
98
100
  with:
99
101
  args: licensed-${{github.event.ref}}-linux-x64.tar.gz licensed-${{github.event.ref}}-darwin-x64.tar.gz
100
102
  env:
101
103
  GITHUB_TOKEN: ${{secrets.API_AUTH_TOKEN}}
102
104
 
103
- - uses: actions/download-artifact@master
105
+ - name: Download gem
106
+ uses: actions/download-artifact@master
104
107
  with:
105
108
  name: licensed-${{github.event.ref}}.gem
109
+
110
+ - name: Set up Ruby 2.6
111
+ uses: actions/setup-ruby@v1
112
+ with:
113
+ version: 2.6.x
106
114
 
107
- - name: Publish to RubyGems
115
+ - name: Publish gem to RubyGems
108
116
  run: |
109
117
  mkdir -p $HOME/.gem
110
118
  touch $HOME/.gem/credentials
@@ -2,7 +2,10 @@ name: Test
2
2
 
3
3
  on:
4
4
  push:
5
- tags: !*
5
+ branches:
6
+ - "*"
7
+ tags:
8
+ - "!*"
6
9
 
7
10
  jobs:
8
11
  bower:
@@ -205,3 +208,25 @@ jobs:
205
208
  run: script/source-setup/pipenv
206
209
  - name: Run tests
207
210
  run: script/test pipenv
211
+
212
+ composer:
213
+ runs-on: ubuntu-latest
214
+ strategy:
215
+ matrix:
216
+ php: [ '5.6', '7.1', '7.2', '7.3' ]
217
+ steps:
218
+ - uses: actions/checkout@master
219
+ - name: Setup php
220
+ uses: nanasess/setup-php@v1.0.2
221
+ with:
222
+ php-version: ${{ matrix.php }}
223
+ - name: Set up Ruby
224
+ uses: actions/setup-ruby@v1
225
+ with:
226
+ version: 2.6.x
227
+ - name: Bootstrap
228
+ run: script/bootstrap
229
+ - name: Set up fixtures
230
+ run: script/source-setup/composer
231
+ - name: Run tests
232
+ run: script/test composer
data/.gitignore CHANGED
@@ -26,6 +26,8 @@ test/fixtures/git_submodule/*
26
26
  test/fixtures/pip/venv
27
27
  test/fixtures/pipenv/Pipfile.lock
28
28
  !test/fixtures/migrations/**/*
29
+ test/fixtures/composer/**/*
30
+ !test/fixtures/composer/composer.json
29
31
 
30
32
  vendor/licenses
31
33
  .licenses
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## 2.4.0
10
+ 2019-09-15
11
+
12
+ ### Added
13
+ - Composer source for PHP (https://github.com/github/licensed/pull/182)
14
+
9
15
  ## 2.3.2
10
16
  2019-08-26
11
17
 
@@ -208,4 +214,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
208
214
 
209
215
  Initial release :tada:
210
216
 
211
- [Unreleased]: https://github.com/github/licensed/compare/2.3.2...HEAD
217
+ [Unreleased]: https://github.com/github/licensed/compare/2.4.0...HEAD
@@ -34,7 +34,7 @@ Pull requests that include a new dependency source must also
34
34
  - Include [documentation](docs/sources) for the new source and update the [documented source list](README.md#sources).
35
35
  - Add a [setup script](script/source-setup) if needed.
36
36
  - Include [tests](test/source) and [test fixtures](test/fixtures) needed to verify the source in CI.
37
- - Add a CI job to [.travis.yml](.travis.yml).
37
+ - Add a CI job to [.github/workflows/test.yml](.github/workflows/test.yml).
38
38
 
39
39
  ## Releasing
40
40
  If you are the current maintainer of this gem:
data/README.md CHANGED
@@ -79,16 +79,17 @@ See the [configuration file documentation](./docs/configuration.md) for more det
79
79
  ### Sources
80
80
 
81
81
  Dependencies will be automatically detected for all of the following sources by default.
82
- 1. [Bower (bower)](./docs/sources/bower.md)
83
- 2. [Bundler](./docs/sources/bundler.md)
84
- 3. [Cabal (cabal)](./docs/sources/cabal.md)
85
- 4. [Go (go)](./docs/sources/go.md)
86
- 5. [Go Dep (dep)](./docs/sources/dep.md)
87
- 6. [Manifest lists (manifests)](./docs/sources/manifests.md)
88
- 7. [NPM (npm)](./docs/sources/npm.md)
89
- 8. [Pip (pip)](./docs/sources/pip.md)
90
- 9. [Pipenv (pipenv)](./docs/sources/pipenv.md)
91
- 10. [Git Submodules (git_submodule)](./docs/sources/git_submodule.md)
82
+ 1. [Bower](./docs/sources/bower.md)
83
+ 1. [Bundler](./docs/sources/bundler.md)
84
+ 1. [Cabal](./docs/sources/cabal.md)
85
+ 1. [Composer](./docs/sources/composer.md)
86
+ 1. [Go](./docs/sources/go.md)
87
+ 1. [Go Dep (dep)](./docs/sources/dep.md)
88
+ 1. [Manifest lists (manifests)](./docs/sources/manifests.md)
89
+ 1. [NPM](./docs/sources/npm.md)
90
+ 1. [Pip](./docs/sources/pip.md)
91
+ 1. [Pipenv](./docs/sources/pipenv.md)
92
+ 1. [Git Submodules (git_submodule)](./docs/sources/git_submodule.md)
92
93
 
93
94
  You can disable any of them in the configuration file:
94
95
 
@@ -0,0 +1,14 @@
1
+ # Composer
2
+
3
+ The composer source will detect dependencies when php is available, a `composer.lock` file is found at an apps `source_path`, and a composer application file is found.
4
+
5
+ It enumerates dependencies and metadata by parsing `composer.lock` files for for dependency metadata and running `php <composer application file> show --format json --path` to obtain local dependency paths on disk.
6
+
7
+ ### Composer application file
8
+
9
+ The default composer application file location is `<repository root>/composer.phar`. To specify a custom composer file location, use the `composer.application_path` configuration setting.
10
+
11
+ ```yml
12
+ composer:
13
+ application_path: "/path/to/composer"
14
+ ```
@@ -5,6 +5,7 @@ module Licensed
5
5
  require "licensed/sources/bower"
6
6
  require "licensed/sources/bundler"
7
7
  require "licensed/sources/cabal"
8
+ require "licensed/sources/composer"
8
9
  require "licensed/sources/dep"
9
10
  require "licensed/sources/git_submodule"
10
11
  require "licensed/sources/go"
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+ require "json"
3
+
4
+ module Licensed
5
+ module Sources
6
+ class Composer < Source
7
+ DEFAULT_COMPOSER_APPLICATON_PATH = "composer.phar"
8
+
9
+ def enabled?
10
+ return false unless Licensed::Shell.tool_available?("php")
11
+ File.exist?(composer_lock) && File.exist?(composer_application_path)
12
+ end
13
+
14
+ def enumerate_dependencies
15
+ packages.map do |package|
16
+ Dependency.new(
17
+ name: package["name"],
18
+ version: package["version"],
19
+ path: package_paths[package["name"]],
20
+ metadata: {
21
+ "type" => Composer.type,
22
+ "name" => package["name"],
23
+ "summary" => package["description"],
24
+ "homepage" => package["homepage"]
25
+ }
26
+ )
27
+ end
28
+ end
29
+
30
+ def packages
31
+ JSON.parse(File.read(composer_lock))["packages"]
32
+ end
33
+
34
+ # Returns the output from running `php composer.phar` to get package metadata
35
+ def package_paths
36
+ return @package_paths if defined?(@package_paths)
37
+
38
+ @package_paths = begin
39
+ output = Licensed::Shell.execute("php", composer_application_path, "show", "--format", "json", "--path", allow_failure: true)
40
+ return {} if output.to_s.empty?
41
+
42
+ path_json = JSON.parse(output)
43
+ return {} unless path_json["installed"]
44
+
45
+ path_json["installed"].each_with_object({}) do |package, hsh|
46
+ hsh[package["name"]] = package["path"]
47
+ end
48
+ end
49
+ end
50
+
51
+ def composer_application_path
52
+ setting = @config.dig("composer", "application_path") || DEFAULT_COMPOSER_APPLICATON_PATH
53
+ File.expand_path(setting, @config.pwd)
54
+ end
55
+
56
+ def composer_lock
57
+ @config.pwd.join("composer.lock")
58
+ end
59
+ end
60
+ end
61
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Licensed
3
- VERSION = "2.3.2".freeze
3
+ VERSION = "2.4.0".freeze
4
4
 
5
5
  def self.previous_major_versions
6
6
  major_version = Gem::Version.new(Licensed::VERSION).segments.first
@@ -6,6 +6,8 @@ if [ -z "$(which cabal)" ]; then
6
6
  exit 127
7
7
  fi
8
8
 
9
+ cabal --version
10
+
9
11
  # setup test fixtures
10
12
  BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
11
13
  cd $BASE_PATH/test/fixtures/cabal
@@ -14,5 +16,4 @@ if [ "$1" == "-f" ]; then
14
16
  find . -not -regex "\.*" -and -not -path "*app*" -print0 | xargs -0 rm -rf
15
17
  fi
16
18
 
17
- cabal update
18
- cabal new-build
19
+ cabal new-build || (cabal update && cabal install)
@@ -0,0 +1,38 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ if [ -z "$(which php)" ]; then
5
+ echo "A local php installation is required for php development." >&2
6
+ exit 127
7
+ fi
8
+
9
+ # setup test fixtures
10
+ BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
11
+ cd $BASE_PATH/test/fixtures/composer
12
+
13
+ if [ "$1" == "-f" ]; then
14
+ find . -not -regex "\.*" -and -not -name "composer\.json" -print0 | xargs -0 rm -rf
15
+ fi
16
+
17
+ if [ ! -f "composer.phar" ]; then
18
+ EXPECTED_SIGNATURE="$(curl -s https://composer.github.io/installer.sig)"
19
+ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
20
+ ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
21
+
22
+ if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then
23
+ >&2 echo 'ERROR: Invalid installer signature'
24
+ rm composer-setup.php
25
+ exit 1
26
+ fi
27
+
28
+ php composer-setup.php
29
+ RESULT=$?
30
+ rm composer-setup.php
31
+
32
+ if [ $RESULT -ne 0 ]; then
33
+ >&2 echo 'ERROR: composer.phar installation failed'
34
+ exit $RESULT
35
+ fi
36
+ fi
37
+
38
+ php composer.phar install
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: licensed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-28 00:00:00.000000000 Z
11
+ date: 2019-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: licensee
@@ -198,7 +198,6 @@ files:
198
198
  - ".licensed.yml"
199
199
  - ".rubocop.yml"
200
200
  - ".ruby-version"
201
- - ".travis.yml"
202
201
  - CHANGELOG.md
203
202
  - CODE_OF_CONDUCT.md
204
203
  - CONTRIBUTING.md
@@ -216,6 +215,7 @@ files:
216
215
  - docs/sources/bower.md
217
216
  - docs/sources/bundler.md
218
217
  - docs/sources/cabal.md
218
+ - docs/sources/composer.md
219
219
  - docs/sources/dep.md
220
220
  - docs/sources/git_submodule.md
221
221
  - docs/sources/go.md
@@ -249,6 +249,7 @@ files:
249
249
  - lib/licensed/sources/bower.rb
250
250
  - lib/licensed/sources/bundler.rb
251
251
  - lib/licensed/sources/cabal.rb
252
+ - lib/licensed/sources/composer.rb
252
253
  - lib/licensed/sources/dep.rb
253
254
  - lib/licensed/sources/git_submodule.rb
254
255
  - lib/licensed/sources/go.rb
@@ -273,6 +274,7 @@ files:
273
274
  - script/source-setup/bower
274
275
  - script/source-setup/bundler
275
276
  - script/source-setup/cabal
277
+ - script/source-setup/composer
276
278
  - script/source-setup/git_submodule
277
279
  - script/source-setup/go
278
280
  - script/source-setup/npm
@@ -1,126 +0,0 @@
1
- install: ./script/bootstrap
2
-
3
- matrix:
4
- include:
5
- # lint and build
6
- - language: ruby
7
- rvm: 2.4.0
8
- script: bundle exec rake rubocop build
9
- env: NAME="Lint and Build"
10
-
11
- # non-source tests
12
- - language: ruby
13
- rvm: 2.4.0
14
- script: ./script/test core
15
- env: NAME="Core"
16
-
17
- # go 1.7 tests
18
- - language: go
19
- go: "1.7.x"
20
- before_script: ./script/source-setup/go
21
- script: ./script/test go
22
- env: NAME="go 1.7.x"
23
-
24
- # go 1.10 tests
25
- - language: go
26
- go: "1.10.x"
27
- before_script: ./script/source-setup/go
28
- script: ./script/test go
29
- env: NAME="go 1.10.x"
30
-
31
- - language: go
32
- go: "1.11.1"
33
- before_script: ./script/source-setup/go
34
- script: ./script/test go
35
- env: NAME="go 1.11.1"
36
-
37
- # dep tests
38
- - language: go
39
- go: "1.10.x"
40
- before_script: ./script/source-setup/go
41
- script: ./script/test dep
42
- env: NAME="go dep"
43
-
44
- # cabal tests
45
- - language: haskell
46
- ghc: "8.2"
47
- before_script: ./script/source-setup/cabal
48
- script: ./script/test cabal
49
- env: NAME="cabal"
50
-
51
- # npm tests
52
- - language: node_js
53
- node_js: "8"
54
- before_script: ./script/source-setup/npm
55
- script: ./script/test npm
56
- env: NAME="npm 8"
57
-
58
- - language: node_js
59
- node_js: "10"
60
- before_script: ./script/source-setup/npm
61
- script: ./script/test npm
62
- env: NAME="npm 10"
63
-
64
- - language: node_js
65
- node_js: "12"
66
- before_script: ./script/source-setup/npm
67
- script: ./script/test npm
68
- env: NAME="npm 12"
69
-
70
- # bower tests
71
- - language: node_js
72
- node_js: "8"
73
- before_script:
74
- - npm install -g bower
75
- - ./script/source-setup/bower
76
- script: ./script/test bower
77
- env: NAME="bower"
78
-
79
- # bundler tests
80
- - language: ruby
81
- rvm: 2.4.0
82
- before_script: ./script/source-setup/bundler
83
- script: ./script/test bundler
84
- env: NAME="bundler"
85
-
86
- # manifest tests
87
- - language: ruby
88
- rvm: 2.4.0
89
- script: ./script/test manifest
90
- env: NAME="manifest"
91
-
92
- # python 2.7 tests
93
- - language: python
94
- python: 2.7
95
- before_script: ./script/source-setup/pip
96
- script: ./script/test pip
97
- env: NAME="pip"
98
-
99
- # python 3.6 tests
100
- - language: python
101
- python: 3.6
102
- before_script: ./script/source-setup/pip
103
- script: ./script/test pip
104
- env: NAME="pip"
105
-
106
- - language: python
107
- python: 3.6
108
- before_script:
109
- - pip install pipenv
110
- - ./script/source-setup/pipenv
111
- script: ./script/test pipenv
112
- env: NAME="pipenv"
113
-
114
- - language: ruby
115
- rvm: 2.4.0
116
- before_script: ./script/source-setup/git_submodule
117
- script: ./script/test git_submodule
118
- env: NAME="git_submodule"
119
-
120
- - language: java
121
- before_script: ./test/fixtures/gradle/gradlew --quiet --version
122
- script: ./script/test gradle
123
- env: NAME="gradle"
124
-
125
- notifications:
126
- disable: true