[ 
https://issues.apache.org/jira/browse/WHIMSY-25?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14968398#comment-14968398
 ] 

Sam Ruby commented on WHIMSY-25:
--------------------------------

Just a quick sketch, the code below would be added to the end of the existing 
asf.rb file:

{code:title=asf.rb|borderStyle=solid}
module ASF
  def self.library_mtime
    parent_dir = File.dirname(File.expand_path(__FILE__))
    sources = Dir.glob("#{parent_dir}/**/*")
    times = sources.map {|source| File.mtime(source)}
    times.max.gmtime
  end
end
{code}

Test using {{ruby -r whimsy/asf -e "p ASF.library_mtime"}}

What this code will do is return the latest time for all of the sources.  
Should work well when run locally or svnpubsub.  For gems, it would basically 
return the time the gem was installed independent of version.

I'm personally OK with this not being more granular.  That may mean that 
scripts that only depend on a part of the library are rerun even if a different 
part is run.  That's still infrequent and yet safe.

> Gem modules could return their file dependencies/last updated status
> --------------------------------------------------------------------
>
>                 Key: WHIMSY-25
>                 URL: https://issues.apache.org/jira/browse/WHIMSY-25
>             Project: Whimsy
>          Issue Type: New Feature
>            Reporter: Sebb
>
> The Gem modules give access to various files.
> These are then used by scripts that may create summaries of the output.
> For example public_icla_info.rb uses asf/icla.rb
> These scripts may check that the underlying source has not changed since the 
> last output file was created; this means that the script needs to know the 
> name(s) of the files that the Gem module used. Rather than repeat the file 
> name in the script, it would be handy if the Gem module had a method to 
> return the file name(s). 
> Alternatively the Gem module could have a method to check a timestamp against 
> its source(s) - this would mean that the Gem could use LDAP or SVN to access 
> its source without affecting the calling script.
> Or indeed the Gem could return the timestamp of its source (the most recent 
> if there is more than one)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to