license_finder 2.0.0 → 2.0.1

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: cfcc32451073719f18ccbd51a98c62a8a741500f
4
- data.tar.gz: 5d51cb13de5f31a9b994ec5259850432b7ad5b6d
3
+ metadata.gz: d990fb1780e04248b610182ed8462f373566c55f
4
+ data.tar.gz: dcf2f4bf1333eab01c97c3f94dee4fda031250d0
5
5
  SHA512:
6
- metadata.gz: 1bf9e97e40975279f6e3a8b7920093be14084b7ac3cfb668e54ee1429b03e825a8d5120877959df8e626e82a5882a84c5f7109c599919fcf1af4cf159b1ea647
7
- data.tar.gz: bea4e4ad49d7567e2650bac22d018f3361868a7d8eaf4e2d6f35d4c7958db902c9e18aa007221ad59395a058bcff3fdaf6410178fac96d696c3e7fe1c6e988e4
6
+ metadata.gz: bb4c5f49e5e9acf40a7d614e5bc9db7800b62216fa7e1090e943ac2ff241f4102d5355a14f8d57aa348ab077eea6b912b0024fe629dc69a63b0ac7fbedaefd52
7
+ data.tar.gz: 8911df07b9c74ada47fafd4b506d6877d758d2299972fe93d9177352bd95aa7ff59b98245321db8277c28ca4ca26789f8ac5bc24586a0d93b57d6c779c5de488
@@ -12,7 +12,7 @@ matrix:
12
12
  - rvm: jruby-head
13
13
 
14
14
  env:
15
- - PATH=$PATH:$HOME/gradle/bin
15
+ - PATH=$PATH:$HOME/gradle/bin:$HOME/rebar
16
16
 
17
17
  notifications:
18
18
  email:
@@ -27,8 +27,12 @@ before_install:
27
27
  - pip --version
28
28
  - cd /tmp
29
29
  - wget http://services.gradle.org/distributions/gradle-1.11-all.zip
30
+ - wget https://raw.github.com/wiki/rebar/rebar/rebar
30
31
  - unzip -q gradle*
31
32
  - rm gradle*.zip
32
33
  - mv gradle* ~/gradle
34
+ - mkdir ~/rebar
35
+ - mv rebar ~/rebar/
36
+ - chmod u+x ~/rebar/rebar
33
37
  - npm install -g bower
34
38
  - cd -
@@ -1,3 +1,9 @@
1
+ === 2.0.1 / 2015-03-02
2
+
3
+ * Features
4
+
5
+ * Support for rebar projects
6
+
1
7
  === 2.0.0 / 2015-03-02
2
8
 
3
9
  * Features
data/README.md CHANGED
@@ -25,6 +25,7 @@ report.
25
25
 
26
26
  * Java (via `maven`)
27
27
  * Java (via `gradle`)
28
+ * Erlang (via `rebar`)
28
29
  * Objective-C (+ CocoaPods)
29
30
 
30
31
 
@@ -95,6 +96,7 @@ languages, as long as that language has a package definition in the project dire
95
96
  * `build.gradle` (for `gradle`)
96
97
  * `bower.json` (for `bower`)
97
98
  * `Podfile` (for CocoaPods)
99
+ * `rebar.config` (for `rebar`)
98
100
 
99
101
 
100
102
  ### Continuous Integration
@@ -156,11 +158,8 @@ any other decision about your project.
156
158
 
157
159
  ### Decisions file
158
160
 
159
- Any decisions you make about approvals will be recorded in a YAML file. Be
160
- default, `license_finder` expects it to be named
161
- `doc/dependency_decisions.yml`. All commands can be passed `--decisions_file`
162
- to override this location. See [Configuration](#configuration) for other
163
- options.
161
+ Any decisions you make about approvals will be recorded in a YAML file named
162
+ `doc/dependency_decisions.yml`.
164
163
 
165
164
  This file must be committed to version control. Rarely, you will have to
166
165
  manually resolve conflicts in it. In this situation, keep in mind that each
@@ -259,6 +258,23 @@ machine. Adding it to the `ignored_dependencies` would prevent it
259
258
 
260
259
  ## Configuration
261
260
 
261
+ Be default, `license_finder` expects the decisions file to be stored at
262
+ `doc/dependency_decisions.yml`. All commands can be passed `--decisions_file`
263
+ to override this location.
264
+
265
+ ### Of Package Managers
266
+
267
+ If you have a gradle project, you can invoke gradle with a custom script by
268
+ passing (for example) `--gradle_command gradlew` to `license_finder` or
269
+ `license_finder report`.
270
+
271
+
272
+ Similarly you can invoke a custom rebar script with `--rebar_command rebar2`.
273
+ If you store rebar dependencies in a custom directory (by setting `deps_dir` in
274
+ `rebar.config`), set `--rebar_deps_dir`.
275
+
276
+ ### Saving Configuration
277
+
262
278
  It may be difficult to remember to pass command line options to every command.
263
279
  In some of these cases you can store default values in a YAML formatted config
264
280
  file. `license_finder` looks for this file in `config/license_finder.yml`.
@@ -269,22 +285,15 @@ As an example, the file might look like this:
269
285
  ---
270
286
  decisions_file: './some_path/decisions.yml'
271
287
  gradle_command: './gradlew'
288
+ rebar_command: './rebarw'
289
+ rebar_deps_dir: './rebar_deps'
272
290
  ```
273
291
 
274
- If you set `decisions_file`, you won't have to pass it to every CLI command.
275
-
276
- Read on to learn about how `gradle_command` is used on gradle projects.
277
-
278
292
  ### Gradle Projects
279
293
 
280
294
  You need to install the license gradle plugin:
281
295
  [https://github.com/hierynomus/license-gradle-plugin](https://github.com/hierynomus/license-gradle-plugin)
282
296
 
283
- LicenseFinder assumes that gradle is in your shell's command path and can be
284
- invoked by just calling `gradle`. If you must invoke gradle some other way
285
- (e.g., with a custom `gradlew` script), pass `--gradle_command` to
286
- `license_finder` or `license_finder report`.
287
-
288
297
  By default, `license_finder` will report on gradle's "runtime" dependencies. If
289
298
  you want to generate a report for some other dependency configuration (e.g.
290
299
  Android projects will sometimes specify their meaningful dependencies in the
data/Rakefile CHANGED
@@ -31,7 +31,8 @@ task :check_dependencies do
31
31
  "npm" => "node.js",
32
32
  "pip" => "Python",
33
33
  "gradle" => "Gradle",
34
- "bower" => "Bower"
34
+ "bower" => "Bower",
35
+ "rebar" => "Rebar"
35
36
  }
36
37
  dependencies["pod"] = "Cocoapods" if LicenseFinder::Platform.darwin?
37
38
  satisfied = true
@@ -0,0 +1,14 @@
1
+ require 'feature_helper'
2
+
3
+ describe "Rebar Dependencies" do
4
+ # As an Erlang developer
5
+ # I want to be able to manage rebar dependencies
6
+
7
+ let(:erlang_developer) { LicenseFinder::TestingDSL::User.new }
8
+
9
+ specify "are shown in reports" do
10
+ LicenseFinder::TestingDSL::RebarProject.create
11
+ erlang_developer.run_license_finder
12
+ expect(erlang_developer).to be_seeing_line "envy, \"BRANCH: master\", \"Apache 2.0\""
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ %% -*- mode: erlang -*-
2
+ %% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*-
3
+ %% ex: ts=4 sw=4 ft=erlang et
4
+
5
+ {erl_opts, [warnings_as_errors, {parse_transform, lager_transform}, debug_info]}.
6
+
7
+ {deps,
8
+ [
9
+ {envy, ".*",
10
+ {git, "git://github.com/manderson26/envy.git", {branch, "master"}}}
11
+ ]
12
+ }.
@@ -133,6 +133,16 @@ module LicenseFinder::TestingDSL
133
133
  end
134
134
  end
135
135
 
136
+ class RebarProject < Project
137
+ def add_dep
138
+ install_fixture("rebar.config")
139
+ end
140
+
141
+ def install
142
+ shell_out("rebar get-deps")
143
+ end
144
+ end
145
+
136
146
  class BundlerProject < Project
137
147
  def add_dep
138
148
  add_to_bundler('license_finder', path: Paths.root.to_s)
@@ -18,7 +18,7 @@ module LicenseFinder
18
18
  end
19
19
 
20
20
  def license_finder_config
21
- result = extract_options(:decisions_file, :gradle_command)
21
+ result = extract_options(:decisions_file, :gradle_command, :rebar_command, :rebar_deps_dir)
22
22
  result[:logger] = logger_config
23
23
  result[:project_path] = Pathname.pwd
24
24
  result
@@ -16,6 +16,8 @@ module LicenseFinder
16
16
  class_option :format, desc: "The desired output format.", default: 'text', enum: FORMATS.keys
17
17
  class_option :columns, type: :array, desc: "For CSV reports, which columns to print. Pick from: #{CsvReport::AVAILABLE_COLUMNS}", default: %w[name version licenses]
18
18
  class_option :gradle_command, desc: "Command to use when fetching gradle packages. Only meaningful if used with a Java/gradle project. Defaults to 'gradle'."
19
+ class_option :rebar_command, desc: "Command to use when fetching rebar packages. Only meaningful if used with a Erlang/rebar project. Defaults to 'rebar'."
20
+ class_option :rebar_deps_dir, desc: "Path to rebar dependencies directory. Only meaningful if used with a Erlang/rebar project. Defaults to 'deps'."
19
21
 
20
22
  method_option :quiet, type: :boolean, desc: "silences progress report"
21
23
  method_option :debug, type: :boolean, desc: "emit detailed info about what LicenseFinder is doing"
@@ -15,6 +15,14 @@ module LicenseFinder
15
15
  get(:gradle_command) || "gradle"
16
16
  end
17
17
 
18
+ def rebar_command
19
+ get(:rebar_command) || "rebar"
20
+ end
21
+
22
+ def rebar_deps_dir
23
+ get(:rebar_deps_dir) || "deps"
24
+ end
25
+
18
26
  def decisions_file
19
27
  file_name = get(:decisions_file) || "doc/dependency_decisions.yml"
20
28
  Pathname(file_name)
@@ -59,8 +59,10 @@ module LicenseFinder
59
59
  PackageManager.current_packages(
60
60
  logger: logger,
61
61
  project_path: project_path,
62
+ ignore_groups: decisions.ignored_groups,
62
63
  gradle_command: config.gradle_command,
63
- ignore_groups: decisions.ignored_groups
64
+ rebar_command: config.rebar_command,
65
+ rebar_deps_dir: config.rebar_deps_dir,
64
66
  )
65
67
  end
66
68
  end
@@ -127,3 +127,4 @@ require 'license_finder/package_managers/npm_package'
127
127
  require 'license_finder/package_managers/maven_package'
128
128
  require 'license_finder/package_managers/gradle_package'
129
129
  require 'license_finder/package_managers/cocoa_pods_package'
130
+ require 'license_finder/package_managers/rebar_package'
@@ -13,7 +13,7 @@ module LicenseFinder
13
13
  #
14
14
  class PackageManager
15
15
  def self.package_managers
16
- [Bundler, NPM, Pip, Bower, Maven, Gradle, CocoaPods]
16
+ [Bundler, NPM, Pip, Bower, Maven, Gradle, CocoaPods, Rebar]
17
17
  end
18
18
 
19
19
  def self.current_packages(options)
@@ -57,5 +57,6 @@ require 'license_finder/package_managers/pip'
57
57
  require 'license_finder/package_managers/maven'
58
58
  require 'license_finder/package_managers/cocoa_pods'
59
59
  require 'license_finder/package_managers/gradle'
60
+ require 'license_finder/package_managers/rebar'
60
61
 
61
62
  require 'license_finder/package'
@@ -0,0 +1,42 @@
1
+ module LicenseFinder
2
+ class Rebar < PackageManager
3
+ def initialize(options={})
4
+ super
5
+ @command = options[:rebar_command] || "rebar"
6
+ @deps_path = Pathname(options[:rebar_deps_dir] || "deps")
7
+ end
8
+
9
+ def current_packages
10
+ rebar_ouput.map do |name, version_type, version_value, homepage|
11
+ RebarPackage.new(
12
+ name,
13
+ "#{version_type}: #{version_value}",
14
+ install_path: @deps_path.join(name),
15
+ homepage: homepage,
16
+ logger: logger
17
+ )
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def rebar_ouput
24
+ command = "#{@command} list-deps"
25
+ output, success = capture(command)
26
+ raise "Command #{command} failed to execute: #{output}" unless success
27
+
28
+ output
29
+ .each_line
30
+ .reject { |line| line.start_with?("=") }
31
+ .map { |line| line.split(" ") }
32
+ end
33
+
34
+ def capture(command)
35
+ [`#{command}`, $?.success?]
36
+ end
37
+
38
+ def package_path
39
+ project_path.join('rebar.config')
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,4 @@
1
+ module LicenseFinder
2
+ class RebarPackage < Package
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module LicenseFinder
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
File without changes
@@ -1,3 +1,5 @@
1
1
  ---
2
2
  decisions_file: './some_path/'
3
3
  gradle_command: 'gradlew'
4
+ rebar_command: 'rebar_new'
5
+ rebar_deps_dir: 'some_dir'
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module LicenseFinder
4
+ describe RebarPackage do
5
+ subject do
6
+ described_class.new(
7
+ "uuid",
8
+ "TAG: v1.3.2",
9
+ install_path: "deps/uuid",
10
+ homepage: "git://github.com/okeuday/uuid.git"
11
+ )
12
+ end
13
+
14
+ its(:name) { should == "uuid" }
15
+ its(:version) { should == "TAG: v1.3.2" }
16
+ its(:summary) { should eq "" }
17
+ its(:description) { should == "" }
18
+ its(:homepage) { should == "git://github.com/okeuday/uuid.git" }
19
+ its(:groups) { should == [] }
20
+ its(:children) { should == [] }
21
+ its(:install_path) { should eq "deps/uuid" }
22
+ end
23
+ end
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+
3
+ module LicenseFinder
4
+ describe Rebar do
5
+ let(:rebar) { Rebar.new }
6
+ it_behaves_like "a PackageManager"
7
+
8
+ output = <<-CMDOUTPUT
9
+ == Sample comment
10
+ uuid TAG v1.3.2 git://github.com/okeuday/uuid.git
11
+ jiffy TAG 0.9.0 https://github.com/davisp/jiffy.git
12
+ CMDOUTPUT
13
+
14
+ describe '.current_packages' do
15
+ it 'lists all the current packages' do
16
+ allow(rebar).to receive(:capture).with(/rebar/).and_return([output, true])
17
+
18
+ current_packages = rebar.current_packages
19
+
20
+ expect(current_packages.map(&:name)).to eq(["uuid", "jiffy"])
21
+ expect(current_packages.map(&:install_path)).to eq([Pathname("deps/uuid"), Pathname("deps/jiffy")])
22
+ end
23
+
24
+ it "fails when command fails" do
25
+ allow(rebar).to receive(:capture).with(/rebar/).and_return('Some error', false).once
26
+ expect { rebar.current_packages }.to raise_error(RuntimeError)
27
+ end
28
+
29
+ it "uses custom rebar command, if provided" do
30
+ rebar = Rebar.new(rebar_command: "rebarfoo")
31
+
32
+ allow(rebar).to receive(:capture).with(/rebarfoo/).and_return([output, true])
33
+
34
+ current_packages = rebar.current_packages
35
+
36
+ expect(current_packages.map(&:name)).to eq(["uuid", "jiffy"])
37
+ end
38
+
39
+ it "uses custom rebar_deps_dir, if provided" do
40
+ rebar = Rebar.new(rebar_deps_dir: "foo")
41
+
42
+ allow(rebar).to receive(:capture).with(/rebar/).and_return([output, true])
43
+
44
+ current_packages = rebar.current_packages
45
+
46
+ expect(current_packages.map(&:install_path)).to eq([Pathname("foo/uuid"), Pathname("foo/jiffy")])
47
+ end
48
+ end
49
+ end
50
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: license_finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Maine
@@ -230,11 +230,13 @@ files:
230
230
  - features/features/package_managers/maven_spec.rb
231
231
  - features/features/package_managers/npm_spec.rb
232
232
  - features/features/package_managers/pip_spec.rb
233
+ - features/features/package_managers/rebar_spec.rb
233
234
  - features/features/report/csv_spec.rb
234
235
  - features/features/report/html_spec.rb
235
236
  - features/fixtures/Podfile
236
237
  - features/fixtures/build.gradle
237
238
  - features/fixtures/pom.xml
239
+ - features/fixtures/rebar.config
238
240
  - features/support/testing_dsl.rb
239
241
  - lib/license_finder.rb
240
242
  - lib/license_finder/cli.rb
@@ -288,6 +290,8 @@ files:
288
290
  - lib/license_finder/package_managers/npm_package.rb
289
291
  - lib/license_finder/package_managers/pip.rb
290
292
  - lib/license_finder/package_managers/pip_package.rb
293
+ - lib/license_finder/package_managers/rebar.rb
294
+ - lib/license_finder/package_managers/rebar_package.rb
291
295
  - lib/license_finder/packages/activation.rb
292
296
  - lib/license_finder/packages/license_files.rb
293
297
  - lib/license_finder/packages/licensing.rb
@@ -313,6 +317,7 @@ files:
313
317
  - spec/fixtures/all_pms/build.gradle
314
318
  - spec/fixtures/all_pms/package.json
315
319
  - spec/fixtures/all_pms/pom.xml
320
+ - spec/fixtures/all_pms/rebar.config
316
321
  - spec/fixtures/all_pms/requirements.txt
317
322
  - spec/fixtures/config/license_finder.yml
318
323
  - spec/fixtures/license_directory/COPYING
@@ -352,6 +357,8 @@ files:
352
357
  - spec/lib/license_finder/package_managers/npm_spec.rb
353
358
  - spec/lib/license_finder/package_managers/pip_package_spec.rb
354
359
  - spec/lib/license_finder/package_managers/pip_spec.rb
360
+ - spec/lib/license_finder/package_managers/rebar_package_spec.rb
361
+ - spec/lib/license_finder/package_managers/rebar_spec.rb
355
362
  - spec/lib/license_finder/package_spec.rb
356
363
  - spec/lib/license_finder/packages/activation_spec.rb
357
364
  - spec/lib/license_finder/packages/license_files_spec.rb
@@ -404,11 +411,13 @@ test_files:
404
411
  - features/features/package_managers/maven_spec.rb
405
412
  - features/features/package_managers/npm_spec.rb
406
413
  - features/features/package_managers/pip_spec.rb
414
+ - features/features/package_managers/rebar_spec.rb
407
415
  - features/features/report/csv_spec.rb
408
416
  - features/features/report/html_spec.rb
409
417
  - features/fixtures/Podfile
410
418
  - features/fixtures/build.gradle
411
419
  - features/fixtures/pom.xml
420
+ - features/fixtures/rebar.config
412
421
  - features/support/testing_dsl.rb
413
422
  - spec/feature_helper.rb
414
423
  - spec/fixtures/all_pms/Gemfile
@@ -417,6 +426,7 @@ test_files:
417
426
  - spec/fixtures/all_pms/build.gradle
418
427
  - spec/fixtures/all_pms/package.json
419
428
  - spec/fixtures/all_pms/pom.xml
429
+ - spec/fixtures/all_pms/rebar.config
420
430
  - spec/fixtures/all_pms/requirements.txt
421
431
  - spec/fixtures/config/license_finder.yml
422
432
  - spec/fixtures/license_directory/COPYING
@@ -456,6 +466,8 @@ test_files:
456
466
  - spec/lib/license_finder/package_managers/npm_spec.rb
457
467
  - spec/lib/license_finder/package_managers/pip_package_spec.rb
458
468
  - spec/lib/license_finder/package_managers/pip_spec.rb
469
+ - spec/lib/license_finder/package_managers/rebar_package_spec.rb
470
+ - spec/lib/license_finder/package_managers/rebar_spec.rb
459
471
  - spec/lib/license_finder/package_spec.rb
460
472
  - spec/lib/license_finder/packages/activation_spec.rb
461
473
  - spec/lib/license_finder/packages/license_files_spec.rb