Created
June 24, 2014 04:57
-
-
Save freshtonic/072f7fec12f0b221d0b0 to your computer and use it in GitHub Desktop.
Revisions
-
freshtonic created this gist
Jun 24, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ #!/usr/bin/env ruby # Reads your JS on STDIN, minified JS is OK as angular methods names should be preserved. # The reason this exists is because I was getting an erroroneous error message about missing # module 'ngLocale', but googling that indicated that it really meant that one of my dependencies # was unresolved. A change to the JS concatenation had caused this error. # In order to resolve the error I wrote a script to parse the old minified and new minified JS to dump # declared services to STDOUT. I could then see what was missing. # Prints out something like the following: # SERVICE # sportsBetBuilderService # FACTORY # BaseSportsBetBuilderState # BetSlip # ConfirmState # InterceptedState # InterceptRejectedState # RejectedState # SoldState # CONSTANT # $moment # VALUE # CONTROLLER # ngModel # ngModel # FILTER # dateOnly # timeOnly content = STDIN.read things = %w(service factory constant value controller filter) matches = things.inject({}) do |hash,thing| hash[thing] = content.scan(Regexp.new("\\.#{thing}\\([\"'][^\"']+[\"']")).map do |match| begin match[/["'][^"']+["']/][1..-2] rescue STDERR.puts "WTF: [#{match}]" end end hash end things.each do |thing| puts thing.upcase matches[thing].sort{|a,b| a.downcase <=> b.downcase}.each{|match| puts " #{match}"} end