lib/asset_hat/vcs.rb in asset_hat-0.1.5 vs lib/asset_hat/vcs.rb in asset_hat-0.2.0

- old
+ new

@@ -1,21 +1,23 @@ module AssetHat class << self - attr_accessor :last_commit_ids, :last_bundle_commit_ids + attr_accessor :last_commit_ids, :last_bundle_commit_ids #:nodoc: end + # Usage: + # + # AssetHat.last_commit_id('public/stylesheets/application.css') + # AssetHat.last_commit_id('public/stylesheets/ie.css', + # 'public/stylesheets/ie7.css', + # 'public/stylesheets/ie6.css') + # + # Returns a string of the commit ID for the file with the most recent + # commit. If the file(s) cannot be found, `nil` is returned. Options: + # + # [vcs] Version control system. Currently, the only supported value is + # <code>:git</code>. def self.last_commit_id(*args) - # Usage: - # - # AssetHat.last_commit_id('public/stylesheets/application.css') - # AssetHat.last_commit_id('public/stylesheets/ie.css', - # 'public/stylesheets/ie7.css', - # 'public/stylesheets/ie6.css') - # - # Returns a string of the commit ID for the file with the most recent - # commit. If the file(s) cannot be found, `nil` is returned. - # Process arguments options = args.extract_options! options = options.symbolize_keys.reverse_merge(:vcs => :git) filepaths = args.join(' ') @@ -31,19 +33,18 @@ @last_commit_ids[filepaths] = h if h.present? end @last_commit_ids[filepaths] end + # Usage: + # + # AssetHat.last_bundle_commit_id('application', :css) + # + # Returns a string of the latest commit ID for the given bundle, based + # on which of its files were most recently modified in the repository. If + # no ID can be found, `nil` is returned. def self.last_bundle_commit_id(bundle, type) - # Usage: - # - # AssetHat.last_bundle_commit_id('application', :css) - # - # Returns a string of the latest commit ID for the given bundle, based - # on which of its files were most recently modified in the repository. If - # no ID can be found, `nil` is returned. - # Process arguments type = type.to_sym unless TYPES.include?(type) raise "Unknown type \"#{type}\"; should be one of: #{TYPES.join(', ')}." return @@ -62,8 +63,10 @@ end @last_bundle_commit_ids[type][bundle] end - def self.last_commit_ids ; @last_commit_ids ; end + def self.last_commit_ids #:nodoc: + @last_commit_ids + end end