-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into remove-test-fixtures-from-gem
- Loading branch information
Showing
23 changed files
with
324 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,14 @@ resources: | |
private_key: ((CfOslBotPrivateKey)) | ||
branch: master | ||
|
||
- name: lf-dockerfile | ||
type: git | ||
source: | ||
uri: [email protected]:pivotal/LicenseFinder.git | ||
private_key: ((CfOslBotPrivateKey)) | ||
branch: master | ||
paths: ["Dockerfile"] | ||
|
||
- name: lf-image | ||
type: docker-image | ||
source: | ||
|
@@ -24,10 +32,11 @@ resources: | |
jobs: | ||
- name: docker | ||
plan: | ||
- get: lf-git | ||
- get: lf-dockerfile | ||
trigger: true | ||
- put: lf-image | ||
params: | ||
build: lf-git | ||
build: lf-dockerfile | ||
|
||
- name: release | ||
plan: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
platform: windows | ||
inputs: | ||
- name: lf-git | ||
- name: LicenseFinder | ||
run: | ||
path: powershell | ||
args: ["-File", "lf-git/ci/scripts/test.ps1"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require_relative '../../support/feature_helper' | ||
|
||
describe "Mix Dependencies" do | ||
# As an Elixir developer | ||
# I want to be able to manage Mix dependencies | ||
|
||
let(:elixir_developer) { LicenseFinder::TestingDSL::User.new } | ||
|
||
specify "are shown in reports" do | ||
LicenseFinder::TestingDSL::MixProject.create | ||
puts "mix project created" | ||
elixir_developer.run_license_finder | ||
expect(elixir_developer).to be_seeing_line "fs, 0.9.1, ISC" | ||
expect(elixir_developer).to be_seeing_line "uuid, 1.1.5, \"Apache 2.0\"" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
defmodule Awesome.Mixfile do | ||
use Mix.Project | ||
|
||
def project do | ||
[app: :awesome, | ||
version: "0.1.0", | ||
elixir: "~> 1.2", | ||
build_embedded: Mix.env == :prod, | ||
start_permanent: Mix.env == :prod, | ||
deps: deps()] | ||
end | ||
|
||
def application do | ||
[applications: []] | ||
end | ||
|
||
defp deps do | ||
[{:fs, "0.9.1"}, | ||
{:uuid, "1.1.5"}] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
module LicenseFinder | ||
class Mix < PackageManager | ||
def initialize(options={}) | ||
super | ||
@command = options[:mix_command] || Mix::package_management_command | ||
@deps_path = Pathname(options[:mix_deps_dir] || "deps") | ||
end | ||
|
||
def current_packages | ||
mix_output.map do |name, version| | ||
MixPackage.new( | ||
name, | ||
version, | ||
install_path: @deps_path.join(name), | ||
logger: logger | ||
) | ||
end | ||
end | ||
|
||
def self.package_management_command | ||
"mix" | ||
end | ||
|
||
private | ||
|
||
def mix_output | ||
command = "#{@command} deps" | ||
output, success = Dir.chdir(project_path) { capture(command) } | ||
raise "Command '#{command}' failed to execute: #{output}" unless success | ||
|
||
output | ||
.each_line | ||
.map(&:strip) | ||
.select { |line| line_of_interest? line } | ||
.each_slice(2).to_a | ||
.map { |line1, line2| [ line1.split(" ")[1], resolve_version(line2) ] } | ||
end | ||
|
||
def line_of_interest?(line) | ||
line.start_with?("* ") || | ||
line.start_with?("locked at") || | ||
line.start_with?("the dependency is not available") | ||
end | ||
|
||
def resolve_version(line) | ||
line =~ /locked at ([^\s]+)/ ? $1 : line | ||
end | ||
|
||
def package_path | ||
project_path.join('mix.exs') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module LicenseFinder | ||
class MixPackage < Package | ||
def package_manager | ||
'Mix' | ||
end | ||
end | ||
end |
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.