Sha256: 2d9c09b1d241ac876476d63b350e3db59a59e2102820a4e4658cecf461dc3550

Contents?: true

Size: 573 Bytes

Versions: 11

Compression:

Stored size: 573 Bytes

Contents

require 'digest/sha1'

module Rake
  module DSL

    def transient(name, value)
      transients = File.join('.rake', 'transients')
      FileUtils.mkdir_p transients

      value_file = File.join(transients, name.to_s)
      value_hash = Digest::SHA1.hexdigest(value.to_s)
      if File.exists? value_file
        previous_hash = IO.read(value_file)
        FileUtils.rm value_file if previous_hash != value_hash
      end

      file value_file do
        File.open(value_file, "w+") { |f| f.print value_hash }
      end

      task name => value_file
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ggake-0.9.0 lib/ggake/transient.rb
ggake-0.8.0 lib/ggake/transient.rb
ggake-0.7.0 lib/ggake/transient.rb
ggake-0.6.0 lib/ggake/transient.rb
ggake-0.5.0 lib/ggake/transient.rb
ggake-0.4.1 lib/ggake/transient.rb
ggake-0.4.0 lib/ggake/transient.rb
ggake-0.3.1 lib/ggake/transient.rb
ggake-0.3.0 lib/ggake/transient.rb
ggake-0.2.0 lib/ggake/transient.rb
ggake-0.1.0 lib/ggake/transient.rb