Created
          October 1, 2012 09:42 
        
      - 
      
 - 
        
Save maxigs/3810584 to your computer and use it in GitHub Desktop.  
    Script to copy the gem licenses into doc folder
  
        
  
    
      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 characters
    
  
  
    
  | #!/usr/bin/env ruby | |
| # | |
| # Put this file in script/licenses.rb | |
| # and make executeable | |
| # $ chmod +x script/licenses.rb | |
| # | |
| # Call with | |
| # $ script/licenses.rb | |
| ROOT_PATH = File.expand_path('../../', __FILE__) | |
| require 'fileutils' | |
| licenses_output_dir = File.join(ROOT_PATH, 'doc', 'gem_licenses') | |
| gems = {} | |
| gem_paths = `bundle list --paths`.split("\n") | |
| gem_paths.each do |gem_path| | |
| gem_name = gem_path.split('/').last | |
| gems[gem_name] = `ls #{gem_path}/*LICENSE*`.split("\n").first rescue nil | |
| end | |
| FileUtils.mkdir_p(licenses_output_dir) | |
| gems.each do |name, path| | |
| out = File.join(licenses_output_dir, name) | |
| if path | |
| FileUtils.cp(path, out) | |
| else | |
| FileUtils.touch(out) | |
| end | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment