Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:pivotal/LicenseFinder

Conflicts:
	lib/license_finder/finder.rb
	spec/finder_spec.rb
  • Loading branch information...
commit 8c449441f2c1476a0eae13e68630fb48e2e5b469 2 parents 8fbb501 + 5c27b5b
@travis travis authored
View
3  README.markdown
@@ -23,6 +23,7 @@ Run 'rake license:action_items:ok'
This will return a non-zero exit status if there are unapproved dependencies. Great for CI.
As a standalone script:
+
cd ~
git clone http://github.com/pivotal/LicenseFinder.git license_finder
cd your/project
@@ -94,4 +95,4 @@ Please add a license to your gemspec!
Gem::Specification.new do |s|
s.name = "my_great_gem"
s.license = "MIT"
- end
+ end
View
14 lib/license_finder/finder.rb
@@ -3,12 +3,16 @@ class Finder
attr_reader :whitelist, :ignore_groups
def initialize
- if File.exists?('./config/license_finder.yml')
- config = YAML.load(File.open('./config/license_finder.yml').readlines.join)
- @whitelist = config['whitelist'] || []
- @ignore_groups = config['ignore_groups'] ? config['ignore_groups'].map{|g| g.to_sym} : []
- @dependencies_dir = config['dependencies_file_dir']
+ config = case
+ when File.exists?('./config/license_finder.yml')
+ YAML.load(File.open('./config/license_finder.yml').readlines.join)
+ else
+ {'whitelist' => [], 'ignore_groups' => []}
end
+
+ @whitelist = config['whitelist']
+ @ignore_groups = config['ignore_groups'].map{|g| g.to_sym}
+ @dependencies_dir = config['dependencies_file_dir']
end
def dependencies_dir
View
2  lib/license_finder/version.rb
@@ -1,3 +1,3 @@
module LicenseFinder
- VERSION = "0.3.0"
+ VERSION = "0.4.0"
end
View
11 lib/tasks/license_finder.rake
@@ -14,9 +14,16 @@ namespace :license do
puts "Dependencies that need approval:"
puts LicenseFinder::Finder.new.action_items
end
-
+
desc 'All gems approved for use'
task 'action_items:ok' => :generate_dependencies do
- exit 1 unless LicenseFinder::Finder.new.action_items.size == 0
+ found = LicenseFinder::Finder.new.action_items
+ if found.size > 0
+ puts "Dependencies that need approval:"
+ puts found
+ else
+ puts "All gems are approved for use"
+ end
+ exit 1 unless found.size == 0
end
end
View
1  license_finder.gemspec
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
s.rubyforge_project = "license_finder"
s.add_development_dependency 'rspec', '~>2.3'
s.add_development_dependency 'rr'
+ s.add_development_dependency 'rake'
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
View
8 spec/finder_spec.rb
@@ -1,6 +1,14 @@
require 'spec_helper'
describe LicenseFinder::Finder do
+
+ it "should properly initialize whitelist and ignore_groups" do
+ stub(File).exists?('./config/license_finder.yml') {false}
+ finder = LicenseFinder::Finder.new
+ finder.whitelist.should_not be_nil
+ finder.ignore_groups.should_not be_nil
+ end
+
it "should generate a yml file and txt file" do
stub(File).exists?('./config/license_finder.yml') {false}
stub(File).exists?('./dependencies.yml') {false}
Please sign in to comment.
Something went wrong with that request. Please try again.