Skip to content

Commit

Permalink
Add script to check dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Sashko Stubailo committed Jul 30, 2015
1 parent 051ba43 commit 6f6bdd1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/admin/check-package-dependencies.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /usr/bin/env ruby

# This script takes two arguments:
# 1. The name of a package - ex. ejson
# 2. The name of an export - ex. EJSON
# It makes sure that if the export appears somewhere in package source code, the
# name of the package appears somewhere in package.js for that package.

root = File.join(File.dirname(__FILE__), "..", "..");

Dir.chdir(root)

file_list = `git grep -l '#{ARGV[0]}' packages/`.lines
package_list = file_list.map do |filename|
filename.split("/")[1]
end

package_list = package_list.uniq

package_list.each do |p|
unless File.open("packages/#{p}/package.js").read.include? ARGV[1]
puts "'#{ARGV[0]}' appears in #{p} but '#{ARGV[1]}' not in package.js. Files:"
puts `git grep -l '#{ARGV[0]}' packages/#{p}/`
puts ""
end
end

0 comments on commit 6f6bdd1

Please sign in to comment.